if (location == null) { throw new IllegalArgumentException("Null 'location' argument."); } if (orientation == null) { throw new IllegalArgumentException("Null 'orientation' argument."); } RectangleEdge result = null; if (location == AxisLocation.TOP_OR_RIGHT) { if (orientation == PlotOrientation.HORIZONTAL) { result = RectangleEdge.RIGHT; } else if (orientation == PlotOrientation.VERTICAL) { result = RectangleEdge.TOP; } } else if (location == AxisLocation.TOP_OR_LEFT) { if (orientation == PlotOrientation.HORIZONTAL) { result = RectangleEdge.LEFT; } else if (orientation == PlotOrientation.VERTICAL) { result = RectangleEdge.TOP; } } else if (location == AxisLocation.BOTTOM_OR_RIGHT) { if (orientation == PlotOrientation.HORIZONTAL) { result = RectangleEdge.RIGHT; } else if (orientation == PlotOrientation.VERTICAL) { result = RectangleEdge.BOTTOM; } } else if (location == AxisLocation.BOTTOM_OR_LEFT) { if (orientation == PlotOrientation.HORIZONTAL) { result = RectangleEdge.LEFT; } else if (orientation == PlotOrientation.VERTICAL) { result = RectangleEdge.BOTTOM; } } // the above should cover all the options... if (result == null) { throw new IllegalStateException("resolveDomainAxisLocation()"); } return result;
if (location == null) { throw new IllegalArgumentException("Null 'location' argument."); } if (orientation == null) { throw new IllegalArgumentException("Null 'orientation' argument."); } RectangleEdge result = null; if (location == AxisLocation.TOP_OR_RIGHT) { if (orientation == PlotOrientation.HORIZONTAL) { result = RectangleEdge.TOP; } else if (orientation == PlotOrientation.VERTICAL) { result = RectangleEdge.RIGHT; } } else if (location == AxisLocation.TOP_OR_LEFT) { if (orientation == PlotOrientation.HORIZONTAL) { result = RectangleEdge.TOP; } else if (orientation == PlotOrientation.VERTICAL) { result = RectangleEdge.LEFT; } } else if (location == AxisLocation.BOTTOM_OR_RIGHT) { if (orientation == PlotOrientation.HORIZONTAL) { result = RectangleEdge.BOTTOM; } else if (orientation == PlotOrientation.VERTICAL) { result = RectangleEdge.RIGHT; } } else if (location == AxisLocation.BOTTOM_OR_LEFT) { if (orientation == PlotOrientation.HORIZONTAL) { result = RectangleEdge.BOTTOM; } else if (orientation == PlotOrientation.VERTICAL) { result = RectangleEdge.LEFT; } } // the above should cover all the options... if (result == null) { throw new IllegalStateException("resolveRangeAxisLocation()"); } return result;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/Plot.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/Plot.java
Method name: RectangleEdge resolveDomainAxisLocation(AxisLocation, PlotOrientation) Method name: RectangleEdge resolveRangeAxisLocation(AxisLocation, PlotOrientation)
Number of AST nodes: 28 Number of AST nodes: 28
1
if (location == null) {
1
if (location == null) {
2
            throw new IllegalArgumentException("Null 'location' argument.");
2
            throw new IllegalArgumentException("Null 'location' argument.");
3
        }
3
        }
4
        if (orientation == null) {
4
        if (orientation == null) {
5
            throw new IllegalArgumentException("Null 'orientation' argument.");
5
            throw new IllegalArgumentException("Null 'orientation' argument.");
6
        }
6
        }
7
        RectangleEdge result = null;
7
        RectangleEdge result = null;
8
        if (location == AxisLocation.TOP_OR_RIGHT) {
8
        if (location == AxisLocation.TOP_OR_RIGHT) {
9
            if (orientation == PlotOrientation.HORIZONTAL) {
9
            if (orientation == PlotOrientation.HORIZONTAL) {
10
                result = RectangleEdge.RIGHT;
10
                result = RectangleEdge.TOP;
11
            }
11
            }
12
            else if (orientation == PlotOrientation.VERTICAL) {
12
            else if (orientation == PlotOrientation.VERTICAL) {
13
                result = RectangleEdge.TOP;
13
                result = RectangleEdge.RIGHT;
14
            }
14
            }
15
        }
15
        }
