263-1-2

Collection result = null; Integer key = new Integer(index); if (layer == Layer.FOREGROUND) { result = (Collection) this.foregroundRangeMarkers.get(key); } else if (layer == Layer.BACKGROUND) { result = (Collection) this.backgroundRangeMarkers.get(key); } if (result != null) { result = Collections.unmodifiableCollection(result); } return result;
Collection result = null; Integer key = new Integer(index); if (layer == Layer.FOREGROUND) { result = (Collection) this.foregroundDomainMarkers.get(key); } else if (layer == Layer.BACKGROUND) { result = (Collection) this.backgroundDomainMarkers.get(key); } if (result != null) { result = Collections.unmodifiableCollection(result); } return result;

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: `Collection getRangeMarkers(int, Layer)` |  | Method name: `Collection getDomainMarkers(int, Layer)`
Number of AST nodes: 9 |  | Number of AST nodes: 9

1

    Collection result = null;↵

1

    Collection result = null;↵

2

            Integer key = new Integer(index);↵

2

            Integer key = new Integer(index);↵

3

            if (layer == Layer.FOREGROUND) {↵

3

            if (layer == Layer.FOREGROUND) {↵

4

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

4

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

5

            }↵

5

            }↵

6

            else if (layer == Layer.BACKGROUND) {↵

6

            else if (layer == Layer.BACKGROUND) {↵

7

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

7

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

8

            }↵

8

            }↵

9

            if (result != null) {↵

9

            if (result != null) {↵

10

                result = Collections.unmodifiableCollection(result);↵

10

                result = Collections.unmodifiableCollection(result);↵

11

            }↵

11

            }↵

12

            return result;

12

            return result;

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

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 9
   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
   --- | --- | --- | --- | ---

   1

       Collection result = null;

   1

       Collection result = null;

   2

       Integer key = new Integer(index);

   2

       Integer key = new Integer(index);

   3

       if (layer == Layer.FOREGROUND)

   3

       if (layer == Layer.FOREGROUND)

   4

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

   4 | result = (Collection)this.foregroundRangeMarkers.get(key);
   4 | result = (Collection)this.foregroundDomainMarkers.get(key);

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

   4

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

   5

       else if (layer == Layer.BACKGROUND)

   5

       else if (layer == Layer.BACKGROUND)

   6

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

   6 | result = (Collection)this.backgroundRangeMarkers.get(key);
   6 | result = (Collection)this.backgroundDomainMarkers.get(key);

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

   6

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

   7

       if (result != null)

   7

       if (result != null)

   8

       result = Collections.unmodifiableCollection(result);

   8

       result = Collections.unmodifiableCollection(result);

   9

       return result;

   9

       return result;

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