1808-6-8

for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == DialLayerChangeListener.class) { ((DialLayerChangeListener) listeners[i + 1]).dialLayerChanged( event); } }
for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == TitleChangeListener.class) { ((TitleChangeListener) listeners[i + 1]).titleChanged( event); } }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/dial/AbstractDialLayer.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/title/Title.java
Method name: `void notifyListeners(DialLayerChangeEvent)` |  | Method name: `void notifyListeners(TitleChangeEvent)`
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] == DialLayerChangeListener.class) {↵

2

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

3

                    ((DialLayerChangeListener) listeners[i + 1]).dialLayerChanged(↵

3

                        ((TitleChangeListener) listeners[i + 1]).titleChanged(↵

4

                            event);↵

4

                                event);↵

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.2
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)

   3

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

   3

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

   4

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

   4

       ((DialLayerChangeListener)listeners[i + 1]).dialLayerChanged(event);

   4 | ((DialLayerChangeListener)listeners[i + 1]).dialLayerChanged(event);

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

   5 | ((TitleChangeListener)listeners[i + 1]).titleChanged(event);

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

   5

       ((TitleChangeListener)listeners[i + 1]).titleChanged(event);

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