if (this.adjustForDaylightSaving) { this.workingCalendarNoDST.setTime(new Date(date)); this.workingCalendar.set( this.workingCalendarNoDST.get(Calendar.YEAR), this.workingCalendarNoDST.get(Calendar.MONTH), this.workingCalendarNoDST.get(Calendar.DATE), this.workingCalendarNoDST.get(Calendar.HOUR_OF_DAY), this.workingCalendarNoDST.get(Calendar.MINUTE), this.workingCalendarNoDST.get(Calendar.SECOND) ); this.workingCalendar.set(Calendar.MILLISECOND, this.workingCalendarNoDST.get(Calendar.MILLISECOND)); // result = this.workingCalendar.getTimeInMillis(); // preceding code won't work with JDK 1.3 result = this.workingCalendar.getTime().getTime(); }
if (this.adjustForDaylightSaving) { this.workingCalendar.setTime(date); this.workingCalendarNoDST.set( this.workingCalendar.get(Calendar.YEAR), this.workingCalendar.get(Calendar.MONTH), this.workingCalendar.get(Calendar.DATE), this.workingCalendar.get(Calendar.HOUR_OF_DAY), this.workingCalendar.get(Calendar.MINUTE), this.workingCalendar.get(Calendar.SECOND)); this.workingCalendarNoDST.set(Calendar.MILLISECOND, this.workingCalendar.get(Calendar.MILLISECOND)); Date revisedDate = this.workingCalendarNoDST.getTime(); result = revisedDate.getTime(); }
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: long getTimeFromLong(long) Method name: long getTime(Date)
Number of AST nodes: 5 Number of AST nodes: 6
1
if (this.adjustForDaylightSaving) {
1
if (this.adjustForDaylightSaving) {
2
            this.workingCalendarNoDST.setTime(new Date(date));
2
            this.workingCalendar.setTime(date);
3
            this.workingCalendar.set(
3
            this.workingCalendarNoDST.set(
4
                this.workingCalendarNoDST.get(Calendar.YEAR),
4
                    this.workingCalendar.get(Calendar.YEAR),
5
                this.workingCalendarNoDST.get(Calendar.MONTH),
5
                    this.workingCalendar.get(Calendar.MONTH),
6
                this.workingCalendarNoDST.get(Calendar.DATE),
6
                    this.workingCalendar.get(Calendar.DATE),
7
                this.workingCalendarNoDST.get(Calendar.HOUR_OF_DAY),
7
                    this.workingCalendar.get(Calendar.HOUR_OF_DAY),
8
                this.workingCalendarNoDST.get(Calendar.MINUTE),
8
                    this.workingCalendar.get(Calendar.MINUTE),
9
                this.workingCalendarNoDST.get(Calendar.SECOND)
9
                    this.workingCalendar.get(Calendar.SECOND)
10
            );
10
);
11
            this.workingCalendar.set(Calendar.MILLISECOND,
11
            this.workingCalendarNoDST.set(Calendar.MILLISECOND,
12
                    this.workingCalendarNoDST.get(Calendar.MILLISECOND));
12
                    this.workingCalendar.get(Calendar.MILLISECOND));
13
            // result = this.workingCalendar.getTimeInMillis();
13
            Date revisedDate = this.workingCalendarNoDST.getTime();
14
            // preceding code won't work with JDK 1.3
14
            
15
            result = this.workingCalendar.getTime().getTime();
15
result = revisedDate.getTime();
16
        }
16
        }
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 comparisons30
  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 fragment1
    Time elapsed for statement mapping (ms)11.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    2
    if (this.adjustForDaylightSaving)
    2
    if (this.adjustForDaylightSaving)
    3
    this.workingCalendarNoDST.setTime(new Date(date));
    3
    this.workingCalendarNoDST.setTime(new Date(date));
    3
    this.workingCalendar.setTime(date);
    Differences
    Expression1Expression2Difference
    new Date(date)dateTYPE_COMPATIBLE_REPLACEMENT
    workingCalendarNoDSTworkingCalendarVARIABLE_NAME_MISMATCH
    3
    this.workingCalendar.setTime(date);
    4
    this.workingCalendar.set(this.workingCalendarNoDST.get(Calendar.YEAR), this.workingCalendarNoDST.get(Calendar.MONTH), this.workingCalendarNoDST.get(Calendar.DATE), this.workingCalendarNoDST.get(Calendar.HOUR_OF_DAY), this.workingCalendarNoDST.get(Calendar.MINUTE), this.workingCalendarNoDST.get(Calendar.SECOND));
    4
    this.workingCalendar.set(this.workingCalendarNoDST.get(Calendar.YEAR), this.workingCalendarNoDST.get(Calendar.MONTH), this.workingCalendarNoDST.get(Calendar.DATE), this.workingCalendarNoDST.get(Calendar.HOUR_OF_DAY), this.workingCalendarNoDST.get(Calendar.MINUTE), this.workingCalendarNoDST.get(Calendar.SECOND));
    4
    this.workingCalendarNoDST.set(this.workingCalendar.get(Calendar.YEAR), this.workingCalendar.get(Calendar.MONTH), this.workingCalendar.get(Calendar.DATE), this.workingCalendar.get(Calendar.HOUR_OF_DAY), this.workingCalendar.get(Calendar.MINUTE), this.workingCalendar.get(Calendar.SECOND));
    Differences
    Expression1Expression2Difference
    workingCalendarNoDSTworkingCalendarVARIABLE_NAME_MISMATCH
    workingCalendarNoDSTworkingCalendarVARIABLE_NAME_MISMATCH
    workingCalendarNoDSTworkingCalendarVARIABLE_NAME_MISMATCH
    workingCalendarNoDSTworkingCalendarVARIABLE_NAME_MISMATCH
    workingCalendarNoDSTworkingCalendarVARIABLE_NAME_MISMATCH
    workingCalendarNoDSTworkingCalendarVARIABLE_NAME_MISMATCH
    workingCalendarworkingCalendarNoDSTVARIABLE_NAME_MISMATCH
    4
    this.workingCalendarNoDST.set(this.workingCalendar.get(Calendar.YEAR), this.workingCalendar.get(Calendar.MONTH), this.workingCalendar.get(Calendar.DATE), this.workingCalendar.get(Calendar.HOUR_OF_DAY), this.workingCalendar.get(Calendar.MINUTE), this.workingCalendar.get(Calendar.SECOND));
    5
    this.workingCalendar.set(Calendar.MILLISECOND, this.workingCalendarNoDST.get(Calendar.MILLISECOND));
    5
    this.workingCalendar.set(Calendar.MILLISECOND, this.workingCalendarNoDST.get(Calendar.MILLISECOND));
    5
    this.workingCalendarNoDST.set(Calendar.MILLISECOND, this.workingCalendar.get(Calendar.MILLISECOND));
    Differences
    Expression1Expression2Difference
    workingCalendarNoDSTworkingCalendarVARIABLE_NAME_MISMATCH
    workingCalendarworkingCalendarNoDSTVARIABLE_NAME_MISMATCH
    5
    this.workingCalendarNoDST.set(Calendar.MILLISECOND, this.workingCalendar.get(Calendar.MILLISECOND));
                                                                                                                    
    6
    Date revisedDate = this.workingCalendarNoDST.getTime();
    Preondition Violations
    Unmatched statement Date revisedDate=this.workingCalendarNoDST.getTime(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    Date revisedDate = this.workingCalendarNoDST.getTime();
    6
    result = this.workingCalendar.getTime().getTime();
    6
    result = this.workingCalendar.getTime().getTime();
    7
    result = revisedDate.getTime();
    Differences
    Expression1Expression2Difference
    this.workingCalendar.getTime()revisedDateTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.workingCalendar.getTime() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7
    result = revisedDate.getTime();
    Precondition Violations (2)
    Row Violation
    1Unmatched statement Date revisedDate=this.workingCalendarNoDST.getTime(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression this.workingCalendar.getTime() cannot be parameterized, because it has dependencies to/from statements that will be extracted