if (!isAngleAtBack(end)) { if (extent > -180.0) { // the segment is entirely at the // front of the chart if (drawFront) { Area side = new Area(new Rectangle2D.Double( arc.getEndPoint().getX(), plotArea.getY(), arc.getStartPoint().getX() - arc.getEndPoint().getX(), plotArea.getHeight())); side.intersect(front); g2.setPaint(paint); g2.fill(side); g2.setPaint(outlinePaint); g2.draw(side); } } else { // the segment starts at the front, and wraps all // the way around // the back and finishes at the front again Area side1 = new Area(new Rectangle2D.Double( plotArea.getX(), plotArea.getY(), arc.getStartPoint().getX() - plotArea.getX(), plotArea.getHeight())); side1.intersect(front); Area side2 = new Area(new Rectangle2D.Double( arc.getEndPoint().getX(), plotArea.getY(), plotArea.getMaxX() - arc.getEndPoint().getX(), plotArea.getHeight())); side2.intersect(front); g2.setPaint(paint); if (drawFront) { g2.fill(side1); g2.fill(side2); } if (drawBack) { g2.fill(back); } g2.setPaint(outlinePaint); if (drawFront) { g2.draw(side1); g2.draw(side2); } if (drawBack) { g2.draw(back); } } } else { // starts at the front, finishes at the back (going // around the left side) if (drawBack) { Area side2 = new Area(new Rectangle2D.Double( plotArea.getX(), plotArea.getY(), arc.getEndPoint().getX() - plotArea.getX(), plotArea.getHeight())); side2.intersect(back); g2.setPaint(paint); g2.fill(side2); g2.setPaint(outlinePaint); g2.draw(side2); } if (drawFront) { Area side1 = new Area(new Rectangle2D.Double( plotArea.getX(), plotArea.getY(), arc.getStartPoint().getX() - plotArea.getX(), plotArea.getHeight())); side1.intersect(front); g2.setPaint(paint); g2.fill(side1); g2.setPaint(outlinePaint); g2.draw(side1); } }
if (!isAngleAtFront(end)) { if (extent < 180.0) { // and finishes at back if (drawBack) { Area side = new Area(new Rectangle2D.Double( arc.getEndPoint().getX(), plotArea.getY(), arc.getStartPoint().getX() - arc.getEndPoint().getX(), plotArea.getHeight())); side.intersect(back); g2.setPaint(paint); g2.fill(side); g2.setPaint(outlinePaint); g2.draw(side); } } else { // starts at back and wraps right around to the // back again Area side1 = new Area(new Rectangle2D.Double( arc.getStartPoint().getX(), plotArea.getY(), plotArea.getX() - arc.getStartPoint().getX(), plotArea.getHeight())); side1.intersect(back); Area side2 = new Area(new Rectangle2D.Double( arc.getEndPoint().getX(), plotArea.getY(), plotArea.getMaxX() - arc.getEndPoint().getX(), plotArea.getHeight())); side2.intersect(back); g2.setPaint(paint); if (drawBack) { g2.fill(side1); g2.fill(side2); } if (drawFront) { g2.fill(front); } g2.setPaint(outlinePaint); if (drawBack) { g2.draw(side1); g2.draw(side2); } if (drawFront) { g2.draw(front); } } } else { // starts at the back and finishes at the front // (wrapping the left side) if (drawBack) { Area side1 = new Area(new Rectangle2D.Double( plotArea.getX(), plotArea.getY(), arc.getStartPoint().getX() - plotArea.getX(), plotArea.getHeight())); side1.intersect(back); g2.setPaint(paint); g2.fill(side1); g2.setPaint(outlinePaint); g2.draw(side1); } if (drawFront) { Area side2 = new Area(new Rectangle2D.Double( plotArea.getX(), plotArea.getY(), arc.getEndPoint().getX() - plotArea.getX(), plotArea.getHeight())); side2.intersect(front); g2.setPaint(paint); g2.fill(side2); g2.setPaint(outlinePaint); g2.draw(side2); } }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/PiePlot3D.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/PiePlot3D.java
Method name: void drawSide(Graphics2D, Rectangle2D, Arc2D, Area, Area, Paint, Paint, Stroke, boolean, boolean) Method name: void drawSide(Graphics2D, Rectangle2D, Arc2D, Area, Area, Paint, Paint, Stroke, boolean, boolean)
Number of AST nodes: 39 Number of AST nodes: 39
1
if (!isAngleAtBack(end)) {
1
if (!isAngleAtFront(end)) {
2
                    if (extent > -180.0) {  // the segment is entirely at the 
2
                    if (extent < 180.0) {  // 
3
                                            // front of the chart
3
and finishes at back
4
                        if (drawFront) {
4
                        if (drawBack) {
5
                            Area side = new Area(new Rectangle2D.Double(
5
                            Area side = new Area(new Rectangle2D.Double(
6
                                    arc.getEndPoint().getX(), plotArea.getY(), 
6
                                    arc.getEndPoint().getX(), plotArea.getY(),
7
                                    arc.getStartPoint().getX() 
7
                                    arc.getStartPoint().getX() 
8
                                    - arc.getEndPoint().getX(),
8
                                    - arc.getEndPoint().getX(),
9
                                    plotArea.getHeight()));
9
                                    plotArea.getHeight()));
10
                            side.intersect(front);
10
                            side.intersect(back);
11
                            g2.setPaint(paint);
11
                            g2.setPaint(paint);
12
                            g2.fill(side);
12
                            g2.fill(side);
13
                            g2.setPaint(outlinePaint);
13
                            g2.setPaint(outlinePaint);
14
                            g2.draw(side);
14
                            g2.draw(side);
15
                        }
15
                        }
16
                    }
16
                    }
17
                    else {  // the segment starts at the front, and wraps all 
17
                    else {  // 
18
                            // the way around
18
starts at back and wraps right around to the 
19
                            // the back and finishes at the front again
19
                            // back again
20
                        Area side1 = new Area(new Rectangle2D.Double(
20
                        Area side1 = new Area(new Rectangle2D.Double(
21
                                plotArea.getX(), plotArea.getY(),
21
                                arc.getStartPoint().getX(), plotArea.getY(),
22
                                arc.getStartPoint().getX() - plotArea.getX(), 
22
                                plotArea.getX() - arc.getStartPoint().getX(),
23
                                plotArea.getHeight()));
23
                                plotArea.getHeight()));
24
                        side1.intersect(front);
24
                        side1.intersect(back);
25
                        Area side2 = new Area(new Rectangle2D.Double(
25
                        Area side2 = new Area(new Rectangle2D.Double(
26
                                arc.getEndPoint().getX(), plotArea.getY(),
26
                                arc.getEndPoint().getX(), plotArea.getY(),
27
                                plotArea.getMaxX() - arc.getEndPoint().getX(),
27
                                plotArea.getMaxX() - arc.getEndPoint().getX(),
28
                                plotArea.getHeight()));
28
                                plotArea.getHeight()));
29
                        side2.intersect(front);
29
                        side2.intersect(back);
30
                        g2.setPaint(paint);
30
                        g2.setPaint(paint);
31
                        if (drawFront) {
31
                        if (drawBack) {
32
                            g2.fill(side1);
32
                            g2.fill(side1);
33
                            g2.fill(side2);
33
                            g2.fill(side2);
34
                        }
34
                        }
35
                        if (drawBack) {
35
                        if (drawFront) {
36
                            g2.fill(back);
36
                            g2.fill(front);
37
                        }
37
                        }
38
                        g2.setPaint(outlinePaint);
38
                        g2.setPaint(outlinePaint);
39
                        if (drawFront) {
39
                        if (drawBack) {
40
                            g2.draw(side1);
40
                            g2.draw(side1);
41
                            g2.draw(side2);
41
                            g2.draw(side2);
42
                        }
42
                        }
43
                        if (drawBack) {
43
                        if (drawFront) {
44
                            g2.draw(back);
44
                            g2.draw(front);
45
                        }
45
                        }
46
                    }
46
                    }
47
                }
47
                }
48
                else {  // starts at the front, finishes at the back (going 
48
                else {  // starts at the back and finishes at the front 
49
                        // around the left side)
49
                        // (wrapping the left side)
50
                    if (drawBack) {
50
                    if (drawBack) {
51
                        Area side2 = new Area(new Rectangle2D.Double(
51
                        Area side1 = new Area(new Rectangle2D.Double(
52
                                plotArea.getX(), plotArea.getY(),
52
                                plotArea.getX(), plotArea.getY(),
53
                                arc.getEndPoint().getX() - plotArea.getX(), 
53
                                arc.getStartPoint().getX() - plotArea.getX(),
54
                                plotArea.getHeight()));
54
                                plotArea.getHeight()));
55
                        side2.intersect(back);
55
                        side1.intersect(back);
56
                        g2.setPaint(paint);
56
                        g2.setPaint(paint);
57
                        g2.fill(side2);
57
                        g2.fill(side1);
58
                        g2.setPaint(outlinePaint);
58
                        g2.setPaint(outlinePaint);
59
                        g2.draw(side2);
59
                        g2.draw(side1);
60
                    }
60
                    }
61
                    if (drawFront) {
61
                    if (drawFront) {
62
                        Area side1 = new Area(new Rectangle2D.Double(
62
                        Area side2 = new Area(new Rectangle2D.Double(
63
                                plotArea.getX(), plotArea.getY(),
63
                                plotArea.getX(), plotArea.getY(),
64
                                arc.getStartPoint().getX() - plotArea.getX(),
64
                                arc.getEndPoint().getX() - plotArea.getX(),
65
                                plotArea.getHeight()));
65
                                plotArea.getHeight()));
66
                        side1.intersect(front);
66
                        side2.intersect(front);
67
                        g2.setPaint(paint);
67
                        g2.setPaint(paint);
68
                        g2.fill(side1);
68
                        g2.fill(side2);
69
                        g2.setPaint(outlinePaint);
69
                        g2.setPaint(outlinePaint);
70
                        g2.draw(side1);
70
                        g2.draw(side2);
71
                    }
71
                    }
72
                }
72
                }
Summary
Number of common nesting structure subtrees5
Number of refactorable cases4
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)1.8
Clones locationClones are in the same method
Number of node comparisons204
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment8
    Time elapsed for statement mapping (ms)2.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                                                                                                                                                                                                                  
    140
    Area side1 = new Area(new Rectangle2D.Double(arc.getStartPoint().getX(), plotArea.getY(), plotArea.getX() - arc.getStartPoint().getX(), plotArea.getHeight()));
                                                          
    141
    side1.intersect(back);
                                                                                                                                                                                                                                                                                                                                
    142
    Area side2 = new Area(new Rectangle2D.Double(arc.getEndPoint().getX(), plotArea.getY(), plotArea.getMaxX() - arc.getEndPoint().getX(), plotArea.getHeight()));
                                                          
    143
    side2.intersect(back);
                                                    
    144
    g2.setPaint(paint);
                                      
    145
    if (drawBack)
                                            
    146
    g2.fill(side1);
                                            
    147
    g2.fill(side2);
    14
    if (drawFront)
    148
    if (drawFront)
    15
    Area side = new Area(new Rectangle2D.Double(arc.getEndPoint().getX(), plotArea.getY(), arc.getStartPoint().getX() - arc.getEndPoint().getX(), plotArea.getHeight()));
                                                                                                                                                                                                                                                                                                                                            
    16
    side.intersect(front);
                                                        
    17
    g2.setPaint(paint);
                                                  
    18
    g2.fill(side);
    18
    g2.fill(side);
    149
    g2.fill(front);
    Differences
    Expression1Expression2Difference
    sidefrontVARIABLE_NAME_MISMATCH
    149
    g2.fill(front);
    19
    g2.setPaint(outlinePaint);
                                                                
    20
    g2.draw(side);
                                        
    Precondition Violations (0)
    Row Violation
  2. {Refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment8
    Number of unmapped statements in the second code fragment8
    Time elapsed for statement mapping (ms)6.9
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    21
    Area side1 = new Area(new Rectangle2D.Double(plotArea.getX(), plotArea.getY(), arc.getStartPoint().getX() - plotArea.getX(), plotArea.getHeight()));
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                                  
    140
    Area side1 = new Area(new Rectangle2D.Double(arc.getStartPoint().getX(), plotArea.getY(), plotArea.getX() - arc.getStartPoint().getX(), plotArea.getHeight()));
    22
    side1.intersect(front);
    22
    side1.intersect(front);
    141
    side1.intersect(back);
    Differences
    Expression1Expression2Difference
    frontbackVARIABLE_NAME_MISMATCH
    141
    side1.intersect(back);
    23
    Area side2 = new Area(new Rectangle2D.Double(arc.getEndPoint().getX(), plotArea.getY(), plotArea.getMaxX() - arc.getEndPoint().getX(), plotArea.getHeight()));
    142
    Area side2 = new Area(new Rectangle2D.Double(arc.getEndPoint().getX(), plotArea.getY(), plotArea.getMaxX() - arc.getEndPoint().getX(), plotArea.getHeight()));
    24
    side2.intersect(front);
    24
    side2.intersect(front);
    143
    side2.intersect(back);
    Differences
    Expression1Expression2Difference
    frontbackVARIABLE_NAME_MISMATCH
    143
    side2.intersect(back);
    25
    g2.setPaint(paint);
    144
    g2.setPaint(paint);
    26
    if (drawFront)
    26
    if (drawFront)
    145
    if (drawBack)
    Differences
    Expression1Expression2Difference
    drawFrontdrawBackVARIABLE_NAME_MISMATCH
    145
    if (drawBack)
    27
    g2.fill(side1);
    146
    g2.fill(side1);
    28
    g2.fill(side2);
    147
    g2.fill(side2);
    29
    if (drawBack)
                                    
    30
    g2.fill(back);
                                        
    31
    g2.setPaint(outlinePaint);
    150
    g2.setPaint(outlinePaint);
    32
    if (drawFront)
                                      
    33
    g2.draw(side1);
                                          
    34
    g2.draw(side2);
                                          
    35
    if (drawBack)
                                    
    36
    g2.draw(back);
                                        
                                        
    148
    if (drawFront)
                                            
    149
    g2.fill(front);
                                      
    151
    if (drawBack)
                                            
    152
    g2.draw(side1);
                                            
    153
    g2.draw(side2);
                                        
    154
    if (drawFront)
                                            
    155
    g2.draw(front);
    Precondition Violations (0)
    Row Violation
  3. {Refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment8
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)1.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    21
    Area side1 = new Area(new Rectangle2D.Double(plotArea.getX(), plotArea.getY(), arc.getStartPoint().getX() - plotArea.getX(), plotArea.getHeight()));
                                                                                                                                                                                                                                                                                                          
    22
    side1.intersect(front);
                                                          
    23
    Area side2 = new Area(new Rectangle2D.Double(arc.getEndPoint().getX(), plotArea.getY(), plotArea.getMaxX() - arc.getEndPoint().getX(), plotArea.getHeight()));
                                                                                                                                                                                                                                                                                                                              
    24
    side2.intersect(front);
                                                          
    25
    g2.setPaint(paint);
                                                  
    26
    if (drawFront)
                                      
    27
    g2.fill(side1);
                                          
    28
    g2.fill(side2);
                                          
    29
    if (drawBack)
    133
    if (drawBack)
                                                                                                                                                                                                                                                                                                                                              
    134
    Area side = new Area(new Rectangle2D.Double(arc.getEndPoint().getX(), plotArea.getY(), arc.getStartPoint().getX() - arc.getEndPoint().getX(), plotArea.getHeight()));
                                                        
    135
    side.intersect(back);
                                                    
    136
    g2.setPaint(paint);
    30
    g2.fill(back);
    30
    g2.fill(back);
    137
    g2.fill(side);
    Differences
    Expression1Expression2Difference
    backsideVARIABLE_NAME_MISMATCH
    137
    g2.fill(side);
                                                                  
    138
    g2.setPaint(outlinePaint);
                                          
    139
    g2.draw(side);
    Precondition Violations (0)
    Row Violation
  4. {Refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)4.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    37
    if (drawBack)
    133
    if (drawBack)
    38
    Area side2 = new Area(new Rectangle2D.Double(plotArea.getX(), plotArea.getY(), arc.getEndPoint().getX() - plotArea.getX(), plotArea.getHeight()));
                                                                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                                                                              
    134
    Area side = new Area(new Rectangle2D.Double(arc.getEndPoint().getX(), plotArea.getY(), arc.getStartPoint().getX() - arc.getEndPoint().getX(), plotArea.getHeight()));
    39
    side2.intersect(back);
    39
    side2.intersect(back);
    135
    side.intersect(back);
    Differences
    Expression1Expression2Difference
    side2sideVARIABLE_NAME_MISMATCH
    135
    side.intersect(back);
    40
    g2.setPaint(paint);
    136
    g2.setPaint(paint);
    41
    g2.fill(side2);
    41
    g2.fill(side2);
    137
    g2.fill(side);
    Differences
    Expression1Expression2Difference
    side2sideVARIABLE_NAME_MISMATCH
    137
    g2.fill(side);
    42
    g2.setPaint(outlinePaint);
    138
    g2.setPaint(outlinePaint);
    43
    g2.draw(side2);
    43
    g2.draw(side2);
    139
    g2.draw(side);
    Differences
    Expression1Expression2Difference
    side2sideVARIABLE_NAME_MISMATCH
    139
    g2.draw(side);
    Precondition Violations (0)
    Row Violation
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment11
    Number of unmapped statements in the second code fragment7
    Time elapsed for statement mapping (ms)3.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                                                                                                                                                                                                                  
    140
    Area side1 = new Area(new Rectangle2D.Double(arc.getStartPoint().getX(), plotArea.getY(), plotArea.getX() - arc.getStartPoint().getX(), plotArea.getHeight()));
                                                          
    141
    side1.intersect(back);
                                                                                                                                                                                                                                                                                                                                
    142
    Area side2 = new Area(new Rectangle2D.Double(arc.getEndPoint().getX(), plotArea.getY(), plotArea.getMaxX() - arc.getEndPoint().getX(), plotArea.getHeight()));
                                                          
    143
    side2.intersect(back);
                                                    
    144
    g2.setPaint(paint);
    37
    if (drawBack)
    145
    if (drawBack)
    38
    Area side2 = new Area(new Rectangle2D.Double(plotArea.getX(), plotArea.getY(), arc.getEndPoint().getX() - plotArea.getX(), plotArea.getHeight()));
                                                                                                                                                                                                                                                                                                      
    39
    side2.intersect(back);
                                                        
    40
    g2.setPaint(paint);
                                                  
    41
    g2.fill(side2);
    147
    g2.fill(side2);
    42
    g2.setPaint(outlinePaint);
                                                                
    43
    g2.draw(side2);
    43
    g2.draw(side2);
    146
    g2.fill(side1);
    Differences
    Expression1Expression2Difference
    drawfillMETHOD_INVOCATION_NAME_MISMATCH
    side2side1VARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression g2.draw(side2) is a void method call, and thus it cannot be parameterized
    Expression g2.fill(side1) is a void method call, and thus it cannot be parameterized
    146
    g2.fill(side1);
    44
    if (drawFront)
                                      
    45
    Area side1 = new Area(new Rectangle2D.Double(plotArea.getX(), plotArea.getY(), arc.getStartPoint().getX() - plotArea.getX(), plotArea.getHeight()));
                                                                                                                                                                                                                                                                                                          
    46
    side1.intersect(front);
                                                          
    47
    g2.setPaint(paint);
                                                  
    48
    g2.fill(side1);
                                          
    49
    g2.setPaint(outlinePaint);
                                                                
    50
    g2.draw(side1);
                                          
                                        
    148
    if (drawFront)
                                            
    149
    g2.fill(front);
    Precondition Violations (2)
    Row Violation
    1Expression g2.draw(side2) is a void method call, and thus it cannot be parameterized
    2Expression g2.fill(side1) is a void method call, and thus it cannot be parameterized