254-2-3

CombinedRangeCategoryPlot plot = createPlot(); JFreeChart chart = new JFreeChart(plot); chart.addChangeListener(this); CategoryPlot subplot1 = (CategoryPlot) plot.getSubplots().get(0); NumberAxis yAxis = (NumberAxis) subplot1.getRangeAxis(); yAxis.setAutoRangeIncludesZero(!yAxis.getAutoRangeIncludesZero()); assertEquals(1, this.events.size()); // a redraw should NOT trigger another change event BufferedImage image = new BufferedImage(200, 100, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); this.events.clear(); chart.draw(g2, new Rectangle2D.Double(0.0, 0.0, 200.0, 100.0)); assertTrue(this.events.isEmpty());
CombinedDomainXYPlot plot = createPlot(); JFreeChart chart = new JFreeChart(plot); chart.addChangeListener(this); XYPlot subplot1 = (XYPlot) plot.getSubplots().get(0); NumberAxis yAxis = (NumberAxis) subplot1.getRangeAxis(); yAxis.setAutoRangeIncludesZero(!yAxis.getAutoRangeIncludesZero()); assertEquals(1, this.events.size()); // a redraw should NOT trigger another change event BufferedImage image = new BufferedImage(200, 100, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); this.events.clear(); chart.draw(g2, new Rectangle2D.Double(0.0, 0.0, 200.0, 100.0)); assertTrue(this.events.isEmpty());

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/CombinedRangeCategoryPlotTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/CombinedDomainXYPlotTests.java
Method name: `void testNotification()` |  | Method name: `void testNotification()`
Number of AST nodes: 12 |  | Number of AST nodes: 12

1

    CombinedRangeCategoryPlot plot = createPlot();↵

1

    CombinedDomainXYPlot plot = createPlot();↵

2

            JFreeChart chart = new JFreeChart(plot);↵

2

            JFreeChart chart = new JFreeChart(plot);↵

3

            chart.addChangeListener(this);↵

3

            chart.addChangeListener(this);↵

4

            CategoryPlot subplot1 = (CategoryPlot) plot.getSubplots().get(0);↵

4

            XYPlot subplot1 = (XYPlot) plot.getSubplots().get(0);↵

5

            NumberAxis yAxis = (NumberAxis) subplot1.getRangeAxis();↵

5

            NumberAxis yAxis = (NumberAxis) subplot1.getRangeAxis();↵

6

            yAxis.setAutoRangeIncludesZero(!yAxis.getAutoRangeIncludesZero());↵

6

            yAxis.setAutoRangeIncludesZero(!yAxis.getAutoRangeIncludesZero());↵

7

            assertEquals(1, this.events.size());↵

7

            assertEquals(1, this.events.size());↵

8

            ↵

8

            ↵

9

            // a redraw should NOT trigger another change event↵

9

            // a redraw should NOT trigger another change event↵

10

            BufferedImage image = new BufferedImage(200, 100, ↵

10

            BufferedImage image = new BufferedImage(200, 100, ↵

11

                    BufferedImage.TYPE_INT_RGB);↵

11

                    BufferedImage.TYPE_INT_RGB);↵

12

            Graphics2D g2 = image.createGraphics();↵

12

            Graphics2D g2 = image.createGraphics();↵

13

            this.events.clear();↵

13

            this.events.clear();↵

14

            chart.draw(g2, new Rectangle2D.Double(0.0, 0.0, 200.0, 100.0));↵

14

            chart.draw(g2, new Rectangle2D.Double(0.0, 0.0, 200.0, 100.0));↵

15

            assertTrue(this.events.isEmpty());

15

            assertTrue(this.events.isEmpty());

See real code fragment |  | See real code fragment

Summary
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 | 61

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 12
   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

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       CombinedRangeCategoryPlot plot = createPlot();

   1 | CombinedRangeCategoryPlot plot = createPlot();
   1 | CombinedDomainXYPlot plot = createPlot();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.CombinedRangeCategoryPlot | org.jfree.chart.plot.CombinedDomainXYPlot | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.plot.CombinedRangeCategoryPlot | org.jfree.chart.plot.CombinedDomainXYPlot | SUBCLASS_TYPE_MISMATCH

   1

       CombinedDomainXYPlot plot = createPlot();

   2

       JFreeChart chart = new JFreeChart(plot);

   2 | JFreeChart chart = new JFreeChart(plot);
   2 | JFreeChart chart = new JFreeChart(plot);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.CombinedRangeCategoryPlot | org.jfree.chart.plot.CombinedDomainXYPlot | SUBCLASS_TYPE_MISMATCH

   2

       JFreeChart chart = new JFreeChart(plot);

   3

       chart.addChangeListener(this);

   3

       chart.addChangeListener(this);

   4

       CategoryPlot subplot1 = (CategoryPlot)plot.getSubplots().get(0);

   4 | CategoryPlot subplot1 = (CategoryPlot)plot.getSubplots().get(0);
   4 | XYPlot subplot1 = (XYPlot)plot.getSubplots().get(0);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.CategoryPlot | org.jfree.chart.plot.XYPlot | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.plot.CategoryPlot | org.jfree.chart.plot.XYPlot | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.plot.CategoryPlot | org.jfree.chart.plot.XYPlot | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.plot.CombinedRangeCategoryPlot | org.jfree.chart.plot.CombinedDomainXYPlot | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression (CategoryPlot)plot.getSubplots().get(0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression (XYPlot)plot.getSubplots().get(0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public List#RAW getSubplots()

   4

       XYPlot subplot1 = (XYPlot)plot.getSubplots().get(0);

   5

       NumberAxis yAxis = (NumberAxis)subplot1.getRangeAxis();

   5 | NumberAxis yAxis = (NumberAxis)subplot1.getRangeAxis();
   5 | NumberAxis yAxis = (NumberAxis)subplot1.getRangeAxis();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.CategoryPlot | org.jfree.chart.plot.XYPlot | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression subplot1 cannot be unified with expression subplot1 , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public org.jfree.chart.axis.ValueAxis getRangeAxis()

   5

       NumberAxis yAxis = (NumberAxis)subplot1.getRangeAxis();

   6

       yAxis.setAutoRangeIncludesZero(!yAxis.getAutoRangeIncludesZero());

   6

       yAxis.setAutoRangeIncludesZero(!yAxis.getAutoRangeIncludesZero());

   7

       assertEquals(1, this.events.size());

   7

       assertEquals(1, this.events.size());

   8

       BufferedImage image = new BufferedImage(200, 100, BufferedImage.TYPE_INT_RGB);

   8

       BufferedImage image = new BufferedImage(200, 100, BufferedImage.TYPE_INT_RGB);

   9

       Graphics2D g2 = image.createGraphics();

   9

       Graphics2D g2 = image.createGraphics();

   10

       this.events.clear();

   10

       this.events.clear();

   11

       chart.draw(g2, new Rectangle2D.Double(0.0, 0.0, 200.0, 100.0));

   11

       chart.draw(g2, new Rectangle2D.Double(0.0, 0.0, 200.0, 100.0));

   12

       assertTrue(this.events.isEmpty());

   12

       assertTrue(this.events.isEmpty());

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Expression (CategoryPlot)plot.getSubplots().get(0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression (XYPlot)plot.getSubplots().get(0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public List#RAW getSubplots()
   4 | Expression subplot1 cannot be unified with expression subplot1 , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public org.jfree.chart.axis.ValueAxis getRangeAxis()