double d = Math.abs(candidateX - this.anchorX); if (d < this.distance) { this.crosshairX = candidateX; this.domainAxisIndex = domainAxisIndex; this.distance = d; }
double d = Math.abs(candidateY - this.anchorY); if (d < this.distance) { this.crosshairY = candidateY; this.rangeAxisIndex = rangeAxisIndex; this.distance = d; }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CrosshairState.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CrosshairState.java
Method name: void updateCrosshairX(double, int) Method name: void updateCrosshairY(double, int)
Number of AST nodes: 5 Number of AST nodes: 5
1
double d = Math.abs(candidateX - this.anchorX);
1
double d = Math.abs(candidateY - this.anchorY);
2
        if (d < this.distance) {
2
        if (d < this.distance) {
3
            this.crosshairX = candidateX;
3
            this.crosshairY = candidateY;
4
            this.domainAxisIndex = domainAxisIndex;
4
            this.rangeAxisIndex = rangeAxisIndex;
5
            this.distance = d;
5
            this.distance = d;
6
        }
6
        }
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)0.1
Clones locationClones are declared in the same class
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    double d = Math.abs(candidateX - this.anchorX);
    1
    double d = Math.abs(candidateX - this.anchorX);
    1
    double d = Math.abs(candidateY - this.anchorY);
    Differences
    Expression1Expression2Difference
    candidateXcandidateYVARIABLE_NAME_MISMATCH
    anchorXanchorYVARIABLE_NAME_MISMATCH
    1
    double d = Math.abs(candidateY - this.anchorY);
    2
    if (d < this.distance)
    2
    if (d < this.distance)
    3
    this.crosshairX = candidateX;
    3
    this.crosshairX = candidateX;
    3
    this.crosshairY = candidateY;
    Differences
    Expression1Expression2Difference
    crosshairXcrosshairYVARIABLE_NAME_MISMATCH
    candidateXcandidateYVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression this.crosshairX is a field being modified, and thus it cannot be parameterized
    Expression this.crosshairY is a field being modified, and thus it cannot be parameterized
    3
    this.crosshairY = candidateY;
    4
    this.domainAxisIndex = domainAxisIndex;
    4
    this.domainAxisIndex = domainAxisIndex;
    4
    this.rangeAxisIndex = rangeAxisIndex;
    Differences
    Expression1Expression2Difference
    domainAxisIndexrangeAxisIndexVARIABLE_NAME_MISMATCH
    domainAxisIndexrangeAxisIndexVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression this.domainAxisIndex is a field being modified, and thus it cannot be parameterized
    Expression this.rangeAxisIndex is a field being modified, and thus it cannot be parameterized
    4
    this.rangeAxisIndex = rangeAxisIndex;
    5
    this.distance = d;
    5
    this.distance = d;
    Precondition Violations (4)
    Row Violation
    1Expression this.crosshairX is a field being modified, and thus it cannot be parameterized
    2Expression this.crosshairY is a field being modified, and thus it cannot be parameterized
    3Expression this.domainAxisIndex is a field being modified, and thus it cannot be parameterized
    4Expression this.rangeAxisIndex is a field being modified, and thus it cannot be parameterized