1678-1-2

Transform swtTransform = new Transform(this.gc.getDevice()); this.gc.getTransform(swtTransform); swtTransform.multiply(getSwtTransformFromPool(Tx)); this.gc.setTransform(swtTransform); swtTransform.dispose();
Transform swtTransform = new Transform(this.gc.getDevice()); this.gc.getTransform(swtTransform); swtTransform.translate(x, y); this.gc.setTransform(swtTransform); swtTransform.dispose();

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/swt/org/jfree/experimental/swt/SWTGraphics2D.java |  | File path: /jfreechart-1.0.10/swt/org/jfree/experimental/swt/SWTGraphics2D.java
Method name: `void transform(AffineTransform)` |  | Method name: `void translate(int, int)`
Number of AST nodes: 5 |  | Number of AST nodes: 5

1

    Transform swtTransform = new Transform(this.gc.getDevice()); ↵

1

    Transform swtTransform = new Transform(this.gc.getDevice()); ↵

2

            this.gc.getTransform(swtTransform);↵

2

            this.gc.getTransform(swtTransform);↵

3

            swtTransform.multiply(getSwtTransformFromPool(Tx));↵

3

            swtTransform.translate(x, y);↵

4

            this.gc.setTransform(swtTransform);↵

4

            this.gc.setTransform(swtTransform);↵

5

            swtTransform.dispose();

5

            swtTransform.dispose();

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 declared in the same class
Number of node comparisons | 17

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 5
   Number of unmapped statements in the first code fragment | 0
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 0.0
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       Transform swtTransform = new Transform(this.gc.getDevice());

   1

       Transform swtTransform = new Transform(this.gc.getDevice());

   2

       this.gc.getTransform(swtTransform);

   2

       this.gc.getTransform(swtTransform);

   3

       swtTransform.multiply(getSwtTransformFromPool(Tx));

   3 | swtTransform.multiply(getSwtTransformFromPool(Tx));
   3 | swtTransform.translate(x, y);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   multiply | translate | METHOD_INVOCATION_NAME_MISMATCH
   swtTransform.multiply(getSwtTransformFromPool(Tx)) | swtTransform.translate(x,y) | ARGUMENT_NUMBER_MISMATCH

   Preondition Violations
   Expression swtTransform.multiply(getSwtTransformFromPool(Tx)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression swtTransform.translate(x,y) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression swtTransform.multiply(getSwtTransformFromPool(Tx)) is a void method call, and thus it cannot be parameterized
   Expression swtTransform.translate(x,y) is a void method call, and thus it cannot be parameterized
   Expression swtTransform.multiply(getSwtTransformFromPool(Tx)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression swtTransform.translate(x,y) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression swtTransform.multiply(getSwtTransformFromPool(Tx)) is a void method call, and thus it cannot be parameterized
   Expression swtTransform.translate(x,y) is a void method call, and thus it cannot be parameterized

   3

       swtTransform.translate(x, y);

   4

       this.gc.setTransform(swtTransform);

   4

       this.gc.setTransform(swtTransform);

   5

       swtTransform.dispose();

   5

       swtTransform.dispose();

   Precondition Violations (8)
   Row | Violation
   --- | ---
   1 | Expression swtTransform.multiply(getSwtTransformFromPool(Tx)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression swtTransform.translate(x,y) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression swtTransform.multiply(getSwtTransformFromPool(Tx)) is a void method call, and thus it cannot be parameterized
   4 | Expression swtTransform.translate(x,y) is a void method call, and thus it cannot be parameterized
   5 | Expression swtTransform.multiply(getSwtTransformFromPool(Tx)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   6 | Expression swtTransform.translate(x,y) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   7 | Expression swtTransform.multiply(getSwtTransformFromPool(Tx)) is a void method call, and thus it cannot be parameterized
   8 | Expression swtTransform.translate(x,y) is a void method call, and thus it cannot be parameterized