TaskSeriesCollection result = new TaskSeriesCollection(); TaskSeries s1 = new TaskSeries("S1"); Task t1 = new Task("Task 1", new Date(10), new Date(20)); t1.addSubtask(new Task("Task 1A", new Date(10), new Date(15))); t1.addSubtask(new Task("Task 1B", new Date(16), new Date(20))); t1.setPercentComplete(0.10); s1.add(t1); Task t2 = new Task("Task 2", new Date(30), new Date(40)); t2.addSubtask(new Task("Task 2A", new Date(30), new Date(35))); t2.addSubtask(new Task("Task 2B", new Date(36), new Date(40))); t2.setPercentComplete(0.20); s1.add(t2); result.add(s1); TaskSeries s2 = new TaskSeries("S2"); Task t3 = new Task("Task 3", new Date(50), new Date(60)); t3.addSubtask(new Task("Task 3A", new Date(50), new Date(55))); t3.addSubtask(new Task("Task 3B", new Date(56), new Date(60))); t3.setPercentComplete(0.30); s2.add(t3); result.add(s2); return result;
TaskSeries s1 = new TaskSeries("S"); s1.add(new Task("T1", new Date(1), new Date(2))); s1.add(new Task("T2", new Date(11), new Date(22))); TaskSeries s2 = new TaskSeries("S"); s2.add(new Task("T1", new Date(1), new Date(2))); s2.add(new Task("T2", new Date(11), new Date(22))); TaskSeriesCollection c1 = new TaskSeriesCollection(); c1.add(s1); c1.add(s2); TaskSeries s1b = new TaskSeries("S"); s1b.add(new Task("T1", new Date(1), new Date(2))); s1b.add(new Task("T2", new Date(11), new Date(22))); TaskSeries s2b = new TaskSeries("S"); s2b.add(new Task("T1", new Date(1), new Date(2))); s2b.add(new Task("T2", new Date(11), new Date(22))); TaskSeriesCollection c2 = new TaskSeriesCollection(); c2.add(s1b); c2.add(s2b); assertTrue(c1.equals(c2)); assertTrue(c2.equals(c1));
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/gantt/junit/TaskSeriesCollectionTests.java File path: /jfreechart-1.0.10/tests/org/jfree/data/gantt/junit/TaskSeriesCollectionTests.java
Method name: TaskSeriesCollection createCollection2() Method name: void testEquals()
Number of AST nodes: 21 Number of AST nodes: 20
1
TaskSeriesCollection result = new TaskSeriesCollection();
1
TaskSeries
2
        TaskSeries s1 = new TaskSeries("S1"
2
 s1 = new TaskSeries("S");
3
);
3
        s1.add(new Task("T1", new Date(1), new Date(2)));
4
        Task t1 = new Task("Task 1", new Date(10), new Date(20));
4
        s1.add(new Task("T2", new Date(11), new Date(22)));
