DefaultComboBoxModel targetModel = new DefaultComboBoxModel(); targetModel.addElement(threadTarget); targetModel.addElement(testTarget); targetBox = new JComboBox(targetModel); targetBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (((String) targetBox.getSelectedItem()).equals(threadTarget)) { target = TestAction.THREAD; } else { target = TestAction.TEST; } } });
DefaultComboBoxModel styleModel = new DefaultComboBoxModel(); styleModel.addElement(BYNUMBER_LABEL); styleModel.addElement(BYPERCENT_LABEL); styleBox = new JComboBox(styleModel); styleBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (((String) styleBox.getSelectedItem()).equals(BYNUMBER_LABEL)) { style = ThroughputController.BYNUMBER; } else { style = ThroughputController.BYPERCENT; } } });
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/sampler/gui/TestActionGui.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/control/gui/ThroughputControllerGui.java
Method name: void init() Method name: void init()
Number of AST nodes: 5 Number of AST nodes: 5
1
DefaultComboBoxModel targetModel = new DefaultComboBoxModel();
1
DefaultComboBoxModel styleModel = new DefaultComboBoxModel();
2
		targetModel.addElement(threadTarget);
2
		styleModel.addElement(
3
		target
3
BYNUMBER_LABEL);
4
Model.addElement(testTarget);
4
		styleModel.addElement(
5
		target
5
BYPERCENT_LABEL);
6
Box = new JComboBox(targetModel);
6
		styleBox = new JComboBox(styleModel);
7
		targetBox.addActionListener(new ActionListener() {
7
		styleBox.addActionListener(new ActionListener() {
8
			public void actionPerformed(ActionEvent e) {
8
			public void actionPerformed(ActionEvent e) {
9
				if (((String) targetBox.getSelectedItem()).equals(threadTarget)) {
9
				if (((String) styleBox.getSelectedItem()).equals(
10
					target = TestAction.THREAD;
11
				} else {
12
					target = TestAction.TES
10
BYNUMBER_LABEL)) {
11
					style = ThroughputController.BYNUMBER;
12
				} else {
13
T;
13
					style = ThroughputController.BYPERCENT;
14
				}
14
				}
15
			}
15
			}
16
		});
16
		});
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are in different classes having the same super class
Number of node comparisons18
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    DefaultComboBoxModel targetModel = new DefaultComboBoxModel();
    6
    DefaultComboBoxModel targetModel = new DefaultComboBoxModel();
    4
    DefaultComboBoxModel styleModel = new DefaultComboBoxModel();
    Differences
    Expression1Expression2Difference
    targetModelstyleModelVARIABLE_NAME_MISMATCH
    4
    DefaultComboBoxModel styleModel = new DefaultComboBoxModel();
    7
    targetModel.addElement(threadTarget);
    7
    targetModel.addElement(threadTarget);
    5
    styleModel.addElement(BYNUMBER_LABEL);
    Differences
    Expression1Expression2Difference
    threadTargetBYNUMBER_LABELVARIABLE_NAME_MISMATCH
    targetModelstyleModelVARIABLE_NAME_MISMATCH
    5
    styleModel.addElement(BYNUMBER_LABEL);
    8
    targetModel.addElement(testTarget);
    8
    targetModel.addElement(testTarget);
    6
    styleModel.addElement(BYPERCENT_LABEL);
    Differences
    Expression1Expression2Difference
    testTargetBYPERCENT_LABELVARIABLE_NAME_MISMATCH
    targetModelstyleModelVARIABLE_NAME_MISMATCH
    6
    styleModel.addElement(BYPERCENT_LABEL);
    9
    targetBox = new JComboBox(targetModel);
    9
    targetBox = new JComboBox(targetModel);
    7
    styleBox = new JComboBox(styleModel);
    Differences
    Expression1Expression2Difference
    targetBoxstyleBoxVARIABLE_NAME_MISMATCH
    targetModelstyleModelVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression targetBox is a field being modified, and thus it cannot be parameterized
    Expression styleBox is a field being modified, and thus it cannot be parameterized
    7
    styleBox = new JComboBox(styleModel);
    10
    targetBox.addActionListener(new ActionListener() {...});
    10
    targetBox.addActionListener(new ActionListener() {...});
    8
    styleBox.addActionListener(new ActionListener() {...});
    Differences
    Expression1Expression2Difference
    threadTargetBYNUMBER_LABELVARIABLE_NAME_MISMATCH
    targetBoxstyleBoxVARIABLE_NAME_MISMATCH
    targetstyleVARIABLE_NAME_MISMATCH
    org.apache.jmeter.sampler.TestActionorg.apache.jmeter.control.ThroughputControllerSUBCLASS_TYPE_MISMATCH
    THREADBYNUMBERVARIABLE_NAME_MISMATCH
    targetstyleVARIABLE_NAME_MISMATCH
    org.apache.jmeter.sampler.TestActionorg.apache.jmeter.control.ThroughputControllerSUBCLASS_TYPE_MISMATCH
    TESTBYPERCENTVARIABLE_NAME_MISMATCH
    targetBoxstyleBoxVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression targetBox cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression styleBox cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression target cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression style cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression target is a field being modified, and thus it cannot be parameterized
    Expression style is a field being modified, and thus it cannot be parameterized
    Expression target cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression style cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression target is a field being modified, and thus it cannot be parameterized
    Expression style is a field being modified, and thus it cannot be parameterized
    Expression targetBox cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression styleBox cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    styleBox.addActionListener(new ActionListener() {...});
    Precondition Violations (14)
    Row Violation
    1Expression targetBox is a field being modified, and thus it cannot be parameterized
    2Expression styleBox is a field being modified, and thus it cannot be parameterized
    3Expression targetBox cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression styleBox cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression target cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression style cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression target is a field being modified, and thus it cannot be parameterized
    8Expression style is a field being modified, and thus it cannot be parameterized
    9Expression target cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression style cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression target is a field being modified, and thus it cannot be parameterized
    12Expression style is a field being modified, and thus it cannot be parameterized
    13Expression targetBox cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression styleBox cannot be parameterized, because it has dependencies to/from statements that will be extracted