List values = new ArrayList(); values.add(new Double(1.0)); values.add(new Double(2.0)); values.add(new Double(3.0)); values.add(new Double(6.0)); values.add(new Double(5.0)); values.add(new Double(4.0)); double median = Statistics.calculateMedian(values); assertEquals(3.5, median, 0.0000001);
XYDataItem i1 = new XYDataItem(1.0, 1.1); XYDataItem i2 = new XYDataItem(1.0, 1.1); assertTrue(i1.equals(i2)); assertTrue(i2.equals(i1)); i1.setY(new Double(9.9)); assertFalse(i1.equals(i2)); i2.setY(new Double(9.9)); assertTrue(i1.equals(i2));
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/statistics/junit/StatisticsTests.java File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/XYDataItemTests.java
Method name: void testCalculateMedian3() Method name: void testEquals()
Number of AST nodes: 9 Number of AST nodes: 8
1
List values = new ArrayList();
2
        values.add(new Double(1.0));
3
        values.add(new Double(2.0));
4
        values.add(new Double(3.0
1
XYDataItem i1 = new XYDataItem(1.0, 1.1);
2
        XYDataItem i2 = new XYDataItem(1.0, 1.1);
3
        assertTrue(i1.equals(i2));
5
));
4
        assertTrue(i2.equals(i1));
6
        values.add(new Double(6.0));
5
        i1.setY(new Double(9.9));
7
        values.add(new Double(5.0));
6
        assertFalse(i1.equals(i2));
8
        values.add(new Double(4.0));
7
        i2.setY(new Double(9.9));
9
        double median = Statistics.calculateMedian(values);
8
        
10
        assertEquals(3.5, median, 0.0000001);
9
assertTrue(i1.equals(i2));
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 comparisons72
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment8
    Number of unmapped statements in the second code fragment7
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                      
    1
    XYDataItem i1 = new XYDataItem(1.0, 1.1);
    Preondition Violations
    Unmatched statement XYDataItem i1=new XYDataItem(1.0,1.1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    1
    XYDataItem i1 = new XYDataItem(1.0, 1.1);
    1
    List values = new ArrayList();
    1
    List values = new ArrayList();
    Preondition Violations
    Unmatched statement List values=new ArrayList(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                  
                                                                                      
    2
    XYDataItem i2 = new XYDataItem(1.0, 1.1);
    Preondition Violations
    Unmatched statement XYDataItem i2=new XYDataItem(1.0,1.1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2
    XYDataItem i2 = new XYDataItem(1.0, 1.1);
    2
    values.add(new Double(1.0));
    2
    values.add(new Double(1.0));
    Preondition Violations
    Unmatched statement values.add(new Double(1.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                  
    3
    values.add(new Double(2.0));
    3
    values.add(new Double(2.0));
    Preondition Violations
    Unmatched statement values.add(new Double(2.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                  
                                                              
    4
    assertTrue(i2.equals(i1));
    4
    values.add(new Double(3.0));
    4
    values.add(new Double(3.0));
    Preondition Violations
    Unmatched statement values.add(new Double(3.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                  
                                                            
    5
    i1.setY(new Double(9.9));
    Preondition Violations
    Unmatched statement i1.setY(new Double(9.9)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    i1.setY(new Double(9.9));
    5
    values.add(new Double(6.0));
    5
    values.add(new Double(6.0));
    Preondition Violations
    Unmatched statement values.add(new Double(6.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                  
                                                                
    6
    assertFalse(i1.equals(i2));
    6
    values.add(new Double(5.0));
    6
    values.add(new Double(5.0));
    Preondition Violations
    Unmatched statement values.add(new Double(5.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                  
                                                            
    7
    i2.setY(new Double(9.9));
    Preondition Violations
    Unmatched statement i2.setY(new Double(9.9)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7
    i2.setY(new Double(9.9));
    7
    values.add(new Double(4.0));
    7
    values.add(new Double(4.0));
    Preondition Violations
    Unmatched statement values.add(new Double(4.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                  
                                                              
    8
    assertTrue(i1.equals(i2));
    8
    double median = Statistics.calculateMedian(values);
                                                                                                            
    9
    assertEquals(3.5, median, 0.0000001);
    9
    assertEquals(3.5, median, 0.0000001);
    3
    assertTrue(i1.equals(i2));
    Differences
    Expression1Expression2Difference
    assertEqualsassertTrueMETHOD_INVOCATION_NAME_MISMATCH
    assertEquals(3.5,median,0.0000001)assertTrue(i1.equals(i2))ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression assertEquals(3.5,median,0.0000001) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertTrue(i1.equals(i2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals(3.5,median,0.0000001) is a void method call, and thus it cannot be parameterized
    Expression assertTrue(i1.equals(i2)) is a void method call, and thus it cannot be parameterized
    Expression assertEquals(3.5,median,0.0000001) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertTrue(i1.equals(i2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals(3.5,median,0.0000001) is a void method call, and thus it cannot be parameterized
    Expression assertTrue(i1.equals(i2)) is a void method call, and thus it cannot be parameterized
    3
    assertTrue(i1.equals(i2));
    Precondition Violations (19)
    Row Violation
    1Unmatched statement XYDataItem i1=new XYDataItem(1.0,1.1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement List values=new ArrayList(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement XYDataItem i2=new XYDataItem(1.0,1.1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement values.add(new Double(1.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement values.add(new Double(2.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched statement values.add(new Double(3.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7Unmatched statement i1.setY(new Double(9.9)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement values.add(new Double(6.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9Unmatched statement values.add(new Double(5.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    10Unmatched statement i2.setY(new Double(9.9)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    11Unmatched statement values.add(new Double(4.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    12Expression assertEquals(3.5,median,0.0000001) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression assertTrue(i1.equals(i2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression assertEquals(3.5,median,0.0000001) is a void method call, and thus it cannot be parameterized
    15Expression assertTrue(i1.equals(i2)) is a void method call, and thus it cannot be parameterized
    16Expression assertEquals(3.5,median,0.0000001) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression assertTrue(i1.equals(i2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Expression assertEquals(3.5,median,0.0000001) is a void method call, and thus it cannot be parameterized
    19Expression assertTrue(i1.equals(i2)) is a void method call, and thus it cannot be parameterized