File path: /jfreechart-1.0.10/tests/org/jfree/chart/entity/junit/StandardEntityCollectionTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/XYIntervalSeriesCollectionTests.java | |||
Method name: void testCloning()
|
Method name: void testCloning()
|
|||
Number of AST nodes: 13 | Number of AST nodes: 13 | |||
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(↵ | 1 | XYIntervalSeriesCollection c1 = new XYIntervalSeriesCollection();↵ | |
5 | );↵ | 2 | XYIntervalSeries s1 = new XYIntervalSeries("Series");↵ | |
6 | c1.add(e1);↵ | 3 | s1.add(↵ | |
7 | StandardEntity↵ | 4 | 1.0, 1.1, 1.2, 1.3, 1.4, 1.5);↵ | |
8 | Collection c2 = null;↵ | 5 | XYIntervalSeriesCollection c2 = null;↵ | |
9 | try {↵ | 6 | try {↵ | |
10 | c2 = (StandardEntityCollection) c1.clone();↵ | 7 | c2 = (XYIntervalSeriesCollection) c1.clone();↵ | |
11 | }↵ | 8 | }↵ | |
12 | catch (CloneNotSupportedException e) {↵ | 9 | catch (CloneNotSupportedException e) {↵ | |
13 | e.printStackTrace();↵ | 10 | e.printStackTrace();↵ | |
14 | }↵ | 11 | }↵ | |
15 | assertTrue(c1 != c2);↵ | 12 | assertTrue(c1 != c2);↵ | |
16 | assertTrue(c1.getClass() == c2.getClass());↵ | 13 | assertTrue(c1.getClass() == c2.getClass());↵ | |
17 | assertTrue(c1.equals(c2));↵ | 14 | assertTrue(c1.equals(c2));↵ | |
18 | ↵ | |||
19 | // check independence↵ | 15 | // check independence↵ | |
20 | c1.clear();↵ | 16 | c1.addSeries(new XYIntervalSeries("Empty"));↵ | |
21 | assertFalse(c1.equals(c2));↵ | 17 | assertFalse(c1.equals(c2));↵ | |
22 | c2.clear();↵ | 18 | c2.addSeries(new XYIntervalSeries("Empty"));↵ | |
23 | assertTrue(c1.equals(c2)); | 19 |
| |
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 | 11 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 33.8 |
Clone type | Type 2 |
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"); |
| 4 | XYIntervalSeriesCollection c2 = null; | |||||||||||||||||||||||||
2 | StandardEntityCollection c1 = new StandardEntityCollection(); |
| 1 | XYIntervalSeriesCollection c1 = new XYIntervalSeriesCollection(); | |||||||||||||||||||||||||
| 2 | XYIntervalSeries s1 = new XYIntervalSeries("Series"); | |||||||||||||||||||||||||||
|
| 3 | s1.add(1.0, 1.1, 1.2, 1.3, 1.4, 1.5); | ||||||||||||||||||||||||||
3 | c1.add(e1); |
| | ||||||||||||||||||||||||||
4 | StandardEntityCollection c2 = null; | | |||||||||||||||||||||||||||
5 | try | 5 | try | ||||||||||||||||||||||||||
6 | c2 = (StandardEntityCollection)c1.clone(); |
| 6 | c2 = (XYIntervalSeriesCollection)c1.clone(); | |||||||||||||||||||||||||
7 | assertTrue(c1 != c2); |
| 7 | assertTrue(c1 != c2); | |||||||||||||||||||||||||
8 | assertTrue(c1.getClass() == c2.getClass()); |
| 8 | assertTrue(c1.getClass() == c2.getClass()); | |||||||||||||||||||||||||
9 | assertTrue(c1.equals(c2)); |
| 9 | assertTrue(c1.equals(c2)); | |||||||||||||||||||||||||
10 | c1.clear(); |
| 10 | c1.addSeries(new XYIntervalSeries("Empty")); | |||||||||||||||||||||||||
11 | assertFalse(c1.equals(c2)); |
| 11 | assertFalse(c1.equals(c2)); | |||||||||||||||||||||||||
12 | c2.clear(); |
| 12 | c2.addSeries(new XYIntervalSeries("Empty")); | |||||||||||||||||||||||||
13 | assertTrue(c1.equals(c2)); |
| 13 | assertTrue(c1.equals(c2)); |
Row | Violation |
---|---|
1 | Expression new PieSectionEntity(new Rectangle2D.Double(1.0,2.0,3.0,4.0),new DefaultPieDataset(),0,1,"Key","ToolTip","URL") cannot be parameterized, because it has dependencies to/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 XYIntervalSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement s1.add(1.0,1.1,1.2,1.3,1.4,1.5); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
5 | Unmatched statement c1.add(e1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Expression (StandardEntityCollection)c1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression (XYIntervalSeriesCollection)c1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression c2 cannot be unified with expression c2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object) |
9 | Expression c2 cannot be unified with expression c2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |
10 | Expression c1 cannot be unified with expression c1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |
11 | Expression c1.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
12 | Expression c1.addSeries(new XYIntervalSeries("Empty")) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
13 | Expression c1.clear() is a void method call, and thus it cannot be parameterized |
14 | Expression c1.addSeries(new XYIntervalSeries("Empty")) is a void method call, and thus it cannot be parameterized |
15 | Expression c1 cannot be unified with expression c1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void clear() , public void addSeries(org.jfree.data.xy.XYIntervalSeries) |
16 | Expression c1.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
17 | Expression c1.addSeries(new XYIntervalSeries("Empty")) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
18 | Expression c1.clear() is a void method call, and thus it cannot be parameterized |
19 | Expression c1.addSeries(new XYIntervalSeries("Empty")) is a void method call, and thus it cannot be parameterized |
20 | Expression c2 cannot be unified with expression c2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object) |
21 | Expression c2 cannot be unified with expression c2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |
22 | Expression c1 cannot be unified with expression c1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |
23 | Expression c2.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
24 | Expression c2.addSeries(new XYIntervalSeries("Empty")) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
25 | Expression c2.clear() is a void method call, and thus it cannot be parameterized |
26 | Expression c2.addSeries(new XYIntervalSeries("Empty")) is a void method call, and thus it cannot be parameterized |
27 | Expression c2 cannot be unified with expression c2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void clear() , public void addSeries(org.jfree.data.xy.XYIntervalSeries) |
28 | Expression c2.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
29 | Expression c2.addSeries(new XYIntervalSeries("Empty")) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
30 | Expression c2.clear() is a void method call, and thus it cannot be parameterized |
31 | Expression c2.addSeries(new XYIntervalSeries("Empty")) is a void method call, and thus it cannot be parameterized |
32 | Expression c2 cannot be unified with expression c2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object) |
33 | Expression c2 cannot be unified with expression c2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |
34 | Expression c1 cannot be unified with expression c1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |
35 | Clone fragment #1 returns variables e1, c1 , while Clone fragment #2 returns variables |