256-1-3

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) { TimePeriod duration = sub.getDuration(); result = new Long(duration.getEnd().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 getEndValue(Comparable, Comparable, int)` |  | Method name: `Number getPercentComplete(Comparable, Comparable, int)`
Number of AST nodes: 10 |  | 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

                Task sub = task.getSubtask(subinterval);↵

6

                Task sub = task.getSubtask(subinterval);↵

7

                if (sub != null) {↵

7

                if (sub != null) {↵

8

                    TimePeriod duration = sub.getDuration();↵

8

                    ↵

9

                    result = new Long(duration.getEnd().getTime());↵

9

    result = sub.getPercentComplete();↵

10

                }↵

10

                }↵

11

            }↵

11

            }↵

12

            return result;

12

            return result;

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1
Clones location | Clones are declared in the same class
Number of node comparisons | 35

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 9
   Number of unmapped statements in the first code fragment | 1
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 1.6
   Clone type | Type 3

   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);

   6

       Task sub = task.getSubtask(subinterval);

   7

       if (sub != null)

   7

       if (sub != null)

   8

       TimePeriod duration = sub.getDuration();

   8 | TimePeriod duration = sub.getDuration();

   Preondition Violations
   Unmatched statement TimePeriod duration=sub.getDuration(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   9

       result = new Long(duration.getEnd().getTime());

   9 | result = new Long(duration.getEnd().getTime());
   8 | result = sub.getPercentComplete();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   new Long(duration.getEnd().getTime()) | sub.getPercentComplete() | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression sub.getPercentComplete() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   8

       result = sub.getPercentComplete();

   10

       return result;

   9

       return result;

   Precondition Violations (3)
   Row | Violation
   --- | ---
   1 | Unmatched statement TimePeriod duration=sub.getDuration(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   2 | Expression sub.getPercentComplete() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Clone fragment #1 returns variables sub , while Clone fragment #2 returns variables