if (edge == RectangleEdge.TOP) { anchor = TextAnchor.BOTTOM_CENTER; if ((lastTick != null) && (lastX == x) && (currentTickValue != cycleBound)) { anchor = isInverted() ? TextAnchor.BOTTOM_LEFT : TextAnchor.BOTTOM_RIGHT; result.remove(result.size() - 1); result.add(new CycleBoundTick( this.boundMappedToLastCycle, lastTick.getNumber(), lastTick.getText(), anchor, anchor, lastTick.getAngle()) ); this.internalMarkerWhenTicksOverlap = true; anchor = isInverted() ? TextAnchor.BOTTOM_RIGHT : TextAnchor.BOTTOM_LEFT; } rotationAnchor = anchor; } else { anchor = TextAnchor.TOP_CENTER; if ((lastTick != null) && (lastX == x) && (currentTickValue != cycleBound)) { anchor = isInverted() ? TextAnchor.TOP_LEFT : TextAnchor.TOP_RIGHT; result.remove(result.size() - 1); result.add(new CycleBoundTick( this.boundMappedToLastCycle, lastTick.getNumber(), lastTick.getText(), anchor, anchor, lastTick.getAngle()) ); this.internalMarkerWhenTicksOverlap = true; anchor = isInverted() ? TextAnchor.TOP_RIGHT : TextAnchor.TOP_LEFT; } rotationAnchor = anchor; }
if (edge == RectangleEdge.LEFT) { anchor = TextAnchor.CENTER_RIGHT; if ((lastTick != null) && (lastY == y) && (currentTickValue != cycleBound)) { anchor = isInverted() ? TextAnchor.BOTTOM_RIGHT : TextAnchor.TOP_RIGHT; result.remove(result.size() - 1); result.add(new CycleBoundTick( this.boundMappedToLastCycle, lastTick.getNumber(), lastTick.getText(), anchor, anchor, lastTick.getAngle()) ); this.internalMarkerWhenTicksOverlap = true; anchor = isInverted() ? TextAnchor.TOP_RIGHT : TextAnchor.BOTTOM_RIGHT; } rotationAnchor = anchor; } else { anchor = TextAnchor.CENTER_LEFT; if ((lastTick != null) && (lastY == y) && (currentTickValue != cycleBound)) { anchor = isInverted() ? TextAnchor.BOTTOM_LEFT : TextAnchor.TOP_LEFT; result.remove(result.size() - 1); result.add(new CycleBoundTick( this.boundMappedToLastCycle, lastTick.getNumber(), lastTick.getText(), anchor, anchor, lastTick.getAngle()) ); this.internalMarkerWhenTicksOverlap = true; anchor = isInverted() ? TextAnchor.TOP_LEFT : TextAnchor.BOTTOM_LEFT; } rotationAnchor = anchor; }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/CyclicNumberAxis.java File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/CyclicNumberAxis.java
Method name: List refreshTicksHorizontal(Graphics2D, Rectangle2D, RectangleEdge) Method name: List refreshVerticalTicks(Graphics2D, Rectangle2D, RectangleEdge)
Number of AST nodes: 17 Number of AST nodes: 17
1
if (edge == RectangleEdge.TOP) {
1
if (edge == RectangleEdge.LEFT) {
2
                    anchor = TextAnchor.BOTTOM_CENTER; 
2
                    anchor = TextAnchor.CENTER_RIGHT; 
3
                    if ((lastTick != null) && (lastX == x) 
3
                    if ((lastTick != null) && (lastY == y) 
4
                            && (currentTickValue != cycleBound)) {
4
                            && (currentTickValue != cycleBound)) {
5
                        anchor = isInverted() 
5
                        anchor = isInverted() 
6
                            ? TextAnchor.BOTTOM_LEFT : TextAnchor.BOTTOM_RIGHT;
6
                            ? TextAnchor.BOTTOM_RIGHT : TextAnchor.TOP_RIGHT;
7
                        result.remove(result.size() - 1);
7
                        result.remove(result.size() - 1);
8
                        result.add(new CycleBoundTick(
8
                        result.add(new CycleBoundTick(
9
                            this.boundMappedToLastCycle, lastTick.getNumber(),
9
                            this.boundMappedToLastCycle, lastTick.getNumber(),
10
                            lastTick.getText(), anchor, anchor, 
10
                            lastTick.getText(), anchor, anchor, 
11
                            lastTick.getAngle())
11
                            lastTick.getAngle())
12
                        );
12
                        );
13
                        this.internalMarkerWhenTicksOverlap = true;
13
                        this.internalMarkerWhenTicksOverlap = true;
14
                        anchor = isInverted() 
14
                        anchor = isInverted() 
15
                            ? TextAnchor.BOTTOM_RIGHT : TextAnchor.BOTTOM_LEFT;
15
                            ? TextAnchor.TOP_RIGHT : TextAnchor.BOTTOM_RIGHT;
16
                    }
16
                    }
17
                    rotationAnchor = anchor;
17
                    rotationAnchor = anchor;
18
                }
18
                }
