double[] starts_S1 = new double[] {0.1, 0.2, 0.3}; double[] starts_S2 = new double[] {0.3, 0.4, 0.5}; double[] ends_S1 = new double[] {0.5, 0.6, 0.7}; double[] ends_S2 = new double[] {0.7, 0.8, 0.9}; double[][] starts = new double[][] {starts_S1, starts_S2}; double[][] ends = new double[][] {ends_S1, ends_S2}; DefaultIntervalCategoryDataset d1 = new DefaultIntervalCategoryDataset( starts, ends); d1.setStartValue(0, "Category 2", new Double(99.9)); assertEquals(new Double(99.9), d1.getStartValue("Series 1", "Category 2")); boolean pass = false; try { d1.setStartValue(-1, "Category 2", new Double(99.9)); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); pass = false; try { d1.setStartValue(2, "Category 2", new Double(99.9)); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass);
double[] starts_S1 = new double[] {0.1, 0.2, 0.3}; double[] starts_S2 = new double[] {0.3, 0.4, 0.5}; double[] ends_S1 = new double[] {0.5, 0.6, 0.7}; double[] ends_S2 = new double[] {0.7, 0.8, 0.9}; double[][] starts = new double[][] {starts_S1, starts_S2}; double[][] ends = new double[][] {ends_S1, ends_S2}; DefaultIntervalCategoryDataset d1 = new DefaultIntervalCategoryDataset( starts, ends); d1.setEndValue(0, "Category 2", new Double(99.9)); assertEquals(new Double(99.9), d1.getEndValue("Series 1", "Category 2")); boolean pass = false; try { d1.setEndValue(-1, "Category 2", new Double(99.9)); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); pass = false; try { d1.setEndValue(2, "Category 2", new Double(99.9)); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/category/junit/DefaultIntervalCategoryDatasetTests.java File path: /jfreechart-1.0.10/tests/org/jfree/data/category/junit/DefaultIntervalCategoryDatasetTests.java
Method name: void testSetStartValue() Method name: void testSetEndValue()
Number of AST nodes: 17 Number of AST nodes: 17
1
double[] starts_S1 = new double[] {0.1, 0.2, 0.3};
1
double[] starts_S1 = new double[] {0.1, 0.2, 0.3};
2
        double[] starts_S2 = new double[] {0.3, 0.4, 0.5};
2
        double[] starts_S2 = new double[] {0.3, 0.4, 0.5};
3
        double[] ends_S1 = new double[] {0.5, 0.6, 0.7};
3
        double[] ends_S1 = new double[] {0.5, 0.6, 0.7};
4
        double[] ends_S2 = new double[] {0.7, 0.8, 0.9};
4
        double[] ends_S2 = new double[] {0.7, 0.8, 0.9};
5
        double[][] starts = new double[][] {starts_S1, starts_S2};
5
        double[][] starts = new double[][] {starts_S1, starts_S2};
6
        double[][] ends = new double[][] {ends_S1, ends_S2};
6
        double[][] ends = new double[][] {ends_S1, ends_S2};
7
        DefaultIntervalCategoryDataset d1 = new DefaultIntervalCategoryDataset(
7
        DefaultIntervalCategoryDataset d1 = new DefaultIntervalCategoryDataset(
8
                starts, ends);
8
                starts, ends);
9
        d1.setStartValue(0, "Category 2", new Double(99.9));
9
        d1.setEndValue(0, "Category 2", new Double(99.9));
10
        assertEquals(new Double(99.9), d1.getStartValue("Series 1", 
10
        assertEquals(new Double(99.9), d1.getEndValue("Series 1", 
11
                "Category 2"));
11
                "Category 2"));
12
        
12
        
13
        boolean pass = false;
13
        boolean pass = false;
14
        try {
14
        try {
15
            d1.setStartValue(-1, "Category 2", new Double(99.9));
15
            d1.setEndValue(-1, "Category 2", new Double(99.9));
16
        }
16
        }
17
        catch (IllegalArgumentException e) {
17
        catch (IllegalArgumentException e) {
18
            pass = true;
18
            pass = true;
19
        }
19
        }
20
        assertTrue(pass);
20
        assertTrue(pass);
21
        
21
        
22
        pass = false;
22
        pass = false;
23
        try {
23
        try {
24
            d1.setStartValue(2, "Category 2", new Double(99.9));
24
            d1.setEndValue(2, "Category 2", new Double(99.9));
25
        }
25
        }
26
        catch (IllegalArgumentException e) {
26
        catch (IllegalArgumentException e) {
27
            pass = true;
27
            pass = true;
28
        }
28
        }
29
        assertTrue(pass);
29
        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.3
Clones locationClones are declared in the same class
Number of node comparisons118
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements17
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)18.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    double[] starts_S1 = new double[] {0.1, 0.2, 0.3};
    1
    double[] starts_S1 = new double[] {0.1, 0.2, 0.3};
    2
    double[] starts_S2 = new double[] {0.3, 0.4, 0.5};
    2
    double[] starts_S2 = new double[] {0.3, 0.4, 0.5};
    3
    double[] ends_S1 = new double[] {0.5, 0.6, 0.7};
    3
    double[] ends_S1 = new double[] {0.5, 0.6, 0.7};
    4
    double[] ends_S2 = new double[] {0.7, 0.8, 0.9};
    4
    double[] ends_S2 = new double[] {0.7, 0.8, 0.9};
    5
    double[][] starts = new double[][] {starts_S1, starts_S2};
    5
    double[][] starts = new double[][] {starts_S1, starts_S2};
    6
    double[][] ends = new double[][] {ends_S1, ends_S2};
    6
    double[][] ends = new double[][] {ends_S1, ends_S2};
    7
    DefaultIntervalCategoryDataset d1 = new DefaultIntervalCategoryDataset(starts, ends);
    7
    DefaultIntervalCategoryDataset d1 = new DefaultIntervalCategoryDataset(starts, ends);
    8
    d1.setStartValue(0, "Category 2", new Double(99.9));
    8
    d1.setStartValue(0, "Category 2", new Double(99.9));
    8
    d1.setEndValue(0, "Category 2", new Double(99.9));
    Differences
    Expression1Expression2Difference
    setStartValuesetEndValueMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression d1.setStartValue(0,"Category 2",new Double(99.9)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression d1.setEndValue(0,"Category 2",new Double(99.9)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression d1.setStartValue(0,"Category 2",new Double(99.9)) is a void method call, and thus it cannot be parameterized
    Expression d1.setEndValue(0,"Category 2",new Double(99.9)) is a void method call, and thus it cannot be parameterized
    8
    d1.setEndValue(0, "Category 2", new Double(99.9));
    9
    assertEquals(new Double(99.9), d1.getStartValue("Series 1", "Category 2"));
    9
    assertEquals(new Double(99.9), d1.getStartValue("Series 1", "Category 2"));
    9
    assertEquals(new Double(99.9), d1.getEndValue("Series 1", "Category 2"));
    Differences
    Expression1Expression2Difference
    getStartValuegetEndValueMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression d1.getStartValue("Series 1","Category 2") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression d1.getEndValue("Series 1","Category 2") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9
    assertEquals(new Double(99.9), d1.getEndValue("Series 1", "Category 2"));
    10
    boolean pass = false;
    10
    boolean pass = false;
    11
    try
    11
    try
    12
    d1.setStartValue(-1, "Category 2", new Double(99.9));
    12
    d1.setStartValue(-1, "Category 2", new Double(99.9));
    12
    d1.setEndValue(-1, "Category 2", new Double(99.9));
    Differences
    Expression1Expression2Difference
    setStartValuesetEndValueMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression d1.setStartValue(-1,"Category 2",new Double(99.9)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression d1.setEndValue(-1,"Category 2",new Double(99.9)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression d1.setStartValue(-1,"Category 2",new Double(99.9)) is a void method call, and thus it cannot be parameterized
    Expression d1.setEndValue(-1,"Category 2",new Double(99.9)) is a void method call, and thus it cannot be parameterized
    12
    d1.setEndValue(-1, "Category 2", new Double(99.9));
    13
    assertTrue(pass);
    13
    assertTrue(pass);
    14
    pass = false;
    14
    pass = false;
    15
    try
    15
    try
    16
    d1.setStartValue(2, "Category 2", new Double(99.9));
    16
    d1.setStartValue(2, "Category 2", new Double(99.9));
    16
    d1.setEndValue(2, "Category 2", new Double(99.9));
    Differences
    Expression1Expression2Difference
    setStartValuesetEndValueMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression d1.setStartValue(2,"Category 2",new Double(99.9)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression d1.setEndValue(2,"Category 2",new Double(99.9)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression d1.setStartValue(2,"Category 2",new Double(99.9)) is a void method call, and thus it cannot be parameterized
    Expression d1.setEndValue(2,"Category 2",new Double(99.9)) is a void method call, and thus it cannot be parameterized
    16
    d1.setEndValue(2, "Category 2", new Double(99.9));
    17
    assertTrue(pass);
    17
    assertTrue(pass);
    Precondition Violations (14)
    Row Violation
    1Expression d1.setStartValue(0,"Category 2",new Double(99.9)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression d1.setEndValue(0,"Category 2",new Double(99.9)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression d1.setStartValue(0,"Category 2",new Double(99.9)) is a void method call, and thus it cannot be parameterized
    4Expression d1.setEndValue(0,"Category 2",new Double(99.9)) is a void method call, and thus it cannot be parameterized
    5Expression d1.getStartValue("Series 1","Category 2") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression d1.getEndValue("Series 1","Category 2") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression d1.setStartValue(-1,"Category 2",new Double(99.9)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression d1.setEndValue(-1,"Category 2",new Double(99.9)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression d1.setStartValue(-1,"Category 2",new Double(99.9)) is a void method call, and thus it cannot be parameterized
    10Expression d1.setEndValue(-1,"Category 2",new Double(99.9)) is a void method call, and thus it cannot be parameterized
    11Expression d1.setStartValue(2,"Category 2",new Double(99.9)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression d1.setEndValue(2,"Category 2",new Double(99.9)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression d1.setStartValue(2,"Category 2",new Double(99.9)) is a void method call, and thus it cannot be parameterized
    14Expression d1.setEndValue(2,"Category 2",new Double(99.9)) is a void method call, and thus it cannot be parameterized