1808-5-9

for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == PlotChangeListener.class) { ((PlotChangeListener) listeners[i + 1]).plotChanged(event); } }
for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == DatasetChangeListener.class) { ((DatasetChangeListener) listeners[i + 1]).datasetChanged( event ); } }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/Plot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/general/AbstractDataset.java
Method name: `void notifyListeners(PlotChangeEvent)` |  | Method name: `void notifyListeners(DatasetChangeEvent)`
Number of AST nodes: 3 |  | Number of AST nodes: 3

1

    for (int i = listeners.length - 2; i >= 0; i -= 2) {↵

1

    for (int i = listeners.length - 2; i >= 0; i -= 2) {↵

2

                if (listeners[i] == PlotChangeListener.class) {↵

2

                if (listeners[i] == DatasetChangeListener.class) {↵

3

                    ((PlotChangeListener) listeners[i + 1]).plotChanged(event↵

3

                    ((DatasetChangeListener) listeners[i + 1]).datasetChanged(↵

4

                        event↵

4

    );↵

5

                    );↵

5

                }↵

6

                }↵

6

            }

7

            }

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
Number of node comparisons | 5

1. {Non-refactorable}

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

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

   2

       for (int i = listeners.length - 2; i >= 0; i -= 2)

   2

       for (int i = listeners.length - 2; i >= 0; i -= 2)

   3

       if (listeners[i] == PlotChangeListener.class)

   3

       if (listeners[i] == DatasetChangeListener.class)

   4 | ((DatasetChangeListener)listeners[i + 1]).datasetChanged(event);

   Preondition Violations
   Unmatched statement ((DatasetChangeListener)listeners[i + 1]).datasetChanged(event); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   4

       ((DatasetChangeListener)listeners[i + 1]).datasetChanged(event);

   4

       ((PlotChangeListener)listeners[i + 1]).plotChanged(event);

   4 | ((PlotChangeListener)listeners[i + 1]).plotChanged(event);

   Preondition Violations
   Unmatched statement ((PlotChangeListener)listeners[i + 1]).plotChanged(event); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Unmatched statement ((DatasetChangeListener)listeners[i + 1]).datasetChanged(event); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   2 | Unmatched statement ((PlotChangeListener)listeners[i + 1]).plotChanged(event); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted