1409-2-7

if (this.foregroundDomainMarkers != null) { Set keys = this.foregroundDomainMarkers.keySet(); Iterator iterator = keys.iterator(); while (iterator.hasNext()) { Integer key = (Integer) iterator.next(); clearDomainMarkers(key.intValue()); } this.foregroundDomainMarkers.clear(); }
if (this.backgroundRangeMarkers != null) { Set keys = this.backgroundRangeMarkers.keySet(); Iterator iterator = keys.iterator(); while (iterator.hasNext()) { Integer key = (Integer) iterator.next(); clearRangeMarkers(key.intValue()); } this.backgroundRangeMarkers.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()` |  | Method name: `void clearRangeMarkers()`
Number of AST nodes: 7 |  | Number of AST nodes: 7

1

    if (this.foregroundDomainMarkers != null) {↵

1

    if (this.backgroundRangeMarkers != null) {↵

2

                Set keys = this.foregroundDomainMarkers.keySet();↵

2

                Set keys = this.backgroundRangeMarkers.keySet();↵

3

                Iterator iterator = keys.iterator();↵

3

                Iterator iterator = keys.iterator();↵

4

                while (iterator.hasNext()) {↵

4

                while (iterator.hasNext()) {↵

5

                    Integer key = (Integer) iterator.next();↵

5

                    Integer key = (Integer) iterator.next();↵

6

                    clearDomainMarkers(key.intValue());↵

6

                    clearRangeMarkers(key.intValue());↵

7

                }↵

7

                }↵

8

                this.foregroundDomainMarkers.clear();↵

8

                this.backgroundRangeMarkers.clear();↵

9

            }

9

            }

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

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

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

   8

       if (this.foregroundDomainMarkers != null)

   8 | if (this.foregroundDomainMarkers != null)
   1 | if (this.backgroundRangeMarkers != null)

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

   1

       if (this.backgroundRangeMarkers != null)

   9

       Set keys = this.foregroundDomainMarkers.keySet();

   9 | Set keys = this.foregroundDomainMarkers.keySet();
   2 | Set keys = this.backgroundRangeMarkers.keySet();

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

   2

       Set keys = this.backgroundRangeMarkers.keySet();

   10

       Iterator iterator = keys.iterator();

   3

       Iterator iterator = keys.iterator();

   11

       while (iterator.hasNext())

   4

       while (iterator.hasNext())

   12

       Integer key = (Integer)iterator.next();

   5

       Integer key = (Integer)iterator.next();

   13

       clearDomainMarkers(key.intValue());

   13 | clearDomainMarkers(key.intValue());
   6 | clearRangeMarkers(key.intValue());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   clearDomainMarkers | clearRangeMarkers | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression clearDomainMarkers(key.intValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression clearRangeMarkers(key.intValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression clearDomainMarkers(key.intValue()) is a void method call, and thus it cannot be parameterized
   Expression clearRangeMarkers(key.intValue()) is a void method call, and thus it cannot be parameterized

   6

       clearRangeMarkers(key.intValue());

   14

       this.foregroundDomainMarkers.clear();

   14 | this.foregroundDomainMarkers.clear();
   7 | this.backgroundRangeMarkers.clear();

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

   7

       this.backgroundRangeMarkers.clear();

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Expression clearDomainMarkers(key.intValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression clearRangeMarkers(key.intValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression clearDomainMarkers(key.intValue()) is a void method call, and thus it cannot be parameterized
   4 | Expression clearRangeMarkers(key.intValue()) is a void method call, and thus it cannot be parameterized