1151-1-2

Range r1 = new Range(0.1, 1000.0); assertEquals(r1.getLowerBound(), 0.1, 0.0d); assertEquals(r1.getUpperBound(), 1000.0, 0.0d); try { /*Range r2 =*/ new Range(10.0, 0.0); fail("Lower bound cannot be greater than the upper"); } catch (Exception e) { // ignore }
XYSeries s1 = new XYSeries("Series 1"); s1.add(1.0, 1.0); s1.add(2.0, 2.0); s1.add(3.0, 3.0); assertEquals(0, s1.indexOf(new Double(1.0)));

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/junit/RangeTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/XYSeriesTests.java
Method name: `void testConstructor()` |  | Method name: `void testIndexOf()`
Number of AST nodes: 6 |  | Number of AST nodes: 5

1

    Range r1 = new Range(0.1, 1000.0);↵

2

            assertEquals(r1.getLowerBound(), 0.1, 0↵

1

    XYSeries s1 = new XYSeries("Series 1");↵

3

    .0d);↵

2

            s1.add(1.0, 1.0);↵

4

            assertEquals(r1.getUpperBound(), 1000.0, 0.0d);↵

3

            s1.add(2.0, 2.0);↵

5

            try {↵

4

            ↵

6

                /*Range r2 =*/ new Range(10.0, 0.0);↵

5

    s1.add(3.0, 3.0);↵

7

                fail("Lower bound cannot be greater than the upper");↵

6

            ↵

8

            }↵

9

            catch (Exception e) {↵

10

                // ignore↵

11

            }

7

    assertEquals(0, s1.indexOf(new Double(1.0)));

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 15

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 2
   Number of unmapped statements in the first code fragment | 1
   Number of unmapped statements in the second code fragment | 3
   Time elapsed for statement mapping (ms) | 0.0
   Clone type | Type 3

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       XYSeries s1 = new XYSeries("Series 1");

   1

       Range r1 = new Range(0.1, 1000.0);

   2

       s1.add(1.0, 1.0);

   4 | s1.add(3.0, 3.0);

   Preondition Violations
   Unmatched statement s1.add(3.0,3.0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   4

       s1.add(3.0, 3.0);

   2

       assertEquals(r1.getLowerBound(), 0.1, 0.0d);

   2 | assertEquals(r1.getLowerBound(), 0.1, 0.0d);
   5 | assertEquals(0, s1.indexOf(new Double(1.0)));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   assertEquals(r1.getLowerBound(),0.1,0.0d) | assertEquals(0,s1.indexOf(new Double(1.0))) | ARGUMENT_NUMBER_MISMATCH

   Preondition Violations
   Expression assertEquals(r1.getLowerBound(),0.1,0.0d) is a void method call, and thus it cannot be parameterized
   Expression assertEquals(0,s1.indexOf(new Double(1.0))) is a void method call, and thus it cannot be parameterized

   5

       assertEquals(0, s1.indexOf(new Double(1.0)));

   3

       assertEquals(r1.getUpperBound(), 1000.0, 0.0d);

   3 | assertEquals(r1.getUpperBound(), 1000.0, 0.0d);
   3 | s1.add(2.0, 2.0);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   assertEquals | add | METHOD_INVOCATION_NAME_MISMATCH
   assertEquals(r1.getUpperBound(),1000.0,0.0d) | s1.add(2.0,2.0) | ARGUMENT_NUMBER_MISMATCH
   | s1 | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression assertEquals(r1.getUpperBound(),1000.0,0.0d) is a void method call, and thus it cannot be parameterized
   Expression s1.add(2.0,2.0) is a void method call, and thus it cannot be parameterized
   Expression assertEquals(r1.getUpperBound(),1000.0,0.0d) is a void method call, and thus it cannot be parameterized
   Expression s1.add(2.0,2.0) is a void method call, and thus it cannot be parameterized

   3

       s1.add(2.0, 2.0);

   Precondition Violations (7)
   Row | Violation
   --- | ---
   1 | Unmatched statement s1.add(3.0,3.0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   2 | Expression assertEquals(r1.getLowerBound(),0.1,0.0d) is a void method call, and thus it cannot be parameterized
   3 | Expression assertEquals(0,s1.indexOf(new Double(1.0))) is a void method call, and thus it cannot be parameterized
   4 | Expression assertEquals(r1.getUpperBound(),1000.0,0.0d) is a void method call, and thus it cannot be parameterized
   5 | Expression s1.add(2.0,2.0) is a void method call, and thus it cannot be parameterized
   6 | Expression assertEquals(r1.getUpperBound(),1000.0,0.0d) is a void method call, and thus it cannot be parameterized
   7 | Expression s1.add(2.0,2.0) is a void method call, and thus it cannot be parameterized