File path: /jfreechart-1.0.10/tests/org/jfree/chart/entity/junit/StandardEntityCollectionTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/XYPlotTests.java | |||
Method name: void testCloning()
|
Method name: void testCloning_QuadrantPaint()
|
|||
Number of AST nodes: 13 | Number of AST nodes: 12 | |||
1 | PieSectionEntity e1 = new PieSectionEntity(new Rectangle2D.Double(1.0, ↵ | |||
2 | 2.0, 3.0, 4.0), new DefaultPieDataset(), 0, 1, "Key", ↵ | |||
3 | "ToolTip", "URL");↵ | |||
4 | StandardEntityCollection c1 = new StandardEntityCollection();↵ | |||
5 | c1.add(e1);↵ | |||
6 | StandardEntityCollection c↵ | 1 | XYPlot p1 = new XYPlot();↵ | |
2 | p1.setQuadrantPaint(3, new GradientPaint(1.0f, 2.0f, Color.red, ↵ | |||
3 | 3.0f, 4.0f, Color.blue));↵ | |||
7 | 2 = null;↵ | 4 | XYPlot p2 = null;↵ | |
8 | try {↵ | 5 | try {↵ | |
9 | c2 = (StandardEntityCollection) c1.clone();↵ | 6 | p2 = (XYPlot) p1.clone();↵ | |
10 | }↵ | 7 | }↵ | |
11 | catch (CloneNotSupportedException e) {↵ | 8 | catch (CloneNotSupportedException e) {↵ | |
12 | e.printStackTrace();↵ | 9 | e.printStackTrace();↵ | |
13 | }↵ | 10 | }↵ | |
14 | assertTrue(c1 != c2);↵ | 11 | assertTrue(p1 != p2);↵ | |
15 | assertTrue(c1.getClass() == c2.getClass());↵ | 12 | assertTrue(p1.getClass() == p2.getClass());↵ | |
16 | assertTrue(c1.equals(c2));↵ | 13 | assertTrue(p1.equals(p2));↵ | |
17 | ↵ | 14 | ↵ | |
18 | // check independence↵ | 15 | // check for independence↵ | |
19 | c1.clear();↵ | 16 | p1.setQuadrantPaint(1, Color.red);↵ | |
20 | assertFalse(c1.equals(c2));↵ | 17 | assertFalse(p1.equals(p2));↵ | |
21 | c2.clear();↵ | 18 | p2.setQuadrantPaint(1, Color.red);↵ | |
22 | assertTrue(c1.equals(c2)); | 19 | assertTrue(p1.equals(p2)); | |
See real code fragment | See real code fragment |
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 having the same super class |
Number of node comparisons | 58 |
Number of mapped statements | 12 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 81.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | PieSectionEntity e1 = new PieSectionEntity(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), new DefaultPieDataset(), 0, 1, "Key", "ToolTip", "URL"); |
| | |||||||||||||||||||||||||||||
2 | StandardEntityCollection c1 = new StandardEntityCollection(); |
| 1 | XYPlot p1 = new XYPlot(); | ||||||||||||||||||||||||||||
3 | c1.add(e1); |
| 2 | p1.setQuadrantPaint(3, new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue)); | ||||||||||||||||||||||||||||
4 | StandardEntityCollection c2 = null; |
| 3 | XYPlot p2 = null; | ||||||||||||||||||||||||||||
5 | try | 4 | try | |||||||||||||||||||||||||||||
6 | c2 = (StandardEntityCollection)c1.clone(); |
| 5 | p2 = (XYPlot)p1.clone(); | ||||||||||||||||||||||||||||
7 | assertTrue(c1 != c2); |
| 6 | assertTrue(p1 != p2); | ||||||||||||||||||||||||||||
8 | assertTrue(c1.getClass() == c2.getClass()); |
| 7 | assertTrue(p1.getClass() == p2.getClass()); | ||||||||||||||||||||||||||||
9 | assertTrue(c1.equals(c2)); |
| 8 | assertTrue(p1.equals(p2)); | ||||||||||||||||||||||||||||
10 | c1.clear(); |
| 9 | p1.setQuadrantPaint(1, Color.red); | ||||||||||||||||||||||||||||
11 | assertFalse(c1.equals(c2)); |
| 10 | assertFalse(p1.equals(p2)); | ||||||||||||||||||||||||||||
12 | c2.clear(); |
| 11 | p2.setQuadrantPaint(1, Color.red); | ||||||||||||||||||||||||||||
13 | assertTrue(c1.equals(c2)); |
| 12 | assertTrue(p1.equals(p2)); |
Row | Violation |
---|---|
1 | Unmatched statement PieSectionEntity e1=new PieSectionEntity(new Rectangle2D.Double(1.0,2.0,3.0,4.0),new DefaultPieDataset(),0,1,"Key","ToolTip","URL"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Expression new StandardEntityCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression new XYPlot() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression c1.add(e1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression p1.setQuadrantPaint(3,new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression c1.add(e1) is a void method call, and thus it cannot be parameterized |
7 | Expression p1.setQuadrantPaint(3,new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) is a void method call, and thus it cannot be parameterized |
8 | Expression c1 cannot be unified with expression p1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void add(org.jfree.chart.entity.ChartEntity) , public void setQuadrantPaint(int, java.awt.Paint) |
9 | Expression c1.add(e1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression p1.setQuadrantPaint(3,new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression c1.add(e1) is a void method call, and thus it cannot be parameterized |
12 | Expression p1.setQuadrantPaint(3,new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) is a void method call, and thus it cannot be parameterized |
13 | Expression (StandardEntityCollection)c1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
14 | Expression (XYPlot)p1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
15 | Expression c2 cannot be unified with expression p2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object) |
16 | Expression c2 cannot be unified with expression p2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |
17 | Expression c1 cannot be unified with expression p1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |
18 | Expression c1.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
19 | Expression p1.setQuadrantPaint(1,Color.red) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
20 | Expression c1.clear() is a void method call, and thus it cannot be parameterized |
21 | Expression p1.setQuadrantPaint(1,Color.red) is a void method call, and thus it cannot be parameterized |
22 | Expression c1 cannot be unified with expression p1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void clear() , public void setQuadrantPaint(int, java.awt.Paint) |
23 | Expression c1.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
24 | Expression p1.setQuadrantPaint(1,Color.red) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
25 | Expression c1.clear() is a void method call, and thus it cannot be parameterized |
26 | Expression p1.setQuadrantPaint(1,Color.red) is a void method call, and thus it cannot be parameterized |
27 | Expression c2 cannot be unified with expression p2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object) |
28 | Expression c2 cannot be unified with expression p2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |
29 | Expression c1 cannot be unified with expression p1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |
30 | Expression c2.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
31 | Expression p2.setQuadrantPaint(1,Color.red) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
32 | Expression c2.clear() is a void method call, and thus it cannot be parameterized |
33 | Expression p2.setQuadrantPaint(1,Color.red) is a void method call, and thus it cannot be parameterized |
34 | Expression c2 cannot be unified with expression p2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void clear() , public void setQuadrantPaint(int, java.awt.Paint) |
35 | Expression c2.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
36 | Expression p2.setQuadrantPaint(1,Color.red) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
37 | Expression c2.clear() is a void method call, and thus it cannot be parameterized |
38 | Expression p2.setQuadrantPaint(1,Color.red) is a void method call, and thus it cannot be parameterized |
39 | Expression c2 cannot be unified with expression p2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object) |
40 | Expression c2 cannot be unified with expression p2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |
41 | Expression c1 cannot be unified with expression p1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |