101-1-2

Range range = getRange(); double axisMin = calculateLog(range.getLowerBound()); double axisMax = calculateLog(range.getUpperBound()); double min = 0.0; double max = 0.0; if (RectangleEdge.isTopOrBottom(edge)) { min = area.getX(); max = area.getMaxX(); } else if (RectangleEdge.isLeftOrRight(edge)) { min = area.getMaxY(); max = area.getY(); } double log = 0.0; if (isInverted()) { log = axisMax - (java2DValue - min) / (max - min) * (axisMax - axisMin); } else { log = axisMin + (java2DValue - min) / (max - min) * (axisMax - axisMin); } return calculateValue(log);
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)); }

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

1

    Range range = getRange();↵

1

    Range range = getRange();↵

2

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

2

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

3

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

3

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

4

            double min = 0.0;↵

4

            double min = 0.0;↵

5

            double max = 0.0;↵

5

            double max = 0.0;↵

6

            if (RectangleEdge.isTopOrBottom(edge)) {↵

6

            if (RectangleEdge.isTopOrBottom(edge)) {↵

7

                min = area.getX();↵

7

                min = plotArea.getMinX();↵

8

                max = area.getMaxX();↵

8

                max = plotArea.getMaxX();↵

9

            }↵

9

            }↵

10

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

10

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

11

                min = area.getMaxY();↵

11

                min = plotArea.getMaxY();↵

12

                max = area.getY();↵

12

                max = plotArea.getMinY();↵

13

            }↵

13

            }↵

14

            double log = 0.0;↵

14

            value = switchedLog10(value);↵

15

            if (isInverted()) {↵

15

            if (isInverted()) {↵

16

                log = axisMax - (java2DValue - min) / (max - min) ↵

16

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

17

                        * (axisMax - axisMin);↵

17

                        * (max - min));↵

18

            }↵

18

            }↵

19

            else {↵

19

            else {↵

20

                log = axisMin + (java2DValue - min) / (max - min) ↵

20

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

21

                        * (axisMax - axisMin);↵

21

                        * (max - min));↵

22

            }↵

22

            }

23

            return calculateValue(log);

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 in different classes having the same super class
Number of node comparisons | 99

1. {Non-refactorable}

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

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

   1

       Range range = getRange();

   1

       Range range = getRange();

   2

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

   2 | double axisMin = calculateLog(range.getLowerBound());
   2 | double axisMin = switchedLog10(range.getLowerBound());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   calculateLog | switchedLog10 | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression calculateLog(range.getLowerBound()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression switchedLog10(range.getLowerBound()) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   2

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

   3

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

   3 | double axisMax = calculateLog(range.getUpperBound());
   3 | double axisMax = switchedLog10(range.getUpperBound());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   calculateLog | switchedLog10 | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression calculateLog(range.getUpperBound()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression switchedLog10(range.getUpperBound()) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   3

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

   4

       double min = 0.0;

   4

       double min = 0.0;

   5

       double max = 0.0;

   5

       double max = 0.0;

   6

       if (RectangleEdge.isTopOrBottom(edge))

   6

       if (RectangleEdge.isTopOrBottom(edge))

   7

       min = area.getX();

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getX | getMinX | METHOD_INVOCATION_NAME_MISMATCH
   area | plotArea | VARIABLE_NAME_MISMATCH

   7

       min = plotArea.getMinX();

   8

       max = area.getMaxX();

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   area | plotArea | VARIABLE_NAME_MISMATCH

   8

       max = plotArea.getMaxX();

   9

       else if (RectangleEdge.isLeftOrRight(edge))

   9

       else if (RectangleEdge.isLeftOrRight(edge))

   10

       min = area.getMaxY();

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   area | plotArea | VARIABLE_NAME_MISMATCH

   10

       min = plotArea.getMaxY();

   11

       max = area.getY();

   11 | max = area.getY();
   11 | max = plotArea.getMinY();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getY | getMinY | METHOD_INVOCATION_NAME_MISMATCH
   area | plotArea | VARIABLE_NAME_MISMATCH

   11

       max = plotArea.getMinY();

   12

       value = switchedLog10(value);

   12

       double log = 0.0;

   13

       if (isInverted())

   13

       if (isInverted())

   14

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

   14

       log = axisMax - (java2DValue - min) / (max - min) * (axisMax - axisMin);

       else

   15

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

   15

       log = axisMin + (java2DValue - min) / (max - min) * (axisMax - axisMin);

   16

       return calculateValue(log);

   16 | return calculateValue(log);

   Preondition Violations
   Unmatched return calculateValue(log);

   Precondition Violations (6)
   Row | Violation
   --- | ---
   1 | Expression calculateLog(range.getLowerBound()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression switchedLog10(range.getLowerBound()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression calculateLog(range.getUpperBound()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression switchedLog10(range.getUpperBound()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   5 | Unmatched return calculateValue(log);
   6 | Clone fragment #1 returns variables axisMin, axisMax, min, max , while Clone fragment #2 returns variables axisMin, axisMax, min, max