291-1-2

public void testGetLegendItemSeriesIndex() { XYSeriesCollection d1 = new XYSeriesCollection(); XYSeries s1 = new XYSeries("S1"); s1.add(1.0, 1.1); XYSeries s2 = new XYSeries("S2"); s2.add(1.0, 1.1); d1.addSeries(s1); d1.addSeries(s2); XYSeriesCollection d2 = new XYSeriesCollection(); XYSeries s3 = new XYSeries("S3"); s3.add(1.0, 1.1); XYSeries s4 = new XYSeries("S4"); s4.add(1.0, 1.1); XYSeries s5 = new XYSeries("S5"); s5.add(1.0, 1.1); d2.addSeries(s3); d2.addSeries(s4); d2.addSeries(s5); StandardXYItemRenderer r = new StandardXYItemRenderer(); XYPlot plot = new XYPlot(d1, new NumberAxis("x"), new NumberAxis("y"), r); plot.setDataset(1, d2); /*JFreeChart chart =*/ new JFreeChart(plot); LegendItem li = r.getLegendItem(1, 2); assertEquals("S5", li.getLabel()); assertEquals(1, li.getDatasetIndex()); assertEquals(2, li.getSeriesIndex());
public void testGetLegendItemSeriesIndex() { XYSeriesCollection d1 = new XYSeriesCollection(); XYSeries s1 = new XYSeries("S1"); s1.add(1.0, 1.1); XYSeries s2 = new XYSeries("S2"); s2.add(1.0, 1.1); d1.addSeries(s1); d1.addSeries(s2); XYSeriesCollection d2 = new XYSeriesCollection(); XYSeries s3 = new XYSeries("S3"); s3.add(1.0, 1.1); XYSeries s4 = new XYSeries("S4"); s4.add(1.0, 1.1); XYSeries s5 = new XYSeries("S5"); s5.add(1.0, 1.1); d2.addSeries(s3); d2.addSeries(s4); d2.addSeries(s5); XYAreaRenderer2 r = new XYAreaRenderer2(); XYPlot plot = new XYPlot(d1, new NumberAxis("x"), new NumberAxis("y"), r); plot.setDataset(1, d2); /*JFreeChart chart =*/ new JFreeChart(plot); LegendItem li = r.getLegendItem(1, 2); assertEquals("S5", li.getLabel()); assertEquals(1, li.getDatasetIndex()); assertEquals(2, li.getSeriesIndex());

Clone fragments detected by clone detection tool
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/XYAreaRenderer2Tests.java
Method name: `` |  | Method name: ``
Number of AST nodes: 0 |  | Number of AST nodes: 0

1

    public void testGetLegendItemSeriesIndex() {↵

1

    public void testGetLegendItemSeriesIndex() {↵

2

            XYSeriesCollection d1 = new XYSeriesCollection();↵

2

            XYSeriesCollection d1 = new XYSeriesCollection();↵

3

            XYSeries s1 = new XYSeries("S1");↵

3

            XYSeries s1 = new XYSeries("S1");↵

4

            s1.add(1.0, 1.1);↵

4

            s1.add(1.0, 1.1);↵

5

            XYSeries s2 = new XYSeries("S2");↵

5

            XYSeries s2 = new XYSeries("S2");↵

6

            s2.add(1.0, 1.1);↵

6

            s2.add(1.0, 1.1);↵

7

            d1.addSeries(s1);↵

7

            d1.addSeries(s1);↵

8

            d1.addSeries(s2);↵

8

            d1.addSeries(s2);↵

9

            XYSeriesCollection d2 = new XYSeriesCollection();↵

9

            XYSeriesCollection d2 = new XYSeriesCollection();↵

10

            XYSeries s3 = new XYSeries("S3");↵

10

            XYSeries s3 = new XYSeries("S3");↵

11

            s3.add(1.0, 1.1);↵

11

            s3.add(1.0, 1.1);↵

12

            XYSeries s4 = new XYSeries("S4");↵

12

            XYSeries s4 = new XYSeries("S4");↵

13

            s4.add(1.0, 1.1);↵

13

            s4.add(1.0, 1.1);↵

14

            XYSeries s5 = new XYSeries("S5");↵

14

            XYSeries s5 = new XYSeries("S5");↵

15

            s5.add(1.0, 1.1);↵

15

            s5.add(1.0, 1.1);↵

16

            d2.addSeries(s3);↵

16

            d2.addSeries(s3);↵

17

            d2.addSeries(s4);↵

17

            d2.addSeries(s4);↵

18

            d2.addSeries(s5);↵

18

            d2.addSeries(s5);↵

19

            StandardXYItemRenderer r = new StandardXYItemRenderer();↵

19

            XYAreaRenderer2 r = new XYAreaRenderer2();↵

20

            XYPlot plot = new XYPlot(d1, new NumberAxis("x"),↵

20

            XYPlot plot = new XYPlot(d1, new NumberAxis("x"),↵

21

                    new NumberAxis("y"), r);↵

21

                    new NumberAxis("y"), r);↵

22

            plot.setDataset(1, d2);↵

22

            plot.setDataset(1, d2);↵

23

            /*JFreeChart chart =*/ new JFreeChart(plot);↵

23

            /*JFreeChart chart =*/ new JFreeChart(plot);↵

24

            LegendItem li = r.getLegendItem(1, 2);↵

24

            LegendItem li = r.getLegendItem(1, 2);↵

25

            assertEquals("S5", li.getLabel());↵

25

            assertEquals("S5", li.getLabel());↵

26

            assertEquals(1, li.getDatasetIndex());↵

26

            assertEquals(1, li.getDatasetIndex());↵

27

            assertEquals(2, li.getSeriesIndex());↵

27

            assertEquals(2, li.getSeriesIndex());↵

28

28

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 0
Number of refactorable cases | 0
Number of non-refactorable cases | 0
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0
Clones location |
Number of node comparisons | 0