1573-2-3

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);
markers = (Collection) this.backgroundDomainMarkers.get( new Integer(index)); if (markers == null) { markers = new java.util.ArrayList(); this.backgroundDomainMarkers.put(new Integer(index), markers); } markers.add(marker);

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 addDomainMarker(int, Marker, Layer, boolean)`
Number of AST nodes: 5 |  | Number of AST nodes: 5

1

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

1

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

2

                        new Integer(index));↵

2

                        new Integer(index));↵

3

                if (markers == null) {↵

3

                if (markers == null) {↵

4

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

4

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

5

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

5

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

6

                }↵

6

                }↵

7

                markers.add(marker);

7

                markers.add(marker);

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 in different classes having the same super class
Number of node comparisons | 14

1. {Refactorable}

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

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

   9

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

   9 | markers = (Collection)this.backgroundRangeMarkers.get(new Integer(index));
   13 | markers = (Collection)this.backgroundDomainMarkers.get(new Integer(index));

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

   13

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

   10

       if (markers == null)

   14

       if (markers == null)

   11

       markers = new java.util.ArrayList();

   15

       markers = new java.util.ArrayList();

   12

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

   12 | this.backgroundRangeMarkers.put(new Integer(index), markers);
   16 | this.backgroundDomainMarkers.put(new Integer(index), markers);

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

   16

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

   13

       markers.add(marker);

   17

       markers.add(marker);

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