19
                else {
19
                else {
20
                    anchor = TextAnchor.TOP_CENTER; 
20
                    anchor = TextAnchor.CENTER_LEFT; 
21
                    if ((lastTick != null) && (lastX == x) 
21
                    if ((lastTick != null) && (lastY == y) 
22
                            && (currentTickValue != cycleBound)) {
22
                            && (currentTickValue != cycleBound)) {
23
                        anchor = isInverted() 
23
                        anchor = isInverted() 
24
                            ? TextAnchor.TOP_LEFT : TextAnchor.TOP_RIGHT;
24
                            ? TextAnchor.BOTTOM_LEFT : TextAnchor.TOP_LEFT;
25
                        result.remove(result.size() - 1);
25
                        result.remove(result.size() - 1);
26
                        result.add(new CycleBoundTick(
26
                        result.add(new CycleBoundTick(
27
                            this.boundMappedToLastCycle, lastTick.getNumber(),
27
                            this.boundMappedToLastCycle, lastTick.getNumber(),
28
                            lastTick.getText(), anchor, anchor, 
28
                            lastTick.getText(), anchor, anchor, 
29
                            lastTick.getAngle())
29
                            lastTick.getAngle())
30
                        );
30
                        );
31
                        this.internalMarkerWhenTicksOverlap = true;
31
                        this.internalMarkerWhenTicksOverlap = true;
32
                        anchor = isInverted() 
32
                        anchor = isInverted() 
33
                            ? TextAnchor.TOP_RIGHT : TextAnchor.TOP_LEFT;
33
                            ? TextAnchor.TOP_LEFT : TextAnchor.BOTTOM_LEFT;
34
                    }
34
                    }
35
                    rotationAnchor = anchor;
35
                    rotationAnchor = anchor;
36
                }
36
                }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)5.7
