1808-1-5

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

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/JFreeChart.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/Plot.java
Method name: `void notifyListeners(ChartChangeEvent)` |  | Method name: `void notifyListeners(PlotChangeEvent)`
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] == ChartChangeListener.class) {↵

2

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

3

                        ((ChartChangeListener) listeners[i + 1]).chartChanged(↵

3

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

4

                                event);↵

4

    event);↵

5

                    }↵

5

                ↵

6

        ↵

6

    }↵

7

            }

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
   --- | --- | --- | --- | ---

   3

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

   2

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

   4

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

   3

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

   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

   4

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

   5

       ((ChartChangeListener)listeners[i + 1]).chartChanged(event);

   5 | ((ChartChangeListener)listeners[i + 1]).chartChanged(event);

   Preondition Violations
   Unmatched statement ((ChartChangeListener)listeners[i + 1]).chartChanged(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 ((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
   2 | Unmatched statement ((ChartChangeListener)listeners[i + 1]).chartChanged(event); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted