while (iterator.hasNext()) { DialLayer current = (DialLayer) iterator.next(); if (current.isVisible()) { if (current.isClippedToWindow()) { Shape savedClip = g2.getClip(); g2.clip(this.dialFrame.getWindow(frame)); current.draw(g2, this, frame, area); g2.setClip(savedClip); } else { current.draw(g2, this, frame, area); } } }
while (iterator.hasNext()) { DialPointer current = (DialPointer) iterator.next(); if (current.isVisible()) { if (current.isClippedToWindow()) { Shape savedClip = g2.getClip(); g2.clip(this.dialFrame.getWindow(frame)); current.draw(g2, this, frame, area); g2.setClip(savedClip); } else { current.draw(g2, this, frame, area); } } }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/dial/DialPlot.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/dial/DialPlot.java
Method name: void draw(Graphics2D, Rectangle2D, Point2D, PlotState, PlotRenderingInfo) Method name: void draw(Graphics2D, Rectangle2D, Point2D, PlotState, PlotRenderingInfo)
Number of AST nodes: 9 Number of AST nodes: 9
1
while (iterator.hasNext()) {
1
while (iterator.hasNext()) {
2
            DialLayer current = (DialLayer) iterator.next();
2
            DialPointer current = (DialPointer) iterator.next();
3
            if (current.isVisible()) {
3
            if (current.isVisible()) {
4
                if (current.isClippedToWindow()) {
4
                if (current.isClippedToWindow()) {
5
                    Shape savedClip = g2.getClip();
5
                    Shape savedClip = g2.getClip();
6
                    g2.clip(this.dialFrame.getWindow(frame));
6
                    g2.clip(this.dialFrame.getWindow(frame));
7
                    current.draw(g2, this, frame, area);
7
                    current.draw(g2, this, frame, area);
8
                    g2.setClip(savedClip);
8
                    g2.setClip(savedClip);
9
                }
9
                }
10
                else {
10
                else {
11
                    current.draw(g2, this, frame, area);
11
                    current.draw(g2, this, frame, area);
12
                }
12
                }
13
            }
13
            }
14
        }
14
        }
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.3
Clones locationClones are in the same method
Number of node comparisons42
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)15.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    12
    while (iterator.hasNext())
    22
    while (iterator.hasNext())
    13
    DialLayer current = (DialLayer)iterator.next();
    13
    DialLayer current = (DialLayer)iterator.next();
    Preondition Violations
    Unmatched statement DialLayer current=(DialLayer)iterator.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                      
                                                                                                              
    23
    DialPointer current = (DialPointer)iterator.next();
    Preondition Violations
    Unmatched statement DialPointer current=(DialPointer)iterator.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    23
    DialPointer current = (DialPointer)iterator.next();
    14
    if (current.isVisible())
    14
    if (current.isVisible())
    24
    if (current.isVisible())
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.dial.DialLayerorg.jfree.chart.plot.dial.DialPointerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.plot.dial.DialLayer of variable current does not match with type org.jfree.chart.plot.dial.DialPointer of variable current
    • Make classes org.jfree.chart.plot.dial.DialLayer and org.jfree.chart.plot.dial.DialPointer extend a common superclass
    24
    if (current.isVisible())
    15
    if (current.isClippedToWindow())
    15
    if (current.isClippedToWindow())
    25
    if (current.isClippedToWindow())
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.dial.DialLayerorg.jfree.chart.plot.dial.DialPointerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.plot.dial.DialLayer of variable current does not match with type org.jfree.chart.plot.dial.DialPointer of variable current
    • Make classes org.jfree.chart.plot.dial.DialLayer and org.jfree.chart.plot.dial.DialPointer extend a common superclass
    25
    if (current.isClippedToWindow())
    16
    Shape savedClip = g2.getClip();
    26
    Shape savedClip = g2.getClip();
    17
    g2.clip(this.dialFrame.getWindow(frame));
    27
    g2.clip(this.dialFrame.getWindow(frame));
    18
    current.draw(g2, this, frame, area);
    18
    current.draw(g2, this, frame, area);
    28
    current.draw(g2, this, frame, area);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.dial.DialLayerorg.jfree.chart.plot.dial.DialPointerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.plot.dial.DialLayer of variable current does not match with type org.jfree.chart.plot.dial.DialPointer of variable current
    • Make classes org.jfree.chart.plot.dial.DialLayer and org.jfree.chart.plot.dial.DialPointer extend a common superclass
    28
    current.draw(g2, this, frame, area);
    19
    g2.setClip(savedClip);
    29
    g2.setClip(savedClip);
    else
    else
    20
    current.draw(g2, this, frame, area);
    20
    current.draw(g2, this, frame, area);
    30
    current.draw(g2, this, frame, area);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.dial.DialLayerorg.jfree.chart.plot.dial.DialPointerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.plot.dial.DialLayer of variable current does not match with type org.jfree.chart.plot.dial.DialPointer of variable current
    • Make classes org.jfree.chart.plot.dial.DialLayer and org.jfree.chart.plot.dial.DialPointer extend a common superclass
    30
    current.draw(g2, this, frame, area);
    Precondition Violations (6)
    Row Violation
    1Unmatched statement DialLayer current=(DialLayer)iterator.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement DialPointer current=(DialPointer)iterator.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type org.jfree.chart.plot.dial.DialLayer of variable current does not match with type org.jfree.chart.plot.dial.DialPointer of variable current
    4Type org.jfree.chart.plot.dial.DialLayer of variable current does not match with type org.jfree.chart.plot.dial.DialPointer of variable current
    5Type org.jfree.chart.plot.dial.DialLayer of variable current does not match with type org.jfree.chart.plot.dial.DialPointer of variable current
    6Type org.jfree.chart.plot.dial.DialLayer of variable current does not match with type org.jfree.chart.plot.dial.DialPointer of variable current