Clones locationClones are declared in the same class
Number of node comparisons108
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements17
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)38.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    45
    if (edge == RectangleEdge.TOP)
    45
    if (edge == RectangleEdge.TOP)
    54
    if (edge == RectangleEdge.LEFT)
    Differences
    Expression1Expression2Difference
    TOPLEFTVARIABLE_NAME_MISMATCH
    54
    if (edge == RectangleEdge.LEFT)
    46
    anchor = TextAnchor.BOTTOM_CENTER;
    46
    anchor = TextAnchor.BOTTOM_CENTER;
    55
    anchor = TextAnchor.CENTER_RIGHT;
    Differences
    Expression1Expression2Difference
    BOTTOM_CENTERCENTER_RIGHTVARIABLE_NAME_MISMATCH
    55
    anchor = TextAnchor.CENTER_RIGHT;
    47
    if ((lastTick != null) && (lastX == x) && (currentTickValue != cycleBound))
    47
    if ((lastTick != null) && (lastX == x) && (currentTickValue != cycleBound))
    56
    if ((lastTick != null) && (lastY == y) && (currentTickValue != cycleBound))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CyclicNumberAxis.CycleBoundTickorg.jfree.chart.axis.NumberTickSUBCLASS_TYPE_MISMATCH
    lastXlastYVARIABLE_NAME_MISMATCH
    xyVARIABLE_NAME_MISMATCH
    56
    if ((lastTick != null) && (lastY == y) && (currentTickValue != cycleBound))
    48
    anchor = isInverted() ? TextAnchor.BOTTOM_LEFT : TextAnchor.BOTTOM_RIGHT;
    48
    anchor = isInverted() ? TextAnchor.BOTTOM_LEFT : TextAnchor.BOTTOM_RIGHT;
    61
    anchor = isInverted() ? TextAnchor.TOP_RIGHT : TextAnchor.BOTTOM_RIGHT;
    Differences
    Expression1Expression2Difference
    BOTTOM_LEFTTOP_RIGHTVARIABLE_NAME_MISMATCH
    61
    anchor = isInverted() ? TextAnchor.TOP_RIGHT : TextAnchor.BOTTOM_RIGHT;
    49
    result.remove(result.size() - 1);
    58
    result.remove(result.size() - 1);
    50
    result.add(new CycleBoundTick(this.boundMappedToLastCycle, lastTick.getNumber(), lastTick.getText(), anchor, anchor, lastTick.getAngle()));
    50
    result.add(new CycleBoundTick(this.boundMappedToLastCycle, lastTick.getNumber(), lastTick.getText(), anchor, anchor, lastTick.getAngle()));
    59
    result.add(new CycleBoundTick(this.boundMappedToLastCycle, lastTick.getNumber(), lastTick.getText(), anchor, anchor, lastTick.getAngle()));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CyclicNumberAxis.CycleBoundTickorg.jfree.chart.axis.NumberTickSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CyclicNumberAxis.CycleBoundTickorg.jfree.chart.axis.NumberTickSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CyclicNumberAxis.CycleBoundTickorg.jfree.chart.axis.NumberTickSUBCLASS_TYPE_MISMATCH
    59
    result.add(new CycleBoundTick(this.boundMappedToLastCycle, lastTick.getNumber(), lastTick.getText(), anchor, anchor, lastTick.getAngle()));
    51
    this.internalMarkerWhenTicksOverlap = true;
    60
    this.internalMarkerWhenTicksOverlap = true;
    52
    anchor = isInverted() ? TextAnchor.BOTTOM_RIGHT : TextAnchor.BOTTOM_LEFT;
    52
    anchor = isInverted() ? TextAnchor.BOTTOM_RIGHT : TextAnchor.BOTTOM_LEFT;
    57
    anchor = isInverted() ? TextAnchor.BOTTOM_RIGHT : TextAnchor.TOP_RIGHT;
    Differences
    Expression1Expression2Difference
    BOTTOM_LEFTTOP_RIGHTVARIABLE_NAME_MISMATCH
    57
    anchor = isInverted() ? TextAnchor.BOTTOM_RIGHT : TextAnchor.TOP_RIGHT;
    53
    rotationAnchor = anchor;
    62
    rotationAnchor = anchor;
    else
    else
    54
    anchor = TextAnchor.TOP_CENTER;
    54
    anchor = TextAnchor.TOP_CENTER;
    63
    anchor = TextAnchor.CENTER_LEFT;
    Differences
    Expression1Expression2Difference
    TOP_CENTERCENTER_LEFTVARIABLE_NAME_MISMATCH
    63
    anchor = TextAnchor.CENTER_LEFT;
    55
    if ((lastTick != null) && (lastX == x) && (currentTickValue != cycleBound))
    55
    if ((lastTick != null) && (lastX == x) && (currentTickValue != cycleBound))
    64
    if ((lastTick != null) && (lastY == y) && (currentTickValue != cycleBound))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CyclicNumberAxis.CycleBoundTickorg.jfree.chart.axis.NumberTickSUBCLASS_TYPE_MISMATCH
    lastXlastYVARIABLE_NAME_MISMATCH
    xyVARIABLE_NAME_MISMATCH
    64
    if ((lastTick != null) && (lastY == y) && (currentTickValue != cycleBound))
    56
    anchor = isInverted() ? TextAnchor.TOP_LEFT : TextAnchor.TOP_RIGHT;
    56
    anchor = isInverted() ? TextAnchor.TOP_LEFT : TextAnchor.TOP_RIGHT;
    69
    anchor = isInverted() ? TextAnchor.TOP_LEFT : TextAnchor.BOTTOM_LEFT;
    Differences
    Expression1Expression2Difference
    TOP_RIGHTBOTTOM_LEFTVARIABLE_NAME_MISMATCH
    69
    anchor = isInverted() ? TextAnchor.TOP_LEFT : TextAnchor.BOTTOM_LEFT;
    57
    result.remove(result.size() - 1);
    66
    result.remove(result.size() - 1);
    58
    result.add(new CycleBoundTick(this.boundMappedToLastCycle, lastTick.getNumber(), lastTick.getText(), anchor, anchor, lastTick.getAngle()));
    58
    result.add(new CycleBoundTick(this.boundMappedToLastCycle, lastTick.getNumber(), lastTick.getText(), anchor, anchor, lastTick.getAngle()));
    67
    result.add(new CycleBoundTick(this.boundMappedToLastCycle, lastTick.getNumber(), lastTick.getText(), anchor, anchor, lastTick.getAngle()));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CyclicNumberAxis.CycleBoundTickorg.jfree.chart.axis.NumberTickSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CyclicNumberAxis.CycleBoundTickorg.jfree.chart.axis.NumberTickSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CyclicNumberAxis.CycleBoundTickorg.jfree.chart.axis.NumberTickSUBCLASS_TYPE_MISMATCH
    67
    result.add(new CycleBoundTick(this.boundMappedToLastCycle, lastTick.getNumber(), lastTick.getText(), anchor, anchor, lastTick.getAngle()));
    59
    this.internalMarkerWhenTicksOverlap = true;
    68
    this.internalMarkerWhenTicksOverlap = true;
    60
    anchor = isInverted() ? TextAnchor.TOP_RIGHT : TextAnchor.TOP_LEFT;
    60
    anchor = isInverted() ? TextAnchor.TOP_RIGHT : TextAnchor.TOP_LEFT;
    65
    anchor = isInverted() ? TextAnchor.BOTTOM_LEFT : TextAnchor.TOP_LEFT;
    Differences
    Expression1Expression2Difference
    TOP_RIGHTBOTTOM_LEFTVARIABLE_NAME_MISMATCH
    65
    anchor = isInverted() ? TextAnchor.BOTTOM_LEFT : TextAnchor.TOP_LEFT;
    61
    rotationAnchor = anchor;
    70
    rotationAnchor = anchor;
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables anchor, rotationAnchor , while Clone fragment #2 returns variables anchor, rotationAnchor