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
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.5
Clones locationClones are declared in the same class
Number of node comparisons82
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)27.6
    Clone typeType 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
    Expression1Expression2Difference
    getMinYgetYMETHOD_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
    Expression1Expression2Difference
    maxaxisMaxVARIABLE_NAME_MISMATCH
    maxaxisMaxVARIABLE_NAME_MISMATCH
    minaxisMinVARIABLE_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
    Expression1Expression2Difference
    minaxisMinVARIABLE_NAME_MISMATCH
    maxaxisMaxVARIABLE_NAME_MISMATCH
    minaxisMinVARIABLE_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
    1Expression max cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression axisMax cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression max cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression axisMax cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression min cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression axisMin cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression ((value - axisMin) / (axisMax - axisMin)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression (java2DValue - min) / (max - min) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression min cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression axisMin cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression max cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression axisMax cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression min cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression axisMin cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression ((value - axisMin) / (axisMax - axisMin)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Expression (java2DValue - min) / (max - min) cannot be parameterized, because it has dependencies to/from statements that will be extracted