if (this.millisecond != FIRST_MILLISECOND_IN_SECOND) { result = new Millisecond(this.millisecond - 1, getSecond()); } else { Second previous = (Second) getSecond().previous(); if (previous != null) { result = new Millisecond(LAST_MILLISECOND_IN_SECOND, previous); } }
if (this.millisecond != LAST_MILLISECOND_IN_SECOND) { result = new Millisecond(this.millisecond + 1, getSecond()); } else { Second next = (Second) getSecond().next(); if (next != null) { result = new Millisecond(FIRST_MILLISECOND_IN_SECOND, next); } }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/time/Millisecond.java File path: /jfreechart-1.0.10/src/org/jfree/data/time/Millisecond.java
Method name: RegularTimePeriod previous() Method name: RegularTimePeriod next()
Number of AST nodes: 5 Number of AST nodes: 5
1
if (this.millisecond != FIRST_MILLISECOND_IN_SECOND) {
1
if (this.millisecond != LAST_MILLISECOND_IN_SECOND) {
2
            result = new Millisecond(this.millisecond - 1, getSecond());
2
            result = new Millisecond(this.millisecond + 1, getSecond());
3
        }
3
        }
4
        else {
4
        else {
5
            Second previous = (Second) getSecond().previous();
5
            Second next = (Second) getSecond().next();
6
            if (previous != null) {
6
            if (next != null) {
7
                result = new Millisecond(LAST_MILLISECOND_IN_SECOND, previous);
7
                result = new Millisecond(FIRST_MILLISECOND_IN_SECOND, next);
8
            }
8
            }
9
        }
9
        }
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)0.2
Clones locationClones are declared in the same class
Number of node comparisons13
  1. {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.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    if (this.millisecond != FIRST_MILLISECOND_IN_SECOND)
    2
    if (this.millisecond != FIRST_MILLISECOND_IN_SECOND)
    2
    if (this.millisecond != LAST_MILLISECOND_IN_SECOND)
    Differences
    Expression1Expression2Difference
    FIRST_MILLISECOND_IN_SECONDLAST_MILLISECOND_IN_SECONDVARIABLE_NAME_MISMATCH
    2
    if (this.millisecond != LAST_MILLISECOND_IN_SECOND)
    3
    result = new Millisecond(this.millisecond - 1, getSecond());
    3
    result = new Millisecond(this.millisecond - 1, getSecond());
    3
    result = new Millisecond(this.millisecond + 1, getSecond());
    Differences
    Expression1Expression2Difference
    -+OPERATOR_MISMATCH
    Preondition Violations
    Expression this.millisecond - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.millisecond + 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    result = new Millisecond(this.millisecond + 1, getSecond());
    else
    else
    4
    Second previous = (Second)getSecond().previous();
    4
    Second previous = (Second)getSecond().previous();
    4
    Second next = (Second)getSecond().next();
    Differences
    Expression1Expression2Difference
    previousnextVARIABLE_NAME_MISMATCH
    previousnextMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression getSecond().previous() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression getSecond().next() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    4
    Second next = (Second)getSecond().next();
    5
    if (previous != null)
    5
    if (previous != null)
    5
    if (next != null)
    Differences
    Expression1Expression2Difference
    previousnextVARIABLE_NAME_MISMATCH
    5
    if (next != null)
    6
    result = new Millisecond(LAST_MILLISECOND_IN_SECOND, previous);
    6
    result = new Millisecond(LAST_MILLISECOND_IN_SECOND, previous);
    6
    result = new Millisecond(FIRST_MILLISECOND_IN_SECOND, next);
    Differences
    Expression1Expression2Difference
    LAST_MILLISECOND_IN_SECONDFIRST_MILLISECOND_IN_SECONDVARIABLE_NAME_MISMATCH
    previousnextVARIABLE_NAME_MISMATCH
    6
    result = new Millisecond(FIRST_MILLISECOND_IN_SECOND, next);
    Precondition Violations (4)
    Row Violation
    1Expression this.millisecond - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression this.millisecond + 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression getSecond().previous() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    4Expression getSecond().next() is a method call throwing exception(s) that should be caught by a try block that will be extracted