349-2-3

if (subplot == null) { throw new IllegalArgumentException("Null 'subplot' argument."); } if (weight <= 0) { throw new IllegalArgumentException("Require weight >= 1."); } // store the plot and its weight subplot.setParent(this); subplot.setWeight(weight); subplot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0), false); subplot.setDomainAxis(null); subplot.addChangeListener(this); this.subplots.add(subplot); // keep track of total weights this.totalWeight += weight; ValueAxis axis = getDomainAxis(); if (axis != null) { axis.configure(); } fireChangeEvent();
if (subplot == null) { throw new IllegalArgumentException("Null 'subplot' argument."); } if (weight <= 0) { throw new IllegalArgumentException("Require weight >= 1."); } // store the plot and its weight subplot.setParent(this); subplot.setWeight(weight); subplot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0)); subplot.setRangeAxis(null); subplot.setOrientation(getOrientation()); subplot.addChangeListener(this); this.subplots.add(subplot); this.totalWeight += weight; // configure the range axis... ValueAxis axis = getRangeAxis(); if (axis != null) { axis.configure(); } fireChangeEvent();

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CombinedDomainXYPlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CombinedRangeCategoryPlot.java
Method name: `void add(XYPlot, int)` |  | Method name: `void add(CategoryPlot, int)`
Number of AST nodes: 15 |  | Number of AST nodes: 16

1

    if (subplot == null) {↵

1

    if (subplot == null) {↵

2

                throw new IllegalArgumentException("Null 'subplot' argument.");↵

2

                throw new IllegalArgumentException("Null 'subplot' argument.");↵

3

            }↵

3

            }↵

4

            if (weight <= 0) {↵

4

            if (weight <= 0) {↵

5

                throw new IllegalArgumentException("Require weight >= 1.");↵

5

                throw new IllegalArgumentException("Require weight >= 1.");↵

6

            }↵

6

            }↵

7

            // store the plot and its weight↵

7

            // store the plot and its weight↵

8

            subplot.setParent(this);↵

8

            subplot.setParent(this);↵

9

            subplot.setWeight(weight);↵

9

            subplot.setWeight(weight);↵

10

            subplot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0), false);↵

10

            subplot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0));↵

11

            subplot.setDomainAxis(null);↵

11

            subplot.setRangeAxis(null);↵

12

            subplot.setOrientation(getOrientation());↵

12

            subplot.addChangeListener(this);↵

13

            subplot.addChangeListener(this);↵

13

            this.subplots.add(subplot);↵

14

            this.subplots.add(subplot);↵

14

            // keep track of total weights↵

15

            ↵

15

            this.totalWeight += weight;↵

16

    this.totalWeight += weight;↵

17

            ↵

18

            // configure the range axis...↵

16

            ValueAxis axis = getDomainAxis();↵

19

            ValueAxis axis = getRangeAxis();↵

17

            if (axis != null) {↵

20

            if (axis != null) {↵

18

                axis.configure();↵

21

                axis.configure();↵

19

            }↵

22

            }↵

20

            fireChangeEvent();

23

            fireChangeEvent();

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 15
   Number of unmapped statements in the first code fragment | 0
   Number of unmapped statements in the second code fragment | 1
   Time elapsed for statement mapping (ms) | 5.7
   Clone type | Type 3

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

   1

       if (subplot == null)

   1 | if (subplot == null)
   1 | if (subplot == null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.XYPlot | org.jfree.chart.plot.CategoryPlot | SUBCLASS_TYPE_MISMATCH

   1

       if (subplot == null)

   2

       throw new IllegalArgumentException("Null 'subplot' argument.");

   2

       throw new IllegalArgumentException("Null 'subplot' argument.");

   3

       if (weight <= 0)

   3

       if (weight <= 0)

   4

       throw new IllegalArgumentException("Require weight >= 1.");

   4

       throw new IllegalArgumentException("Require weight >= 1.");

   5

       subplot.setParent(this);

   5 | subplot.setParent(this);
   5 | subplot.setParent(this);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.XYPlot | org.jfree.chart.plot.CategoryPlot | SUBCLASS_TYPE_MISMATCH

   5

       subplot.setParent(this);

   6

       subplot.setWeight(weight);

   6 | subplot.setWeight(weight);
   6 | subplot.setWeight(weight);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.XYPlot | org.jfree.chart.plot.CategoryPlot | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression subplot cannot be unified with expression subplot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void setWeight(int)

   6

       subplot.setWeight(weight);

   7

       subplot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0), false);

   7 | subplot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0), false);
   7 | subplot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.XYPlot | org.jfree.chart.plot.CategoryPlot | SUBCLASS_TYPE_MISMATCH
   subplot.setInsets(new RectangleInsets(0.0,0.0,0.0,0.0),false) | subplot.setInsets(new RectangleInsets(0.0,0.0,0.0,0.0)) | ARGUMENT_NUMBER_MISMATCH

   Preondition Violations
   Expression subplot.setInsets(new RectangleInsets(0.0,0.0,0.0,0.0),false) is a void method call, and thus it cannot be parameterized
   Expression subplot.setInsets(new RectangleInsets(0.0,0.0,0.0,0.0)) is a void method call, and thus it cannot be parameterized

   7

       subplot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0));

   8

       subplot.setDomainAxis(null);

   8 | subplot.setDomainAxis(null);
   8 | subplot.setRangeAxis(null);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   setDomainAxis | setRangeAxis | METHOD_INVOCATION_NAME_MISMATCH
   org.jfree.chart.plot.XYPlot | org.jfree.chart.plot.CategoryPlot | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression subplot.setDomainAxis(null) is a void method call, and thus it cannot be parameterized
   Expression subplot.setRangeAxis(null) is a void method call, and thus it cannot be parameterized

   8

       subplot.setRangeAxis(null);

   9

       subplot.setOrientation(getOrientation());

   9

       subplot.addChangeListener(this);

   9 | subplot.addChangeListener(this);
   10 | subplot.addChangeListener(this);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.XYPlot | org.jfree.chart.plot.CategoryPlot | SUBCLASS_TYPE_MISMATCH

   10

       subplot.addChangeListener(this);

   10

       this.subplots.add(subplot);

   10 | this.subplots.add(subplot);
   11 | this.subplots.add(subplot);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.XYPlot | org.jfree.chart.plot.CategoryPlot | SUBCLASS_TYPE_MISMATCH

   11

       this.subplots.add(subplot);

   11

       this.totalWeight += weight;

   12

       this.totalWeight += weight;

   12

       ValueAxis axis = getDomainAxis();

   12 | ValueAxis axis = getDomainAxis();
   13 | ValueAxis axis = getRangeAxis();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getDomainAxis | getRangeAxis | METHOD_INVOCATION_NAME_MISMATCH

   13

       ValueAxis axis = getRangeAxis();

   13

       if (axis != null)

   14

       if (axis != null)

   14

       axis.configure();

   15

       axis.configure();

   15

       fireChangeEvent();

   16

       fireChangeEvent();

   Precondition Violations (5)
   Row | Violation
   --- | ---
   1 | Expression subplot cannot be unified with expression subplot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void setWeight(int)
   2 | Expression subplot.setInsets(new RectangleInsets(0.0,0.0,0.0,0.0),false) is a void method call, and thus it cannot be parameterized
   3 | Expression subplot.setInsets(new RectangleInsets(0.0,0.0,0.0,0.0)) is a void method call, and thus it cannot be parameterized
   4 | Expression subplot.setDomainAxis(null) is a void method call, and thus it cannot be parameterized
   5 | Expression subplot.setRangeAxis(null) is a void method call, and thus it cannot be parameterized