Number result = null; int row = getRowIndex(rowKey); TaskSeries series = (TaskSeries) this.data.get(row); Task task = series.get(columnKey.toString()); if (task != null) { TimePeriod duration = task.getDuration(); if (duration != null) { result = new Long(duration.getStart().getTime()); } } return result;
Number result = null; int row = getRowIndex(rowKey); TaskSeries series = (TaskSeries) this.data.get(row); Task task = series.get(columnKey.toString()); if (task != null) { Task sub = task.getSubtask(subinterval); if (sub != null) { result = sub.getPercentComplete(); } } return result;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/gantt/TaskSeriesCollection.java File path: /jfreechart-1.0.10/src/org/jfree/data/gantt/TaskSeriesCollection.java
Method name: Number getStartValue(Comparable, Comparable) Method name: Number getPercentComplete(Comparable, Comparable, int)
Number of AST nodes: 9 Number of AST nodes: 9
1
Number result = null;
1
Number result = null;
2
        int row = getRowIndex(rowKey);
2
        int row = getRowIndex(rowKey);
3
        TaskSeries series = (TaskSeries) this.data.get(row);
3
        TaskSeries series = (TaskSeries) this.data.get(row);
4
        Task task = series.get(columnKey.toString());
4
        Task task = series.get(columnKey.toString());
5
        if (task != null) {
5
        if (task != null) {
6
            TimePeriod duration = task.getDuration();
6
            Task sub = task.getSubtask(subinterval);
7
            if (duration != null) {
7
            if (sub != null) {
8
                result = new Long(duration.getStart().getTime());
8
                result = sub.getPercentComplete();
9
            }
9
            }
10
        }
10
        }
11
        return result;
11
        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.2
Clones locationClones are declared in the same class
Number of node comparisons33
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)63.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Number result = null;
    1
    Number result = null;
    2
    int row = getRowIndex(rowKey);
    2
    int row = getRowIndex(rowKey);
    3
    TaskSeries series = (TaskSeries)this.data.get(row);
    3
    TaskSeries series = (TaskSeries)this.data.get(row);
    4
    Task task = series.get(columnKey.toString());
    4
    Task task = series.get(columnKey.toString());
    5
    if (task != null)
    5
    if (task != null)
                                                                                      
    6
    Task sub = task.getSubtask(subinterval);
    Preondition Violations
    Unmatched statement Task sub=task.getSubtask(subinterval); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    Task sub = task.getSubtask(subinterval);
    6
    TimePeriod duration = task.getDuration();
    6
    TimePeriod duration = task.getDuration();
    Preondition Violations
    Unmatched statement TimePeriod duration=task.getDuration(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                        
    7
    if (duration != null)
    7
    if (duration != null)
    7
    if (sub != null)
    Differences
    Expression1Expression2Difference
    durationsubVARIABLE_NAME_MISMATCH
    org.jfree.data.time.TimePeriodorg.jfree.data.gantt.TaskVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.data.time.TimePeriod of variable duration does not match with type org.jfree.data.gantt.Task of variable sub
    • Make classes org.jfree.data.time.TimePeriod and org.jfree.data.gantt.Task extend a common superclass
    7
    if (sub != null)
    8
    result = new Long(duration.getStart().getTime());
    8
    result = new Long(duration.getStart().getTime());
    8
    result = sub.getPercentComplete();
    Differences
    Expression1Expression2Difference
    java.lang.Longjava.lang.DoubleSUBCLASS_TYPE_MISMATCH
    new Long(duration.getStart().getTime())sub.getPercentComplete()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression new Long(duration.getStart().getTime()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression sub.getPercentComplete() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    result = sub.getPercentComplete();
    9
    return result;
    9
    return result;
    Precondition Violations (5)
    Row Violation
    1Unmatched statement Task sub=task.getSubtask(subinterval); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement TimePeriod duration=task.getDuration(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type org.jfree.data.time.TimePeriod of variable duration does not match with type org.jfree.data.gantt.Task of variable sub
    4Expression new Long(duration.getStart().getTime()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression sub.getPercentComplete() cannot be parameterized, because it has dependencies to/from statements that will be extracted