File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/XYPlotTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/YIntervalSeriesCollectionTests.java | |||
Method name: void testRemoveAnnotation()
|
Method name: void testEquals()
|
|||
Number of AST nodes: 14 | Number of AST nodes: 15 | |||
1 | XYPlot plot = new XYPlot();↵ | |||
2 | XYTextAnnota↵ | 1 | YIntervalSeriesCollection c1 = new YIntervalSeriesCollection();↵ | |
3 | tion a1 = new XYTextAnnotation("X", 1.0, 2.0);↵ | 2 | YIntervalSeriesCollection c2 = new ↵ | |
4 | XYTextAnnotation a2 = new XYTextAnnotation("X", 3.0, 4.0);↵ | |||
5 | XYTextAnnotation a3 = new XYTextAnnotation("X", 1.0, 2.0);↵ | |||
6 | plot.addAnnotation(a1);↵ | |||
7 | plot.addAnnotation(a2);↵ | |||
8 | plot.addAnnotation(a3);↵ | |||
9 | plot.removeAnnotation(a2);↵ | |||
10 | XYTextAnnotation x = (XYTextAnnotation) plot.getAnnotations().get(0↵ | 3 | YIntervalSeriesCollection();↵ | |
4 | assertEquals(c1, c2);↵ | |||
5 | // add a series↵ | |||
6 | YIntervalSeries s1 = new YIntervalSeries("Series");↵ | |||
7 | s1.add(1.0, 1.1, 1.2, 1.3);↵ | |||
8 | c1.addSeries(s1);↵ | |||
9 | assertFalse(c1.equals(c2));↵ | |||
10 | YIntervalSeries s2 = new YIntervalSeries("Series");↵ | |||
11 | s2.add(1.0, 1.1, 1.2, 1.3);↵ | |||
11 | );↵ | 12 | c2.addSeries(s2);↵ | |
12 | assertEquals(x, a1);↵ | 13 | assert↵ | |
13 | ↵ | |||
14 | // now remove a3, but since a3.equals(a1), this will in fact remove ↵ | |||
15 | // a1...↵ | 14 | True(c1.equals(c2));↵ | |
15 | // add an empty series↵ | |||
16 | c1.addSeries(new YIntervalSeries("Empty Series"));↵ | |||
16 | assertTrue(a1.equals(a3));↵ | 17 | assertFalse(c1.equals(c2));↵ | |
17 | plot.removeAnnotation(a3); // actually removes a1↵ | 18 | ↵ | |
18 | x = (XYTextAnnotation) plot.getAnnotations().get(0);↵ | 19 | c2.addSeries(new YIntervalSeries("Empty Series"));↵ | |
19 | assertEquals(x, a3); | 20 | assertTrue(c1.equals(c2)); | |
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.0 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 185 |
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 9 |
Number of unmapped statements in the second code fragment | 10 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | XYPlot plot = new XYPlot(); |
| 1 | YIntervalSeriesCollection c1 = new YIntervalSeriesCollection(); | ||||||||||||||||||||||||||
2 | XYTextAnnotation a1 = new XYTextAnnotation("X", 1.0, 2.0); |
| 2 | YIntervalSeriesCollection c2 = new YIntervalSeriesCollection(); | ||||||||||||||||||||||||||
3 | XYTextAnnotation a2 = new XYTextAnnotation("X", 3.0, 4.0); |
| | |||||||||||||||||||||||||||
| 4 | YIntervalSeries s1 = new YIntervalSeries("Series"); | ||||||||||||||||||||||||||||
4 | XYTextAnnotation a3 = new XYTextAnnotation("X", 1.0, 2.0); |
| | |||||||||||||||||||||||||||
|
| 5 | s1.add(1.0, 1.1, 1.2, 1.3); | |||||||||||||||||||||||||||
5 | plot.addAnnotation(a1); |
| | |||||||||||||||||||||||||||
|
| 6 | c1.addSeries(s1); | |||||||||||||||||||||||||||
6 | plot.addAnnotation(a2); |
| | |||||||||||||||||||||||||||
|
| 7 | assertFalse(c1.equals(c2)); | |||||||||||||||||||||||||||
7 | plot.addAnnotation(a3); |
| | |||||||||||||||||||||||||||
| 8 | YIntervalSeries s2 = new YIntervalSeries("Series"); | ||||||||||||||||||||||||||||
8 | plot.removeAnnotation(a2); |
| | |||||||||||||||||||||||||||
9 | XYTextAnnotation x = (XYTextAnnotation)plot.getAnnotations().get(0); |
| | |||||||||||||||||||||||||||
10 | assertEquals(x, a1); |
| 3 | assertEquals(c1, c2); | ||||||||||||||||||||||||||
|
| 9 | s2.add(1.0, 1.1, 1.2, 1.3); | |||||||||||||||||||||||||||
|
| 10 | c2.addSeries(s2); | |||||||||||||||||||||||||||
11 | assertTrue(a1.equals(a3)); |
| 11 | assertTrue(c1.equals(c2)); | ||||||||||||||||||||||||||
|
| 12 | c1.addSeries(new YIntervalSeries("Empty Series")); | |||||||||||||||||||||||||||
12 | plot.removeAnnotation(a3); |
| | |||||||||||||||||||||||||||
13 | x = (XYTextAnnotation)plot.getAnnotations().get(0); |
| | |||||||||||||||||||||||||||
14 | assertEquals(x, a3); |
| 13 | assertFalse(c1.equals(c2)); | ||||||||||||||||||||||||||
|
| 14 | c2.addSeries(new YIntervalSeries("Empty Series")); | |||||||||||||||||||||||||||
|
| 15 | assertTrue(c1.equals(c2)); |
Row | Violation |
---|---|
1 | Expression new XYPlot() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression new YIntervalSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression new XYTextAnnotation("X",1.0,2.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression new YIntervalSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression new XYTextAnnotation("X",1.0,2.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression new YIntervalSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Unmatched statement XYTextAnnotation a2=new XYTextAnnotation("X",3.0,4.0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
8 | Unmatched statement XYTextAnnotation a3=new XYTextAnnotation("X",1.0,2.0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
9 | Unmatched statement s1.add(1.0,1.1,1.2,1.3); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
10 | Unmatched statement plot.addAnnotation(a1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
11 | Unmatched statement c1.addSeries(s1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
12 | Unmatched statement plot.addAnnotation(a2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
13 | Unmatched statement assertFalse(c1.equals(c2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
14 | Unmatched statement plot.addAnnotation(a3); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
15 | Unmatched statement plot.removeAnnotation(a2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
16 | Unmatched statement XYTextAnnotation x=(XYTextAnnotation)plot.getAnnotations().get(0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
17 | Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted |
18 | Expression c1 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
19 | Expression x cannot be unified with expression c1 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public static void assertEquals(java.lang.Object, java.lang.Object) |
20 | Expression a1 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
21 | Expression c2 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
22 | Expression a1 cannot be unified with expression c2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public static void assertEquals(java.lang.Object, java.lang.Object) |
23 | Unmatched statement s2.add(1.0,1.1,1.2,1.3); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
24 | Unmatched statement c2.addSeries(s2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
25 | Expression a3 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
26 | Expression c2 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
27 | Expression a3 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) |
28 | Expression a3 cannot be unified with expression c2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |
29 | Expression a1 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
30 | Expression c1 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
31 | Expression a1 cannot be unified with expression c1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |
32 | Unmatched statement c1.addSeries(new YIntervalSeries("Empty Series")); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
33 | Unmatched statement plot.removeAnnotation(a3); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
34 | Unmatched statement x=(XYTextAnnotation)plot.getAnnotations().get(0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
35 | Expression assertEquals(x,a3) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
36 | Expression assertFalse(c1.equals(c2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
37 | Expression assertEquals(x,a3) is a void method call, and thus it cannot be parameterized |
38 | Expression assertFalse(c1.equals(c2)) is a void method call, and thus it cannot be parameterized |
39 | Expression assertEquals(x,a3) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
40 | Expression assertFalse(c1.equals(c2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
41 | Expression assertEquals(x,a3) is a void method call, and thus it cannot be parameterized |
42 | Expression assertFalse(c1.equals(c2)) is a void method call, and thus it cannot be parameterized |
43 | Unmatched statement c2.addSeries(new YIntervalSeries("Empty Series")); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
44 | Unmatched statement assertTrue(c1.equals(c2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
45 | Clone fragment #1 returns variables plot, a1 , while Clone fragment #2 returns variables c1, c2 |