11-1-2

CategoryPointerAnnotation a1 = new CategoryPointerAnnotation("Label", "Key 1", 20.0, Math.PI); CategoryPointerAnnotation a2 = new CategoryPointerAnnotation("Label", "Key 1", 20.0, Math.PI); assertTrue(a1.equals(a2)); a1 = new CategoryPointerAnnotation("Label2", "Key 1", 20.0, Math.PI); assertFalse(a1.equals(a2)); a2 = new CategoryPointerAnnotation("Label2", "Key 1", 20.0, Math.PI); assertTrue(a1.equals(a2)); a1.setCategory("Key 2"); assertFalse(a1.equals(a2)); a2.setCategory("Key 2"); assertTrue(a1.equals(a2)); a1.setValue(22.0); assertFalse(a1.equals(a2)); a2.setValue(22.0); assertTrue(a1.equals(a2)); //private double angle; a1.setAngle(Math.PI / 4.0); assertFalse(a1.equals(a2)); a2.setAngle(Math.PI / 4.0); assertTrue(a1.equals(a2)); //private double tipRadius; a1.setTipRadius(20.0); assertFalse(a1.equals(a2)); a2.setTipRadius(20.0); assertTrue(a1.equals(a2)); //private double baseRadius; a1.setBaseRadius(5.0); assertFalse(a1.equals(a2)); a2.setBaseRadius(5.0); assertTrue(a1.equals(a2)); //private double arrowLength; a1.setArrowLength(33.0); assertFalse(a1.equals(a2)); a2.setArrowLength(33.0); assertTrue(a1.equals(a2)); //private double arrowWidth; a1.setArrowWidth(9.0); assertFalse(a1.equals(a2)); a2.setArrowWidth(9.0); assertTrue(a1.equals(a2)); //private Stroke arrowStroke; Stroke stroke = new BasicStroke(1.5f); a1.setArrowStroke(stroke); assertFalse(a1.equals(a2)); a2.setArrowStroke(stroke); assertTrue(a1.equals(a2)); //private Paint arrowPaint; a1.setArrowPaint(Color.blue); assertFalse(a1.equals(a2)); a2.setArrowPaint(Color.blue); assertTrue(a1.equals(a2)); //private double labelOffset; a1.setLabelOffset(10.0); assertFalse(a1.equals(a2)); a2.setLabelOffset(10.0); assertTrue(a1.equals(a2));
XYPointerAnnotation a1 = new XYPointerAnnotation("Label", 10.0, 20.0, Math.PI); XYPointerAnnotation a2 = new XYPointerAnnotation("Label", 10.0, 20.0, Math.PI); assertTrue(a1.equals(a2)); a1 = new XYPointerAnnotation("Label2", 10.0, 20.0, Math.PI); assertFalse(a1.equals(a2)); a2 = new XYPointerAnnotation("Label2", 10.0, 20.0, Math.PI); assertTrue(a1.equals(a2)); a1.setX(11.0); assertFalse(a1.equals(a2)); a2.setX(11.0); assertTrue(a1.equals(a2)); a1.setY(22.0); assertFalse(a1.equals(a2)); a2.setY(22.0); assertTrue(a1.equals(a2)); //private double angle; a1.setAngle(Math.PI / 4.0); assertFalse(a1.equals(a2)); a2.setAngle(Math.PI / 4.0); assertTrue(a1.equals(a2)); //private double tipRadius; a1.setTipRadius(20.0); assertFalse(a1.equals(a2)); a2.setTipRadius(20.0); assertTrue(a1.equals(a2)); //private double baseRadius; a1.setBaseRadius(5.0); assertFalse(a1.equals(a2)); a2.setBaseRadius(5.0); assertTrue(a1.equals(a2)); //private double arrowLength; a1.setArrowLength(33.0); assertFalse(a1.equals(a2)); a2.setArrowLength(33.0); assertTrue(a1.equals(a2)); //private double arrowWidth; a1.setArrowWidth(9.0); assertFalse(a1.equals(a2)); a2.setArrowWidth(9.0); assertTrue(a1.equals(a2)); //private Stroke arrowStroke; Stroke stroke = new BasicStroke(1.5f); a1.setArrowStroke(stroke); assertFalse(a1.equals(a2)); a2.setArrowStroke(stroke); assertTrue(a1.equals(a2)); //private Paint arrowPaint; a1.setArrowPaint(Color.blue); assertFalse(a1.equals(a2)); a2.setArrowPaint(Color.blue); assertTrue(a1.equals(a2)); //private double labelOffset; a1.setLabelOffset(10.0); assertFalse(a1.equals(a2)); a2.setLabelOffset(10.0); assertTrue(a1.equals(a2));

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/annotations/junit/CategoryPointerAnnotationTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/annotations/junit/XYPointerAnnotationTests.java
Method name: `void testEquals()` |  | Method name: `void testEquals()`
Number of AST nodes: 48 |  | Number of AST nodes: 48

