1172-3-4

if (index == 0 && location == null) { throw new IllegalArgumentException( "Null 'location' for index 0 not permitted."); } this.domainAxisLocations.set(index, location); if (notify) { fireChangeEvent(); }
if (index == 0 && location == null) { throw new IllegalArgumentException( "Null 'location' for index 0 not permitted."); } this.rangeAxisLocations.set(index, location); if (notify) { fireChangeEvent(); }

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 setDomainAxisLocation(int, AxisLocation, boolean)` |  | Method name: `void setRangeAxisLocation(int, AxisLocation, boolean)`
Number of AST nodes: 5 |  | Number of AST nodes: 5

1

    if (index == 0 && location == null) {↵

1

    if (index == 0 && location == null) {↵

2

                throw new IllegalArgumentException(↵

2

                throw new IllegalArgumentException(↵

3

                        "Null 'location' for index 0 not permitted.");↵

3

                        "Null 'location' for index 0 not permitted.");↵

4

            }↵

4

            }↵

5

            this.domainAxisLocations.set(index, location);↵

5

            this.rangeAxisLocations.set(index, location);↵

6

            if (notify) {↵

6

            if (notify) {↵

7

                fireChangeEvent();↵

7

                fireChangeEvent();↵

8

            }

8

            }

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 declared in the same 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) | 0.8
   Clone type | Type 2

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

   1

       if (index == 0 && location == null)

   1

       if (index == 0 && location == null)

   2

       throw new IllegalArgumentException("Null 'location' for index 0 not permitted.");

   2

       throw new IllegalArgumentException("Null 'location' for index 0 not permitted.");

   3

       this.domainAxisLocations.set(index, location);

   3 | this.domainAxisLocations.set(index, location);
   3 | this.rangeAxisLocations.set(index, location);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   domainAxisLocations | rangeAxisLocations | VARIABLE_NAME_MISMATCH

   3

       this.rangeAxisLocations.set(index, location);

   4

       if (notify)

   4

       if (notify)

   5

       fireChangeEvent();

   5

       fireChangeEvent();

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