CategoryAxis domainAxis1 = new CategoryAxis("X1"); CategoryAxis domainAxis2 = new CategoryAxis("X2"); NumberAxis rangeAxis1 = new NumberAxis("Y1"); CategoryPlot plot = new CategoryPlot(null, domainAxis1, rangeAxis1, null); assertEquals(0, plot.getDomainAxisIndex(domainAxis1)); assertEquals(-1, plot.getDomainAxisIndex(domainAxis2)); plot.setDomainAxis(1, domainAxis2); assertEquals(1, plot.getDomainAxisIndex(domainAxis2)); assertEquals(-1, plot.getDomainAxisIndex(new CategoryAxis("X2"))); boolean pass = false; try { plot.getDomainAxisIndex(null); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass);
CategoryAxis domainAxis1 = new CategoryAxis("X1"); NumberAxis rangeAxis1 = new NumberAxis("Y1"); NumberAxis rangeAxis2 = new NumberAxis("Y2"); CategoryPlot plot = new CategoryPlot(null, domainAxis1, rangeAxis1, null); assertEquals(0, plot.getRangeAxisIndex(rangeAxis1)); assertEquals(-1, plot.getRangeAxisIndex(rangeAxis2)); plot.setRangeAxis(1, rangeAxis2); assertEquals(1, plot.getRangeAxisIndex(rangeAxis2)); assertEquals(-1, plot.getRangeAxisIndex(new NumberAxis("Y2"))); boolean pass = false; try { plot.getRangeAxisIndex(null); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/CategoryPlotTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/CategoryPlotTests.java
Method name: void testGetDomainAxisIndex() Method name: void testGetRangeAxisIndex()
Number of AST nodes: 13 Number of AST nodes: 13
1
CategoryAxis domainAxis1 = new CategoryAxis("X1");
1
CategoryAxis domainAxis1 = new CategoryAxis("X1");
2
        CategoryAxis domainAxis2 = new CategoryAxis("X2");
2
        NumberAxis rangeAxis1 = new NumberAxis("Y1");
3
        NumberAxis rangeAxis1 = new NumberAxis("Y1");
3
        NumberAxis rangeAxis2 = new NumberAxis("Y2");
4
        CategoryPlot plot = new CategoryPlot(null, domainAxis1, rangeAxis1,
4
        CategoryPlot plot = new CategoryPlot(null, domainAxis1, rangeAxis1,
5
                null);
5
                null);
6
        assertEquals(0, plot.getDomainAxisIndex(domainAxis1));
6
        assertEquals(0, plot.getRangeAxisIndex(rangeAxis1));
7
        assertEquals(-1, plot.getDomainAxisIndex(domainAxis2));
7
        assertEquals(-1, plot.getRangeAxisIndex(rangeAxis2));
8
        plot.setDomainAxis(1, domainAxis2);
8
        plot.setRangeAxis(1, rangeAxis2);
9
        assertEquals(1, plot.getDomainAxisIndex(domainAxis2));
9
        assertEquals(1, plot.getRangeAxisIndex(rangeAxis2));
10
        assertEquals(-1, plot.getDomainAxisIndex(new CategoryAxis("X2")));
10
        assertEquals(-1, plot.getRangeAxisIndex(new NumberAxis("Y2")));
11
        boolean pass = false;
11
        boolean pass = false;
12
        try {
12
        try {
13
            plot.getDomainAxisIndex(null);
13
            plot.getRangeAxisIndex(null);
14
        }
14
        }
15
        catch (IllegalArgumentException e) {
15
        catch (IllegalArgumentException e) {
16
            pass = true;
16
            pass = true;
17
        }
17
        }
18
        assertTrue(pass);
18
        assertTrue(pass);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are declared in the same class
Number of node comparisons55
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)109.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    CategoryAxis domainAxis1 = new CategoryAxis("X1");
    1
    CategoryAxis domainAxis1 = new CategoryAxis("X1");
    2
    CategoryAxis domainAxis2 = new CategoryAxis("X2");
    2
    CategoryAxis domainAxis2 = new CategoryAxis("X2");
    3
    NumberAxis rangeAxis2 = new NumberAxis("Y2");
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    domainAxis2rangeAxis2VARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    "X2""Y2"LITERAL_VALUE_MISMATCH
    Preondition Violations
    Expression new CategoryAxis("X2") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new NumberAxis("Y2") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    NumberAxis rangeAxis2 = new NumberAxis("Y2");
    3
    NumberAxis rangeAxis1 = new NumberAxis("Y1");
    2
    NumberAxis rangeAxis1 = new NumberAxis("Y1");
    4
    CategoryPlot plot = new CategoryPlot(null, domainAxis1, rangeAxis1, null);
    4
    CategoryPlot plot = new CategoryPlot(null, domainAxis1, rangeAxis1, null);
    5
    assertEquals(0, plot.getDomainAxisIndex(domainAxis1));
    5
    assertEquals(0, plot.getDomainAxisIndex(domainAxis1));
    5
    assertEquals(0, plot.getRangeAxisIndex(rangeAxis1));
    Differences
    Expression1Expression2Difference
    domainAxis1rangeAxis1VARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    getDomainAxisIndexgetRangeAxisIndexMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression domainAxis1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression rangeAxis1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.getDomainAxisIndex(domainAxis1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.getRangeAxisIndex(rangeAxis1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    assertEquals(0, plot.getRangeAxisIndex(rangeAxis1));
    6
    assertEquals(-1, plot.getDomainAxisIndex(domainAxis2));
    6
    assertEquals(-1, plot.getDomainAxisIndex(domainAxis2));
    6
    assertEquals(-1, plot.getRangeAxisIndex(rangeAxis2));
    Differences
    Expression1Expression2Difference
    domainAxis2rangeAxis2VARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    getDomainAxisIndexgetRangeAxisIndexMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression plot.getDomainAxisIndex(domainAxis2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.getRangeAxisIndex(rangeAxis2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    assertEquals(-1, plot.getRangeAxisIndex(rangeAxis2));
    7
    plot.setDomainAxis(1, domainAxis2);
    7
    plot.setDomainAxis(1, domainAxis2);
    7
    plot.setRangeAxis(1, rangeAxis2);
    Differences
    Expression1Expression2Difference
    domainAxis2rangeAxis2VARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    setDomainAxissetRangeAxisMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression plot.setDomainAxis(1,domainAxis2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.setRangeAxis(1,rangeAxis2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.setDomainAxis(1,domainAxis2) is a void method call, and thus it cannot be parameterized
    Expression plot.setRangeAxis(1,rangeAxis2) is a void method call, and thus it cannot be parameterized
    7
    plot.setRangeAxis(1, rangeAxis2);
    8
    assertEquals(1, plot.getDomainAxisIndex(domainAxis2));
    8
    assertEquals(1, plot.getDomainAxisIndex(domainAxis2));
    8
    assertEquals(1, plot.getRangeAxisIndex(rangeAxis2));
    Differences
    Expression1Expression2Difference
    domainAxis2rangeAxis2VARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    getDomainAxisIndexgetRangeAxisIndexMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression plot.getDomainAxisIndex(domainAxis2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.getRangeAxisIndex(rangeAxis2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    assertEquals(1, plot.getRangeAxisIndex(rangeAxis2));
    9
    assertEquals(-1, plot.getDomainAxisIndex(new CategoryAxis("X2")));
    9
    assertEquals(-1, plot.getDomainAxisIndex(new CategoryAxis("X2")));
    9
    assertEquals(-1, plot.getRangeAxisIndex(new NumberAxis("Y2")));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    "X2""Y2"LITERAL_VALUE_MISMATCH
    getDomainAxisIndexgetRangeAxisIndexMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression plot.getDomainAxisIndex(new CategoryAxis("X2")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.getRangeAxisIndex(new NumberAxis("Y2")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9
    assertEquals(-1, plot.getRangeAxisIndex(new NumberAxis("Y2")));
    10
    boolean pass = false;
    10
    boolean pass = false;
    11
    try
    11
    try
    12
    plot.getDomainAxisIndex(null);
    12
    plot.getDomainAxisIndex(null);
    12
    plot.getRangeAxisIndex(null);
    Differences
    Expression1Expression2Difference
    getDomainAxisIndexgetRangeAxisIndexMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression plot.getDomainAxisIndex(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.getRangeAxisIndex(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.getDomainAxisIndex(null) is a void method call, and thus it cannot be parameterized
    Expression plot.getRangeAxisIndex(null) is a void method call, and thus it cannot be parameterized
    12
    plot.getRangeAxisIndex(null);
    13
    assertTrue(pass);
    13
    assertTrue(pass);
    Precondition Violations (20)
    Row Violation
    1Expression new CategoryAxis("X2") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new NumberAxis("Y2") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression domainAxis1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression rangeAxis1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression plot.getDomainAxisIndex(domainAxis1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression plot.getRangeAxisIndex(rangeAxis1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression plot.getDomainAxisIndex(domainAxis2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression plot.getRangeAxisIndex(rangeAxis2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression plot.setDomainAxis(1,domainAxis2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression plot.setRangeAxis(1,rangeAxis2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression plot.setDomainAxis(1,domainAxis2) is a void method call, and thus it cannot be parameterized
    12Expression plot.setRangeAxis(1,rangeAxis2) is a void method call, and thus it cannot be parameterized
    13Expression plot.getDomainAxisIndex(domainAxis2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression plot.getRangeAxisIndex(rangeAxis2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression plot.getDomainAxisIndex(new CategoryAxis("X2")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Expression plot.getRangeAxisIndex(new NumberAxis("Y2")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression plot.getDomainAxisIndex(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Expression plot.getRangeAxisIndex(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    19Expression plot.getDomainAxisIndex(null) is a void method call, and thus it cannot be parameterized
    20Expression plot.getRangeAxisIndex(null) is a void method call, and thus it cannot be parameterized