CyclicNumberAxis a1 = new CyclicNumberAxis(10, 0, "Test Axis"); CyclicNumberAxis a2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(a1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); a2 = (CyclicNumberAxis) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(a1, a2);
DateAxis axis = new DateAxis("Test Axis"); Date date = new Date(); axis.setMaximumDate(date); assertEquals(date, axis.getMaximumDate()); // check that setting the max date to something on or before the // current min date works... Date d1 = new Date(); Date d2 = new Date(d1.getTime() + 1); Date d0 = new Date(d1.getTime() - 1); axis.setMaximumDate(d2); axis.setMinimumDate(d1); axis.setMaximumDate(d1); assertEquals(d0, axis.getMinimumDate());
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/CyclicNumberAxisTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/DateAxisTests.java
Method name: void testSerialization() Method name: void testSetMaximumDate()
Number of AST nodes: 11 Number of AST nodes: 11
1
CyclicNumberAxis a1 = new CyclicNumberAxis(10, 0, "Test Axis");
1
DateAxis axis = new 
2
        CyclicNumberAxis a2 = null;
3
        try {
4
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
5
            ObjectOutput out = new ObjectOutputStream(buffer);
6
            out.writeObject(a1);
7
            out.clos
2
DateAxis("Test Axis");
3
        Date date = new Date();
4
        axis.setMaximumDate(date);
5
        assertEquals(date, axis.getMaximumDate());
6
        // check that setting the max date to something on or before the 
7
        // current min date works...
8
e();
8
        Date d1 = new Date();
9
            ObjectInput in = new ObjectInputStream(
9
        
10
                new ByteArrayInputStream(buffer.toByteArray())
11
            
10
Date d2 = new Date(d1.getTime() + 1);
12
);
11
        Date d0 = new Date(d1.getTime() - 1);
13
            a2 = (CyclicNumberAxis) in.readObject();
12
        
14
            in.close(
13
axis.setMaximumDate(d2);
15
);
14
        axis.setMinimumDate(d1);
16
        }
15
      
17
        catch (Exception e) {
18
            System.out.println(e.toString());
19
        }
16
  axis.setMaximumDate(d1);
20
        assertEquals(a1, a2);
17
        assertEquals(d0, axis.getMinimumDate());
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 comparisons29
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    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
    CyclicNumberAxis a1 = new CyclicNumberAxis(10, 0, "Test Axis");
    1
    CyclicNumberAxis a1 = new CyclicNumberAxis(10, 0, "Test Axis");
    1
    DateAxis axis = new DateAxis("Test Axis");
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CyclicNumberAxisorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    a1axisVARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.CyclicNumberAxisorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CyclicNumberAxisorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    new CyclicNumberAxis(10,0,"Test Axis")new DateAxis("Test Axis")ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression new CyclicNumberAxis(10,0,"Test Axis") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new DateAxis("Test Axis") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new CyclicNumberAxis(10,0,"Test Axis") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new DateAxis("Test Axis") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    DateAxis axis = new DateAxis("Test Axis");
                                                    
    2
    Date date = new Date();
    2
    CyclicNumberAxis a2 = null;
                                                            
                                                              
    3
    axis.setMaximumDate(date);
    Preondition Violations
    Unmatched statement axis.setMaximumDate(date); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    axis.setMaximumDate(date);
                                                                                            
    4
    assertEquals(date, axis.getMaximumDate());
    Preondition Violations
    Unmatched statement assertEquals(date,axis.getMaximumDate()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    assertEquals(date, axis.getMaximumDate());
                                                
    5
    Date d1 = new Date();
                                                                                
    6
    Date d2 = new Date(d1.getTime() + 1);
    Preondition Violations
    Unmatched statement Date d2=new Date(d1.getTime() + 1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6
    Date d2 = new Date(d1.getTime() + 1);
                                                                                
    7
    Date d0 = new Date(d1.getTime() - 1);
    Preondition Violations
    Unmatched statement Date d0=new Date(d1.getTime() - 1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7
    Date d0 = new Date(d1.getTime() - 1);
                                                          
    8
    axis.setMaximumDate(d2);
    Preondition Violations
    Unmatched statement axis.setMaximumDate(d2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    axis.setMaximumDate(d2);
                                                          
    9
    axis.setMinimumDate(d1);
    Preondition Violations
    Unmatched statement axis.setMinimumDate(d1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9
    axis.setMinimumDate(d1);
                                                            
    10
    axis.setMaximumDate(d1);
    Preondition Violations
    Unmatched statement axis.setMaximumDate(d1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    axis.setMaximumDate(d1);
                                                                                          
    11
    assertEquals(d0, axis.getMinimumDate());
    Preondition Violations
    Unmatched statement assertEquals(d0,axis.getMinimumDate()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11
    assertEquals(d0, axis.getMinimumDate());
    11
    assertEquals(a1, a2);
    11
    assertEquals(a1, a2);
    Preondition Violations
    Unmatched statement assertEquals(a1,a2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                    
    Precondition Violations (14)
    Row Violation
    1Expression new CyclicNumberAxis(10,0,"Test Axis") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new DateAxis("Test Axis") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new CyclicNumberAxis(10,0,"Test Axis") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression new DateAxis("Test Axis") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Unmatched statement axis.setMaximumDate(date); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement assertEquals(date,axis.getMaximumDate()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement Date d2=new Date(d1.getTime() + 1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8Unmatched statement Date d0=new Date(d1.getTime() - 1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9Unmatched statement axis.setMaximumDate(d2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10Unmatched statement axis.setMinimumDate(d1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11Unmatched statement axis.setMaximumDate(d1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12Unmatched statement assertEquals(d0,axis.getMinimumDate()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13Unmatched statement assertEquals(a1,a2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    14Clone fragment #1 returns variable a1 with type org.jfree.chart.axis.CyclicNumberAxis , while Clone fragment #2 returns variable axis with type org.jfree.chart.axis.DateAxis