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