File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/xy/junit/StandardXYItemRendererTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/xy/junit/XYLineAndShapeRendererTests.java | |||
Method name: void testGetLegendItemSeriesIndex()
|
Method name: void testGetLegendItemSeriesIndex()
|
|||
Number of AST nodes: 25 | Number of AST nodes: 25 | |||
1 | XYSeriesCollection d1 = new XYSeriesCollection();↵ | 1 | XYSeriesCollection d1 = new XYSeriesCollection();↵ | |
2 | XYSeries s1 = new XYSeries("S1");↵ | 2 | XYSeries s1 = new XYSeries("S1");↵ | |
3 | s1.add(1.0, 1.1);↵ | 3 | s1.add(1.0, 1.1);↵ | |
4 | XYSeries s2 = new XYSeries("S2");↵ | 4 | XYSeries s2 = new XYSeries("S2");↵ | |
5 | s2.add(1.0, 1.1);↵ | 5 | s2.add(1.0, 1.1);↵ | |
6 | d1.addSeries(s1);↵ | 6 | d1.addSeries(s1);↵ | |
7 | d1.addSeries(s2);↵ | 7 | d1.addSeries(s2);↵ | |
8 | XYSeriesCollection d2 = new XYSeriesCollection();↵ | 8 | XYSeriesCollection d2 = new XYSeriesCollection();↵ | |
9 | XYSeries s3 = new XYSeries("S3");↵ | 9 | XYSeries s3 = new XYSeries("S3");↵ | |
10 | s3.add(1.0, 1.1);↵ | 10 | s3.add(1.0, 1.1);↵ | |
11 | XYSeries s4 = new XYSeries("S4");↵ | 11 | XYSeries s4 = new XYSeries("S4");↵ | |
12 | s4.add(1.0, 1.1);↵ | 12 | s4.add(1.0, 1.1);↵ | |
13 | XYSeries s5 = new XYSeries("S5");↵ | 13 | XYSeries s5 = new XYSeries("S5");↵ | |
14 | s5.add(1.0, 1.1);↵ | 14 | s5.add(1.0, 1.1);↵ | |
15 | d2.addSeries(s3);↵ | 15 | d2.addSeries(s3);↵ | |
16 | d2.addSeries(s4);↵ | 16 | d2.addSeries(s4);↵ | |
17 | d2.addSeries(s5);↵ | 17 | d2.addSeries(s5);↵ | |
18 | StandardXYItemRenderer r = new StandardXYItemRenderer();↵ | 18 | XYLineAndShapeRenderer r = new XYLineAndShapeRenderer();↵ | |
19 | XYPlot plot = new XYPlot(d1, new NumberAxis("x"),↵ | 19 | XYPlot plot = new XYPlot(d1, new NumberAxis("x"),↵ | |
20 | new NumberAxis("y"), r);↵ | 20 | new NumberAxis("y"), r);↵ | |
21 | plot.setDataset(1, d2);↵ | 21 | plot.setDataset(1, d2);↵ | |
22 | /*JFreeChart chart =*/ new JFreeChart(plot);↵ | 22 | /*JFreeChart chart =*/ new JFreeChart(plot);↵ | |
23 | LegendItem li = r.getLegendItem(1, 2);↵ | 23 | LegendItem li = r.getLegendItem(1, 2);↵ | |
24 | assertEquals("S5", li.getLabel());↵ | 24 | assertEquals("S5", li.getLabel());↵ | |
25 | assertEquals(1, li.getDatasetIndex());↵ | 25 | assertEquals(1, li.getDatasetIndex());↵ | |
26 | assertEquals(2, li.getSeriesIndex()); | 26 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
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 | 198 |
Number of mapped statements | 25 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | XYSeriesCollection d1 = new XYSeriesCollection(); | 1 | XYSeriesCollection d1 = new XYSeriesCollection(); | |||||||||||||||||||
2 | XYSeries s1 = new XYSeries("S1"); | 2 | XYSeries s1 = new XYSeries("S1"); | |||||||||||||||||||
3 | s1.add(1.0, 1.1); | 3 | s1.add(1.0, 1.1); | |||||||||||||||||||
4 | XYSeries s2 = new XYSeries("S2"); | 4 | XYSeries s2 = new XYSeries("S2"); | |||||||||||||||||||
5 | s2.add(1.0, 1.1); | 5 | s2.add(1.0, 1.1); | |||||||||||||||||||
6 | d1.addSeries(s1); | 6 | d1.addSeries(s1); | |||||||||||||||||||
7 | d1.addSeries(s2); | 7 | d1.addSeries(s2); | |||||||||||||||||||
8 | XYSeriesCollection d2 = new XYSeriesCollection(); | 8 | XYSeriesCollection d2 = new XYSeriesCollection(); | |||||||||||||||||||
9 | XYSeries s3 = new XYSeries("S3"); | 9 | XYSeries s3 = new XYSeries("S3"); | |||||||||||||||||||
10 | s3.add(1.0, 1.1); | 10 | s3.add(1.0, 1.1); | |||||||||||||||||||
11 | XYSeries s4 = new XYSeries("S4"); | 11 | XYSeries s4 = new XYSeries("S4"); | |||||||||||||||||||
12 | s4.add(1.0, 1.1); | 12 | s4.add(1.0, 1.1); | |||||||||||||||||||
13 | XYSeries s5 = new XYSeries("S5"); | 13 | XYSeries s5 = new XYSeries("S5"); | |||||||||||||||||||
14 | s5.add(1.0, 1.1); | 14 | s5.add(1.0, 1.1); | |||||||||||||||||||
15 | d2.addSeries(s3); | 15 | d2.addSeries(s3); | |||||||||||||||||||
16 | d2.addSeries(s4); | 16 | d2.addSeries(s4); | |||||||||||||||||||
17 | d2.addSeries(s5); | 17 | d2.addSeries(s5); | |||||||||||||||||||
18 | StandardXYItemRenderer r = new StandardXYItemRenderer(); |
| 18 | XYLineAndShapeRenderer r = new XYLineAndShapeRenderer(); | ||||||||||||||||||
19 | XYPlot plot = new XYPlot(d1, new NumberAxis("x"), new NumberAxis("y"), r); |
| 19 | XYPlot plot = new XYPlot(d1, new NumberAxis("x"), new NumberAxis("y"), r); | ||||||||||||||||||
20 | plot.setDataset(1, d2); | 20 | plot.setDataset(1, d2); | |||||||||||||||||||
21 | new JFreeChart(plot); | 21 | new JFreeChart(plot); | |||||||||||||||||||
22 | LegendItem li = r.getLegendItem(1, 2); |
| 22 | LegendItem li = r.getLegendItem(1, 2); | ||||||||||||||||||
23 | assertEquals("S5", li.getLabel()); | 23 | assertEquals("S5", li.getLabel()); | |||||||||||||||||||
24 | assertEquals(1, li.getDatasetIndex()); | 24 | assertEquals(1, li.getDatasetIndex()); | |||||||||||||||||||
25 | assertEquals(2, li.getSeriesIndex()); | 25 | assertEquals(2, li.getSeriesIndex()); |
Row | Violation |
---|---|
1 | Expression new StandardXYItemRenderer() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression new XYLineAndShapeRenderer() cannot be parameterized, because it has dependencies to/from statements that will be extracted |