if (c.getType().equals(IComponent.TYPE.TODO)) { ITodo todo = (ITodo) c; Calendar startDate = todo.getDtStart(); Calendar endDate = todo.getDue(); IDateRange dr = new DateRange(startDate, endDate); if (dateRange.equals(dr)) result.add(id); } else throw new IllegalArgumentException( "unsupported component type " + c.getType());
if (c.getType().equals(IComponent.TYPE.TODO)) { ITodo todo = (ITodo) c; Calendar sd = todo.getDtStart(); Calendar endDate = todo.getDue(); IDateRange dr = new DateRange(startDate, endDate); if (startDate.equals(sd)) result.add(id); } else throw new IllegalArgumentException( "unsupported component type " + c.getType());
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/calendar/src/main/java/org/columba/calendar/store/LocalCalendarStore.java File path: /columba-1.4-src/calendar/src/main/java/org/columba/calendar/store/LocalCalendarStore.java
Method name: Iterator findByDateRange(IDateRange) Method name: Iterator findByStartDate(Calendar)
Number of AST nodes: 8 Number of AST nodes: 8
1
if (c.getType().equals(IComponent.TYPE.TODO)) {
1
if (c.getType().equals(IComponent.TYPE.TODO)) {
2
				ITodo todo = (ITodo) c;
2
				ITodo todo = (ITodo) c;
3
				Calendar startDate = todo.getDtStart();
3
				Calendar sd = todo.getDtStart();
4
				Calendar endDate = todo.getDue();
4
				Calendar endDate = todo.getDue();
5
				IDateRange dr = new DateRange(startDate, endDate);
5
				IDateRange dr = new DateRange(startDate, endDate);
6
				if (dateRange.equals(dr))
6
				if (startDate.equals(sd))
7
					result.add(id);
7
					result.add(id);
8
			} else
8
			} else
9
				throw new IllegalArgumentException(
9
				throw new IllegalArgumentException(
10
						"unsupported component type " + c.getType());
10
						"unsupported component type " + c.getType());
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.8
Clones locationClones are declared in the same class
Number of node comparisons41
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    13
    else if (c.getType().equals(IComponent.TYPE.TODO))
    11
    else if (c.getType().equals(IComponent.TYPE.TODO))
    14
    ITodo todo = (ITodo)c;
    12
    ITodo todo = (ITodo)c;
    15
    Calendar startDate = todo.getDtStart();
    15
    Calendar startDate = todo.getDtStart();
    13
    Calendar sd = todo.getDtStart();
    Differences
    Expression1Expression2Difference
    startDatesdVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression startDate cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression sd cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13
    Calendar sd = todo.getDtStart();
    16
    Calendar endDate = todo.getDue();
    14
    Calendar endDate = todo.getDue();
    17
    IDateRange dr = new DateRange(startDate, endDate);
    15
    IDateRange dr = new DateRange(startDate, endDate);
    18
    if (dateRange.equals(dr))
    18
    if (dateRange.equals(dr))
    16
    if (startDate.equals(sd))
    Differences
    Expression1Expression2Difference
    drsdVARIABLE_NAME_MISMATCH
    org.columba.calendar.model.api.IDateRangejava.util.CalendarVARIABLE_TYPE_MISMATCH
    dateRangestartDateVARIABLE_NAME_MISMATCH
    org.columba.calendar.model.api.IDateRangejava.util.CalendarVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression dr cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression sd cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.columba.calendar.model.api.IDateRange of variable dr does not match with type java.util.Calendar of variable sd
    • Make classes org.columba.calendar.model.api.IDateRange and java.util.Calendar extend a common superclass
    Type org.columba.calendar.model.api.IDateRange of variable dateRange does not match with type java.util.Calendar of variable startDate
    • Make classes org.columba.calendar.model.api.IDateRange and java.util.Calendar extend a common superclass
    16
    if (startDate.equals(sd))
    19
    result.add(id);
    17
    result.add(id);
    else
    else
    20
    throw new IllegalArgumentException("unsupported component type " + c.getType());
    18
    throw new IllegalArgumentException("unsupported component type " + c.getType());
    Precondition Violations (6)
    Row Violation
    1Expression startDate cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression sd cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression dr cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression sd cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Type org.columba.calendar.model.api.IDateRange of variable dr does not match with type java.util.Calendar of variable sd
    6Type org.columba.calendar.model.api.IDateRange of variable dateRange does not match with type java.util.Calendar of variable startDate