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 statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)19.8
    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
    Preondition Violations
    Expression this.workingCalendarNoDST cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.workingCalendar cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.workingCalendarNoDST cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.workingCalendar cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.workingCalendarNoDST cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.workingCalendar cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.workingCalendarNoDST cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.workingCalendar cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.workingCalendarNoDST cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.workingCalendar cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.workingCalendarNoDST cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.workingCalendar cannot be parameterized, because it has dependencies to/from statements that will be extracted
    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
    Preondition Violations
    Expression this.workingCalendarNoDST cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.workingCalendar cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.workingCalendar cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.workingCalendarNoDST cannot be parameterized, because it has dependencies to/from statements that will be extracted
    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 the extracted code, because it has control dependencies from statements that will be extracted
    6
    Date revisedDate = this.workingCalendarNoDST.getTime();
    6
    result = this.workingCalendar.getTime().getTime();
    6
    result = this.workingCalendar.getTime().getTime();
    Preondition Violations
    Unmatched statement result=this.workingCalendar.getTime().getTime(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                          
                                                                    
    7
    result = revisedDate.getTime();
    Preondition Violations
    Unmatched statement result=revisedDate.getTime(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7
    result = revisedDate.getTime();
    Precondition Violations (19)
    Row Violation
    1Expression this.workingCalendarNoDST cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression this.workingCalendar cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression this.workingCalendarNoDST cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression this.workingCalendar cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression this.workingCalendarNoDST cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression this.workingCalendar cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression this.workingCalendarNoDST cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression this.workingCalendar cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression this.workingCalendarNoDST cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression this.workingCalendar cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression this.workingCalendarNoDST cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression this.workingCalendar cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression this.workingCalendarNoDST cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression this.workingCalendar cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression this.workingCalendar cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Expression this.workingCalendarNoDST cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Unmatched statement Date revisedDate=this.workingCalendarNoDST.getTime(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    18Unmatched statement result=this.workingCalendar.getTime().getTime(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    19Unmatched statement result=revisedDate.getTime(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted