1124-1-3

DefaultCategoryDataset underlying = new DefaultCategoryDataset(); SlidingCategoryDataset dataset = new SlidingCategoryDataset(underlying, 10, 5); assertEquals(0, dataset.getRowCount()); underlying.addValue(1.0, "R1", "C1"); assertEquals(1, dataset.getRowCount()); underlying.clear(); assertEquals(0, dataset.getRowCount());
DefaultKeyedValues2D d = new DefaultKeyedValues2D(); assertEquals(0, d.getColumnCount()); d.addValue(new Double(1.0), "R1", "C1"); assertEquals(1, d.getColumnCount()); d.addValue(new Double(2.0), "R1", "C2"); assertEquals(2, d.getColumnCount());

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/category/junit/SlidingCategoryDatasetTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/junit/DefaultKeyedValues2DTests.java
Method name: `void testGetRowCount()` |  | Method name: `void testColumnCount()`
Number of AST nodes: 7 |  | Number of AST nodes: 6

1

    DefaultCategoryDataset underlying = new DefaultCategoryDataset();↵

1

    Default↵

2

        	SlidingCategoryDataset dataset = new SlidingCategoryDataset(underlying,↵

3

        			10, 5);↵

2

    KeyedValues2D d = new DefaultKeyedValues2D();↵

4

        	assertEquals(0, dataset.getRowCount());↵

3

            assertEquals(0, d.getColumnCount());↵

5

        	underlying.addValue(1.0, "R1", "C1");↵

4

            d.addValue(new Double(1.0), "R1", "C1");↵

6

        	assertEquals(1, dataset.getRowCount());↵

5

            assertEquals(1, d.getColumnCount());↵

7

        	underlying.clear();↵

6

            d.addValue(new Double(2.0), "R1", "C2");↵

8

        	assertEquals(0, dataset.getRowCount());

7

            assertEquals(2, d.getColumnCount());

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

1. {Non-refactorable}

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

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

   1

       DefaultKeyedValues2D d = new DefaultKeyedValues2D();

   1

       DefaultCategoryDataset underlying = new DefaultCategoryDataset();

   2

       SlidingCategoryDataset dataset = new SlidingCategoryDataset(underlying, 10, 5);

   3

       assertEquals(0, dataset.getRowCount());

   3 | assertEquals(0, dataset.getRowCount());
   3 | d.addValue(new Double(1.0), "R1", "C1");

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   assertEquals | addValue | METHOD_INVOCATION_NAME_MISMATCH
   assertEquals(0,dataset.getRowCount()) | d.addValue(new Double(1.0),"R1","C1") | ARGUMENT_NUMBER_MISMATCH
   | d | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression d.addValue(new Double(1.0),"R1","C1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression assertEquals(0,dataset.getRowCount()) is a void method call, and thus it cannot be parameterized
   Expression d.addValue(new Double(1.0),"R1","C1") is a void method call, and thus it cannot be parameterized
   Expression d.addValue(new Double(1.0),"R1","C1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression assertEquals(0,dataset.getRowCount()) is a void method call, and thus it cannot be parameterized
   Expression d.addValue(new Double(1.0),"R1","C1") is a void method call, and thus it cannot be parameterized

   3

       d.addValue(new Double(1.0), "R1", "C1");

   4

       underlying.addValue(1.0, "R1", "C1");

   4 | underlying.addValue(1.0, "R1", "C1");
   4 | assertEquals(1, d.getColumnCount());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   addValue | assertEquals | METHOD_INVOCATION_NAME_MISMATCH
   underlying.addValue(1.0,"R1","C1") | assertEquals(1,d.getColumnCount()) | ARGUMENT_NUMBER_MISMATCH
   underlying |  | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression assertEquals(1,d.getColumnCount()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression underlying.addValue(1.0,"R1","C1") is a void method call, and thus it cannot be parameterized
   Expression assertEquals(1,d.getColumnCount()) is a void method call, and thus it cannot be parameterized
   Expression assertEquals(1,d.getColumnCount()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression underlying.addValue(1.0,"R1","C1") is a void method call, and thus it cannot be parameterized
   Expression assertEquals(1,d.getColumnCount()) is a void method call, and thus it cannot be parameterized

   4

       assertEquals(1, d.getColumnCount());

   5

       assertEquals(1, dataset.getRowCount());

   5 | assertEquals(1, dataset.getRowCount());
   5 | d.addValue(new Double(2.0), "R1", "C2");

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   assertEquals | addValue | METHOD_INVOCATION_NAME_MISMATCH
   assertEquals(1,dataset.getRowCount()) | d.addValue(new Double(2.0),"R1","C2") | ARGUMENT_NUMBER_MISMATCH
   | d | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression d.addValue(new Double(2.0),"R1","C2") cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression assertEquals(1,dataset.getRowCount()) is a void method call, and thus it cannot be parameterized
   Expression d.addValue(new Double(2.0),"R1","C2") is a void method call, and thus it cannot be parameterized
   Expression d.addValue(new Double(2.0),"R1","C2") cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression assertEquals(1,dataset.getRowCount()) is a void method call, and thus it cannot be parameterized
   Expression d.addValue(new Double(2.0),"R1","C2") is a void method call, and thus it cannot be parameterized

   5

       d.addValue(new Double(2.0), "R1", "C2");

   6

       underlying.clear();

   6 | underlying.clear();
   2 | assertEquals(0, d.getColumnCount());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   clear | assertEquals | METHOD_INVOCATION_NAME_MISMATCH
   underlying.clear() | assertEquals(0,d.getColumnCount()) | ARGUMENT_NUMBER_MISMATCH
   underlying |  | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression underlying.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression underlying.clear() is a void method call, and thus it cannot be parameterized
   Expression assertEquals(0,d.getColumnCount()) is a void method call, and thus it cannot be parameterized
   Expression underlying.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression underlying.clear() is a void method call, and thus it cannot be parameterized
   Expression assertEquals(0,d.getColumnCount()) is a void method call, and thus it cannot be parameterized

   2

       assertEquals(0, d.getColumnCount());

   6 | assertEquals(2, d.getColumnCount());

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

   6

       assertEquals(2, d.getColumnCount());

   7

       assertEquals(0, dataset.getRowCount());

   Precondition Violations (25)
   Row | Violation
   --- | ---
   1 | Expression d.addValue(new Double(1.0),"R1","C1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression assertEquals(0,dataset.getRowCount()) is a void method call, and thus it cannot be parameterized
   3 | Expression d.addValue(new Double(1.0),"R1","C1") is a void method call, and thus it cannot be parameterized
   4 | Expression d.addValue(new Double(1.0),"R1","C1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
   5 | Expression assertEquals(0,dataset.getRowCount()) is a void method call, and thus it cannot be parameterized
   6 | Expression d.addValue(new Double(1.0),"R1","C1") is a void method call, and thus it cannot be parameterized
   7 | Expression assertEquals(1,d.getColumnCount()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   8 | Expression underlying.addValue(1.0,"R1","C1") is a void method call, and thus it cannot be parameterized
   9 | Expression assertEquals(1,d.getColumnCount()) is a void method call, and thus it cannot be parameterized
   10 | Expression assertEquals(1,d.getColumnCount()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   11 | Expression underlying.addValue(1.0,"R1","C1") is a void method call, and thus it cannot be parameterized
   12 | Expression assertEquals(1,d.getColumnCount()) is a void method call, and thus it cannot be parameterized
   13 | Expression d.addValue(new Double(2.0),"R1","C2") cannot be parameterized, because it has dependencies to/from statements that will be extracted
   14 | Expression assertEquals(1,dataset.getRowCount()) is a void method call, and thus it cannot be parameterized
   15 | Expression d.addValue(new Double(2.0),"R1","C2") is a void method call, and thus it cannot be parameterized
   16 | Expression d.addValue(new Double(2.0),"R1","C2") cannot be parameterized, because it has dependencies to/from statements that will be extracted
   17 | Expression assertEquals(1,dataset.getRowCount()) is a void method call, and thus it cannot be parameterized
   18 | Expression d.addValue(new Double(2.0),"R1","C2") is a void method call, and thus it cannot be parameterized
   19 | Expression underlying.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   20 | Expression underlying.clear() is a void method call, and thus it cannot be parameterized
   21 | Expression assertEquals(0,d.getColumnCount()) is a void method call, and thus it cannot be parameterized
   22 | Expression underlying.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   23 | Expression underlying.clear() is a void method call, and thus it cannot be parameterized
   24 | Expression assertEquals(0,d.getColumnCount()) is a void method call, and thus it cannot be parameterized
   25 | Unmatched statement assertEquals(2,d.getColumnCount()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted