1261-1-2

if (this.info != null) { EntityCollection entities = this.info.getEntityCollection(); if (entities != null) { Insets insets = getInsets(); ChartEntity entity = entities.getEntity( (int) ((e.getX() - insets.left) / this.scaleX), (int) ((e.getY() - insets.top) / this.scaleY)); if (entity != null) { result = entity.getToolTipText(); } } }
if (this.info != null) { EntityCollection entities = this.info.getEntityCollection(); if (entities != null) { Rectangle insets = getClientArea(); ChartEntity entity = entities.getEntity( (int) ((e.x - insets.x) / this.scaleX), (int) ((e.y - insets.y) / this.scaleY)); if (entity != null) { result = entity.getToolTipText(); } } }

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: `String getToolTipText(MouseEvent)` |  | Method name: `String getToolTipText(org.eclipse.swt.events.MouseEvent)`
Number of AST nodes: 7 |  | Number of AST nodes: 7

1

    if (this.info != null) {
    ↵

1

    if (this.info != null) {↵

2

                EntityCollection entities = this.info.getEntityCollection();
    ↵

2

                EntityCollection entities = this.info.getEntityCollection();↵

3

                if (entities != null) {
    ↵

3

                if (entities != null) {↵

4

                    Insets insets = getInsets();
    ↵

4

                    Rectangle insets = getClientArea();↵

5

                    ChartEntity entity = entities.getEntity(
    ↵

5

                    ChartEntity entity = entities.getEntity(↵

6

                            (int) ((e.getX() - insets.left) / this.scaleX),
    ↵

6

                            (int) ((e.x - insets.x) / this.scaleX),↵

7

                            (int) ((e.getY() - insets.top) / this.scaleY));
    ↵

7

                            (int) ((e.y - insets.y) / this.scaleY));↵

8

                    if (entity != null) {
    ↵

8

                    if (entity != null) {↵

9

                        result = entity.getToolTipText();
    ↵

9

                        result = entity.getToolTipText();↵

10

                    }
    ↵

10

                    }↵

11

                }
    ↵

11

                }↵

12

            }

12

            }

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.2
Clones location | Clones are in different classes
Number of node comparisons | 17

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 6
   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) | 2.4
   Clone type | Type 2

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

   2

       if (this.info != null)

   2

       if (this.info != null)

   3

       EntityCollection entities = this.info.getEntityCollection();

   3

       EntityCollection entities = this.info.getEntityCollection();

   4

       if (entities != null)

   4

       if (entities != null)

   5

       Rectangle insets = getClientArea();

   5

       Insets insets = getInsets();

   6

       ChartEntity entity = entities.getEntity((int)((e.getX() - insets.left) / this.scaleX), (int)((e.getY() - insets.top) / this.scaleY));

   6 | ChartEntity entity = entities.getEntity((int)((e.getX() - insets.left) / this.scaleX), (int)((e.getY() - insets.top) / this.scaleY));
   6 | ChartEntity entity = entities.getEntity((int)((e.x - insets.x) / this.scaleX), (int)((e.y - insets.y) / this.scaleY));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   e.getX() | e.x | TYPE_COMPATIBLE_REPLACEMENT
   java.awt.Insets | org.eclipse.swt.graphics.Rectangle | VARIABLE_TYPE_MISMATCH
   left | x | VARIABLE_NAME_MISMATCH
   e.getY() | e.y | TYPE_COMPATIBLE_REPLACEMENT
   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

   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

   6

       ChartEntity entity = entities.getEntity((int)((e.x - insets.x) / this.scaleX), (int)((e.y - insets.y) / this.scaleY));

   7

       if (entity != null)

   7

       if (entity != null)

   8

       result = entity.getToolTipText();

   8

       result = entity.getToolTipText();

   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