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 domain axis... if (this.fixedDomainAxisSpace != null) { if (this.orientation == PlotOrientation.HORIZONTAL) { space.ensureAtLeast(this.fixedDomainAxisSpace.getLeft(), RectangleEdge.LEFT); space.ensureAtLeast(this.fixedDomainAxisSpace.getRight(), RectangleEdge.RIGHT); } else if (this.orientation == PlotOrientation.VERTICAL) { space.ensureAtLeast(this.fixedDomainAxisSpace.getTop(), RectangleEdge.TOP); space.ensureAtLeast(this.fixedDomainAxisSpace.getBottom(), RectangleEdge.BOTTOM); } } else { // reserve space for the domain axes... for (int i = 0; i < this.domainAxes.size(); i++) { Axis axis = (Axis) this.domainAxes.get(i); if (axis != null) { RectangleEdge edge = getDomainAxisEdge(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 calculateDomainAxisSpace(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 domain axis...
5
        if (this.fixedRangeAxisSpace != null) {
5
        if (this.fixedDomainAxisSpace != null) {
6
            if (this.orientation == PlotOrientation.HORIZONTAL) {
6
            if (this.orientation == PlotOrientation.HORIZONTAL) {
7
                space.ensureAtLeast(this.fixedRangeAxisSpace.getTop(),
7
                space.ensureAtLeast(this.fixedDomainAxisSpace.getLeft(),
8
                        RectangleEdge.TOP);
8
                        RectangleEdge.LEFT);
9
                space.ensureAtLeast(this.fixedRangeAxisSpace.getBottom(),
9
                space.ensureAtLeast(this.fixedDomainAxisSpace.getRight(),
10
                        RectangleEdge.BOTTOM);
10
                        RectangleEdge.RIGHT);
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.fixedDomainAxisSpace.getTop(),
14
                        RectangleEdge.LEFT);
14
                        RectangleEdge.TOP);
15
                space.ensureAtLeast(this.fixedRangeAxisSpace.getRight(),
15
                space.ensureAtLeast(this.fixedDomainAxisSpace.getBottom(),
16
                        RectangleEdge.RIGHT);
16
                        RectangleEdge.BOTTOM);
17
            }
17
            }
18
        }
18
        }