1

    CategoryPointerAnnotation a1 = new CategoryPointerAnnotation("Label",↵

1

    XYPointerAnnotation a1 = new XYPointerAnnotation("Label",↵

2

     ↵

2

     10.0, 20.0,↵

3

                   "Key 1", 20.0, Math.PI);↵

3

                    Math.PI);↵

4

            CategoryPointerAnnotation a2 = new CategoryPointerAnnotation("Label",↵

4

            XYPointerAnnotation a2 = new XYPointerAnnotation("Label",↵

5

     ↵

5

     10.0, 20.0,↵

6

                   "Key 1", 20.0, Math.PI);↵

6

                    Math.PI);↵

7

            assertTrue(a1.equals(a2));↵

7

            assertTrue(a1.equals(a2));↵

8

            a1 = new CategoryPointerAnnotation("Label2", "Key 1", 20.0, Math.PI);↵

8

            a1 = new XYPointerAnnotation("Label2", 10.0, 20.0, Math.PI);↵

9

            assertFalse(a1.equals(a2));↵

9

            assertFalse(a1.equals(a2));↵

10

            a2 = new CategoryPointerAnnotation("Label2", "Key 1", 20.0, Math.PI);↵

10

            a2 = new XYPointerAnnotation("Label2", 10.0, 20.0, Math.PI);↵

11

            assertTrue(a1.equals(a2));↵

11

            assertTrue(a1.equals(a2));↵

12

            a1.setCategory("Key 2");↵

12

            a1.setX(11.0);↵

13

            assertFalse(a1.equals(a2));↵

13

            assertFalse(a1.equals(a2));↵

14

            a2.setCategory("Key 2");↵

14

            a2.setX(11.0);↵

15

            assertTrue(a1.equals(a2));↵

15

            assertTrue(a1.equals(a2));↵

16

            a1.setValue(22.0);↵

16

            a1.setY(22.0);↵

17

            assertFalse(a1.equals(a2));↵

17

            assertFalse(a1.equals(a2));↵

18

            a2.setValue(22.0);↵

18

            a2.setY(22.0);↵

19

            assertTrue(a1.equals(a2));↵

19

            assertTrue(a1.equals(a2));↵

20

            //private double angle;↵

20

            //private double angle;↵

21

            a1.setAngle(Math.PI / 4.0);↵

21

            a1.setAngle(Math.PI / 4.0);↵

22

            assertFalse(a1.equals(a2));↵

22

            assertFalse(a1.equals(a2));↵

23

            a2.setAngle(Math.PI / 4.0);↵

23

            a2.setAngle(Math.PI / 4.0);↵

24

            assertTrue(a1.equals(a2));↵

24

            assertTrue(a1.equals(a2));↵

25

            //private double tipRadius;↵

25

            //private double tipRadius;↵

26

            a1.setTipRadius(20.0);↵

