321-3-4

Integer key = new Integer(index); if (this.backgroundDomainMarkers != null) { Collection markers = (Collection) this.backgroundDomainMarkers.get(key); if (markers != null) { Iterator iterator = markers.iterator(); while (iterator.hasNext()) { Marker m = (Marker) iterator.next(); m.removeChangeListener(this); } markers.clear(); } } if (this.foregroundRangeMarkers != null) { Collection markers = (Collection) this.foregroundDomainMarkers.get(key); if (markers != null) { Iterator iterator = markers.iterator(); while (iterator.hasNext()) { Marker m = (Marker) iterator.next(); m.removeChangeListener(this); } markers.clear(); } } fireChangeEvent();
Integer key = new Integer(index); if (this.backgroundRangeMarkers != null) { Collection markers = (Collection) this.backgroundRangeMarkers.get(key); if (markers != null) { Iterator iterator = markers.iterator(); while (iterator.hasNext()) { Marker m = (Marker) iterator.next(); m.removeChangeListener(this); } markers.clear(); } } if (this.foregroundRangeMarkers != null) { Collection markers = (Collection) this.foregroundRangeMarkers.get(key); if (markers != null) { Iterator iterator = markers.iterator(); while (iterator.hasNext()) { Marker m = (Marker) iterator.next(); m.removeChangeListener(this); } markers.clear(); } } fireChangeEvent();

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/XYPlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/XYPlot.java
Method name: `void clearDomainMarkers(int)` |  | Method name: `void clearRangeMarkers(int)`
Number of AST nodes: 18 |  | Number of AST nodes: 18

1

    Integer key = new Integer(index);↵

1

    Integer key = new Integer(index);↵

2

            if (this.backgroundDomainMarkers != null) {↵

2

            if (this.backgroundRangeMarkers != null) {↵

3

                Collection markers↵

3

                Collection markers↵

4

                    = (Collection) this.backgroundDomainMarkers.get(key);↵

4

                    = (Collection) this.backgroundRangeMarkers.get(key);↵

5

                if (markers != null) {↵

5

                if (markers != null) {↵

6

                    Iterator iterator = markers.iterator();↵

6

                    Iterator iterator = markers.iterator();↵

7

                    while (iterator.hasNext()) {↵

7

                    while (iterator.hasNext()) {↵

8

                        Marker m = (Marker) iterator.next();↵

8

                        Marker m = (Marker) iterator.next();↵

9

                        m.removeChangeListener(this);↵

9

                        m.removeChangeListener(this);↵

10

                    }↵

10

                    }↵

11

                    markers.clear();↵

11

                    markers.clear();↵

12

                }↵

12

                }↵

13

            }↵

13

            }↵

14

            if (this.foregroundRangeMarkers != null) {↵

14

            if (this.foregroundRangeMarkers != null) {↵

15

                Collection markers↵

15

                Collection markers↵

16

                    = (Collection) this.foregroundDomainMarkers.get(key);↵

16

                    = (Collection) this.foregroundRangeMarkers.get(key);↵

17

                if (markers != null) {↵

17

                if (markers != null) {↵

18

                    Iterator iterator = markers.iterator();↵

18

                    Iterator iterator = markers.iterator();↵

19

                    while (iterator.hasNext()) {↵

19

                    while (iterator.hasNext()) {↵

20

                        Marker m = (Marker) iterator.next();↵

20

                        Marker m = (Marker) iterator.next();↵

21

                        m.removeChangeListener(this);↵

21

                        m.removeChangeListener(this);↵

22

                    }↵

22

                    }↵

23

                    markers.clear();↵

23

                    markers.clear();↵

24

                }↵

24

                }↵

25

            }↵

25

            }↵

26

            fireChangeEvent();

26

            fireChangeEvent();

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.9
Clones location | Clones are declared in the same class
Number of node comparisons | 60

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 18
   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) | 20.5
   Clone type | Type 2

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

   1

       Integer key = new Integer(index);

   1

       Integer key = new Integer(index);

   2

       if (this.backgroundDomainMarkers != null)

   2 | if (this.backgroundDomainMarkers != null)
   2 | if (this.backgroundRangeMarkers != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   backgroundDomainMarkers | backgroundRangeMarkers | VARIABLE_NAME_MISMATCH

   2

       if (this.backgroundRangeMarkers != null)

   3

       Collection markers = (Collection)this.backgroundDomainMarkers.get(key);

   3 | Collection markers = (Collection)this.backgroundDomainMarkers.get(key);
   3 | Collection markers = (Collection)this.backgroundRangeMarkers.get(key);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   backgroundDomainMarkers | backgroundRangeMarkers | VARIABLE_NAME_MISMATCH

   3

       Collection markers = (Collection)this.backgroundRangeMarkers.get(key);

   4

       if (markers != null)

   4

       if (markers != null)

   5

       Iterator iterator = markers.iterator();

   5

       Iterator iterator = markers.iterator();

   6

       while (iterator.hasNext())

   6

       while (iterator.hasNext())

   7

       Marker m = (Marker)iterator.next();

   7

       Marker m = (Marker)iterator.next();

   8

       m.removeChangeListener(this);

   8

       m.removeChangeListener(this);

   9

       markers.clear();

   9

       markers.clear();

   10

       if (this.foregroundRangeMarkers != null)

   10

       if (this.foregroundRangeMarkers != null)

   11

       Collection markers = (Collection)this.foregroundDomainMarkers.get(key);

   11 | Collection markers = (Collection)this.foregroundDomainMarkers.get(key);
   11 | Collection markers = (Collection)this.foregroundRangeMarkers.get(key);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   foregroundDomainMarkers | foregroundRangeMarkers | VARIABLE_NAME_MISMATCH

   11

       Collection markers = (Collection)this.foregroundRangeMarkers.get(key);

   12

       if (markers != null)

   12

       if (markers != null)

   13

       Iterator iterator = markers.iterator();

   13

       Iterator iterator = markers.iterator();

   14

       while (iterator.hasNext())

   14

       while (iterator.hasNext())

   15

       Marker m = (Marker)iterator.next();

   15

       Marker m = (Marker)iterator.next();

   16

       m.removeChangeListener(this);

   16

       m.removeChangeListener(this);

   17

       markers.clear();

   17

       markers.clear();

   18

       fireChangeEvent();

   18

       fireChangeEvent();

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