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
        }
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.9
Clones locationClones are in different classes
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)4.7
    Clone typeType 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();
    38
    Title currentTitle = (Title)iterator.next();
    Preondition Violations
    Unmatched statement Title currentTitle=(Title)iterator.next(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                
    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
    Expression1Expression2Difference
    eaxisVARIABLE_NAME_MISMATCH
    org.jfree.chart.entity.EntityCollectionorg.jfree.chart.axis.AxisVARIABLE_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);
    Preondition Violations
    Unmatched statement RectangleEdge edge=getRangeAxisEdge(i); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    13
    RectangleEdge edge = getRangeAxisEdge(i);
                                                                                                                      
    14
    space = axis.reserveSpace(g2, this, plotArea, edge, space);
    Preondition Violations
    Unmatched statement space=axis.reserveSpace(g2,this,plotArea,edge,space); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement space=axis.reserveSpace(g2,this,plotArea,edge,space); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    14
    space = axis.reserveSpace(g2, this, plotArea, edge, space);
    41
    entities.addAll(e);
    41
    entities.addAll(e);
    Preondition Violations
    Unmatched statement entities.addAll(e); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                  
    Precondition Violations (9)
    Row Violation
    1Unmatched 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
    2Unmatched statement Title currentTitle=(Title)iterator.next(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched 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
    4Type org.jfree.chart.entity.EntityCollection of variable e does not match with type org.jfree.chart.axis.Axis of variable axis
    5Unmatched statement RectangleEdge edge=getRangeAxisEdge(i); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    6Unmatched statement space=axis.reserveSpace(g2,this,plotArea,edge,space); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7Unmatched statement space=axis.reserveSpace(g2,this,plotArea,edge,space); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    8Unmatched statement entities.addAll(e); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero