XYPlot plot = new XYPlot(); XYTextAnnotation a1 = new XYTextAnnotation("X", 1.0, 2.0); XYTextAnnotation a2 = new XYTextAnnotation("X", 3.0, 4.0); XYTextAnnotation a3 = new XYTextAnnotation("X", 1.0, 2.0); plot.addAnnotation(a1); plot.addAnnotation(a2); plot.addAnnotation(a3); plot.removeAnnotation(a2); XYTextAnnotation x = (XYTextAnnotation) plot.getAnnotations().get(0); assertEquals(x, a1); // now remove a3, but since a3.equals(a1), this will in fact remove // a1... assertTrue(a1.equals(a3)); plot.removeAnnotation(a3); // actually removes a1 x = (XYTextAnnotation) plot.getAnnotations().get(0); assertEquals(x, a3);
XIntervalSeriesCollection c1 = new XIntervalSeriesCollection(); XIntervalSeriesCollection c2 = new XIntervalSeriesCollection(); assertEquals(c1, c2); // add a series XIntervalSeries s1 = new XIntervalSeries("Series"); s1.add(1.0, 1.1, 1.2, 1.3); c1.addSeries(s1); assertFalse(c1.equals(c2)); XIntervalSeries s2 = new XIntervalSeries("Series"); s2.add(1.0, 1.1, 1.2, 1.3); c2.addSeries(s2); assertTrue(c1.equals(c2)); // add an empty series c1.addSeries(new XIntervalSeries("Empty Series")); assertFalse(c1.equals(c2)); c2.addSeries(new XIntervalSeries("Empty Series")); assertTrue(c1.equals(c2));
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/XYPlotTests.java File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/XIntervalSeriesCollectionTests.java
Method name: void testRemoveAnnotation() Method name: void testEquals()
Number of AST nodes: 14 Number of AST nodes: 15
1
XYPlot plot = new XYPlot();
1
X
2
        XYTextAnnota
2
IntervalSeriesCollection c1 = new XIntervalSeriesCollection();
3
tion a1 = new XYTextAnnotation("X", 1.0, 2.0);
3
        XIntervalSeriesCollection c2 = new X
4
        XYTextAnnotation a2 = new XYTextAnnotation("X", 3.0, 4.0);
5
        XYTextAnnotation a3 = new XYTextAnnotation("X", 1.0, 2.0);
6
        plot.addAnnotation(a1);
7
        plot.addAnnotation(a2);
8
        plot.addAnnotation(a3);
9
        plot.removeAnnotation(a2);
10
        XYTextAnnotation x = (XYTextAnnotation) plot.getAnnotations().get(0
4
IntervalSeriesCollection();
5
        assertEquals(c1, c2);
6
        // add a series
7
        XIntervalSeries s1 = new XIntervalSeries("Series");
8
        s1.add(1.0, 1.1, 1.2, 1.3);
9
        c1.addSeries(s1);
10
        assertFalse(c1.equals(c2));
11
        XIntervalSeries s2 = new XIntervalSeries("Series");
12
        s2.add(1.0, 1.1, 1.2, 1.3);
11
);
13
        c2.addSeries(s2);
12
        assertEquals(x, a1);
14
        assert
13
        
14
        // now remove a3, but since a3.equals(a1), this will in fact remove 
15
        // a1...
15
True(c1.equals(c2));
16
        // add an empty series
17
        c1.addSeries(new XIntervalSeries("Empty Series"));
16
        assertTrue(a1.equals(a3));
18
        assertFalse(c1.equals(c2));
17
        plot.removeAnnotation(a3);  // actually removes a1
19
        
18
        x = (XYTextAnnotation) plot.getAnnotations().get(0);
20
c2.addSeries(new XIntervalSeries("Empty Series"));
19
        assertEquals(x, a3);
