1342-4-9

DefaultCategoryDataset d = new DefaultCategoryDataset(); d.addValue(-1.0, "s0", "c0"); d.addValue(1.1, "s1", "c0"); List l = MyRenderer.createStackedValueList(d, "c0", 0.0, false); assertEquals(3, l.size()); assertEquals(new Double(-1.0), ((Object[]) l.get(0))[1]); assertEquals(new Double(0.0), ((Object[]) l.get(1))[1]); assertEquals(new Double(1.1), ((Object[]) l.get(2))[1]);
DefaultCategoryDataset d = new DefaultCategoryDataset(); d.addValue(0.0, "s0", "c0"); d.addValue(0.0, "s1", "c0"); List l = MyRenderer.createStackedValueList(d, "c0", 0.0, false); assertEquals(3, l.size()); assertEquals(new Double(0.0), ((Object[]) l.get(0))[1]); assertEquals(new Double(0.0), ((Object[]) l.get(1))[1]); assertEquals(new Double(0.0), ((Object[]) l.get(2))[1]);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/category/junit/StackedBarRenderer3DTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/category/junit/StackedBarRenderer3DTests.java
Method name: `void testCreateStackedValueList2a()` |  | Method name: `void testCreateStackedValueList3c()`
Number of AST nodes: 8 |  | Number of AST nodes: 8

1

    DefaultCategoryDataset d = new DefaultCategoryDataset();↵

1

    DefaultCategoryDataset d = new DefaultCategoryDataset();↵

2

            d.addValue(-1.0, "s0", "c0");↵

2

            d.addValue(0.0, "s0", "c0");↵

3

            d.addValue(1.1, "s1", "c0");↵

3

            d.addValue(0.0, "s1", "c0");↵

4

            List l = MyRenderer.createStackedValueList(d, "c0", 0.0, false);↵

4

            List l = MyRenderer.createStackedValueList(d, "c0", 0.0, false);↵

5

            assertEquals(3, l.size());↵

5

            assertEquals(3, l.size());↵

6

            assertEquals(new Double(-1.0), ((Object[]) l.get(0))[1]);↵

6

            assertEquals(new Double(0.0), ((Object[]) l.get(0))[1]);↵

7

            assertEquals(new Double(0.0), ((Object[]) l.get(1))[1]);↵

7

            assertEquals(new Double(0.0), ((Object[]) l.get(1))[1]);↵

8

            assertEquals(new Double(1.1), ((Object[]) l.get(2))[1]);

8

            assertEquals(new Double(0.0), ((Object[]) l.get(2))[1]);

See real code fragment |  | See real code fragment

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

1. {Refactorable}

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

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

   1

       DefaultCategoryDataset d = new DefaultCategoryDataset();

   1

       DefaultCategoryDataset d = new DefaultCategoryDataset();

   2

       d.addValue(-1.0, "s0", "c0");

   2 | d.addValue(-1.0, "s0", "c0");
   2 | d.addValue(0.0, "s0", "c0");

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   -1.0 | 0.0 | TYPE_COMPATIBLE_REPLACEMENT

   2

       d.addValue(0.0, "s0", "c0");

   3

       d.addValue(1.1, "s1", "c0");

   3 | d.addValue(1.1, "s1", "c0");
   3 | d.addValue(0.0, "s1", "c0");

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   1.1 | 0.0 | LITERAL_VALUE_MISMATCH

   3

       d.addValue(0.0, "s1", "c0");

   4

       List l = MyRenderer.createStackedValueList(d, "c0", 0.0, false);

   4

       List l = MyRenderer.createStackedValueList(d, "c0", 0.0, false);

   5

       assertEquals(3, l.size());

   5

       assertEquals(3, l.size());

   6

       assertEquals(new Double(-1.0), ((Object[])l.get(0))[1]);

   6 | assertEquals(new Double(-1.0), ((Object[])l.get(0))[1]);
   6 | assertEquals(new Double(0.0), ((Object[])l.get(0))[1]);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   -1.0 | 0.0 | TYPE_COMPATIBLE_REPLACEMENT

   6

       assertEquals(new Double(0.0), ((Object[])l.get(0))[1]);

   7

       assertEquals(new Double(0.0), ((Object[])l.get(1))[1]);

   7

       assertEquals(new Double(0.0), ((Object[])l.get(1))[1]);

   8

       assertEquals(new Double(1.1), ((Object[])l.get(2))[1]);

   8 | assertEquals(new Double(1.1), ((Object[])l.get(2))[1]);
   8 | assertEquals(new Double(0.0), ((Object[])l.get(2))[1]);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   1.1 | 0.0 | LITERAL_VALUE_MISMATCH

   8

       assertEquals(new Double(0.0), ((Object[])l.get(2))[1]);

   Precondition Violations (0)
   Row | Violation
   --- | ---