101-2-3

Range range = getRange(); double axisMin = switchedLog10(range.getLowerBound()); double axisMax = switchedLog10(range.getUpperBound()); double min = 0.0; double max = 0.0; if (RectangleEdge.isTopOrBottom(edge)) { min = plotArea.getMinX(); max = plotArea.getMaxX(); } else if (RectangleEdge.isLeftOrRight(edge)) { min = plotArea.getMaxY(); max = plotArea.getMinY(); } value = switchedLog10(value); if (isInverted()) { return max - (((value - axisMin) / (axisMax - axisMin)) * (max - min)); } else { return min + (((value - axisMin) / (axisMax - axisMin)) * (max - min)); }
Range range = getRange(); double axisMin = switchedLog10(range.getLowerBound()); double axisMax = switchedLog10(range.getUpperBound()); double plotMin = 0.0; double plotMax = 0.0; if (RectangleEdge.isTopOrBottom(edge)) { plotMin = plotArea.getX(); plotMax = plotArea.getMaxX(); } else if (RectangleEdge.isLeftOrRight(edge)) { plotMin = plotArea.getMaxY(); plotMax = plotArea.getMinY(); } if (isInverted()) { return switchedPow10(axisMax - ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin)); } else { return switchedPow10(axisMin + ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin)); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/LogarithmicAxis.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/LogarithmicAxis.java
Method name: `double valueToJava2D(double, Rectangle2D, RectangleEdge)` |  | Method name: `double java2DToValue(double, Rectangle2D, RectangleEdge)`
Number of AST nodes: 15 |  | Number of AST nodes: 14

1

    Range range = getRange();↵

1

    Range range = getRange();↵

2

            double axisMin = switchedLog10(range.getLowerBound());↵

2

            double axisMin = switchedLog10(range.getLowerBound());↵

3

            double axisMax = switchedLog10(range.getUpperBound());↵

3

            double axisMax = switchedLog10(range.getUpperBound());↵

4

            double min = 0.0;↵

4

            double plotMin = 0.0;↵

5

            double max = 0.0;↵

5

            double plotMax = 0.0;↵

6

            if (RectangleEdge.isTopOrBottom(edge)) {↵

6

            if (RectangleEdge.isTopOrBottom(edge)) {↵

7

                min = plotArea.getMinX();↵

7

                plotMin = plotArea.getX();↵

8

                max = plotArea.getMaxX();↵

8

                plotMax = plotArea.getMaxX();↵

9

            }↵

9

            }↵

10

            else if (RectangleEdge.isLeftOrRight(edge)) {↵

10

            else if (RectangleEdge.isLeftOrRight(edge)) {↵

11

                min = plotArea.getMaxY();↵

11

                plotMin = plotArea.getMaxY();↵

12

                max = plotArea.getMinY();↵

12

                plotMax = plotArea.getMinY();↵

13

            }↵

13

            }↵

14

            value = switchedLog10(value);↵

15

            if (isInverted()) {↵

14

            if (isInverted()) {↵

16

                return max - (((value - axisMin) / (axisMax - axisMin)) ↵

15

                return switchedPow10(axisMax - ((java2DValue - plotMin) ↵

17

                        * (max - m↵

18

    in));↵

16

                        / (plotMax - plotMin)) * (axisMax - axisMin));↵

19

            }↵

17

            }↵

20

            else {↵

18

            else {↵

21

                return min + (((value - axisMin) / (axisMax - axisMin)) ↵

19

                return switchedPow10(axisMin + ((java2DValue - plotMin) ↵

22

                        * (max - m↵

23

    in));↵

20

                        / (plotMax - plotMin)) * (axisMax - axisMin));↵

24

            }

21

            }

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.4
Clones location | Clones are declared in the same class
Number of node comparisons | 87

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 14
   Number of unmapped statements in the first code fragment | 1
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 3.2
   Clone type | Type 3

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

   1

       Range range = getRange();

   1

       Range range = getRange();

   2

       double axisMin = switchedLog10(range.getLowerBound());

   2

       double axisMin = switchedLog10(range.getLowerBound());

   3

       double axisMax = switchedLog10(range.getUpperBound());

   3

       double axisMax = switchedLog10(range.getUpperBound());

   4

       double min = 0.0;

   4 | double min = 0.0;
   4 | double plotMin = 0.0;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   min | plotMin | VARIABLE_NAME_MISMATCH

   4

       double plotMin = 0.0;

   5

       double max = 0.0;

   5 | double max = 0.0;
   5 | double plotMax = 0.0;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   max | plotMax | VARIABLE_NAME_MISMATCH

   5

       double plotMax = 0.0;

   6

       if (RectangleEdge.isTopOrBottom(edge))

   6

       if (RectangleEdge.isTopOrBottom(edge))

   7

       min = plotArea.getMinX();

   7 | min = plotArea.getMinX();
   7 | plotMin = plotArea.getX();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   min | plotMin | VARIABLE_NAME_MISMATCH
   getMinX | getX | METHOD_INVOCATION_NAME_MISMATCH

   7

       plotMin = plotArea.getX();

   8

       max = plotArea.getMaxX();

   8 | max = plotArea.getMaxX();
   8 | plotMax = plotArea.getMaxX();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   max | plotMax | VARIABLE_NAME_MISMATCH

   8

       plotMax = plotArea.getMaxX();

   9

       else if (RectangleEdge.isLeftOrRight(edge))

   9

       else if (RectangleEdge.isLeftOrRight(edge))

   10

       min = plotArea.getMaxY();

   10 | min = plotArea.getMaxY();
   10 | plotMin = plotArea.getMaxY();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   min | plotMin | VARIABLE_NAME_MISMATCH

   10

       plotMin = plotArea.getMaxY();

   11

       max = plotArea.getMinY();

   11 | max = plotArea.getMinY();
   11 | plotMax = plotArea.getMinY();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   max | plotMax | VARIABLE_NAME_MISMATCH

   11

       plotMax = plotArea.getMinY();

   12

       value = switchedLog10(value);

   13

       if (isInverted())

   12

       if (isInverted())

   14

       return max - (((value - axisMin) / (axisMax - axisMin)) * (max - min));

   14 | return max - (((value - axisMin) / (axisMax - axisMin)) * (max - min));
   13 | return switchedPow10(axisMax - ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   max - (((value - axisMin) / (axisMax - axisMin)) * (max - min)) | switchedPow10(axisMax - ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin)) | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression max - (((value - axisMin) / (axisMax - axisMin)) * (max - min)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression switchedPow10(axisMax - ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin)) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   13

       return switchedPow10(axisMax - ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin));

       else

       else

   15

       return min + (((value - axisMin) / (axisMax - axisMin)) * (max - min));

   15 | return min + (((value - axisMin) / (axisMax - axisMin)) * (max - min));
   14 | return switchedPow10(axisMin + ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   min + (((value - axisMin) / (axisMax - axisMin)) * (max - min)) | switchedPow10(axisMin + ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin)) | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression min + (((value - axisMin) / (axisMax - axisMin)) * (max - min)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression switchedPow10(axisMin + ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin)) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   14

       return switchedPow10(axisMin + ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin));

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Expression max - (((value - axisMin) / (axisMax - axisMin)) * (max - min)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression switchedPow10(axisMax - ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression min + (((value - axisMin) / (axisMax - axisMin)) * (max - min)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression switchedPow10(axisMin + ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin)) cannot be parameterized, because it has dependencies to/from statements that will be extracted