378-1-2

Range range = getRange(); double axisMin = range.getLowerBound(); double axisMax = 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)) { max = area.getMinY(); min = area.getMaxY(); } if (isInverted()) { return max - ((value - axisMin) / (axisMax - axisMin)) * (max - min); } else { return min + ((value - axisMin) / (axisMax - axisMin)) * (max - min); }
Range range = getRange(); double axisMin = range.getLowerBound(); double axisMax = 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(); } if (isInverted()) { return axisMax - (java2DValue - min) / (max - min) * (axisMax - axisMin); } else { return axisMin + (java2DValue - min) / (max - min) * (axisMax - axisMin); }

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

1

    Range range = getRange();↵

1

    Range range = getRange();↵

2

            double axisMin = range.getLowerBound();↵

2

            double axisMin = range.getLowerBound();↵

3

            double axisMax = range.getUpperBound();↵

3

            double axisMax = 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();↵

8

                max = area.getMaxX();↵

8

                max = area.getMaxX();↵

9

            }↵

9

            }↵

10

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

10

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

11

                max = area.getMinY();↵

11

                min = area.getMaxY();↵

12

                min = area.getMaxY();↵

12

                max = area.getY();↵

13

            }↵

13

            }↵

14

            if (isInverted()) {↵

14

            if (isInverted()) {↵

15

                return max↵

15

                return axisMax↵

16

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

16

                       - (java2DValue - min) / (max - min) * (axisMax - axisMin);↵

17

            }↵

17

            }↵

18

            else {↵

18

            else {↵

19

                return min↵

19

                return axisMin↵

20

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

20

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

21

            }

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 | 82

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 14
   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) | 3.9
   Clone type | Type 2

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

   1

       Range range = getRange();

   1

       Range range = getRange();

   2

       double axisMin = range.getLowerBound();

   2

       double axisMin = range.getLowerBound();

   3

       double axisMax = range.getUpperBound();

   3

       double axisMax = 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();

   8

       max = area.getMaxX();

   8

       max = area.getMaxX();

   9

       else if (RectangleEdge.isLeftOrRight(edge))

   9

       else if (RectangleEdge.isLeftOrRight(edge))

   10

       max = area.getMinY();

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getMinY | getY | METHOD_INVOCATION_NAME_MISMATCH

   11

       max = area.getY();

   11

       min = area.getMaxY();

   10

       min = area.getMaxY();

   12

       if (isInverted())

   12

       if (isInverted())

   13

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

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   max | axisMax | VARIABLE_NAME_MISMATCH
   max | axisMax | VARIABLE_NAME_MISMATCH
   min | axisMin | VARIABLE_NAME_MISMATCH
   ((value - axisMin) / (axisMax - axisMin)) | (java2DValue - min) / (max - min) | INFIX_LEFT_OPERAND_MISMATCH

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

   13

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

       else

       else

   14

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

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   min | axisMin | VARIABLE_NAME_MISMATCH
   max | axisMax | VARIABLE_NAME_MISMATCH
   min | axisMin | VARIABLE_NAME_MISMATCH
   ((value - axisMin) / (axisMax - axisMin)) | (java2DValue - min) / (max - min) | INFIX_LEFT_OPERAND_MISMATCH

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

   14

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

   Precondition Violations (16)
   Row | Violation
   --- | ---
   1 | Expression max cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression axisMax cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression max cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression axisMax cannot be parameterized, because it has dependencies to/from statements that will be extracted
   5 | Expression min cannot be parameterized, because it has dependencies to/from statements that will be extracted
   6 | Expression axisMin cannot be parameterized, because it has dependencies to/from statements that will be extracted
   7 | Expression ((value - axisMin) / (axisMax - axisMin)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   8 | Expression (java2DValue - min) / (max - min) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   9 | Expression min cannot be parameterized, because it has dependencies to/from statements that will be extracted
   10 | Expression axisMin cannot be parameterized, because it has dependencies to/from statements that will be extracted
   11 | Expression max cannot be parameterized, because it has dependencies to/from statements that will be extracted
   12 | Expression axisMax cannot be parameterized, because it has dependencies to/from statements that will be extracted
   13 | Expression min cannot be parameterized, because it has dependencies to/from statements that will be extracted
   14 | Expression axisMin cannot be parameterized, because it has dependencies to/from statements that will be extracted
   15 | Expression ((value - axisMin) / (axisMax - axisMin)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   16 | Expression (java2DValue - min) / (max - min) cannot be parameterized, because it has dependencies to/from statements that will be extracted