if (space == null) { space = new AxisSpace(); } // reserve some space for the range axis... if (this.fixedRangeAxisSpace != null) { if (this.orientation == PlotOrientation.HORIZONTAL) { space.ensureAtLeast(this.fixedRangeAxisSpace.getTop(), RectangleEdge.TOP); space.ensureAtLeast(this.fixedRangeAxisSpace.getBottom(), RectangleEdge.BOTTOM); } else if (this.orientation == PlotOrientation.VERTICAL) { space.ensureAtLeast(this.fixedRangeAxisSpace.getLeft(), RectangleEdge.LEFT); space.ensureAtLeast(this.fixedRangeAxisSpace.getRight(), RectangleEdge.RIGHT); } } else { // reserve space for the range axes (if any)... for (int i = 0; i < this.rangeAxes.size(); i++) { Axis yAxis = (Axis) this.rangeAxes.get(i); if (yAxis != null) { RectangleEdge edge = getRangeAxisEdge(i); space = yAxis.reserveSpace(g2, this, plotArea, edge, space); } } } return space;
if (space == null) { space = new AxisSpace(); } // reserve some space for the range axis... if (this.fixedRangeAxisSpace != null) { if (this.orientation == PlotOrientation.HORIZONTAL) { space.ensureAtLeast(this.fixedRangeAxisSpace.getTop(), RectangleEdge.TOP); space.ensureAtLeast(this.fixedRangeAxisSpace.getBottom(), RectangleEdge.BOTTOM); } else if (this.orientation == PlotOrientation.VERTICAL) { space.ensureAtLeast(this.fixedRangeAxisSpace.getLeft(), RectangleEdge.LEFT); space.ensureAtLeast(this.fixedRangeAxisSpace.getRight(), RectangleEdge.RIGHT); } } else { // reserve space for the range axes... for (int i = 0; i < this.rangeAxes.size(); i++) { Axis axis = (Axis) this.rangeAxes.get(i); if (axis != null) { RectangleEdge edge = getRangeAxisEdge(i); space = axis.reserveSpace(g2, this, plotArea, edge, space); } } } return space;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CategoryPlot.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/XYPlot.java
Method name: AxisSpace calculateRangeAxisSpace(Graphics2D, Rectangle2D, AxisSpace) Method name: AxisSpace calculateRangeAxisSpace(Graphics2D, Rectangle2D, AxisSpace)
Number of AST nodes: 15 Number of AST nodes: 15
1
if (space == null) {
1
if (space == null) {
2
            space = new AxisSpace();
2
            space = new AxisSpace();
3
        }
3
        }
4
        // reserve some space for the range axis...
4
        // reserve some space for the range axis...
5
        if (this.fixedRangeAxisSpace != null) {
5
        if (this.fixedRangeAxisSpace != null) {
6
            if (this.orientation == PlotOrientation.HORIZONTAL) {
6
            if (this.orientation == PlotOrientation.HORIZONTAL) {
7
                space.ensureAtLeast(this.fixedRangeAxisSpace.getTop(),
7
                space.ensureAtLeast(this.fixedRangeAxisSpace.getTop(),
8
                        RectangleEdge.TOP);
8
                        RectangleEdge.TOP);
9
                space.ensureAtLeast(this.fixedRangeAxisSpace.getBottom(),
9
                space.ensureAtLeast(this.fixedRangeAxisSpace.getBottom(),
10
                        RectangleEdge.BOTTOM);
10
                        RectangleEdge.BOTTOM);
11
            }
11
            }
12
            else if (this.orientation == PlotOrientation.VERTICAL) {
12
            else if (this.orientation == PlotOrientation.VERTICAL) {
13
                space.ensureAtLeast(this.fixedRangeAxisSpace.getLeft(),
13
                space.ensureAtLeast(this.fixedRangeAxisSpace.getLeft(),
14
                        RectangleEdge.LEFT);
14
                        RectangleEdge.LEFT);
15
                space.ensureAtLeast(this.fixedRangeAxisSpace.getRight(),
15
                space.ensureAtLeast(this.fixedRangeAxisSpace.getRight(),
16
                        RectangleEdge.RIGHT);
16
                        RectangleEdge.RIGHT);
17
            }
17
            }
18
        }
18
        }
