long result = date; 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(); } return result;
long result = date.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(); } return result;
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: 7 Number of AST nodes: 8
1
long result = date;
1
long result = date.getTime();
2
        if (this.adjustForDaylightSaving) {
2
        if (this.adjustForDaylightSaving) {
3
            this.workingCalendarNoDST.setTime(new Date(date));
3
            this.workingCalendar.setTime(date);
4
            this.workingCalendar.set(
4
            this.workingCalendarNoDST.set(
5
                this.workingCalendarNoDST.get(Calendar.YEAR),
5
                    this.workingCalendar.get(Calendar.YEAR),
6
                this.workingCalendarNoDST.get(Calendar.MONTH),
6
                    this.workingCalendar.get(Calendar.MONTH),
7
                this.workingCalendarNoDST.get(Calendar.DATE),
7
                    this.workingCalendar.get(Calendar.DATE),
8
                this.workingCalendarNoDST.get(Calendar.HOUR_OF_DAY),
8
                    this.workingCalendar.get(Calendar.HOUR_OF_DAY),
9
                this.workingCalendarNoDST.get(Calendar.MINUTE),
9
                    this.workingCalendar.get(Calendar.MINUTE),
10
                this.workingCalendarNoDST.get(Calendar.SECOND)
10
                    this.workingCalendar.get(Calendar.SECOND)
11
            );
11
);
12
            this.workingCalendar.set(Calendar.MILLISECOND,
12
            this.workingCalendarNoDST.set(Calendar.MILLISECOND,
13
                    this.workingCalendarNoDST.get(Calendar.MILLISECOND));
13
                    this.workingCalendar.get(Calendar.MILLISECOND));
14
            // result = this.workingCalendar.getTimeInMillis();
14
            Date revisedDate = this.workingCalendarNoDST.getTime();
15
            // preceding code won't work with JDK 1.3
15
            
16
            result = this.workingCalendar.getTime().getTime();
16
result = revisedDate.getTime();
17
        }
17
        }
18
        return result;
18
        return result;
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 comparisons34
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)20.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    long result = date;
    1
    long result = date;
    1
    long result = date.getTime();
    Differences
    Expression1Expression2Difference
    datedate.getTime()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression date.getTime() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    long result = date.getTime();
    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
    Preondition Violations
    Expression date cannot be parameterized, because it has dependencies to/from statements that will be extracted
    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 or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                          
                                                                    
    7
    result = revisedDate.getTime();
    Preondition Violations
    Unmatched statement result=revisedDate.getTime(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    result = revisedDate.getTime();
    7
    return result;
    8
    return result;
    Precondition Violations (21)
    Row Violation
    1Expression date.getTime() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression date 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.workingCalendarNoDST cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Expression this.workingCalendar cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression this.workingCalendar cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Expression this.workingCalendarNoDST cannot be parameterized, because it has dependencies to/from statements that will be extracted
    19Unmatched statement Date revisedDate=this.workingCalendarNoDST.getTime(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    20Unmatched statement result=this.workingCalendar.getTime().getTime(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    21Unmatched statement result=revisedDate.getTime(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted