StrokeMap m1 = new StrokeMap(); StrokeMap m2 = null; try { m2 = (StrokeMap) m1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(m1.equals(m2)); m1.put("K1", new BasicStroke(1.1f)); m1.put("K2", new BasicStroke(2.2f)); try { m2 = (StrokeMap) m1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(m1.equals(m2));
XYSeriesCollection dataset = null; assertTrue(DatasetUtilities.isEmptyOrNull(dataset)); dataset = new XYSeriesCollection(); assertTrue(DatasetUtilities.isEmptyOrNull(dataset)); XYSeries s1 = new XYSeries("S1"); dataset.addSeries(s1); assertTrue(DatasetUtilities.isEmptyOrNull(dataset)); s1.add(1.0, 2.0); assertFalse(DatasetUtilities.isEmptyOrNull(dataset)); s1.clear(); assertTrue(DatasetUtilities.isEmptyOrNull(dataset));
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/junit/StrokeMapTests.java File path: /jfreechart-1.0.10/tests/org/jfree/data/general/junit/DatasetUtilitiesTests.java
Method name: void testCloning() Method name: void testIsEmptyOrNullXYDataset()
Number of AST nodes: 10 Number of AST nodes: 11
1
StrokeMap m1 = new StrokeMap();
2
        StrokeMap m2 = null;
3
        try {
4
            m2 = (StrokeMap) m1.clone();
5
        }
6
        catch (CloneNotSupportedException e) {
7
            e.printStackTrace
1
XYSeriesCollection dataset = null;
2
        assertTrue(DatasetUtilities.isEmptyOrNull(dataset));
8
();
3
        dataset = new XYSeriesCollection();
9
        }
10
        assertTrue(m1.equals(m2));
4
        assertTrue(
11
        
12
        m1.put("K1", new BasicStroke(1.1f));
13
        m1.put("K2", new BasicStroke(2.2f));
14
        try {
15
            m2 = (StrokeMap) m1.clone();
16
        }
17
        catch (CloneNotSupportedException e) {
18
            e.printStackTrace();
19
        }
20
        assertTrue(m1.equals(m2
5
DatasetUtilities.isEmptyOrNull(dataset));
6
        XYSeries s1 = new XYSeries("S1");
7
        dataset.addSeries(s1);
8
        assertTrue(DatasetUtilities.isEmptyOrNull(dataset));
9
        s1.add(1.0, 2.0);
10
        assertFalse(DatasetUtilities.isEmptyOrNull(dataset));
11
        s1.clear();
21
));
12
        assertTrue(DatasetUtilities.isEmptyOrNull(dataset));
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 comparisons66
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment9
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                          
    1
    XYSeriesCollection dataset = null;
    1
    StrokeMap m1 = new StrokeMap();
    1
    StrokeMap m1 = new StrokeMap();
    Preondition Violations
    Unmatched statement StrokeMap m1=new StrokeMap(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                    
                                                                                                                  
    2
    assertTrue(DatasetUtilities.isEmptyOrNull(dataset));
    2
    StrokeMap m2 = null;
                                              
                                                                            
    3
    dataset = new XYSeriesCollection();
    Preondition Violations
    Unmatched statement dataset=new XYSeriesCollection(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    dataset = new XYSeriesCollection();
                                                                                                                  
    4
    assertTrue(DatasetUtilities.isEmptyOrNull(dataset));
                                                                        
    5
    XYSeries s1 = new XYSeries("S1");
    Preondition Violations
    Unmatched statement XYSeries s1=new XYSeries("S1"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    XYSeries s1 = new XYSeries("S1");
                                                      
    6
    dataset.addSeries(s1);
    Preondition Violations
    Unmatched statement dataset.addSeries(s1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6
    dataset.addSeries(s1);
    5
    assertTrue(m1.equals(m2));
    5
    assertTrue(m1.equals(m2));
    7
    assertTrue(DatasetUtilities.isEmptyOrNull(dataset));
    Differences
    Expression1Expression2Difference
    m1.equals(m2)DatasetUtilities.isEmptyOrNull(dataset)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression m1.equals(m2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression DatasetUtilities.isEmptyOrNull(dataset) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7
    assertTrue(DatasetUtilities.isEmptyOrNull(dataset));
    6
    m1.put("K1", new BasicStroke(1.1f));
    6
    m1.put("K1", new BasicStroke(1.1f));
    Preondition Violations
    Unmatched statement m1.put("K1",new BasicStroke(1.1f)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                
    7
    m1.put("K2", new BasicStroke(2.2f));
    7
    m1.put("K2", new BasicStroke(2.2f));
    Preondition Violations
    Unmatched statement m1.put("K2",new BasicStroke(2.2f)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                
                                          
    8
    s1.add(1.0, 2.0);
    Preondition Violations
    Unmatched statement s1.add(1.0,2.0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8
    s1.add(1.0, 2.0);
                                                                                                                    
    9
    assertFalse(DatasetUtilities.isEmptyOrNull(dataset));
                                  
    10
    s1.clear();
    Preondition Violations
    Unmatched statement s1.clear(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    10
    s1.clear();
    10
    assertTrue(m1.equals(m2));
    10
    assertTrue(m1.equals(m2));
    11
    assertTrue(DatasetUtilities.isEmptyOrNull(dataset));
    Differences
    Expression1Expression2Difference
    m1.equals(m2)DatasetUtilities.isEmptyOrNull(dataset)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression m1.equals(m2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression DatasetUtilities.isEmptyOrNull(dataset) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11
    assertTrue(DatasetUtilities.isEmptyOrNull(dataset));
    Precondition Violations (12)
    Row Violation
    1Unmatched statement StrokeMap m1=new StrokeMap(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement dataset=new XYSeriesCollection(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement XYSeries s1=new XYSeries("S1"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement dataset.addSeries(s1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Expression m1.equals(m2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression DatasetUtilities.isEmptyOrNull(dataset) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Unmatched statement m1.put("K1",new BasicStroke(1.1f)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement m1.put("K2",new BasicStroke(2.2f)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched statement s1.add(1.0,2.0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    10Unmatched statement s1.clear(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    11Expression m1.equals(m2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression DatasetUtilities.isEmptyOrNull(dataset) cannot be parameterized, because it has dependencies to/from statements that will be extracted