287-1-3

PieDataset existing = this.dataset; if (existing != null) { existing.removeChangeListener(this); } // set the new dataset, and register the chart as a change listener... this.dataset = dataset; if (dataset != null) { setDatasetGroup(dataset.getGroup()); dataset.addChangeListener(this); } // send a dataset change event to self... DatasetChangeEvent event = new DatasetChangeEvent(this, dataset); datasetChanged(event);
ContourDataset existing = this.dataset; if (existing != null) { existing.removeChangeListener(this); } // set the new dataset, and register the chart as a change listener... this.dataset = dataset; if (dataset != null) { setDatasetGroup(dataset.getGroup()); dataset.addChangeListener(this); } // send a dataset change event to self... DatasetChangeEvent event = new DatasetChangeEvent(this, dataset); datasetChanged(event);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/PiePlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/ContourPlot.java
Method name: `void setDataset(PieDataset)` |  | Method name: `void setDataset(ContourDataset)`
Number of AST nodes: 9 |  | Number of AST nodes: 9

1

    PieDataset existing = this.dataset;↵

1

    ContourDataset existing = this.dataset;↵

2

            if (existing != null) {↵

2

            if (existing != null) {↵

3

                existing.removeChangeListener(this);↵

3

                existing.removeChangeListener(this);↵

4

            }↵

4

            }↵

5

            // set the new dataset, and register the chart as a change listener...↵

5

            // set the new dataset, and register the chart as a change listener...↵

6

            this.dataset = dataset;↵

6

            this.dataset = dataset;↵

7

            if (dataset != null) {↵

7

            if (dataset != null) {↵

8

                setDatasetGroup(dataset.getGroup());↵

8

                setDatasetGroup(dataset.getGroup());↵

9

                dataset.addChangeListener(this);↵

9

                dataset.addChangeListener(this);↵

10

            }↵

10

            }↵

11

            // send a dataset change event to self...↵

11

            // send a dataset change event to self...↵

12

            DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);↵

12

            DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);↵

13

            datasetChanged(event);

13

            datasetChanged(event);

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 7
   Number of unmapped statements in the first code fragment | 2
   Number of unmapped statements in the second code fragment | 2
   Time elapsed for statement mapping (ms) | 2.1
   Clone type | Type 2

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

   1

       ContourDataset existing = this.dataset;

   1

       PieDataset existing = this.dataset;

   2

       if (existing != null)

   2 | if (existing != null)
   2 | if (existing != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.general.PieDataset | org.jfree.data.contour.ContourDataset | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.data.general.PieDataset of variable existing does not match with type org.jfree.data.contour.ContourDataset of variable existing
   - Make classes org.jfree.data.general.PieDataset and org.jfree.data.contour.ContourDataset extend a common superclass

   2

       if (existing != null)

   3

       existing.removeChangeListener(this);

   3 | existing.removeChangeListener(this);
   3 | existing.removeChangeListener(this);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.general.PieDataset | org.jfree.data.contour.ContourDataset | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.data.general.PieDataset of variable existing does not match with type org.jfree.data.contour.ContourDataset of variable existing
   - Make classes org.jfree.data.general.PieDataset and org.jfree.data.contour.ContourDataset extend a common superclass

   3

       existing.removeChangeListener(this);

   4

       this.dataset = dataset;

   4

       this.dataset = dataset;

   5

       if (dataset != null)

   5 | if (dataset != null)
   5 | if (dataset != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.general.PieDataset | org.jfree.data.contour.ContourDataset | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.data.general.PieDataset of variable dataset does not match with type org.jfree.data.contour.ContourDataset of variable dataset
   - Make classes org.jfree.data.general.PieDataset and org.jfree.data.contour.ContourDataset extend a common superclass

   5

       if (dataset != null)

   6

       setDatasetGroup(dataset.getGroup());

   6 | setDatasetGroup(dataset.getGroup());
   6 | setDatasetGroup(dataset.getGroup());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.general.PieDataset | org.jfree.data.contour.ContourDataset | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.data.general.PieDataset of variable dataset does not match with type org.jfree.data.contour.ContourDataset of variable dataset
   - Make classes org.jfree.data.general.PieDataset and org.jfree.data.contour.ContourDataset extend a common superclass

   6

       setDatasetGroup(dataset.getGroup());

   7

       dataset.addChangeListener(this);

   7 | dataset.addChangeListener(this);
   7 | dataset.addChangeListener(this);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.general.PieDataset | org.jfree.data.contour.ContourDataset | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.data.general.PieDataset of variable dataset does not match with type org.jfree.data.contour.ContourDataset of variable dataset
   - Make classes org.jfree.data.general.PieDataset and org.jfree.data.contour.ContourDataset extend a common superclass

   7

       dataset.addChangeListener(this);

   8

       DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);

   8 | DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);
   8 | DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.general.PieDataset | org.jfree.data.contour.ContourDataset | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.data.general.PieDataset of variable dataset does not match with type org.jfree.data.contour.ContourDataset of variable dataset
   - Make classes org.jfree.data.general.PieDataset and org.jfree.data.contour.ContourDataset extend a common superclass

   8

       DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);

   9

       datasetChanged(event);

   9

       datasetChanged(event);

   Precondition Violations (6)
   Row | Violation
   --- | ---
   1 | Type org.jfree.data.general.PieDataset of variable existing does not match with type org.jfree.data.contour.ContourDataset of variable existing
   2 | Type org.jfree.data.general.PieDataset of variable existing does not match with type org.jfree.data.contour.ContourDataset of variable existing
   3 | Type org.jfree.data.general.PieDataset of variable dataset does not match with type org.jfree.data.contour.ContourDataset of variable dataset
   4 | Type org.jfree.data.general.PieDataset of variable dataset does not match with type org.jfree.data.contour.ContourDataset of variable dataset
   5 | Type org.jfree.data.general.PieDataset of variable dataset does not match with type org.jfree.data.contour.ContourDataset of variable dataset
   6 | Type org.jfree.data.general.PieDataset of variable dataset does not match with type org.jfree.data.contour.ContourDataset of variable dataset