5
        t1.addSubtask(new Task("Task 1A
5
        TaskSeries s2 = new TaskSeries("S");
6
", new Date(10), new Date(15)));
6
        s2.add(new Task("T1", new Date(1), new Date(2)));
7
        t1.addSubtask(new Task("Task 1B", new Date(16), new Date(20)));
7
        s2.add(new Task("T2", new Date(11), new Date(22)));
8
        t1.setPercentComplete(0.10);
8
        TaskSeriesCollection c1 = new TaskSeriesCollection();
9
        s1.add(t1);
9
        c1.add(s1);
10
        Task t2 = new Task("Task 2", new Date(30), new Date(40)
10
        c1.add(s2);
11
);
11
        TaskSeries s1b = new TaskSeries("S");
12
        t2.addSubtask(new Task("Task 2A", new Date(30), new Date(35)));
12
        s1b.add(new Task("T1", new Date(1), new Date(2)));
13
        t2.addSubtask(new Task("Task 2B", new Date(36), new Date(40)));
13
        s1b.add(new Task("T2", new Date(11), new Date(
14
        t2.setPercentComplete(0.20);
15
        s1.add(t2);
16
        result.add(s1);
14
22)));
17
        TaskSeries s2 = new TaskSeries("S2");
15
        TaskSeries s2b = new TaskSeries("S");
18
        Task t3 = new Task("Task 3", new Date(50), new Date(60));
16
        s2b.add(new Task("T1", new Date(1), new Date(2)));
19
        t3.addSubtask(new Task("Task 3A", new Date(50), new Date(55)));
17
        s2b.add(new Task("T2", new Date(11), new Date(22)));
20
        t3.addSubtask(new Task("Task 3B", new Date(56), new Date(60)));
18
        
21
        t3.setPercentComplete(0.30
19
TaskSeriesCollection c2 = new TaskSeriesCollection();
22
);
20
        c2.add(s1b);
23
        s2.add(t3);
21
        c2.add(s2b);
24
        result.add(s2);
22
        
25
        return result
23
assertTrue(c1.equals(c2));
26
;
24
        assertTrue(c2.equals(c1));
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 declared in the same class
Number of node comparisons258
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment12
    Number of unmapped statements in the second code fragment11
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    TaskSeriesCollection result = new TaskSeriesCollection();
    1
    TaskSeriesCollection result = new TaskSeriesCollection();
    7
    TaskSeriesCollection c1 = new TaskSeriesCollection();
    Differences
    Expression1Expression2Difference
    resultc1VARIABLE_NAME_MISMATCH
    7
    TaskSeriesCollection c1 = new TaskSeriesCollection();
    2
    TaskSeries s1 = new TaskSeries("S1");
    2
    TaskSeries s1 = new TaskSeries("S1");
    1
    TaskSeries s1 = new TaskSeries("S");
    Differences
    Expression1Expression2Difference
    "S1""S"LITERAL_VALUE_MISMATCH
    1
    TaskSeries s1 = new TaskSeries("S");
    3
    Task t1 = new Task("Task 1", new Date(10), new Date(20));
    3
    Task t1 = new Task("Task 1", new Date(10), new Date(20));
    16
    TaskSeriesCollection c2 = new TaskSeriesCollection();
    Differences
    Expression1Expression2Difference
    org.jfree.data.gantt.Taskorg.jfree.data.gantt.TaskSeriesCollectionSUBCLASS_TYPE_MISMATCH
    t1c2VARIABLE_NAME_MISMATCH
    org.jfree.data.gantt.Taskorg.jfree.data.gantt.TaskSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.gantt.Taskorg.jfree.data.gantt.TaskSeriesCollectionSUBCLASS_TYPE_MISMATCH
    new Task("Task 1",new Date(10),new Date(20))new TaskSeriesCollection()ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression new Task("Task 1",new Date(10),new Date(20)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new TaskSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new Task("Task 1",new Date(10),new Date(20)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new TaskSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16
    TaskSeriesCollection c2 = new TaskSeriesCollection();
    4
    t1.addSubtask(new Task("Task 1A", new Date(10), new Date(15)));
    4
    t1.addSubtask(new Task("Task 1A", new Date(10), new Date(15)));
    Preondition Violations
    Unmatched statement t1.addSubtask(new Task("Task 1A",new Date(10),new Date(15))); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                    
    5
    t1.addSubtask(new Task("Task 1B", new Date(16), new Date(20)));
    5
    t1.addSubtask(new Task("Task 1B", new Date(16), new Date(20)));
    Preondition Violations
    Unmatched statement t1.addSubtask(new Task("Task 1B",new Date(16),new Date(20))); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                    
    6
    t1.setPercentComplete(0.10);
    6
    t1.setPercentComplete(0.10);
    Preondition Violations
    Unmatched statement t1.setPercentComplete(0.10); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                  
    7
    s1.add(t1);
    7
    s1.add(t1);
    2
    s1.add(new Task("T1", new Date(1), new Date(2)));
    Differences
    Expression1Expression2Difference
    t1new Task("T1",new Date(1),new Date(2))TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression t1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    s1.add(new Task("T1", new Date(1), new Date(2)));
                                                                              
    4
    TaskSeries s2 = new TaskSeries("S");
    Preondition Violations
    Unmatched statement TaskSeries s2=new TaskSeries("S"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4
    TaskSeries s2 = new TaskSeries("S");
                                                                                                        
    5
    s2.add(new Task("T1", new Date(1), new Date(2)));
    Preondition Violations
    Unmatched statement s2.add(new Task("T1",new Date(1),new Date(2))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    s2.add(new Task("T1", new Date(1), new Date(2)));
                                                                                                            
    6
    s2.add(new Task("T2", new Date(11), new Date(22)));
    Preondition Violations
    Unmatched statement s2.add(new Task("T2",new Date(11),new Date(22))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6
    s2.add(new Task("T2", new Date(11), new Date(22)));
    8
    Task t2 = new Task("Task 2", new Date(30), new Date(40));
    8
    Task t2 = new Task("Task 2", new Date(30), new Date(40));
    Preondition Violations
    Unmatched statement Task t2=new Task("Task 2",new Date(30),new Date(40)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                    
    9
    t2.addSubtask(new Task("Task 2A", new Date(30), new Date(35)));
    9
    t2.addSubtask(new Task("Task 2A", new Date(30), new Date(35)));
    Preondition Violations
    Unmatched statement t2.addSubtask(new Task("Task 2A",new Date(30),new Date(35))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                    
    10
    t2.addSubtask(new Task("Task 2B", new Date(36), new Date(40)));
    10
    t2.addSubtask(new Task("Task 2B", new Date(36), new Date(40)));
    Preondition Violations
    Unmatched statement t2.addSubtask(new Task("Task 2B",new Date(36),new Date(40))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                      
    11
    t2.setPercentComplete(0.20);
    11
    t2.setPercentComplete(0.20);
    Preondition Violations
    Unmatched statement t2.setPercentComplete(0.20); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                    
    12
    s1.add(t2);
    12
    s1.add(t2);
    3
    s1.add(new Task("T2", new Date(11), new Date(22)));
    Differences
    Expression1Expression2Difference
    t2new Task("T2",new Date(11),new Date(22))TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression t2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    s1.add(new Task("T2", new Date(11), new Date(22)));
    13
    result.add(s1);
    13
    result.add(s1);
    8
    c1.add(s1);
    Differences
    Expression1Expression2Difference
    resultc1VARIABLE_NAME_MISMATCH
    8
    c1.add(s1);
                                                                                  
    10
    TaskSeries s1b = new TaskSeries("S");
    Preondition Violations
    Unmatched statement TaskSeries s1b=new TaskSeries("S"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    10
    TaskSeries s1b = new TaskSeries("S");
                                                                                                            
    11
    s1b.add(new Task("T1", new Date(1), new Date(2)));
    Preondition Violations
    Unmatched statement s1b.add(new Task("T1",new Date(1),new Date(2))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    11
    s1b.add(new Task("T1", new Date(1), new Date(2)));
                                                                                                                
    12
    s1b.add(new Task("T2", new Date(11), new Date(22)));
    Preondition Violations
    Unmatched statement s1b.add(new Task("T2",new Date(11),new Date(22))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    12
    s1b.add(new Task("T2", new Date(11), new Date(22)));
    14
    TaskSeries s2 = new TaskSeries("S2");
    14
    TaskSeries s2 = new TaskSeries("S2");
    13
    TaskSeries s2b = new TaskSeries("S");
    Differences
    Expression1Expression2Difference
    s2s2bVARIABLE_NAME_MISMATCH
    "S2""S"LITERAL_VALUE_MISMATCH
    13
    TaskSeries s2b = new TaskSeries("S");
                                                                                                            
    14
    s2b.add(new Task("T1", new Date(1), new Date(2)));
    Preondition Violations
    Unmatched statement s2b.add(new Task("T1",new Date(1),new Date(2))); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    14
    s2b.add(new Task("T1", new Date(1), new Date(2)));
                                                                                                                
    15
    s2b.add(new Task("T2", new Date(11), new Date(22)));
    Preondition Violations
    Unmatched statement s2b.add(new Task("T2",new Date(11),new Date(22))); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    15
    s2b.add(new Task("T2", new Date(11), new Date(22)));
    15
    Task t3 = new Task("Task 3", new Date(50), new Date(60));
    15
    Task t3 = new Task("Task 3", new Date(50), new Date(60));
    Preondition Violations
    Unmatched statement Task t3=new Task("Task 3",new Date(50),new Date(60)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                      
    16
    t3.addSubtask(new Task("Task 3A", new Date(50), new Date(55)));
    16
    t3.addSubtask(new Task("Task 3A", new Date(50), new Date(55)));
    Preondition Violations
    Unmatched statement t3.addSubtask(new Task("Task 3A",new Date(50),new Date(55))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                      
                                    
    17
    c2.add(s1b);
    Preondition Violations
    Unmatched statement c2.add(s1b); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    17
    c2.add(s1b);
    17
    t3.addSubtask(new Task("Task 3B", new Date(56), new Date(60)));
    17
    t3.addSubtask(new Task("Task 3B", new Date(56), new Date(60)));
    Preondition Violations
    Unmatched statement t3.addSubtask(new Task("Task 3B",new Date(56),new Date(60))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                      
    18
    t3.setPercentComplete(0.30);
    18
    t3.setPercentComplete(0.30);
    Preondition Violations
    Unmatched statement t3.setPercentComplete(0.30); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                    
    19
    s2.add(t3);
    19
    s2.add(t3);
    18
    c2.add(s2b);
    Differences
    Expression1Expression2Difference
    t3s2bVARIABLE_NAME_MISMATCH
    org.jfree.data.gantt.Taskorg.jfree.data.gantt.TaskSeriesVARIABLE_TYPE_MISMATCH
    s2c2VARIABLE_NAME_MISMATCH
    org.jfree.data.gantt.TaskSeriesorg.jfree.data.gantt.TaskSeriesCollectionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression t3 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s2b cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.jfree.data.gantt.Task of variable t3 does not match with type org.jfree.data.gantt.TaskSeries of variable s2b
    • Make classes org.jfree.data.gantt.Task and org.jfree.data.gantt.TaskSeries extend a common superclass
    Expression s2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression c2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.jfree.data.gantt.TaskSeries of variable s2 does not match with type org.jfree.data.gantt.TaskSeriesCollection of variable c2
    • Make classes org.jfree.data.gantt.TaskSeries and org.jfree.data.gantt.TaskSeriesCollection extend a common superclass
    18
    c2.add(s2b);
    20
    result.add(s2);
    20
    result.add(s2);
    9
    c1.add(s2);
    Differences
    Expression1Expression2Difference
    resultc1VARIABLE_NAME_MISMATCH
    9
    c1.add(s2);
                                                                
    19
    assertTrue(c1.equals(c2));
    Preondition Violations
    Unmatched statement assertTrue(c1.equals(c2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    19
    assertTrue(c1.equals(c2));
                                                                
    20
    assertTrue(c2.equals(c1));
    Preondition Violations
    Unmatched statement assertTrue(c2.equals(c1)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    20
    assertTrue(c2.equals(c1));
    21
    return result;
    21
    return result;
    Preondition Violations
    Unmatched statement return result; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return result;
                                        
    Precondition Violations (37)
    Row Violation
    1Expression new Task("Task 1",new Date(10),new Date(20)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new TaskSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new Task("Task 1",new Date(10),new Date(20)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression new TaskSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Unmatched statement t1.addSubtask(new Task("Task 1A",new Date(10),new Date(15))); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement t1.addSubtask(new Task("Task 1B",new Date(16),new Date(20))); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement t1.setPercentComplete(0.10); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Expression t1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Unmatched statement TaskSeries s2=new TaskSeries("S"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    10Unmatched statement s2.add(new Task("T1",new Date(1),new Date(2))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    11Unmatched statement s2.add(new Task("T2",new Date(11),new Date(22))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    12Unmatched statement Task t2=new Task("Task 2",new Date(30),new Date(40)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    13Unmatched statement t2.addSubtask(new Task("Task 2A",new Date(30),new Date(35))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    14Unmatched statement t2.addSubtask(new Task("Task 2B",new Date(36),new Date(40))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    15Unmatched statement t2.setPercentComplete(0.20); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    16Expression t2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Unmatched statement TaskSeries s1b=new TaskSeries("S"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    18Unmatched statement s1b.add(new Task("T1",new Date(1),new Date(2))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    19Unmatched statement s1b.add(new Task("T2",new Date(11),new Date(22))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    20Unmatched statement s2b.add(new Task("T1",new Date(1),new Date(2))); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    21Unmatched statement s2b.add(new Task("T2",new Date(11),new Date(22))); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    22Unmatched statement Task t3=new Task("Task 3",new Date(50),new Date(60)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    23Unmatched statement t3.addSubtask(new Task("Task 3A",new Date(50),new Date(55))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    24Unmatched statement c2.add(s1b); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    25Unmatched statement t3.addSubtask(new Task("Task 3B",new Date(56),new Date(60))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    26Unmatched statement t3.setPercentComplete(0.30); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    27Expression t3 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    28Expression s2b cannot be parameterized, because it has dependencies to/from statements that will be extracted
    29Type org.jfree.data.gantt.Task of variable t3 does not match with type org.jfree.data.gantt.TaskSeries of variable s2b
    30Expression s2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    31Expression c2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    32Type org.jfree.data.gantt.TaskSeries of variable s2 does not match with type org.jfree.data.gantt.TaskSeriesCollection of variable c2
    33Unmatched statement assertTrue(c1.equals(c2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    34Unmatched statement assertTrue(c2.equals(c1)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    35Unmatched statement return result; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    36Unmatched return result;
    37Clone fragment #1 returns variables result , while Clone fragment #2 returns variables s2b, c2, c1