int year = this.serialDate.getYYYY(); int month = this.serialDate.getMonth(); int day = this.serialDate.getDayOfMonth(); calendar.clear(); calendar.set(year, month - 1, day, 23, 59, 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 dom = this.day.getDayOfMonth(); calendar.set(year, month, dom, this.hour, 59, 59); calendar.set(Calendar.MILLISECOND, 999); //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/Day.java File path: /jfreechart-1.0.10/src/org/jfree/data/time/Hour.java
Method name: long getLastMillisecond(Calendar) Method name: long getLastMillisecond(Calendar)
Number of AST nodes: 7 Number of AST nodes: 6
1
int year = this.serialDate.getYYYY();
1
int year = this.day.getYear();
2
        int month = this.serialDate.getMonth();
2
        int month = this.day.getMonth() - 1;
3
        int day = this.serialDate.getDayOfMonth();
3
        int dom = this.day.getDayOfMonth();
4
        calendar.clear();
5
        calendar.set(year, month - 1, day, 23, 59, 59);
4
        calendar.set(year, month, dom, this.hour, 59, 59);
6
        calendar.set(Calendar.MILLISECOND, 999);
5
        calendar.set(Calendar.MILLISECOND, 999);
7
        //return calendar.getTimeInMillis();  // this won't work for JDK 1.3
6
        //return calendar.getTimeInMillis();  // this won't work for JDK 1.3
8
        return calendar.getTime().getTime();
7
        return calendar.getTime().getTime();
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.0
Clones locationClones are in different classes having the same super class
Number of node comparisons42
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                  
    1
    int year = this.day.getYear();
    1
    int year = this.serialDate.getYYYY();
                                                                                
    2
    int month = this.serialDate.getMonth();
    2
    int month = this.serialDate.getMonth();
    2
    int month = this.day.getMonth() - 1;
    Differences
    Expression1Expression2Difference
    this.serialDate.getMonth()this.day.getMonth() - 1TYPE_COMPATIBLE_REPLACEMENT
    2
    int month = this.day.getMonth() - 1;
    3
    int day = this.serialDate.getDayOfMonth();
    3
    int day = this.serialDate.getDayOfMonth();
    3
    int dom = this.day.getDayOfMonth();
    Differences
    Expression1Expression2Difference
    daydomVARIABLE_NAME_MISMATCH
    serialDatedayVARIABLE_NAME_MISMATCH
    org.jfree.date.SerialDateorg.jfree.data.time.DayVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.date.SerialDate of variable this.serialDate does not match with type org.jfree.data.time.Day of variable this.day
    • Make classes org.jfree.date.SerialDate and org.jfree.data.time.Day extend a common superclass
    3
    int dom = this.day.getDayOfMonth();
    4
    calendar.clear();
    4
    calendar.clear();
    4
    calendar.set(year, month, dom, this.hour, 59, 59);
    Differences
    Expression1Expression2Difference
    clearsetMETHOD_INVOCATION_NAME_MISMATCH
    calendar.clear()calendar.set(year,month,dom,this.hour,59,59)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression calendar.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression calendar.set(year,month,dom,this.hour,59,59) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression calendar.clear() is a void method call, and thus it cannot be parameterized
    Expression calendar.set(year,month,dom,this.hour,59,59) is a void method call, and thus it cannot be parameterized
    Expression calendar.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression calendar.set(year,month,dom,this.hour,59,59) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression calendar.clear() is a void method call, and thus it cannot be parameterized
    Expression calendar.set(year,month,dom,this.hour,59,59) is a void method call, and thus it cannot be parameterized
    4
    calendar.set(year, month, dom, this.hour, 59, 59);
    5
    calendar.set(year, month - 1, day, 23, 59, 59);
    5
    calendar.set(year, month - 1, day, 23, 59, 59);
    5
    calendar.set(Calendar.MILLISECOND, 999);
    Differences
    Expression1Expression2Difference
    calendar.set(year,month - 1,day,23,59,59)calendar.set(Calendar.MILLISECOND,999)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression calendar.set(year,month - 1,day,23,59,59) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression calendar.set(Calendar.MILLISECOND,999) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression calendar.set(year,month - 1,day,23,59,59) is a void method call, and thus it cannot be parameterized
    Expression calendar.set(Calendar.MILLISECOND,999) is a void method call, and thus it cannot be parameterized
    5
    calendar.set(Calendar.MILLISECOND, 999);
                                                                                  
    6
    return calendar.getTime().getTime();
    Preondition Violations
    Unmatched statement return calendar.getTime().getTime(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return calendar.getTime().getTime();
    6
    return calendar.getTime().getTime();
    6
    calendar.set(Calendar.MILLISECOND, 999);
    6
    calendar.set(Calendar.MILLISECOND, 999);
    Preondition Violations
    Unmatched statement calendar.set(Calendar.MILLISECOND,999); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                        
    7
    return calendar.getTime().getTime();
    7
    return calendar.getTime().getTime();
    Preondition Violations
    Unmatched statement return calendar.getTime().getTime(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return calendar.getTime().getTime();
                                                                                  
    Precondition Violations (18)
    Row Violation
    1Type org.jfree.date.SerialDate of variable this.serialDate does not match with type org.jfree.data.time.Day of variable this.day
    2Expression calendar.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression calendar.set(year,month,dom,this.hour,59,59) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression calendar.clear() is a void method call, and thus it cannot be parameterized
    5Expression calendar.set(year,month,dom,this.hour,59,59) is a void method call, and thus it cannot be parameterized
    6Expression calendar.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression calendar.set(year,month,dom,this.hour,59,59) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression calendar.clear() is a void method call, and thus it cannot be parameterized
    9Expression calendar.set(year,month,dom,this.hour,59,59) is a void method call, and thus it cannot be parameterized
    10Expression calendar.set(year,month - 1,day,23,59,59) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression calendar.set(Calendar.MILLISECOND,999) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression calendar.set(year,month - 1,day,23,59,59) is a void method call, and thus it cannot be parameterized
    13Expression calendar.set(Calendar.MILLISECOND,999) is a void method call, and thus it cannot be parameterized
    14Unmatched statement return calendar.getTime().getTime(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    15Unmatched return calendar.getTime().getTime();
    16Unmatched statement calendar.set(Calendar.MILLISECOND,999); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    17Unmatched statement return calendar.getTime().getTime(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    18Unmatched return calendar.getTime().getTime();