1271-6-8

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(); }
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/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: 7 |  | Number of AST nodes: 7

1

    Collection markers↵

1

    Collection markers↵

2

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

2

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

3

                if (markers != null) {↵

3

                if (markers != null) {↵

4

                    Iterator iterator = markers.iterator();↵

4

                    Iterator iterator = markers.iterator();↵

5

                    while (iterator.hasNext()) {↵

5

                    while (iterator.hasNext()) {↵

6

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

6

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

7

                        m.removeChangeListener(this);↵

7

                        m.removeChangeListener(this);↵

8

                    }↵

8

                    }↵

9

                    markers.clear();↵

9

                    markers.clear();↵

10

                }

10

                }

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

1. {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) | 6.8
   Clone type | Type 2

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

   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();

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