Insets insets = getInsets(); int x = (int) (java2DPoint.getX() * this.scaleX + insets.left); int y = (int) (java2DPoint.getY() * this.scaleY + insets.top); return new Point(x, y);
Rectangle insets = this.getClientArea(); int x = (int) (java2DPoint.getX() * this.scaleX + insets.x); int y = (int) (java2DPoint.getY() * this.scaleY + insets.y); return new Point(x, y);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/ChartPanel.java File path: /jfreechart-1.0.10/swt/org/jfree/experimental/chart/swt/ChartComposite.java
Method name: Point translateJava2DToScreen(Point2D) Method name: Point translateJava2DToScreen(Point2D)
Number of AST nodes: 4 Number of AST nodes: 4
1
Insets insets = getInsets();
1
Rectangle insets = this.getClientArea();
2
        int x = (int) (java2DPoint.getX() * this.scaleX + insets.left);
2
        int x = (int) (java2DPoint.getX() * this.scaleX + insets.x);
3
        int y = (int) (java2DPoint.getY() * this.scaleY + insets.top);
3
        int y = (int) (java2DPoint.getY() * this.scaleY + insets.y);
4
        return new Point(x, y);
4
        return new Point(x, y);
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
Number of node comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                      
    1
    Rectangle insets = this.getClientArea();
    1
    Insets insets = getInsets();
                                                              
    2
    int x = (int)(java2DPoint.getX() * this.scaleX + insets.left);
    2
    int x = (int)(java2DPoint.getX() * this.scaleX + insets.left);
    2
    int x = (int)(java2DPoint.getX() * this.scaleX + insets.x);
    Differences
    Expression1Expression2Difference
    java.awt.Insetsorg.eclipse.swt.graphics.RectangleVARIABLE_TYPE_MISMATCH
    leftxVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type int of variable insets.left does not match with type int of variable insets.x
    • Make classes java.awt.Insets and org.eclipse.swt.graphics.Rectangle extend a common superclass
    Expression insets.left cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression insets.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    int x = (int)(java2DPoint.getX() * this.scaleX + insets.x);
    3
    int y = (int)(java2DPoint.getY() * this.scaleY + insets.top);
    3
    int y = (int)(java2DPoint.getY() * this.scaleY + insets.top);
    3
    int y = (int)(java2DPoint.getY() * this.scaleY + insets.y);
    Differences
    Expression1Expression2Difference
    java.awt.Insetsorg.eclipse.swt.graphics.RectangleVARIABLE_TYPE_MISMATCH
    topyVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type int of variable insets.top does not match with type int of variable insets.y
    • Make classes java.awt.Insets and org.eclipse.swt.graphics.Rectangle extend a common superclass
    Expression insets.top cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression insets.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    int y = (int)(java2DPoint.getY() * this.scaleY + insets.y);
    4
    return new Point(x, y);
    4
    return new Point(x, y);
    Precondition Violations (7)
    Row Violation
    1Type int of variable insets.left does not match with type int of variable insets.x
    2Expression insets.left cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression insets.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Type int of variable insets.top does not match with type int of variable insets.y
    5Expression insets.top cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression insets.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7The refactoring of the clones is infeasible, because classes org.jfree.chart.ChartPanel and org.jfree.experimental.chart.swt.ChartComposite do not have a common superclass