if (isAngleAtFront(start)) { // start at front 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); } } } else { // the segment starts at the back (still extending // CLOCKWISE) if (!isAngleAtFront(end)) { if (extent > -180.0) { // whole segment stays at the back if (drawBack) { Area side = new Area(new Rectangle2D.Double( arc.getStartPoint().getX(), plotArea.getY(), arc.getEndPoint().getX() - arc.getStartPoint().getX(), plotArea.getHeight())); side.intersect(back); g2.setPaint(paint); g2.fill(side); g2.setPaint(outlinePaint); g2.draw(side); } } else { // starts at the back, wraps around front, and // finishes at back again Area side1 = new Area(new Rectangle2D.Double( arc.getStartPoint().getX(), plotArea.getY(), plotArea.getMaxX() - arc.getStartPoint().getX(), plotArea.getHeight())); side1.intersect(back); Area side2 = new Area(new Rectangle2D.Double( plotArea.getX(), plotArea.getY(), arc.getEndPoint().getX() - plotArea.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 back, finishes at front (CLOCKWISE) if (drawBack) { Area side1 = new Area(new Rectangle2D.Double( arc.getStartPoint().getX(), plotArea.getY(), plotArea.getMaxX() - arc.getStartPoint().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( arc.getEndPoint().getX(), plotArea.getY(), plotArea.getMaxX() - arc.getEndPoint().getX(), plotArea.getHeight())); side2.intersect(front); g2.setPaint(paint); g2.fill(side2); g2.setPaint(outlinePaint); g2.draw(side2);
else if (extent > 0.0) { // the pie sections are arranged ANTICLOCKWISE if (isAngleAtFront(start)) { // segment starts at the front if (!isAngleAtBack(end)) { // and finishes at the front if (extent < 180.0) { // segment only occupies the front if (drawFront) { Area side = new Area(new Rectangle2D.Double( arc.getStartPoint().getX(), plotArea.getY(), arc.getEndPoint().getX() - arc.getStartPoint().getX(), plotArea.getHeight())); side.intersect(front); g2.setPaint(paint); g2.fill(side); g2.setPaint(outlinePaint); g2.draw(side); } } else { // segments wraps right around the back... Area side1 = new Area(new Rectangle2D.Double( arc.getStartPoint().getX(), plotArea.getY(), plotArea.getMaxX() - arc.getStartPoint().getX(), plotArea.getHeight())); side1.intersect(front); Area side2 = new Area(new Rectangle2D.Double( plotArea.getX(), plotArea.getY(), arc.getEndPoint().getX() - plotArea.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 { // segments starts at front and finishes at back... if (drawBack) { 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); g2.fill(side2); g2.setPaint(outlinePaint); g2.draw(side2); } if (drawFront) { Area side1 = new Area(new Rectangle2D.Double( arc.getStartPoint().getX(), plotArea.getY(), plotArea.getMaxX() - arc.getStartPoint().getX(), plotArea.getHeight())); side1.intersect(front); g2.setPaint(paint); g2.fill(side1); g2.setPaint(outlinePaint); g2.draw(side1); } } } else { // segment starts at back 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: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
else if (extent > 0.0) {  // the pie sections are arranged ANTICLOCKWISE
1
if (isAngleAtFront(start)) {  // start at front
2
            if (isAngleAtFront(start)) {  // segment starts at the front
2
                if (!isAngleAtBack(end)) {
3
                if (!isAngleAtBack(end)) {  // and finishes at the front
3
                    if (extent > -180.0) {  // the segment is entirely at the 
4
                    if (extent < 180.0) {  // segment 
4
                                            // front of the chart
5
only occupies the front
5
                        if (drawFront) {
6
                        if (drawFront) {
6
                            Area side = new Area(new Rectangle2D.Double(
7
                            Area side = new Area(new Rectangle2D.Double(
7
                                    arc.getEndPoint().getX(), plotArea.getY(), 
8
                                    arc.getStartPoint().getX(), plotArea.getY(),
8
                                    arc.getStartPoint().getX() 
9
                                    arc.getEndPoint().getX() 
9
                                    - arc.getEndPoint().getX(),
10
                                    - arc.getStartPoint().getX(),
10
                                    plotArea.getHeight()));
11
                                    plotArea.getHeight()));
11
                            side.intersect(front);
12
                            side.intersect(front);
12
                            g2.setPaint(paint);
13
                            g2.setPaint(paint);
13
                            g2.fill(side);
14
                            g2.fill(side);
14
                            g2.setPaint(outlinePaint);
15
                            g2.setPaint(outlinePaint);
15
                            g2.draw(side);
16
                            g2.draw(side);
16
                        }
17
                        }
17
                    }
18
                    }
18
                    else {  // the segment starts at the front, and wraps all 
19
                    else {  // segment
19
                            // the way around
20
                            // the back and finishes at the front again
20
s wraps right around the back...
21
                        Area side1 = new Area(new Rectangle2D.Double(
21
                        Area side1 = new Area(new Rectangle2D.Double(
22
                                plotArea.getX(), plotArea.getY(),
22
                                arc.getStartPoint().getX(), plotArea.getY(),
23
                                arc.getStartPoint().getX() - plotArea.getX(), 
23
                                plotArea.getMaxX() - arc.getStartPoint().getX(),
24
                                plotArea.getHeight()));
24
                                plotArea.getHeight()));
25
                        side1.intersect(front);
25
                        side1.intersect(front);
26
                        Area side2 = new Area(new Rectangle2D.Double(
26
                        Area side2 = new Area(new Rectangle2D.Double(
27
                                arc.getEndPoint().getX(), plotArea.getY(),
27
                                plotArea.getX(), plotArea.getY(),
28
                                plotArea.getMaxX() - arc.getEndPoint().getX(),
28
                                arc.getEndPoint().getX() - plotArea.getX(),
29
                                plotArea.getHeight()));
29
                                plotArea.getHeight()));
30
                        side2.intersect(front);
30
                        side2.intersect(front);
31
                        g2.setPaint(paint);
31
                        g2.setPaint(paint);
32
                        if (drawFront) {
32
                        if (drawFront) {
33
                            g2.fill(side1);
33
                            g2.fill(side1);
34
                            g2.fill(side2);
34
                            g2.fill(side2);
35
                        }
35
                        }
36
                        if (drawBack) {
36
                        if (drawBack) {
37
                            g2.fill(back);
37
                            g2.fill(back);
38
                        }
38
                        }
39
                        g2.setPaint(outlinePaint);
39
                        g2.setPaint(outlinePaint);
40
                        if (drawFront) {
40
                        if (drawFront) {
41
                            g2.draw(side1);
41
                            g2.draw(side1);
42
                            g2.draw(side2);
42
                            g2.draw(side2);
43
                        }
43
                        }
44
                        if (drawBack) {
44
                        if (drawBack) {
45
                            g2.draw(back);
45
                            g2.draw(back);
46
                        }
46
                        }
47
                    }
47
                    }
48
                }
48
                }
49
                else {  // starts at the front, finishes at the back (going 
49
                else {  // segments starts at front and finishes at 
50
                        // around the left side)
50
back...
51
                    if (drawBack) {
51
                    if (drawBack) {
52
                        Area side2 = new Area(new Rectangle2D.Double(
52
                        Area side2 = new Area(new Rectangle2D.Double(
53
                                plotArea.getX(), plotArea.getY(),
53
                                arc.getEndPoint().getX(), plotArea.getY(),
54
                                arc.getEndPoint().getX() - plotArea.getX(), 
54
                                plotArea.getMaxX() - arc.getEndPoint().getX(),
55
                                plotArea.getHeight()));
55
                                plotArea.getHeight()));
56
                        side2.intersect(back);
56
                        side2.intersect(back);
57
                        g2.setPaint(paint);
57
                        g2.setPaint(paint);
58
                        g2.fill(side2);
58
                        g2.fill(side2);
59
                        g2.setPaint(outlinePaint);
59
                        g2.setPaint(outlinePaint);
60
                        g2.draw(side2);
60
                        g2.draw(side2);
61
                    }
61
                    }
62
                    if (drawFront) {
62
                    if (drawFront) {
63
                        Area side1 = new Area(new Rectangle2D.Double(
63
                        Area side1 = new Area(new Rectangle2D.Double(
64
                                plotArea.getX(), plotArea.getY(),
64
                                arc.getStartPoint().getX(), plotArea.getY(),
65
                                arc.getStartPoint().getX() - plotArea.getX(),
65
                                plotArea.getMaxX() - arc.getStartPoint().getX(),
66
                                plotArea.getHeight()));
66
                                plotArea.getHeight()));
67
                        side1.intersect(front);
67
                        side1.intersect(front);
68
                        g2.setPaint(paint);
68
                        g2.setPaint(paint);
69
                        g2.fill(side1);
69
                        g2.fill(side1);
70
                        g2.setPaint(outlinePaint);
70
                        g2.setPaint(outlinePaint);
71
                        g2.draw(side1);
71
                        g2.draw(side1);
72
                    }
72
                    }
73
                }
73
                }
74
            }
74
            }
75
            else {  // the segment starts at the back (still extending 
75
            else {  // segment starts at back
76
                    // CLOCKWISE)
77
                if (!isAngleAtFront(end)) {
76
                if (!isAngleAtFront(end)) {
78
                    if (extent > -180.0) {  // whole segment stays at the back
77
                    if (extent < 180.0) {  // and finishes at back
79
                        if (drawBack) {
78
                        if (drawBack) {
80
                            Area side = new Area(new Rectangle2D.Double(
79
                            Area side = new Area(new Rectangle2D.Double(
81
                                    arc.getStartPoint().getX(), plotArea.getY(),
80
                                    arc.getEndPoint().getX(), plotArea.getY(),
82
                                    arc.getEndPoint().getX() 
81
                                    arc.getStartPoint().getX() 
83
                                    - arc.getStartPoint().getX(),
82
                                    - arc.getEndPoint().getX(),
84
                                    plotArea.getHeight()));
83
                                    plotArea.getHeight()));
85
                            side.intersect(back);
84
                            side.intersect(back);
86
                            g2.setPaint(paint);
85
                            g2.setPaint(paint);
87
                            g2.fill(side);
86
                            g2.fill(side);
88
                            g2.setPaint(outlinePaint);
87
                            g2.setPaint(outlinePaint);
89
                            g2.draw(side);
88
                            g2.draw(side);
90
                        }
89
                        }
91
                    }
90
                    }
92
                    else {  // starts at the back, wraps around front, and 
91
                    else {  // starts at back and wraps right around to the 
93
                            // finishes at back again
92
                            // back again
94
                        Area side1 = new Area(new Rectangle2D.Double(
93
                        Area side1 = new Area(new Rectangle2D.Double(
95
                                arc.getStartPoint().getX(), plotArea.getY(),
94
                                arc.getStartPoint().getX(), plotArea.getY(),
96
                                plotArea.getMaxX() - arc.getStartPoint().getX(),
95
                                plotArea.getX() - arc.getStartPoint().getX(),
97
                                plotArea.getHeight()));
96
                                plotArea.getHeight()));
98
                        side1.intersect(back);
97
                        side1.intersect(back);
99
                        Area side2 = new Area(new Rectangle2D.Double(
98
                        Area side2 = new Area(new Rectangle2D.Double(
100
                                plotArea.getX(), plotArea.getY(),
99
                                arc.getEndPoint().getX(), plotArea.getY(),
101
                                arc.getEndPoint().getX() - plotArea.getX(),
100
                                plotArea.getMaxX() - arc.getEndPoint().getX(),
102
                                plotArea.getHeight()));
101
                                plotArea.getHeight()));
103
                        side2.intersect(back);
102
                        side2.intersect(back);
104
                        g2.setPaint(paint);
103
                        g2.setPaint(paint);
105
                        if (drawBack) {
104
                        if (drawBack) {
106
                            g2.fill(side1);
105
                            g2.fill(side1);
107
                            g2.fill(side2);
106
                            g2.fill(side2);
108
                        }
107
                        }
109
                        if (drawFront) {
108
                        if (drawFront) {
110
                            g2.fill(front);
109
                            g2.fill(front);
111
                        }
110
                        }
112
                        g2.setPaint(outlinePaint);
111
                        g2.setPaint(outlinePaint);
113
                        if (drawBack) {
112
                        if (drawBack) {
114
                            g2.draw(side1);
113
                            g2.draw(side1);
115
                            g2.draw(side2);
114
                            g2.draw(side2);
116
                        }
115
                        }
117
                        if (drawFront) {
116
                        if (drawFront) {
118
                            g2.draw(front);
117
                            g2.draw(front);
119
                        }
118
                        }
120
                    }
119
                    }
121
                }
120
                }
122
                else {  // starts at back, finishes at front (CLOCKWISE)
121
                else {  // starts at the back and finishes at the front 
122
                        // (wrapping the left side)
123
                    if (drawBack) {
123
                    if (drawBack) {
124
                        Area side1 = new Area(new Rectangle2D.Double(
124
                        Area side1 = new Area(new Rectangle2D.Double(
125
                                arc.getStartPoint().getX(), plotArea.getY(),
125
                                plotArea.getX(), plotArea.getY(),
126
                                plotArea.getMaxX() - arc.getStartPoint().getX(),
126
                                arc.getStartPoint().getX() - plotArea.getX(),
127
                                plotArea.getHeight()));
127
                                plotArea.getHeight()));
128
                        side1.intersect(back);
128
                        side1.intersect(back);
129
                        g2.setPaint(paint);
129
                        g2.setPaint(paint);
130
                        g2.fill(side1);
130
                        g2.fill(side1);
131
                        g2.setPaint(outlinePaint);
131
                        g2.setPaint(outlinePaint);
132
                        g2.draw(side1);
132
                        g2.draw(side1);
133
                    }
133
                    }
134
                    if (drawFront) {
134
                    if (drawFront) {
135
                        Area side2 = new Area(new Rectangle2D.Double(
135
                        Area side2 = new Area(new Rectangle2D.Double(
136
                                arc.getEndPoint().getX(), plotArea.getY(),
136
                                plotArea.getX(), plotArea.getY(),
137
                                plotArea.getMaxX() - arc.getEndPoint().getX(),
137
                                arc.getEndPoint().getX() - plotArea.getX(),
138
                                plotArea.getHeight()));
138
                                plotArea.getHeight()));
139
                        side2.intersect(front);
139
                        side2.intersect(front);
140
                        g2.setPaint(paint);
140
                        g2.setPaint(paint);
141
                        g2.fill(side2);
141
                        g2.fill(side2);
142
                        g2.setPaint(outlinePaint);
142
                        g2.setPaint(outlinePaint);
143
                        g2.draw(side2);
143
                        g2.draw(side2);
144
                    
144
                    
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0