26

            a1.setTipRadius(20.0);↵

27

            assertFalse(a1.equals(a2));↵

27

            assertFalse(a1.equals(a2));↵

28

            a2.setTipRadius(20.0);↵

28

            a2.setTipRadius(20.0);↵

29

            assertTrue(a1.equals(a2));↵

29

            assertTrue(a1.equals(a2));↵

30

            //private double baseRadius;↵

30

            //private double baseRadius;↵

31

            a1.setBaseRadius(5.0);↵

31

            a1.setBaseRadius(5.0);↵

32

            assertFalse(a1.equals(a2));↵

32

            assertFalse(a1.equals(a2));↵

33

            a2.setBaseRadius(5.0);↵

33

            a2.setBaseRadius(5.0);↵

34

            assertTrue(a1.equals(a2));↵

34

            assertTrue(a1.equals(a2));↵

35

            //private double arrowLength;↵

35

            //private double arrowLength;↵

36

            a1.setArrowLength(33.0);↵

36

            a1.setArrowLength(33.0);↵

37

            assertFalse(a1.equals(a2));↵

37

            assertFalse(a1.equals(a2));↵

38

            a2.setArrowLength(33.0);↵

38

            a2.setArrowLength(33.0);↵

39

            assertTrue(a1.equals(a2));↵

39

            assertTrue(a1.equals(a2));↵

40

            //private double arrowWidth;↵

40

            //private double arrowWidth;↵

41

            a1.setArrowWidth(9.0);↵

41

            a1.setArrowWidth(9.0);↵

42

            assertFalse(a1.equals(a2));↵

42

            assertFalse(a1.equals(a2));↵

43

            a2.setArrowWidth(9.0);↵

43

            a2.setArrowWidth(9.0);↵

44

            assertTrue(a1.equals(a2));↵

44

            assertTrue(a1.equals(a2));↵

45

            //private Stroke arrowStroke;↵

45

            //private Stroke arrowStroke;↵

46

            Stroke stroke = new BasicStroke(1.5f);↵

46

            Stroke stroke = new BasicStroke(1.5f);↵

47

            a1.setArrowStroke(stroke);↵

47

            a1.setArrowStroke(stroke);↵

48

            assertFalse(a1.equals(a2));↵

48

            assertFalse(a1.equals(a2));↵

49

            a2.setArrowStroke(stroke);↵

49

            a2.setArrowStroke(stroke);↵

50

            assertTrue(a1.equals(a2));↵

50

            assertTrue(a1.equals(a2));↵

51

            //private Paint arrowPaint;↵

51

            //private Paint arrowPaint;↵

52

            a1.setArrowPaint(Color.blue);↵

52

            a1.setArrowPaint(Color.blue);↵

53

            assertFalse(a1.equals(a2));↵

53

            assertFalse(a1.equals(a2));↵

54

            a2.setArrowPaint(Color.blue);↵

54

            a2.setArrowPaint(Color.blue);↵

55

            assertTrue(a1.equals(a2));↵

55

            assertTrue(a1.equals(a2));↵

56

            //private double labelOffset;↵

56

            //private double labelOffset;↵

57

            a1.setLabelOffset(10.0);↵

57

            a1.setLabelOffset(10.0);↵

58

            assertFalse(a1.equals(a2));↵

58

            assertFalse(a1.equals(a2));↵

59

            a2.setLabelOffset(10.0);↵

59

            a2.setLabelOffset(10.0);↵

60

            assertTrue(a1.equals(a2));

60

            assertTrue(a1.equals(a2));

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

