public class IntegerPropertyConverter implements Converter { private static final String ATT_NAME = "name"; // $NON-NLS-1$ /** * Returns the converter version; used to check for possible * incompatibilities */ public static String getVersion() { return "$Revision: 493779 $"; // $NON-NLS-1$ } /* * (non-Javadoc) * * @see com.thoughtworks.xstream.converters.Converter#canConvert(java.lang.Class) */ public boolean canConvert(Class arg0) { return arg0.equals(IntegerProperty.class); } /* * (non-Javadoc) * * @see com.thoughtworks.xstream.converters.Converter#marshal(java.lang.Object, * com.thoughtworks.xstream.io.HierarchicalStreamWriter, * com.thoughtworks.xstream.converters.MarshallingContext) */ public void marshal(Object obj, HierarchicalStreamWriter writer, MarshallingContext arg2) { IntegerProperty prop = (IntegerProperty) obj; writer.addAttribute(ATT_NAME, ConversionHelp.encode(prop.getName())); writer.setValue(prop.getStringValue()); } /* * (non-Javadoc) * * @see com.thoughtworks.xstream.converters.Converter#unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader, * com.thoughtworks.xstream.converters.UnmarshallingContext) */ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext arg1) { IntegerProperty prop = new IntegerProperty(ConversionHelp.decode(reader.getAttribute(ATT_NAME)), Integer .parseInt(reader.getValue())); return prop;
public class LongPropertyConverter implements Converter { private static final String ATT_NAME = "name"; // $NON-NLS-1$ /** * Returns the converter version; used to check for possible * incompatibilities */ public static String getVersion() { return "$Revision: 493779 $"; // $NON-NLS-1$ } /* * (non-Javadoc) * * @see com.thoughtworks.xstream.converters.Converter#canConvert(java.lang.Class) */ public boolean canConvert(Class arg0) { return arg0.equals(LongProperty.class); } /* * (non-Javadoc) * * @see com.thoughtworks.xstream.converters.Converter#marshal(java.lang.Object, * com.thoughtworks.xstream.io.HierarchicalStreamWriter, * com.thoughtworks.xstream.converters.MarshallingContext) */ public void marshal(Object obj, HierarchicalStreamWriter writer, MarshallingContext arg2) { LongProperty prop = (LongProperty) obj; writer.addAttribute(ATT_NAME, ConversionHelp.encode(prop.getName())); writer.setValue(prop.getStringValue()); } /* * (non-Javadoc) * * @see com.thoughtworks.xstream.converters.Converter#unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader, * com.thoughtworks.xstream.converters.UnmarshallingContext) */ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext arg1) { LongProperty prop = new LongProperty(ConversionHelp.decode(reader.getAttribute(ATT_NAME)), Long.parseLong(reader .getValue())); return prop;
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/save/converters/IntegerPropertyConverter.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/save/converters/LongPropertyConverter.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class IntegerPropertyConverter implements Converter {
1
public class LongPropertyConverter implements Converter {
2
    
3
	private static final String ATT_NAME = "name"; // $NON-NLS-1$
2
	private static final String ATT_NAME = "name"; // $NON-NLS-1$
4
    /**
3
    /**
5
	 * Returns the converter version; used to check for possible
4
	 * Returns the converter version; used to check for possible
6
	 * incompatibilities
5
	 * incompatibilities
7
	 */
6
	 */
8
	public static String getVersion() {
7
	public static String getVersion() {
9
		return "$Revision: 493779 $"; // $NON-NLS-1$
8
		return "$Revision: 493779 $"; // $NON-NLS-1$
10
	}
9
	}
11
	/*
10
	/*
12
	 * (non-Javadoc)
11
	 * (non-Javadoc)
13
	 * 
12
	 * 
14
	 * @see com.thoughtworks.xstream.converters.Converter#canConvert(java.lang.Class)
13
	 * @see com.thoughtworks.xstream.converters.Converter#canConvert(java.lang.Class)
15
	 */
14
	 */
16
	public boolean canConvert(Class arg0) {
15
	public boolean canConvert(Class arg0) {
17
		return arg0.equals(IntegerProperty.class);
16
		return arg0.equals(LongProperty.class);
18
	}
17
	}
19
	/*
18
	/*
20
	 * (non-Javadoc)
19
	 * (non-Javadoc)
21
	 * 
20
	 * 
22
	 * @see com.thoughtworks.xstream.converters.Converter#marshal(java.lang.Object,
21
	 * @see com.thoughtworks.xstream.converters.Converter#marshal(java.lang.Object,
23
	 *      com.thoughtworks.xstream.io.HierarchicalStreamWriter,
22
	 *      com.thoughtworks.xstream.io.HierarchicalStreamWriter,
24
	 *      com.thoughtworks.xstream.converters.MarshallingContext)
23
	 *      com.thoughtworks.xstream.converters.MarshallingContext)
25
	 */
24
	 */
26
	public void marshal(Object obj, HierarchicalStreamWriter writer, MarshallingContext arg2) {
25
	public void marshal(Object obj, HierarchicalStreamWriter writer, MarshallingContext arg2) {
27
		IntegerProperty prop = (IntegerProperty) obj;
26
		LongProperty prop = (LongProperty) obj;
28
		writer.addAttribute(ATT_NAME, ConversionHelp.encode(prop.getName()));
27
		writer.addAttribute(ATT_NAME, ConversionHelp.encode(prop.getName()));
29
		writer.setValue(prop.getStringValue());
28
		writer.setValue(prop.getStringValue());
30
	}
29
	}
31
	/*
30
	/*
32
	 * (non-Javadoc)
31
	 * (non-Javadoc)
33
	 * 
32
	 * 
34
	 * @see com.thoughtworks.xstream.converters.Converter#unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader,
33
	 * @see com.thoughtworks.xstream.converters.Converter#unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader,
35
	 *      com.thoughtworks.xstream.converters.UnmarshallingContext)
34
	 *      com.thoughtworks.xstream.converters.UnmarshallingContext)
36
	 */
35
	 */
37
	public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext arg1) {
36
	public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext arg1) {
38
		IntegerProperty prop = new IntegerProperty(ConversionHelp.decode(reader.getAttribute(ATT_NAME)), Integer
37
		LongProperty prop = new LongProperty(ConversionHelp.decode(reader.getAttribute(ATT_NAME)), 
39
				.parseInt(reader
38
Long.parseLong(reader
40
.getValue()));
39
				.getValue()));
41
		return prop;
40
		return prop;
42
	
41
	
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0