while (segment.getSegmentStart() <= baseSegment.getSegmentEnd()) { if (segment.inIncludeSegments()) { // find all consecutive included segments long fromDomainValue = segment.getSegmentStart(); long toDomainValue; do { toDomainValue = segment.getSegmentEnd(); segment.inc(); } while (segment.inIncludeSegments()); // add the interval as an exception addException(fromDomainValue, toDomainValue); } else { // this is not one of our included segment, skip it segment.inc(); } }
while (segment.getSegmentStart() <= baseExclusionRangeEnd) { if (segment.inIncludeSegments()) { // find all consecutive included segments long fromDomainValue = segment.getSegmentStart(); long toDomainValue; do { toDomainValue = segment.getSegmentEnd(); segment.inc(); } while (segment.inIncludeSegments()); // add the interval as an exception addException(new BaseTimelineSegmentRange( fromDomainValue, toDomainValue)); } else { // this is not one of our included segment, skip it segment.inc(); } }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/SegmentedTimeline.java File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/SegmentedTimeline.java
Method name: void addBaseTimelineException(long) Method name: void addBaseTimelineExclusions(long, long)
Number of AST nodes: 9 Number of AST nodes: 9
1
while (segment.getSegmentStart() <= baseSegment.getSegmentEnd()) {
1
while (segment.getSegmentStart() <= baseExclusionRangeEnd) {
2
                if (segment.inIncludeSegments()) {
2
                if (segment.inIncludeSegments()) {
3
                    // find all consecutive included segments
3
                    // find all consecutive included segments
4
                    long fromDomainValue = segment.getSegmentStart();
4
                    long fromDomainValue = segment.getSegmentStart();
5
                    long toDomainValue;
5
                    long toDomainValue;
6
                    do {
6
                    do {
7
                        toDomainValue = segment.getSegmentEnd();
7
                        toDomainValue = segment.getSegmentEnd();
8
                        segment.inc();
8
                        segment.inc();
9
                    }
9
                    }
10
                    while (segment.inIncludeSegments());
10
                    while (segment.inIncludeSegments());
11
                    // add the interval as an exception
11
                    // add the interval as an exception
12
                    addException(
12
                    addException(new BaseTimelineSegmentRange(
13
fromDomainValue, toDomainValue);
13
                            fromDomainValue, toDomainValue));
14
                }
14
                }
15
                else {
15
                else {
16
                    // this is not one of our included segment, skip it
16
                    // this is not one of our included segment, skip it
17
                    segment.inc();
17
                    segment.inc();
18
                }
18
                }
19
            }
19
            }
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.4
Clones locationClones are declared in the same class
Number of node comparisons38
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)12.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    while (segment.getSegmentStart() <= baseSegment.getSegmentEnd())
    4
    while (segment.getSegmentStart() <= baseSegment.getSegmentEnd())
    7
    while (segment.getSegmentStart() <= baseExclusionRangeEnd)
    Differences
    Expression1Expression2Difference
    baseSegment.getSegmentEnd()baseExclusionRangeEndTYPE_COMPATIBLE_REPLACEMENT
    7
    while (segment.getSegmentStart() <= baseExclusionRangeEnd)
    5
    if (segment.inIncludeSegments())
    8
    if (segment.inIncludeSegments())
    6
    long fromDomainValue = segment.getSegmentStart();
    9
    long fromDomainValue = segment.getSegmentStart();
    7
    long toDomainValue;
    10
    long toDomainValue;
    10
    do while(segment.inIncludeSegments())
    13
    do while(segment.inIncludeSegments())
    8
    toDomainValue = segment.getSegmentEnd();
    11
    toDomainValue = segment.getSegmentEnd();
    9
    segment.inc();
    12
    segment.inc();
    11
    addException(fromDomainValue, toDomainValue);
    11
    addException(fromDomainValue, toDomainValue);
    14
    addException(new BaseTimelineSegmentRange(fromDomainValue, toDomainValue));
    Differences
    Expression1Expression2Difference
    addException(fromDomainValue,toDomainValue)addException(new BaseTimelineSegmentRange(fromDomainValue,toDomainValue))ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression addException(fromDomainValue,toDomainValue) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression addException(new BaseTimelineSegmentRange(fromDomainValue,toDomainValue)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method addException
    Expression addException(fromDomainValue,toDomainValue) is a void method call, and thus it cannot be parameterized
    Expression addException(new BaseTimelineSegmentRange(fromDomainValue,toDomainValue)) is a void method call, and thus it cannot be parameterized
    14
    addException(new BaseTimelineSegmentRange(fromDomainValue, toDomainValue));
    else
    else
    12
    segment.inc();
    15
    segment.inc();
    Precondition Violations (4)
    Row Violation
    1Expression addException(fromDomainValue,toDomainValue) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression addException(new BaseTimelineSegmentRange(fromDomainValue,toDomainValue)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression addException(fromDomainValue,toDomainValue) is a void method call, and thus it cannot be parameterized
    4Expression addException(new BaseTimelineSegmentRange(fromDomainValue,toDomainValue)) is a void method call, and thus it cannot be parameterized