1. {Non-refactorable}

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

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

   1

       XYPointerAnnotation a1 = new XYPointerAnnotation("Label", 10.0, 20.0, Math.PI);

   1

       CategoryPointerAnnotation a1 = new CategoryPointerAnnotation("Label", "Key 1", 20.0, Math.PI);

   2

       XYPointerAnnotation a2 = new XYPointerAnnotation("Label", 10.0, 20.0, Math.PI);

   2

       CategoryPointerAnnotation a2 = new CategoryPointerAnnotation("Label", "Key 1", 20.0, Math.PI);

   3

       assertTrue(a1.equals(a2));

   3

       assertTrue(a1.equals(a2));

   4 | a1 = new XYPointerAnnotation("Label2", 10.0, 20.0, Math.PI);

   Preondition Violations
   Unmatched statement a1=new XYPointerAnnotation("Label2",10.0,20.0,Math.PI); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   4

       a1 = new XYPointerAnnotation("Label2", 10.0, 20.0, Math.PI);

   4

       a1 = new CategoryPointerAnnotation("Label2", "Key 1", 20.0, Math.PI);

   4 | a1 = new CategoryPointerAnnotation("Label2", "Key 1", 20.0, Math.PI);

   Preondition Violations
   Unmatched statement a1=new CategoryPointerAnnotation("Label2","Key 1",20.0,Math.PI); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   5

       assertFalse(a1.equals(a2));

   5

       assertFalse(a1.equals(a2));

   6 | a2 = new XYPointerAnnotation("Label2", 10.0, 20.0, Math.PI);

   Preondition Violations
   Unmatched statement a2=new XYPointerAnnotation("Label2",10.0,20.0,Math.PI); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   6

       a2 = new XYPointerAnnotation("Label2", 10.0, 20.0, Math.PI);

   6

       a2 = new CategoryPointerAnnotation("Label2", "Key 1", 20.0, Math.PI);

   6 | a2 = new CategoryPointerAnnotation("Label2", "Key 1", 20.0, Math.PI);

   Preondition Violations
   Unmatched statement a2=new CategoryPointerAnnotation("Label2","Key 1",20.0,Math.PI); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   7

       assertTrue(a1.equals(a2));

   7

       assertTrue(a1.equals(a2));

   8 | a1.setX(11.0);

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

   8

       a1.setX(11.0);

   8

       a1.setCategory("Key 2");

   8 | a1.setCategory("Key 2");

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

   9

       assertFalse(a1.equals(a2));

   9

       assertFalse(a1.equals(a2));

   10

       a2.setX(11.0);

   10

       a2.setCategory("Key 2");

   11

       assertTrue(a1.equals(a2));

   11

       assertTrue(a1.equals(a2));

   12

       a1.setValue(22.0);

   12 | a1.setValue(22.0);
   12 | a1.setY(22.0);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   setValue | setY | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression a1.setValue(22.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression a1.setY(22.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression a1.setValue(22.0) is a void method call, and thus it cannot be parameterized
   Expression a1.setY(22.0) is a void method call, and thus it cannot be parameterized

   12

       a1.setY(22.0);

   13

       assertFalse(a1.equals(a2));

   13

       assertFalse(a1.equals(a2));

   14

       a2.setValue(22.0);

   14 | a2.setValue(22.0);
   14 | a2.setY(22.0);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   setValue | setY | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression a2.setValue(22.0) is a void method call, and thus it cannot be parameterized
   Expression a2.setY(22.0) is a void method call, and thus it cannot be parameterized

   14

       a2.setY(22.0);

   15

       assertTrue(a1.equals(a2));

   15

       assertTrue(a1.equals(a2));

   16

       a1.setAngle(Math.PI / 4.0);

   16

       a1.setAngle(Math.PI / 4.0);

   17

       assertFalse(a1.equals(a2));

   17

       assertFalse(a1.equals(a2));

   18

       a2.setAngle(Math.PI / 4.0);

   18

       a2.setAngle(Math.PI / 4.0);

   19

       assertTrue(a1.equals(a2));

   19

       assertTrue(a1.equals(a2));

   20

       a1.setTipRadius(20.0);

   20

       a1.setTipRadius(20.0);

   21

       assertFalse(a1.equals(a2));

   21

       assertFalse(a1.equals(a2));

   22

       a2.setTipRadius(20.0);

   22

       a2.setTipRadius(20.0);

   23

       assertTrue(a1.equals(a2));

   23

       assertTrue(a1.equals(a2));

   24

       a1.setBaseRadius(5.0);

   24

       a1.setBaseRadius(5.0);

   25

       assertFalse(a1.equals(a2));

   25

       assertFalse(a1.equals(a2));

   26

       a2.setBaseRadius(5.0);

   26

       a2.setBaseRadius(5.0);

   27

       assertTrue(a1.equals(a2));

   27

       assertTrue(a1.equals(a2));

   28

       a1.setArrowLength(33.0);

   28

       a1.setArrowLength(33.0);

   29

       assertFalse(a1.equals(a2));

   29

       assertFalse(a1.equals(a2));

   30

       a2.setArrowLength(33.0);

   30

       a2.setArrowLength(33.0);

   31

       assertTrue(a1.equals(a2));

   31

       assertTrue(a1.equals(a2));

   32

       a1.setArrowWidth(9.0);

   32

       a1.setArrowWidth(9.0);

   33

       assertFalse(a1.equals(a2));

   33

       assertFalse(a1.equals(a2));

   34

       a2.setArrowWidth(9.0);

   34

       a2.setArrowWidth(9.0);

   35

       assertTrue(a1.equals(a2));

   35

       assertTrue(a1.equals(a2));

   36

       Stroke stroke = new BasicStroke(1.5f);

   36

       Stroke stroke = new BasicStroke(1.5f);

   37

       a1.setArrowStroke(stroke);

   37

       a1.setArrowStroke(stroke);

   38

       assertFalse(a1.equals(a2));

   38

       assertFalse(a1.equals(a2));

   39

       a2.setArrowStroke(stroke);

   39

       a2.setArrowStroke(stroke);

   40

       assertTrue(a1.equals(a2));

   40

       assertTrue(a1.equals(a2));

   41

       a1.setArrowPaint(Color.blue);

   41

       a1.setArrowPaint(Color.blue);

   42

       assertFalse(a1.equals(a2));

   42

       assertFalse(a1.equals(a2));

   43

       a2.setArrowPaint(Color.blue);

   43

       a2.setArrowPaint(Color.blue);

   44

       assertTrue(a1.equals(a2));

   44

       assertTrue(a1.equals(a2));

   45

       a1.setLabelOffset(10.0);

   45

       a1.setLabelOffset(10.0);

   46

       assertFalse(a1.equals(a2));

   46

       assertFalse(a1.equals(a2));

   47

       a2.setLabelOffset(10.0);

   47

       a2.setLabelOffset(10.0);

   48

       assertTrue(a1.equals(a2));

   48

       assertTrue(a1.equals(a2));

   Precondition Violations (12)
   Row | Violation
   --- | ---
   1 | Unmatched statement a1=new XYPointerAnnotation("Label2",10.0,20.0,Math.PI); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   2 | Unmatched statement a1=new CategoryPointerAnnotation("Label2","Key 1",20.0,Math.PI); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   3 | Unmatched statement a2=new XYPointerAnnotation("Label2",10.0,20.0,Math.PI); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   4 | Unmatched statement a2=new CategoryPointerAnnotation("Label2","Key 1",20.0,Math.PI); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   5 | Unmatched statement a1.setX(11.0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   6 | Unmatched statement a1.setCategory("Key 2"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   7 | Expression a1.setValue(22.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   8 | Expression a1.setY(22.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   9 | Expression a1.setValue(22.0) is a void method call, and thus it cannot be parameterized
   10 | Expression a1.setY(22.0) is a void method call, and thus it cannot be parameterized
   11 | Expression a2.setValue(22.0) is a void method call, and thus it cannot be parameterized
   12 | Expression a2.setY(22.0) is a void method call, and thus it cannot be parameterized