1652-1-5

while (iterator.hasNext()) { Title currentTitle = (Title) iterator.next(); EntityCollection e = drawTitle(currentTitle, g2, nonTitleArea, (entities != null)); if (e != null) { entities.addAll(e); } }
Axis axis = (Axis) this.rangeAxes.get(i); if (axis != null) { RectangleEdge edge = getRangeAxisEdge(i); space = axis.reserveSpace(g2, this, plotArea, edge, space); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/JFreeChart.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/XYPlot.java
Method name: `void draw(Graphics2D, Rectangle2D, Point2D, ChartRenderingInfo)` |  | Method name: `AxisSpace calculateRangeAxisSpace(Graphics2D, Rectangle2D, AxisSpace)`
Number of AST nodes: 5 |  | Number of AST nodes: 4

1

    while (iterator.hasNext()) {↵

2

                Title currentTitle = (Title) iterator.next();↵

1

    Axis axis = (Axis) this.rangeAxes.get(i);↵

3

                EntityCollection e = drawTitle(currentTitle, g2, nonTitleArea,↵

2

                ↵

4

                        (entities != null));↵

5

                if (e != null) {↵

6

                    entities.addAll(↵

3

        if (axis != null) {↵

4

                        RectangleEdge edge = getRangeAxisEdge(i);↵

7

    e);↵

5

                        space = axis.reserveSpace(g2, this, plotArea, edge, space);↵

8

                }↵

6

            ↵

9

            }

7

            }

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 1
   Number of unmapped statements in the first code fragment | 3
   Number of unmapped statements in the second code fragment | 3
   Time elapsed for statement mapping (ms) | 0.9
   Clone type | Type 3

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

   11 | Axis axis = (Axis)this.rangeAxes.get(i);

   Preondition Violations
   Unmatched statement Axis axis=(Axis)this.rangeAxes.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   11

       Axis axis = (Axis)this.rangeAxes.get(i);

   38

       Title currentTitle = (Title)iterator.next();

   39

       EntityCollection e = drawTitle(currentTitle, g2, nonTitleArea, (entities != null));

   39 | EntityCollection e = drawTitle(currentTitle, g2, nonTitleArea, (entities != null));

   Preondition Violations
   Unmatched statement EntityCollection e=drawTitle(currentTitle,g2,nonTitleArea,(entities != null)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   40

       if (e != null)

   40 | if (e != null)
   12 | if (axis != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   e | axis | VARIABLE_NAME_MISMATCH
   org.jfree.chart.entity.EntityCollection | org.jfree.chart.axis.Axis | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.entity.EntityCollection of variable e does not match with type org.jfree.chart.axis.Axis of variable axis
   - Make classes org.jfree.chart.entity.EntityCollection and org.jfree.chart.axis.Axis extend a common superclass

   12

       if (axis != null)

   13

       RectangleEdge edge = getRangeAxisEdge(i);

   14

       space = axis.reserveSpace(g2, this, plotArea, edge, space);

   41

       entities.addAll(e);

   Precondition Violations (3)
   Row | Violation
   --- | ---
   1 | Unmatched statement Axis axis=(Axis)this.rangeAxes.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   2 | Unmatched statement EntityCollection e=drawTitle(currentTitle,g2,nonTitleArea,(entities != null)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   3 | Type org.jfree.chart.entity.EntityCollection of variable e does not match with type org.jfree.chart.axis.Axis of variable axis