16
        else if (location == AxisLocation.TOP_OR_LEFT) {
16
        else if (location == AxisLocation.TOP_OR_LEFT) {
17
            if (orientation == PlotOrientation.HORIZONTAL) {
17
            if (orientation == PlotOrientation.HORIZONTAL) {
18
                result = RectangleEdge.LEFT;
18
                result = RectangleEdge.TOP;
19
            }
19
            }
20
            else if (orientation == PlotOrientation.VERTICAL) {
20
            else if (orientation == PlotOrientation.VERTICAL) {
21
                result = RectangleEdge.TOP;
21
                result = RectangleEdge.LEFT;
22
            }
22
            }
23
        }
23
        }
24
        else if (location == AxisLocation.BOTTOM_OR_RIGHT) {
24
        else if (location == AxisLocation.BOTTOM_OR_RIGHT) {
25
            if (orientation == PlotOrientation.HORIZONTAL) {
25
            if (orientation == PlotOrientation.HORIZONTAL) {
26
                result = RectangleEdge.RIGHT;
26
                result = RectangleEdge.BOTTOM;
27
            }
27
            }
28
            else if (orientation == PlotOrientation.VERTICAL) {
28
            else if (orientation == PlotOrientation.VERTICAL) {
29
                result = RectangleEdge.BOTTOM;
29
                result = RectangleEdge.RIGHT;
30
            }
30
            }
31
        }
31
        }
32
        else if (location == AxisLocation.BOTTOM_OR_LEFT) {
32
        else if (location == AxisLocation.BOTTOM_OR_LEFT) {
33
            if (orientation == PlotOrientation.HORIZONTAL) {
33
            if (orientation == PlotOrientation.HORIZONTAL) {
34
                result = RectangleEdge.LEFT;
34
                result = RectangleEdge.BOTTOM;
35
            }
35
            }
36
            else if (orientation == PlotOrientation.VERTICAL) {
36
            else if (orientation == PlotOrientation.VERTICAL) {
37
                result = RectangleEdge.BOTTOM;
37
                result = RectangleEdge.LEFT;
38
            }
38
            }
39
        }
39
        }
40
        // the above should cover all the options...
40
        // the above should cover all the options...
41
        if (result == null) {
41
        if (result == null) {
42
            throw new IllegalStateException("resolveDomainAxisLocation()");
42
            throw new IllegalStateException("resolveRangeAxisLocation()");
43
        }
43
        }
44
        return result;