21
        assertTrue(c1.equals(c2));
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 comparisons185
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment9
    Number of unmapped statements in the second code fragment10
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    XYPlot plot = new XYPlot();
    1
    XYPlot plot = new XYPlot();
    1
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.XYPlotorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    plotc1VARIABLE_NAME_MISMATCH
    org.jfree.chart.plot.XYPlotorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.XYPlotorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new XYPlot() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XIntervalSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    2
    XYTextAnnotation a1 = new XYTextAnnotation("X", 1.0, 2.0);
    2
    XYTextAnnotation a1 = new XYTextAnnotation("X", 1.0, 2.0);
    2
    XIntervalSeriesCollection c2 = new XIntervalSeriesCollection();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    a1c2VARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    new XYTextAnnotation("X",1.0,2.0)new XIntervalSeriesCollection()ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression new XYTextAnnotation("X",1.0,2.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XIntervalSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYTextAnnotation("X",1.0,2.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XIntervalSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    XIntervalSeriesCollection c2 = new XIntervalSeriesCollection();
    3
    XYTextAnnotation a2 = new XYTextAnnotation("X", 3.0, 4.0);
    3
    XYTextAnnotation a2 = new XYTextAnnotation("X", 3.0, 4.0);
    Preondition Violations
    Unmatched statement XYTextAnnotation a2=new XYTextAnnotation("X",3.0,4.0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                      
                                                                                                            
    4
    XIntervalSeries s1 = new XIntervalSeries("Series");
    4
    XYTextAnnotation a3 = new XYTextAnnotation("X", 1.0, 2.0);
    4
    XYTextAnnotation a3 = new XYTextAnnotation("X", 1.0, 2.0);
    Preondition Violations
    Unmatched statement XYTextAnnotation a3=new XYTextAnnotation("X",1.0,2.0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                      
                                                          
    5
    s1.add(1.0, 1.1, 1.2, 1.3);
    Preondition Violations
    Unmatched statement s1.add(1.0,1.1,1.2,1.3); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    s1.add(1.0, 1.1, 1.2, 1.3);
    5
    plot.addAnnotation(a1);
    5
    plot.addAnnotation(a1);
    Preondition Violations
    Unmatched statement plot.addAnnotation(a1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                        
                                            
    6
    c1.addSeries(s1);
    Preondition Violations
    Unmatched statement c1.addSeries(s1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    c1.addSeries(s1);
    6
    plot.addAnnotation(a2);
    6
    plot.addAnnotation(a2);
    Preondition Violations
    Unmatched statement plot.addAnnotation(a2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                        
                                                                
    7
    assertFalse(c1.equals(c2));
    Preondition Violations
    Unmatched statement assertFalse(c1.equals(c2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    assertFalse(c1.equals(c2));
    7
    plot.addAnnotation(a3);
    7
    plot.addAnnotation(a3);
    Preondition Violations
    Unmatched statement plot.addAnnotation(a3); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                        
                                                                                                            
    8
    XIntervalSeries s2 = new XIntervalSeries("Series");
    8
    plot.removeAnnotation(a2);
    8
    plot.removeAnnotation(a2);
    Preondition Violations
    Unmatched statement plot.removeAnnotation(a2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                              
    9
    XYTextAnnotation x = (XYTextAnnotation)plot.getAnnotations().get(0);
    9
    XYTextAnnotation x = (XYTextAnnotation)plot.getAnnotations().get(0);
    Preondition Violations
    Unmatched statement XYTextAnnotation x=(XYTextAnnotation)plot.getAnnotations().get(0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                              
    10
    assertEquals(x, a1);
    10
    assertEquals(x, a1);
    3
    assertEquals(c1, c2);
    Differences
    Expression1Expression2Difference
    xc1VARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    a1c2VARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression c1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression x cannot be unified with expression c1 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public static void assertEquals(java.lang.Object, java.lang.Object)
    Expression a1 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
    Expression a1 cannot be unified with expression c2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public static void assertEquals(java.lang.Object, java.lang.Object)
    3
    assertEquals(c1, c2);
                                                          
    9
    s2.add(1.0, 1.1, 1.2, 1.3);
    Preondition Violations
    Unmatched statement s2.add(1.0,1.1,1.2,1.3); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9
    s2.add(1.0, 1.1, 1.2, 1.3);
                                              
    10
    c2.addSeries(s2);
    Preondition Violations
    Unmatched statement c2.addSeries(s2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    c2.addSeries(s2);
    11
    assertTrue(a1.equals(a3));
    11
    assertTrue(a1.equals(a3));
    11
    assertTrue(c1.equals(c2));
    Differences
    Expression1Expression2Difference
    a3c2VARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    a1c1VARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression a3 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
    Expression a3 cannot be unified with expression c2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object)
    Expression a3 cannot be unified with expression c2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    Expression a1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression c1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression a1 cannot be unified with expression c1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    11
    assertTrue(c1.equals(c2));
                                                                                                                
    12
    c1.addSeries(new XIntervalSeries("Empty Series"));
    Preondition Violations
    Unmatched statement c1.addSeries(new XIntervalSeries("Empty Series")); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12
    c1.addSeries(new XIntervalSeries("Empty Series"));
    12
    plot.removeAnnotation(a3);
    12
    plot.removeAnnotation(a3);
    Preondition Violations
    Unmatched statement plot.removeAnnotation(a3); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                
    13
    x = (XYTextAnnotation)plot.getAnnotations().get(0);
    13
    x = (XYTextAnnotation)plot.getAnnotations().get(0);
    Preondition Violations
    Unmatched statement x=(XYTextAnnotation)plot.getAnnotations().get(0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                              
    14
    assertEquals(x, a3);
    14
    assertEquals(x, a3);
    13
    assertFalse(c1.equals(c2));
    Differences
    Expression1Expression2Difference
    assertEqualsassertFalseMETHOD_INVOCATION_NAME_MISMATCH
    assertEquals(x,a3)assertFalse(c1.equals(c2))ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression assertEquals(x,a3) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertFalse(c1.equals(c2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals(x,a3) is a void method call, and thus it cannot be parameterized
    Expression assertFalse(c1.equals(c2)) is a void method call, and thus it cannot be parameterized
    Expression assertEquals(x,a3) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertFalse(c1.equals(c2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals(x,a3) is a void method call, and thus it cannot be parameterized
    Expression assertFalse(c1.equals(c2)) is a void method call, and thus it cannot be parameterized
    13
    assertFalse(c1.equals(c2));
                                                                                                                
    14
    c2.addSeries(new XIntervalSeries("Empty Series"));
    Preondition Violations
    Unmatched statement c2.addSeries(new XIntervalSeries("Empty Series")); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    14
    c2.addSeries(new XIntervalSeries("Empty Series"));
                                                                
    15
    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
    15
    assertTrue(c1.equals(c2));
    Precondition Violations (45)
    Row Violation
    1Expression new XYPlot() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new XIntervalSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new XYTextAnnotation("X",1.0,2.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression new XIntervalSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression new XYTextAnnotation("X",1.0,2.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression new XIntervalSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Unmatched statement XYTextAnnotation a2=new XYTextAnnotation("X",3.0,4.0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8Unmatched statement XYTextAnnotation a3=new XYTextAnnotation("X",1.0,2.0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9Unmatched statement s1.add(1.0,1.1,1.2,1.3); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    10Unmatched statement plot.addAnnotation(a1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11Unmatched statement c1.addSeries(s1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12Unmatched statement plot.addAnnotation(a2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13Unmatched statement assertFalse(c1.equals(c2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    14Unmatched statement plot.addAnnotation(a3); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    15Unmatched statement plot.removeAnnotation(a2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    16Unmatched statement XYTextAnnotation x=(XYTextAnnotation)plot.getAnnotations().get(0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    17Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Expression c1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    19Expression x cannot be unified with expression c1 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public static void assertEquals(java.lang.Object, java.lang.Object)
    20Expression a1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    21Expression c2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    22Expression a1 cannot be unified with expression c2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public static void assertEquals(java.lang.Object, java.lang.Object)
    23Unmatched statement s2.add(1.0,1.1,1.2,1.3); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    24Unmatched statement c2.addSeries(s2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    25Expression a3 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    26Expression c2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    27Expression a3 cannot be unified with expression c2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object)
    28Expression a3 cannot be unified with expression c2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    29Expression a1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    30Expression c1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    31Expression a1 cannot be unified with expression c1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object)
    32Unmatched statement c1.addSeries(new XIntervalSeries("Empty Series")); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    33Unmatched statement plot.removeAnnotation(a3); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    34Unmatched statement x=(XYTextAnnotation)plot.getAnnotations().get(0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    35Expression assertEquals(x,a3) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    36Expression assertFalse(c1.equals(c2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    37Expression assertEquals(x,a3) is a void method call, and thus it cannot be parameterized
    38Expression assertFalse(c1.equals(c2)) is a void method call, and thus it cannot be parameterized
    39Expression assertEquals(x,a3) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    40Expression assertFalse(c1.equals(c2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    41Expression assertEquals(x,a3) is a void method call, and thus it cannot be parameterized
    42Expression assertFalse(c1.equals(c2)) is a void method call, and thus it cannot be parameterized
    43Unmatched statement c2.addSeries(new XIntervalSeries("Empty Series")); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    44Unmatched 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
    45Clone fragment #1 returns variables plot, a1 , while Clone fragment #2 returns variables c1, c2