1475-1-3

DefaultKeyedValues v = new DefaultKeyedValues(); assertEquals(-1, v.getIndex("K1")); v.addValue("K1", 1.0); assertEquals(0, v.getIndex("K1")); v.removeValue("K1"); assertEquals(-1, v.getIndex("K1"));
DefaultWindDataset d = createSampleDataset1(); assertEquals(0, d.indexOf("Series 1")); assertEquals(1, d.indexOf("Series 2")); assertEquals(-1, d.indexOf("Green Eggs and Ham")); assertEquals(-1, d.indexOf(null));

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

1

    DefaultKeyedValues v = new DefaultKeyedValues();↵

1

    DefaultWindDataset d = createSampleDataset1();↵

2

            assertEquals(-1, v.getIndex("K1"));↵

2

            assertEquals(↵

3

            v.addValue("K1", 1.0↵

3

    0, d.indexOf("Series 1"));↵

4

    );↵

4

            assertEquals(1, d.indexOf("Series 2"));↵

5

            assertEquals(0, v.getIndex("K1"));↵

5

            assertEquals(↵

6

            v.removeValue("K1");↵

6

    -1, d.indexOf("Green Eggs and Ham"));↵

7

            assertEquals(-1, v.getIndex("K1"));

7

            assertEquals(-1, d.indexOf(null));

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 | 30

1. {Non-refactorable}

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

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

   1

       DefaultWindDataset d = createSampleDataset1();

   1

       DefaultKeyedValues v = new DefaultKeyedValues();

   2

       assertEquals(-1, v.getIndex("K1"));

   3

       assertEquals(1, d.indexOf("Series 2"));

   3

       v.addValue("K1", 1.0);

   4

       assertEquals(-1, d.indexOf("Green Eggs and Ham"));

   4

       assertEquals(0, v.getIndex("K1"));

   5

       v.removeValue("K1");

   5 | v.removeValue("K1");
   2 | assertEquals(0, d.indexOf("Series 1"));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   removeValue | assertEquals | METHOD_INVOCATION_NAME_MISMATCH
   v.removeValue("K1") | assertEquals(0,d.indexOf("Series 1")) | ARGUMENT_NUMBER_MISMATCH
   v |  | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression v.removeValue("K1") is a void method call, and thus it cannot be parameterized
   Expression assertEquals(0,d.indexOf("Series 1")) is a void method call, and thus it cannot be parameterized
   Expression v.removeValue("K1") is a void method call, and thus it cannot be parameterized
   Expression assertEquals(0,d.indexOf("Series 1")) is a void method call, and thus it cannot be parameterized

   2

       assertEquals(0, d.indexOf("Series 1"));

   5

       assertEquals(-1, d.indexOf(null));

   6

       assertEquals(-1, v.getIndex("K1"));

   6 | assertEquals(-1, v.getIndex("K1"));

   Preondition Violations
   Unmatched statement assertEquals(-1,v.getIndex("K1")); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   Precondition Violations (5)
   Row | Violation
   --- | ---
   1 | Expression v.removeValue("K1") is a void method call, and thus it cannot be parameterized
   2 | Expression assertEquals(0,d.indexOf("Series 1")) is a void method call, and thus it cannot be parameterized
   3 | Expression v.removeValue("K1") is a void method call, and thus it cannot be parameterized
   4 | Expression assertEquals(0,d.indexOf("Series 1")) is a void method call, and thus it cannot be parameterized
   5 | Unmatched statement assertEquals(-1,v.getIndex("K1")); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted