392-1-5

StackedBarRenderer r1 = new StackedBarRenderer(); StackedBarRenderer r2 = new StackedBarRenderer(); assertTrue(r1.equals(r2)); assertTrue(r2.equals(r1)); r1.setRenderAsPercentages(true); assertFalse(r1.equals(r2)); r2.setRenderAsPercentages(true); assertTrue(r1.equals(r2));
DefaultWindDataset d1 = new DefaultWindDataset(); DefaultWindDataset d2 = new DefaultWindDataset(); assertTrue(d1.equals(d2)); assertTrue(d2.equals(d1)); d1 = createSampleDataset1(); assertFalse(d1.equals(d2)); d2 = createSampleDataset1(); assertTrue(d1.equals(d2));

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

1

    StackedBarRenderer r1 = new StackedBarRenderer();↵

2

            StackedBarRenderer r2 = new StackedBarRenderer↵

1

    DefaultWindDataset d1 = new DefaultWindDataset();↵

3

    ();↵

2

            DefaultWindDataset d2 = new DefaultWindDataset();↵

4

            assertTrue(r1.equals(r2));↵

3

            assertTrue(d1.equals(d2));↵

5

            assertTrue(r2.equals(r1));↵

4

            assertTrue(d2.equals(d1));↵

6

            r1.setRenderAsPercentages(true);↵

5

            d1 = createSampleDataset1();↵

7

            assertFalse(r1.equals(r2));↵

6

            assertFalse(d1.equals(d2));↵

8

            r2.setRenderAsPercentages(true);↵

7

            d2 = createSampleDataset1();↵

9

            assertTrue(r1.equals(r2));

8

            assertTrue(d1.equals(d2));

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

1. {Non-refactorable}

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

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

   1

       StackedBarRenderer r1 = new StackedBarRenderer();

   1 | StackedBarRenderer r1 = new StackedBarRenderer();
   1 | DefaultWindDataset d1 = new DefaultWindDataset();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   r1 | d1 | VARIABLE_NAME_MISMATCH

   1

       DefaultWindDataset d1 = new DefaultWindDataset();

   2

       StackedBarRenderer r2 = new StackedBarRenderer();

   2 | StackedBarRenderer r2 = new StackedBarRenderer();
   2 | DefaultWindDataset d2 = new DefaultWindDataset();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   r2 | d2 | VARIABLE_NAME_MISMATCH

   2

       DefaultWindDataset d2 = new DefaultWindDataset();

   3

       assertTrue(r1.equals(r2));

   3 | assertTrue(r1.equals(r2));
   3 | assertTrue(d1.equals(d2));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   r2 | d2 | VARIABLE_NAME_MISMATCH
   r1 | d1 | VARIABLE_NAME_MISMATCH

   3

       assertTrue(d1.equals(d2));

   4

       assertTrue(r2.equals(r1));

   4 | assertTrue(r2.equals(r1));
   4 | assertTrue(d2.equals(d1));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   r1 | d1 | VARIABLE_NAME_MISMATCH
   r2 | d2 | VARIABLE_NAME_MISMATCH

   4

       assertTrue(d2.equals(d1));

   5 | d1 = createSampleDataset1();

   Preondition Violations
   Unmatched statement d1=createSampleDataset1(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   5

       d1 = createSampleDataset1();

   5

       r1.setRenderAsPercentages(true);

   5 | r1.setRenderAsPercentages(true);
   6 | assertFalse(d1.equals(d2));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   setRenderAsPercentages | assertFalse | METHOD_INVOCATION_NAME_MISMATCH
   true | d1.equals(d2) | TYPE_COMPATIBLE_REPLACEMENT
   r1 |  | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression r1.setRenderAsPercentages(true) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression assertFalse(d1.equals(d2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression r1.setRenderAsPercentages(true) is a void method call, and thus it cannot be parameterized
   Expression assertFalse(d1.equals(d2)) is a void method call, and thus it cannot be parameterized
   Expression d1.equals(d2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression r1.setRenderAsPercentages(true) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression assertFalse(d1.equals(d2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression r1.setRenderAsPercentages(true) is a void method call, and thus it cannot be parameterized
   Expression assertFalse(d1.equals(d2)) is a void method call, and thus it cannot be parameterized

   6

       assertFalse(d1.equals(d2));

   6

       assertFalse(r1.equals(r2));

   7 | d2 = createSampleDataset1();

   Preondition Violations
   Unmatched statement d2=createSampleDataset1(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   7

       d2 = createSampleDataset1();

   7

       r2.setRenderAsPercentages(true);

   8

       assertTrue(r1.equals(r2));

   8 | assertTrue(r1.equals(r2));
   8 | assertTrue(d1.equals(d2));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   r2 | d2 | VARIABLE_NAME_MISMATCH
   r1 | d1 | VARIABLE_NAME_MISMATCH

   8

       assertTrue(d1.equals(d2));

   Precondition Violations (12)
   Row | Violation
   --- | ---
   1 | Unmatched statement d1=createSampleDataset1(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   2 | Expression r1.setRenderAsPercentages(true) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression assertFalse(d1.equals(d2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression r1.setRenderAsPercentages(true) is a void method call, and thus it cannot be parameterized
   5 | Expression assertFalse(d1.equals(d2)) is a void method call, and thus it cannot be parameterized
   6 | Expression d1.equals(d2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   7 | Expression r1.setRenderAsPercentages(true) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   8 | Expression assertFalse(d1.equals(d2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   9 | Expression r1.setRenderAsPercentages(true) is a void method call, and thus it cannot be parameterized
   10 | Expression assertFalse(d1.equals(d2)) is a void method call, and thus it cannot be parameterized
   11 | Unmatched statement d2=createSampleDataset1(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   12 | Clone fragment #1 returns variables r1, r2 , while Clone fragment #2 returns variables d1, d2