1222-1-2

ValueMarker m = new ValueMarker(1.1); m.addChangeListener(this); this.lastEvent = null; assertEquals(0.8f, m.getAlpha(), EPSILON); m.setAlpha(0.5f); assertEquals(0.5f, m.getAlpha(), EPSILON); assertEquals(m, this.lastEvent.getMarker());
ValueMarker m = new ValueMarker(1.1); m.addChangeListener(this); this.lastEvent = null; assertEquals(1.1, m.getValue(), EPSILON); m.setValue(33.3); assertEquals(33.3, m.getValue(), EPSILON); assertEquals(m, this.lastEvent.getMarker());

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/MarkerTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/ValueMarkerTests.java
Method name: `void testGetSetAlpha()` |  | Method name: `void testGetSetValue()`
Number of AST nodes: 7 |  | Number of AST nodes: 7

1

    ValueMarker m = new ValueMarker(1.1);↵

1

    ValueMarker m = new ValueMarker(1.1);↵

2

            m.addChangeListener(this);↵

2

            m.addChangeListener(this);↵

3

            this.lastEvent = null;↵

3

            this.lastEvent = null;↵

4

            assertEquals(0.8f, m.getAlpha(), EPSILON);↵

4

            assertEquals(1.1, m.getValue(), EPSILON);↵

5

            m.setAlpha(0.5f);↵

5

            m.setValue(33.3);↵

6

            assertEquals(0.5f, m.getAlpha(), EPSILON);↵

6

            assertEquals(33.3, m.getValue(), EPSILON);↵

7

            assertEquals(m, this.lastEvent.getMarker());

7

            assertEquals(m, this.lastEvent.getMarker());

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 7
   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

       ValueMarker m = new ValueMarker(1.1);

   1

       ValueMarker m = new ValueMarker(1.1);

   2

       m.addChangeListener(this);

   2

       m.addChangeListener(this);

   3

       this.lastEvent = null;

   3

       this.lastEvent = null;

   4

       assertEquals(0.8f, m.getAlpha(), EPSILON);

   4 | assertEquals(0.8f, m.getAlpha(), EPSILON);
   4 | assertEquals(1.1, m.getValue(), EPSILON);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   0.8f | 1.1 | LITERAL_VALUE_MISMATCH

   4

       assertEquals(1.1, m.getValue(), EPSILON);

   5

       m.setAlpha(0.5f);

   5 | m.setAlpha(0.5f);
   5 | m.setValue(33.3);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   setAlpha | setValue | METHOD_INVOCATION_NAME_MISMATCH
   0.5f | 33.3 | LITERAL_VALUE_MISMATCH

   Preondition Violations
   Expression m.setAlpha(0.5f) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression m.setValue(33.3) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression m.setAlpha(0.5f) is a void method call, and thus it cannot be parameterized
   Expression m.setValue(33.3) is a void method call, and thus it cannot be parameterized

   5

       m.setValue(33.3);

   6

       assertEquals(0.5f, m.getAlpha(), EPSILON);

   6 | assertEquals(0.5f, m.getAlpha(), EPSILON);
   6 | assertEquals(33.3, m.getValue(), EPSILON);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   0.5f | 33.3 | LITERAL_VALUE_MISMATCH

   6

       assertEquals(33.3, m.getValue(), EPSILON);

   7

       assertEquals(m, this.lastEvent.getMarker());

   7

       assertEquals(m, this.lastEvent.getMarker());

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Expression m.setAlpha(0.5f) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression m.setValue(33.3) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression m.setAlpha(0.5f) is a void method call, and thus it cannot be parameterized
   4 | Expression m.setValue(33.3) is a void method call, and thus it cannot be parameterized