1119-1-8

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.foregroundRangeMarkers.get(key); if (markers != null) { Iterator iterator = markers.iterator(); while (iterator.hasNext()) { Marker m = (Marker) iterator.next(); m.removeChangeListener(this); } markers.clear(); } }

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 clearDomainMarkers(int)` |  | Method name: `void clearRangeMarkers(int)`
Number of AST nodes: 8 |  | Number of AST nodes: 8

1

    if (this.backgroundDomainMarkers != null) {↵

1

    if (this.foregroundRangeMarkers != null) {↵

2

                Collection markers↵

2

                Collection markers↵

3

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

3

                    = (Collection) this.foregroundRangeMarkers.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

                    }↵

9

                    }↵

10

                    markers.clear();↵

10

                    markers.clear();↵

11

                }↵

11

                }↵

12

            }

12

            }

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

1. {Refactorable}

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

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

   2

       if (this.backgroundDomainMarkers != null)

   2 | if (this.backgroundDomainMarkers != null)
   10 | if (this.foregroundRangeMarkers != null)

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

   10

       if (this.foregroundRangeMarkers != null)

   3

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

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

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

   11

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

   4

       if (markers != null)

   12

       if (markers != null)

   5

       Iterator iterator = markers.iterator();

   13

       Iterator iterator = markers.iterator();

   6

       while (iterator.hasNext())

   14

       while (iterator.hasNext())

   7

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

   15

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

   8

       m.removeChangeListener(this);

   16

       m.removeChangeListener(this);

   9

       markers.clear();

   17

       markers.clear();

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