19
        else {
19
        else {
20
            // reserve space for the range axes (if any)...
20
            // reserve space for the domain axes...
21
            for (int i = 0; i < this.rangeAxes.size(); i++) {
21
            for (int i = 0; i < this.domainAxes.size(); i++) {
22
                Axis yAxis = (Axis) this.rangeAxes.get(i);
22
                Axis axis = (Axis) this.domainAxes.get(i);
23
                if (yAxis != null) {
23
                if (axis != null) {
24
                    RectangleEdge edge = getRangeAxisEdge(i);
24
                    RectangleEdge edge = getDomainAxisEdge(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.4
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)30.3
    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)
    3
    if (this.fixedDomainAxisSpace != null)
    Differences
    Expression1Expression2Difference
    fixedRangeAxisSpacefixedDomainAxisSpaceVARIABLE_NAME_MISMATCH
    3
    if (this.fixedDomainAxisSpace != null)
    4
    if (this.orientation == PlotOrientation.HORIZONTAL)
    4
    if (this.orientation == PlotOrientation.HORIZONTAL)
    7
    if (this.orientation == PlotOrientation.VERTICAL)
    Differences
    Expression1Expression2Difference
    HORIZONTALVERTICALVARIABLE_NAME_MISMATCH
    7
    if (this.orientation == PlotOrientation.VERTICAL)
    5
    space.ensureAtLeast(this.fixedRangeAxisSpace.getTop(), RectangleEdge.TOP);
    5
    space.ensureAtLeast(this.fixedRangeAxisSpace.getTop(), RectangleEdge.TOP);
    8
    space.ensureAtLeast(this.fixedDomainAxisSpace.getTop(), RectangleEdge.TOP);
    Differences
    Expression1Expression2Difference
    fixedRangeAxisSpacefixedDomainAxisSpaceVARIABLE_NAME_MISMATCH
    8
    space.ensureAtLeast(this.fixedDomainAxisSpace.getTop(), RectangleEdge.TOP);
    6
    space.ensureAtLeast(this.fixedRangeAxisSpace.getBottom(), RectangleEdge.BOTTOM);
    6
    space.ensureAtLeast(this.fixedRangeAxisSpace.getBottom(), RectangleEdge.BOTTOM);
    9
    space.ensureAtLeast(this.fixedDomainAxisSpace.getBottom(), RectangleEdge.BOTTOM);
    Differences
    Expression1Expression2Difference
    fixedRangeAxisSpacefixedDomainAxisSpaceVARIABLE_NAME_MISMATCH
    9
    space.ensureAtLeast(this.fixedDomainAxisSpace.getBottom(), RectangleEdge.BOTTOM);
    7
    else if (this.orientation == PlotOrientation.VERTICAL)
    7
    else if (this.orientation == PlotOrientation.VERTICAL)
    4
    else if (this.orientation == PlotOrientation.HORIZONTAL)
    Differences
    Expression1Expression2Difference
    VERTICALHORIZONTALVARIABLE_NAME_MISMATCH
    4
    else if (this.orientation == PlotOrientation.HORIZONTAL)
    8
    space.ensureAtLeast(this.fixedRangeAxisSpace.getLeft(), RectangleEdge.LEFT);
    8
    space.ensureAtLeast(this.fixedRangeAxisSpace.getLeft(), RectangleEdge.LEFT);
    5
    space.ensureAtLeast(this.fixedDomainAxisSpace.getLeft(), RectangleEdge.LEFT);
    Differences
    Expression1Expression2Difference
    fixedRangeAxisSpacefixedDomainAxisSpaceVARIABLE_NAME_MISMATCH
    5
    space.ensureAtLeast(this.fixedDomainAxisSpace.getLeft(), RectangleEdge.LEFT);
    9
    space.ensureAtLeast(this.fixedRangeAxisSpace.getRight(), RectangleEdge.RIGHT);
    9
    space.ensureAtLeast(this.fixedRangeAxisSpace.getRight(), RectangleEdge.RIGHT);
    6
    space.ensureAtLeast(this.fixedDomainAxisSpace.getRight(), RectangleEdge.RIGHT);
    Differences
    Expression1Expression2Difference
    fixedRangeAxisSpacefixedDomainAxisSpaceVARIABLE_NAME_MISMATCH
    6
    space.ensureAtLeast(this.fixedDomainAxisSpace.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++)
    10
    for (int i = 0; i < this.domainAxes.size(); i++)
    Differences
    Expression1Expression2Difference
    rangeAxesdomainAxesVARIABLE_NAME_MISMATCH
    10
    for (int i = 0; i < this.domainAxes.size(); i++)
    11
    Axis yAxis = (Axis)this.rangeAxes.get(i);
    11
    Axis yAxis = (Axis)this.rangeAxes.get(i);
    11
    Axis axis = (Axis)this.domainAxes.get(i);
    Differences
    Expression1Expression2Difference
    yAxisaxisVARIABLE_NAME_MISMATCH
    rangeAxesdomainAxesVARIABLE_NAME_MISMATCH
    11
    Axis axis = (Axis)this.domainAxes.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);
    13
    RectangleEdge edge = getDomainAxisEdge(i);
    Differences
    Expression1Expression2Difference
    getRangeAxisEdgegetDomainAxisEdgeMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression getRangeAxisEdge(i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression getDomainAxisEdge(i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13
    RectangleEdge edge = getDomainAxisEdge(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 (2)
    Row Violation
    1Expression getRangeAxisEdge(i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression getDomainAxisEdge(i) cannot be parameterized, because it has dependencies to/from statements that will be extracted