212-1-2

PlotRenderingInfo plotInfo = this.info.getPlotInfo(); Rectangle2D result; if (plotInfo.getSubplotCount() == 0) { result = getScreenDataArea(); } else { // get the origin of the zoom selection in the Java2D space used for // drawing the chart (that is, before any scaling to fit the panel) Point2D selectOrigin = translateScreenToJava2D(new Point(x, y)); int subplotIndex = plotInfo.getSubplotIndex(selectOrigin); if (subplotIndex == -1) { return null; } result = scale(plotInfo.getSubplotInfo(subplotIndex).getDataArea()); } return result;
PlotRenderingInfo plotInfo = this.info.getPlotInfo(); Rectangle result; if (plotInfo.getSubplotCount() == 0) result = getScreenDataArea(); else { // get the origin of the zoom selection in the Java2D space used for // drawing the chart (that is, before any scaling to fit the panel) Point2D selectOrigin = translateScreenToJava2D(new Point(x, y)); int subplotIndex = plotInfo.getSubplotIndex(selectOrigin); if (subplotIndex == -1) { return null; } result = scale(plotInfo.getSubplotInfo(subplotIndex).getDataArea()); } return result;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/ChartPanel.java |  | File path: /jfreechart-1.0.10/swt/org/jfree/experimental/chart/swt/ChartComposite.java
Method name: `Rectangle2D getScreenDataArea(int, int)` |  | Method name: `Rectangle getScreenDataArea(int, int)`
Number of AST nodes: 10 |  | Number of AST nodes: 10

1

    PlotRenderingInfo plotInfo = this.info.getPlotInfo();
    ↵

1

    PlotRenderingInfo plotInfo = this.info.getPlotInfo();↵

2

            Rectangle2D result;
    ↵

2

            Rectangle result;↵

3

            if (plotInfo.getSubplotCount() == 0) {
    ↵

3

            if (plotInfo.getSubplotCount() == 0)↵

4

                result = getScreenDataArea();↵

4

                result = getScreenDataArea();↵

5

            }
    ↵

6

            else {
    ↵

5

            else {↵

7

                // get the origin of the zoom selection in the Java2D space used for
    ↵

6

                // get the origin of the zoom selection in the Java2D space used for↵

8

                // drawing the chart (that is, before any scaling to fit the panel)
    ↵

7

                // drawing the chart (that is, before any scaling to fit the panel)↵

9

                Point2D selectOrigin = translateScreenToJava2D(new Point(x, y));
    ↵

8

                Point2D selectOrigin = translateScreenToJava2D(new Point(x, y));↵

10

                int subplotIndex = plotInfo.getSubplotIndex(selectOrigin);
    ↵

9

                int subplotIndex = plotInfo.getSubplotIndex(selectOrigin);↵

11

                if (subplotIndex == -1) {
    ↵

10

                if (subplotIndex == -1) {↵

12

                    return null;
    ↵

11

                    return null;↵

13

                }
    ↵

12

                }↵

14

                result = scale(plotInfo.getSubplotInfo(subplotIndex).getDataArea());
    ↵

13

                result = scale(plotInfo.getSubplotInfo(subplotIndex).getDataArea());↵

15

            }
    ↵

14

            }↵

16

            return result;

15

            return result;

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.2
Clones location | Clones are in different classes
Number of node comparisons | 38

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 6
   Number of unmapped statements in the first code fragment | 4
   Number of unmapped statements in the second code fragment | 4
   Time elapsed for statement mapping (ms) | 1.6
   Clone type | Type 2

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

   1

       PlotRenderingInfo plotInfo = this.info.getPlotInfo();

   1

       PlotRenderingInfo plotInfo = this.info.getPlotInfo();

   2

       Rectangle result;

   2

       Rectangle2D result;

   3

       if (plotInfo.getSubplotCount() == 0)

   3

       if (plotInfo.getSubplotCount() == 0)

   4

       result = getScreenDataArea();

   4

       result = getScreenDataArea();

       else

       else

   5

       Point2D selectOrigin = translateScreenToJava2D(new Point(x, y));

   5

       Point2D selectOrigin = translateScreenToJava2D(new Point(x, y));

   6

       int subplotIndex = plotInfo.getSubplotIndex(selectOrigin);

   6

       int subplotIndex = plotInfo.getSubplotIndex(selectOrigin);

   7

       if (subplotIndex == -1)

   7

       if (subplotIndex == -1)

   8

       return null;

   8

       return null;

   9 | result = scale(plotInfo.getSubplotInfo(subplotIndex).getDataArea());

   Preondition Violations
   Unmatched statement result=scale(plotInfo.getSubplotInfo(subplotIndex).getDataArea()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted

   9

       result = scale(plotInfo.getSubplotInfo(subplotIndex).getDataArea());

   9

       result = scale(plotInfo.getSubplotInfo(subplotIndex).getDataArea());

   9 | result = scale(plotInfo.getSubplotInfo(subplotIndex).getDataArea());

   Preondition Violations
   Unmatched statement result=scale(plotInfo.getSubplotInfo(subplotIndex).getDataArea()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted

   10 | return result;

   Preondition Violations
   Unmatched return result;

   10

       return result;

   10

       return result;

   10 | return result;

   Preondition Violations
   Unmatched return result;

   Precondition Violations (5)
   Row | Violation
   --- | ---
   1 | Unmatched statement result=scale(plotInfo.getSubplotInfo(subplotIndex).getDataArea()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
   2 | Unmatched statement result=scale(plotInfo.getSubplotInfo(subplotIndex).getDataArea()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
   3 | Unmatched return result;
   4 | Unmatched return result;
   5 | Clone fragment #1 returns variables plotInfo, subplotIndex , while Clone fragment #2 returns variables plotInfo, subplotIndex