44
        return result;
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)8.6
Clones locationClones are declared in the same class
Number of node comparisons198
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements28
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)10.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (location == null)
    1
    if (location == null)
    2
    throw new IllegalArgumentException("Null 'location' argument.");
    2
    throw new IllegalArgumentException("Null 'location' argument.");
    3
    if (orientation == null)
    3
    if (orientation == null)
    4
    throw new IllegalArgumentException("Null 'orientation' argument.");
    4
    throw new IllegalArgumentException("Null 'orientation' argument.");
    5
    RectangleEdge result = null;
    5
    RectangleEdge result = null;
    6
    if (location == AxisLocation.TOP_OR_RIGHT)
    6
    if (location == AxisLocation.TOP_OR_RIGHT)
    7
    if (orientation == PlotOrientation.HORIZONTAL)
    7
    if (orientation == PlotOrientation.HORIZONTAL)
    8
    result = RectangleEdge.RIGHT;
    8
    result = RectangleEdge.RIGHT;
    8
    result = RectangleEdge.TOP;
    Differences
    Expression1Expression2Difference
    RIGHTTOPVARIABLE_NAME_MISMATCH
    8
    result = RectangleEdge.TOP;
    9
    else if (orientation == PlotOrientation.VERTICAL)
    9
    else if (orientation == PlotOrientation.VERTICAL)
    10
    result = RectangleEdge.TOP;
    10
    result = RectangleEdge.TOP;
    10
    result = RectangleEdge.RIGHT;
    Differences
    Expression1Expression2Difference
    TOPRIGHTVARIABLE_NAME_MISMATCH
    10
    result = RectangleEdge.RIGHT;
    11
    else if (location == AxisLocation.TOP_OR_LEFT)
    11
    else if (location == AxisLocation.TOP_OR_LEFT)
    12
    if (orientation == PlotOrientation.HORIZONTAL)
    12
    if (orientation == PlotOrientation.HORIZONTAL)
    13
    result = RectangleEdge.LEFT;
    13
    result = RectangleEdge.LEFT;
    13
    result = RectangleEdge.TOP;
    Differences
    Expression1Expression2Difference
    LEFTTOPVARIABLE_NAME_MISMATCH
    13
    result = RectangleEdge.TOP;
    14
    else if (orientation == PlotOrientation.VERTICAL)
    14
    else if (orientation == PlotOrientation.VERTICAL)
    15
    result = RectangleEdge.TOP;
    15
    result = RectangleEdge.TOP;
    15
    result = RectangleEdge.LEFT;
    Differences
    Expression1Expression2Difference
    TOPLEFTVARIABLE_NAME_MISMATCH
    15
    result = RectangleEdge.LEFT;
    16
    else if (location == AxisLocation.BOTTOM_OR_RIGHT)
    16
    else if (location == AxisLocation.BOTTOM_OR_RIGHT)
    17
    if (orientation == PlotOrientation.HORIZONTAL)
    17
    if (orientation == PlotOrientation.HORIZONTAL)
    18
    result = RectangleEdge.RIGHT;
    18
    result = RectangleEdge.RIGHT;
    18
    result = RectangleEdge.BOTTOM;
    Differences
    Expression1Expression2Difference
    RIGHTBOTTOMVARIABLE_NAME_MISMATCH
    18
    result = RectangleEdge.BOTTOM;
    19
    else if (orientation == PlotOrientation.VERTICAL)
    19
    else if (orientation == PlotOrientation.VERTICAL)
    20
    result = RectangleEdge.BOTTOM;
    20
    result = RectangleEdge.BOTTOM;
    20
    result = RectangleEdge.RIGHT;
    Differences
    Expression1Expression2Difference
    BOTTOMRIGHTVARIABLE_NAME_MISMATCH
    20
    result = RectangleEdge.RIGHT;
    21
    else if (location == AxisLocation.BOTTOM_OR_LEFT)
    21
    else if (location == AxisLocation.BOTTOM_OR_LEFT)
    22
    if (orientation == PlotOrientation.HORIZONTAL)
    22
    if (orientation == PlotOrientation.HORIZONTAL)
    23
    result = RectangleEdge.LEFT;
    23
    result = RectangleEdge.LEFT;
    23
    result = RectangleEdge.BOTTOM;
    Differences
    Expression1Expression2Difference
    LEFTBOTTOMVARIABLE_NAME_MISMATCH
    23
    result = RectangleEdge.BOTTOM;
    24
    else if (orientation == PlotOrientation.VERTICAL)
    24
    else if (orientation == PlotOrientation.VERTICAL)
    25
    result = RectangleEdge.BOTTOM;
    25
    result = RectangleEdge.BOTTOM;
    25
    result = RectangleEdge.LEFT;
    Differences
    Expression1Expression2Difference
    BOTTOMLEFTVARIABLE_NAME_MISMATCH
    25
    result = RectangleEdge.LEFT;
    26
    if (result == null)
    26
    if (result == null)
    27
    throw new IllegalStateException("resolveDomainAxisLocation()");
    27
    throw new IllegalStateException("resolveDomainAxisLocation()");
    27
    throw new IllegalStateException("resolveRangeAxisLocation()");
    Differences
    Expression1Expression2Difference
    "resolveDomainAxisLocation()""resolveRangeAxisLocation()"LITERAL_VALUE_MISMATCH
    27
    throw new IllegalStateException("resolveRangeAxisLocation()");
    28
    return result;
    28
    return result;
    Precondition Violations (0)
    Row Violation