102-1-2

Collection markers; if (layer == Layer.FOREGROUND) { markers = (Collection) this.foregroundRangeMarkers.get( new Integer(index)); if (markers == null) { markers = new java.util.ArrayList(); this.foregroundRangeMarkers.put(new Integer(index), markers); } markers.add(marker); } else if (layer == Layer.BACKGROUND) { markers = (Collection) this.backgroundRangeMarkers.get( new Integer(index)); if (markers == null) { markers = new java.util.ArrayList(); this.backgroundRangeMarkers.put(new Integer(index), markers); } markers.add(marker); } marker.addChangeListener(this); if (notify) { fireChangeEvent(); }
Collection markers; if (layer == Layer.FOREGROUND) { markers = (Collection) this.foregroundRangeMarkers.get( new Integer(index)); if (markers == null) { markers = new java.util.ArrayList(); this.foregroundRangeMarkers.put(new Integer(index), markers); } markers.add(marker); } else if (layer == Layer.BACKGROUND) { markers = (Collection) this.backgroundRangeMarkers.get( new Integer(index)); if (markers == null) { markers = new java.util.ArrayList(); this.backgroundRangeMarkers.put(new Integer(index), markers); } markers.add(marker); } marker.addChangeListener(this); if (notify) { fireChangeEvent(); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CategoryPlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/XYPlot.java
Method name: `void addRangeMarker(int, Marker, Layer, boolean)` |  | Method name: `void addRangeMarker(int, Marker, Layer, boolean)`
Number of AST nodes: 16 |  | Number of AST nodes: 16

1

    Collection markers;↵

1

    Collection markers;↵

2

            if (layer == Layer.FOREGROUND) {↵

2

            if (layer == Layer.FOREGROUND) {↵

3

                markers = (Collection) this.foregroundRangeMarkers.get(↵

3

                markers = (Collection) this.foregroundRangeMarkers.get(↵

4

                        new Integer(index));↵

4

                        new Integer(index));↵

5

                if (markers == null) {↵

5

                if (markers == null) {↵

6

                    markers = new java.util.ArrayList();↵

6

                    markers = new java.util.ArrayList();↵

7

                    this.foregroundRangeMarkers.put(new Integer(index), markers);↵

7

                    this.foregroundRangeMarkers.put(new Integer(index), markers);↵

8

                }↵

8

                }↵

9

                markers.add(marker);↵

9

                markers.add(marker);↵

10

            }↵

10

            }↵

11

            else if (layer == Layer.BACKGROUND) {↵

11

            else if (layer == Layer.BACKGROUND) {↵

12

                markers = (Collection) this.backgroundRangeMarkers.get(↵

12

                markers = (Collection) this.backgroundRangeMarkers.get(↵

13

                        new Integer(index));↵

13

                        new Integer(index));↵

14

                if (markers == null) {↵

14

                if (markers == null) {↵

15

                    markers = new java.util.ArrayList();↵

15

                    markers = new java.util.ArrayList();↵

16

                    this.backgroundRangeMarkers.put(new Integer(index), markers);↵

16

                    this.backgroundRangeMarkers.put(new Integer(index), markers);↵

17

                }↵

17

                }↵

18

                markers.add(marker);↵

18

                markers.add(marker);↵

19

            }↵

19

            }↵

20

            marker.addChangeListener(this);↵

20

            marker.addChangeListener(this);↵

21

            if (notify) {↵

21

            if (notify) {↵

22

                fireChangeEvent();↵

22

                fireChangeEvent();↵

23

            }

23

            }

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.8
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 59

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 16
   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) | 4.0
   Clone type | Type 1

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

   1

       Collection markers;

   1

       Collection markers;

   2

       if (layer == Layer.FOREGROUND)

   2

       if (layer == Layer.FOREGROUND)

   3

       markers = (Collection)this.foregroundRangeMarkers.get(new Integer(index));

   3

       markers = (Collection)this.foregroundRangeMarkers.get(new Integer(index));

   4

       if (markers == null)

   4

       if (markers == null)

   5

       markers = new java.util.ArrayList();

   5

       markers = new java.util.ArrayList();

   6

       this.foregroundRangeMarkers.put(new Integer(index), markers);

   6

       this.foregroundRangeMarkers.put(new Integer(index), markers);

   7

       markers.add(marker);

   7

       markers.add(marker);

   8

       else if (layer == Layer.BACKGROUND)

   8

       else if (layer == Layer.BACKGROUND)

   9

       markers = (Collection)this.backgroundRangeMarkers.get(new Integer(index));

   9

       markers = (Collection)this.backgroundRangeMarkers.get(new Integer(index));

   10

       if (markers == null)

   10

       if (markers == null)

   11

       markers = new java.util.ArrayList();

   11

       markers = new java.util.ArrayList();

   12

       this.backgroundRangeMarkers.put(new Integer(index), markers);

   12

       this.backgroundRangeMarkers.put(new Integer(index), markers);

   13

       markers.add(marker);

   13

       markers.add(marker);

   14

       marker.addChangeListener(this);

   14

       marker.addChangeListener(this);

   15

       if (notify)

   15

       if (notify)

   16

       fireChangeEvent();

   16

       fireChangeEvent();

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