CategoryAxis a1 = new CategoryAxis("Test"); a1.setTickLabelFont("C1", new Font("Dialog", Font.PLAIN, 15)); a1.setTickLabelPaint("C1", new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.white)); CategoryAxis a2 = null; try { a2 = (CategoryAxis) a1.clone(); } catch (CloneNotSupportedException e) { System.err.println("Failed to clone."); } assertTrue(a1 != a2); assertTrue(a1.getClass() == a2.getClass()); assertTrue(a1.equals(a2)); // check that changing a tick label font in a1 doesn't change a2 a1.setTickLabelFont("C1", null); assertFalse(a1.equals(a2)); a2.setTickLabelFont("C1", null); assertTrue(a1.equals(a2)); // check that changing a tick label paint in a1 doesn't change a2 a1.setTickLabelPaint("C1", Color.yellow); assertFalse(a1.equals(a2)); a2.setTickLabelPaint("C1", Color.yellow); assertTrue(a1.equals(a2)); // check that changing a category label tooltip in a1 doesn't change a2 a1.addCategoryLabelToolTip("C1", "XYZ"); assertFalse(a1.equals(a2)); a2.addCategoryLabelToolTip("C1", "XYZ"); assertTrue(a1.equals(a2));
ExtendedCategoryAxis a1 = new ExtendedCategoryAxis("Test"); a1.setTickLabelFont("C1", new Font("Dialog", Font.PLAIN, 15)); a1.setTickLabelPaint("C1", new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.white)); ExtendedCategoryAxis a2 = null; try { a2 = (ExtendedCategoryAxis) a1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(a1 != a2); assertTrue(a1.getClass() == a2.getClass()); assertTrue(a1.equals(a2)); // check that changing a tick label font in a1 doesn't change a2 a1.setTickLabelFont("C1", null); assertFalse(a1.equals(a2)); a2.setTickLabelFont("C1", null); assertTrue(a1.equals(a2)); // check that changing a tick label paint in a1 doesn't change a2 a1.setTickLabelPaint("C1", Color.yellow); assertFalse(a1.equals(a2)); a2.setTickLabelPaint("C1", Color.yellow); assertTrue(a1.equals(a2)); // check that changing a category label tooltip in a1 doesn't change a2 a1.addCategoryLabelToolTip("C1", "XYZ"); assertFalse(a1.equals(a2)); a2.addCategoryLabelToolTip("C1", "XYZ"); assertTrue(a1.equals(a2));
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/CategoryAxisTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/ExtendedCategoryAxisTests.java
Method name: void testCloning2() Method name: void testCloning2()
Number of AST nodes: 21 Number of AST nodes: 21
1
CategoryAxis a1 = new CategoryAxis("Test");
1
ExtendedCategoryAxis a1 = new ExtendedCategoryAxis("Test");
2
        a1.setTickLabelFont("C1", new Font("Dialog", Font.PLAIN, 15));
2
        a1.setTickLabelFont("C1", new Font("Dialog", Font.PLAIN, 15));
3
        a1.setTickLabelPaint("C1", new GradientPaint(1.0f, 2.0f, Color.red, 
3
        a1.setTickLabelPaint("C1", new GradientPaint(1.0f, 2.0f, Color.red, 
4
                3.0f, 4.0f, Color.white));
4
                3.0f, 4.0f, Color.white));
5
        CategoryAxis a2 = null;
5
        ExtendedCategoryAxis a2 = null;
6
        try {
6
        try {
7
            a2 = (CategoryAxis) a1.clone();
7
            a2 = (ExtendedCategoryAxis) a1.clone();
8
        }
8
        }
9
        catch (CloneNotSupportedException e) {
9
        catch (CloneNotSupportedException e) {
10
            System.err.println("Failed to clone.");
10
            e.printStackTrace();
11
        }
11
        }
12
        assertTrue(a1 != a2);
12
        assertTrue(a1 != a2);
13
        assertTrue(a1.getClass() == a2.getClass());
13
        assertTrue(a1.getClass() == a2.getClass());
14
        assertTrue(a1.equals(a2));
14
        assertTrue(a1.equals(a2));
15
        
15
        
16
        // check that changing a tick label font in a1 doesn't change a2
16
        // check that changing a tick label font in a1 doesn't change a2
17
        a1.setTickLabelFont("C1", null);
17
        a1.setTickLabelFont("C1", null);
18
        assertFalse(a1.equals(a2));
18
        assertFalse(a1.equals(a2));
19
        a2.setTickLabelFont("C1", null);
19
        a2.setTickLabelFont("C1", null);
20
        assertTrue(a1.equals(a2));
20
        assertTrue(a1.equals(a2));
21
        
21
        
22
        // check that changing a tick label paint in a1 doesn't change a2
22
        // check that changing a tick label paint in a1 doesn't change a2
23
        a1.setTickLabelPaint("C1", Color.yellow);
23
        a1.setTickLabelPaint("C1", Color.yellow);
24
        assertFalse(a1.equals(a2));
24
        assertFalse(a1.equals(a2));
25
        a2.setTickLabelPaint("C1", Color.yellow);
25
        a2.setTickLabelPaint("C1", Color.yellow);
26
        assertTrue(a1.equals(a2));
26
        assertTrue(a1.equals(a2));
27
        // check that changing a category label tooltip in a1 doesn't change a2
27
        // check that changing a category label tooltip in a1 doesn't change a2
28
        a1.addCategoryLabelToolTip("C1", "XYZ");
28
        a1.addCategoryLabelToolTip("C1", "XYZ");
29
        assertFalse(a1.equals(a2));
29
        assertFalse(a1.equals(a2));
30
        a2.addCategoryLabelToolTip("C1", "XYZ");
30
        a2.addCategoryLabelToolTip("C1", "XYZ");
31
        assertTrue(a1.equals(a2));
31
        assertTrue(a1.equals(a2));
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.4
Clones locationClones are in different classes having the same super class
Number of node comparisons127
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements21
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)119.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    CategoryAxis a1 = new CategoryAxis("Test");
    1
    CategoryAxis a1 = new CategoryAxis("Test");
    1
    ExtendedCategoryAxis a1 = new ExtendedCategoryAxis("Test");
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new CategoryAxis("Test") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new ExtendedCategoryAxis("Test") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    ExtendedCategoryAxis a1 = new ExtendedCategoryAxis("Test");
    2
    a1.setTickLabelFont("C1", new Font("Dialog", Font.PLAIN, 15));
    2
    a1.setTickLabelFont("C1", new Font("Dialog", Font.PLAIN, 15));
    2
    a1.setTickLabelFont("C1", new Font("Dialog", Font.PLAIN, 15));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    2
    a1.setTickLabelFont("C1", new Font("Dialog", Font.PLAIN, 15));
    3
    a1.setTickLabelPaint("C1", new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.white));
    3
    a1.setTickLabelPaint("C1", new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.white));
    3
    a1.setTickLabelPaint("C1", new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.white));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    3
    a1.setTickLabelPaint("C1", new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.white));
    4
    CategoryAxis a2 = null;
    4
    CategoryAxis a2 = null;
    4
    ExtendedCategoryAxis a2 = null;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    4
    ExtendedCategoryAxis a2 = null;
    5
    try
    5
    try
    5
    try
    Differences
    Expression1Expression2Difference
    printlnprintStackTraceMETHOD_INVOCATION_NAME_MISMATCH
    System.erreAST_TYPE_MISMATCH
    System.err.println("Failed to clone.")e.printStackTrace()ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression System.err.println("Failed to clone.") is a void method call, and thus it cannot be parameterized
    Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized
    Expression e cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression System.err.println("Failed to clone.") is a void method call, and thus it cannot be parameterized
    Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized
    5
    try
    6
    a2 = (CategoryAxis)a1.clone();
    6
    a2 = (CategoryAxis)a1.clone();
    6
    a2 = (ExtendedCategoryAxis)a1.clone();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (CategoryAxis)a1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (ExtendedCategoryAxis)a1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    a2 = (ExtendedCategoryAxis)a1.clone();
    7
    assertTrue(a1 != a2);
    7
    assertTrue(a1 != a2);
    7
    assertTrue(a1 != a2);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    7
    assertTrue(a1 != a2);
    8
    assertTrue(a1.getClass() == a2.getClass());
    8
    assertTrue(a1.getClass() == a2.getClass());
    8
    assertTrue(a1.getClass() == a2.getClass());
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    8
    assertTrue(a1.getClass() == a2.getClass());
    9
    assertTrue(a1.equals(a2));
    9
    assertTrue(a1.equals(a2));
    9
    assertTrue(a1.equals(a2));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    9
    assertTrue(a1.equals(a2));
    10
    a1.setTickLabelFont("C1", null);
    10
    a1.setTickLabelFont("C1", null);
    10
    a1.setTickLabelFont("C1", null);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    10
    a1.setTickLabelFont("C1", null);
    11
    assertFalse(a1.equals(a2));
    11
    assertFalse(a1.equals(a2));
    11
    assertFalse(a1.equals(a2));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    11
    assertFalse(a1.equals(a2));
    12
    a2.setTickLabelFont("C1", null);
    12
    a2.setTickLabelFont("C1", null);
    12
    a2.setTickLabelFont("C1", null);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    12
    a2.setTickLabelFont("C1", null);
    13
    assertTrue(a1.equals(a2));
    13
    assertTrue(a1.equals(a2));
    13
    assertTrue(a1.equals(a2));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    13
    assertTrue(a1.equals(a2));
    14
    a1.setTickLabelPaint("C1", Color.yellow);
    14
    a1.setTickLabelPaint("C1", Color.yellow);
    14
    a1.setTickLabelPaint("C1", Color.yellow);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    14
    a1.setTickLabelPaint("C1", Color.yellow);
    15
    assertFalse(a1.equals(a2));
    15
    assertFalse(a1.equals(a2));
    15
    assertFalse(a1.equals(a2));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    15
    assertFalse(a1.equals(a2));
    16
    a2.setTickLabelPaint("C1", Color.yellow);
    16
    a2.setTickLabelPaint("C1", Color.yellow);
    16
    a2.setTickLabelPaint("C1", Color.yellow);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    16
    a2.setTickLabelPaint("C1", Color.yellow);
    17
    assertTrue(a1.equals(a2));
    17
    assertTrue(a1.equals(a2));
    17
    assertTrue(a1.equals(a2));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    17
    assertTrue(a1.equals(a2));
    18
    a1.addCategoryLabelToolTip("C1", "XYZ");
    18
    a1.addCategoryLabelToolTip("C1", "XYZ");
    18
    a1.addCategoryLabelToolTip("C1", "XYZ");
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    18
    a1.addCategoryLabelToolTip("C1", "XYZ");
    19
    assertFalse(a1.equals(a2));
    19
    assertFalse(a1.equals(a2));
    19
    assertFalse(a1.equals(a2));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    19
    assertFalse(a1.equals(a2));
    20
    a2.addCategoryLabelToolTip("C1", "XYZ");
    20
    a2.addCategoryLabelToolTip("C1", "XYZ");
    20
    a2.addCategoryLabelToolTip("C1", "XYZ");
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    20
    a2.addCategoryLabelToolTip("C1", "XYZ");
    21
    assertTrue(a1.equals(a2));
    21
    assertTrue(a1.equals(a2));
    21
    assertTrue(a1.equals(a2));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.ExtendedCategoryAxisSUBCLASS_TYPE_MISMATCH
    21
    assertTrue(a1.equals(a2));
    Precondition Violations (11)
    Row Violation
    1Expression new CategoryAxis("Test") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new ExtendedCategoryAxis("Test") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression System.err.println("Failed to clone.") is a void method call, and thus it cannot be parameterized
    5Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized
    6Expression e cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression System.err.println("Failed to clone.") is a void method call, and thus it cannot be parameterized
    9Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized
    10Expression (CategoryAxis)a1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression (ExtendedCategoryAxis)a1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted