int year = this.day.getYear(); int month = this.day.getMonth() - 1; int day = this.day.getDayOfMonth(); calendar.clear(); calendar.set(year, month, day, this.hour, this.minute, 59); calendar.set(Calendar.MILLISECOND, 999); //return calendar.getTimeInMillis(); // this won't work for JDK 1.3 return calendar.getTime().getTime();
int year = this.day.getYear(); int month = this.day.getMonth() - 1; int day = this.day.getDayOfMonth(); calendar.clear(); calendar.set(year, month, day, this.hour, this.minute, this.second); calendar.set(Calendar.MILLISECOND, 0); //return calendar.getTimeInMillis(); // this won't work for JDK 1.3 return calendar.getTime().getTime();
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/time/Minute.java File path: /jfreechart-1.0.10/src/org/jfree/data/time/Second.java
Method name: long getLastMillisecond(Calendar) Method name: long getFirstMillisecond(Calendar)
Number of AST nodes: 7 Number of AST nodes: 7
1
int year = this.day.getYear();
1
int year = this.day.getYear();
2
        int month = this.day.getMonth() - 1;
2
        int month = this.day.getMonth() - 1;
3
        int day = this.day.getDayOfMonth();
3
        int day = this.day.getDayOfMonth();
4
        calendar.clear();
4
        calendar.clear();
5
        calendar.set(year, month, day, this.hour, this.minute, 59);
5
        calendar.set(year, month, day, this.hour, this.minute, this.second);
6
        calendar.set(Calendar.MILLISECOND, 999);
6
        calendar.set(Calendar.MILLISECOND, 
7
0);
7
        //return calendar.getTimeInMillis();  // this won't work for JDK 1.3
8
        //return calendar.getTimeInMillis();  // this won't work for JDK 1.3
8
        return calendar.getTime().getTime();
9
        return calendar.getTime().getTime();
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.0
Clones locationClones are in different classes having the same super class
Number of node comparisons49
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    int year = this.day.getYear();
    1
    int year = this.day.getYear();
    2
    int month = this.day.getMonth() - 1;
    2
    int month = this.day.getMonth() - 1;
    3
    int day = this.day.getDayOfMonth();
    3
    int day = this.day.getDayOfMonth();
    4
    calendar.clear();
    4
    calendar.clear();
                                                                                                                                        
    5
    calendar.set(year, month, day, this.hour, this.minute, this.second);
    Preondition Violations
    Unmatched statement calendar.set(year,month,day,this.hour,this.minute,this.second); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    calendar.set(year, month, day, this.hour, this.minute, this.second);
    5
    calendar.set(year, month, day, this.hour, this.minute, 59);
    5
    calendar.set(year, month, day, this.hour, this.minute, 59);
    Preondition Violations
    Unmatched statement calendar.set(year,month,day,this.hour,this.minute,59); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                      
    6
    calendar.set(Calendar.MILLISECOND, 999);
    6
    calendar.set(Calendar.MILLISECOND, 999);
    6
    calendar.set(Calendar.MILLISECOND, 0);
    Differences
    Expression1Expression2Difference
    9990LITERAL_VALUE_MISMATCH
    6
    calendar.set(Calendar.MILLISECOND, 0);
    7
    return calendar.getTime().getTime();
    7
    return calendar.getTime().getTime();
    Precondition Violations (2)
    Row Violation
    1Unmatched statement calendar.set(year,month,day,this.hour,this.minute,this.second); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement calendar.set(year,month,day,this.hour,this.minute,59); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted