if (vgap > 0 && subPanel.getComponentCount() > 0) { subPanel.add(Box.createVerticalStrut(vgap)); } if (c instanceof JComponent) { ((JComponent) c).setAlignmentX(horizontalAlign); } return subPanel.add(c);
if (hgap > 0 && subPanel.getComponentCount() > 0) { subPanel.add(Box.createHorizontalStrut(hgap)); } if (c instanceof JComponent) { ((JComponent) c).setAlignmentY(verticalAlign); } return subPanel.add(c);
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/util/VerticalPanel.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/util/HorizontalPanel.java
Method name: Component add(Component) Method name: Component add(Component)
Number of AST nodes: 5 Number of AST nodes: 5
1
if (vgap > 0 && subPanel.getComponentCount() > 0) {
1
if (hgap > 0 && subPanel.getComponentCount() > 0) {
2
			subPanel.add(Box.createVerticalStrut(vgap));
2
			subPanel.add(Box.createHorizontalStrut(hgap));
3
		}
3
		}
4
		if (c instanceof JComponent) {
4
		if (c instanceof JComponent) {
5
			((JComponent) c).setAlignmentX(horizontalAlign);
5
			((JComponent) c).setAlignmentY(verticalAlign);
6
		}
6
		}
7
		return subPanel.add(c);
7
		return subPanel.add(c);
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.3
Clones locationClones are in different classes having the same super class
Number of node comparisons14
  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)1.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (vgap > 0 && subPanel.getComponentCount() > 0)
    1
    if (vgap > 0 && subPanel.getComponentCount() > 0)
    1
    if (hgap > 0 && subPanel.getComponentCount() > 0)
    Differences
    Expression1Expression2Difference
    vgaphgapVARIABLE_NAME_MISMATCH
    1
    if (hgap > 0 && subPanel.getComponentCount() > 0)
    2
    subPanel.add(Box.createVerticalStrut(vgap));
    2
    subPanel.add(Box.createVerticalStrut(vgap));
    2
    subPanel.add(Box.createHorizontalStrut(hgap));
    Differences
    Expression1Expression2Difference
    createVerticalStrutcreateHorizontalStrutMETHOD_INVOCATION_NAME_MISMATCH
    vgaphgapVARIABLE_NAME_MISMATCH
    2
    subPanel.add(Box.createHorizontalStrut(hgap));
    3
    if (c instanceof JComponent)
    3
    if (c instanceof JComponent)
    4
    ((JComponent)c).setAlignmentX(horizontalAlign);
    4
    ((JComponent)c).setAlignmentX(horizontalAlign);
    4
    ((JComponent)c).setAlignmentY(verticalAlign);
    Differences
    Expression1Expression2Difference
    setAlignmentXsetAlignmentYMETHOD_INVOCATION_NAME_MISMATCH
    horizontalAlignverticalAlignVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression ((JComponent)c).setAlignmentX(horizontalAlign) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((JComponent)c).setAlignmentY(verticalAlign) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((JComponent)c).setAlignmentX(horizontalAlign) is a void method call, and thus it cannot be parameterized
    Expression ((JComponent)c).setAlignmentY(verticalAlign) is a void method call, and thus it cannot be parameterized
    4
    ((JComponent)c).setAlignmentY(verticalAlign);
    5
    return subPanel.add(c);
    5
    return subPanel.add(c);
    Precondition Violations (4)
    Row Violation
    1Expression ((JComponent)c).setAlignmentX(horizontalAlign) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression ((JComponent)c).setAlignmentY(verticalAlign) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression ((JComponent)c).setAlignmentX(horizontalAlign) is a void method call, and thus it cannot be parameterized
    4Expression ((JComponent)c).setAlignmentY(verticalAlign) is a void method call, and thus it cannot be parameterized