19
        else {
19
        else {
20
            // reserve space for the range axes (if any)...
20
            // reserve space for the range axes...
21
            for (int i = 0; i < this.rangeAxes.size(); i++) {
21
            for (int i = 0; i < this.rangeAxes.size(); i++) {
22
                Axis yAxis = (Axis) this.rangeAxes.get(i);
22
                Axis axis = (Axis) this.rangeAxes.get(i);
23
                if (yAxis != null) {
23
                if (axis != null) {
24
                    RectangleEdge edge = getRangeAxisEdge(i);
24
                    RectangleEdge edge = getRangeAxisEdge(i);
25
                    space = yAxis.reserveSpace(g2, this, plotArea, edge, space);
25
                    space = axis.reserveSpace(g2, this, plotArea, edge, space);
26
                }
26
                }
27
            }
27
            }
28
        }
28
        }
29
        return space;
29
        return space;
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)3.5
Clones locationClones are in different classes having the same super class
Number of node comparisons52
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements15
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)25.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (space == null)
    1
    if (space == null)
    2
    space = new AxisSpace();
    2
    space = new AxisSpace();
    3
    if (this.fixedRangeAxisSpace != null)
    3
    if (this.fixedRangeAxisSpace != null)
    4
    if (this.orientation == PlotOrientation.HORIZONTAL)
    4
    if (this.orientation == PlotOrientation.HORIZONTAL)
    5
    space.ensureAtLeast(this.fixedRangeAxisSpace.getTop(), RectangleEdge.TOP);
    5
    space.ensureAtLeast(this.fixedRangeAxisSpace.getTop(), RectangleEdge.TOP);
    6
    space.ensureAtLeast(this.fixedRangeAxisSpace.getBottom(), RectangleEdge.BOTTOM);
    6
    space.ensureAtLeast(this.fixedRangeAxisSpace.getBottom(), RectangleEdge.BOTTOM);
    7
    else if (this.orientation == PlotOrientation.VERTICAL)
    7
    else if (this.orientation == PlotOrientation.VERTICAL)
    8
    space.ensureAtLeast(this.fixedRangeAxisSpace.getLeft(), RectangleEdge.LEFT);
    8
    space.ensureAtLeast(this.fixedRangeAxisSpace.getLeft(), RectangleEdge.LEFT);
    9
    space.ensureAtLeast(this.fixedRangeAxisSpace.getRight(), RectangleEdge.RIGHT);
    9
    space.ensureAtLeast(this.fixedRangeAxisSpace.getRight(), RectangleEdge.RIGHT);
    else
    else
    10
    for (int i = 0; i < this.rangeAxes.size(); i++)
    10
    for (int i = 0; i < this.rangeAxes.size(); i++)
    11
    Axis yAxis = (Axis)this.rangeAxes.get(i);
    11
    Axis yAxis = (Axis)this.rangeAxes.get(i);
    11
    Axis axis = (Axis)this.rangeAxes.get(i);
    Differences
    Expression1Expression2Difference
    yAxisaxisVARIABLE_NAME_MISMATCH
    11
    Axis axis = (Axis)this.rangeAxes.get(i);
    12
    if (yAxis != null)
    12
    if (yAxis != null)
    12
    if (axis != null)
    Differences
    Expression1Expression2Difference
    yAxisaxisVARIABLE_NAME_MISMATCH
    12
    if (axis != null)
    13
    RectangleEdge edge = getRangeAxisEdge(i);
    13
    RectangleEdge edge = getRangeAxisEdge(i);
    14
    space = yAxis.reserveSpace(g2, this, plotArea, edge, space);
    14
    space = yAxis.reserveSpace(g2, this, plotArea, edge, space);
    14
    space = axis.reserveSpace(g2, this, plotArea, edge, space);
    Differences
    Expression1Expression2Difference
    yAxisaxisVARIABLE_NAME_MISMATCH
    14
    space = axis.reserveSpace(g2, this, plotArea, edge, space);
    15
    return space;
    15
    return space;
    Precondition Violations (0)
    Row Violation