1777-1-2

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);

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0
Clones location | Clones are in different classes
Number of node comparisons | 16

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 3
   Number of unmapped statements in the first code fragment | 1
   Number of unmapped statements in the second code fragment | 1
   Time elapsed for statement mapping (ms) | 0.0
   Clone type | Type 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
   Expression1 | Expression2 | Difference
   --- | --- | ---
   java.awt.Insets | org.eclipse.swt.graphics.Rectangle | VARIABLE_TYPE_MISMATCH
   left | x | VARIABLE_NAME_MISMATCH

   Preondition Violations

   Type java.awt.Insets of variable insets does not match with type org.eclipse.swt.graphics.Rectangle of variable insets
   - Make classes java.awt.Insets and org.eclipse.swt.graphics.Rectangle extend a common superclass

   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
   Expression1 | Expression2 | Difference
   --- | --- | ---
   java.awt.Insets | org.eclipse.swt.graphics.Rectangle | VARIABLE_TYPE_MISMATCH
   top | y | VARIABLE_NAME_MISMATCH

   Preondition Violations

   Type java.awt.Insets of variable insets does not match with type org.eclipse.swt.graphics.Rectangle of variable insets
   - Make classes java.awt.Insets and org.eclipse.swt.graphics.Rectangle extend a common superclass

   3

       int y = (int)(java2DPoint.getY() * this.scaleY + insets.y);

   4

       return new Point(x, y);

   4

       return new Point(x, y);

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Type java.awt.Insets of variable insets does not match with type org.eclipse.swt.graphics.Rectangle of variable insets
   2 | Type java.awt.Insets of variable insets does not match with type org.eclipse.swt.graphics.Rectangle of variable insets