1718-1-2

if (this.notify) { Object[] listeners = this.changeListeners.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == ChartChangeListener.class) { ((ChartChangeListener) listeners[i + 1]).chartChanged( event); } } }
if (this.notify) { Object[] listeners = this.listenerList.getListenerList(); 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/JFreeChart.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/title/Title.java
Method name: `void notifyListeners(ChartChangeEvent)` |  | Method name: `void notifyListeners(TitleChangeEvent)`
Number of AST nodes: 5 |  | Number of AST nodes: 5

1

    if (this.notify) {↵

1

    if (this.notify) {↵

2

                Object[] listeners = this.changeListeners.getListenerList();↵

2

                Object[] listeners = this.listenerList.getListenerList();↵

3

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

3

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

4

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

4

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

5

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

5

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

6

                                event);↵

6

                                event);↵

7

                    }↵

7

                    }↵

8

                }↵

8

                }↵

9

            }

9

            }

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 4
   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.7
   Clone type | Type 2

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

   1

       if (this.notify)

   1

       if (this.notify)

   2

       Object[] listeners = this.changeListeners.getListenerList();

   2 | Object[] listeners = this.changeListeners.getListenerList();
   2 | Object[] listeners = this.listenerList.getListenerList();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   changeListeners | listenerList | VARIABLE_NAME_MISMATCH

   2

       Object[] listeners = this.listenerList.getListenerList();

   3

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

   3

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

   4

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

   4

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

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

   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 (3)
   Row | Violation
   --- | ---
   1 | 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
   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
   3 | Clone fragment #1 returns variables listeners, i , while Clone fragment #2 returns variables listeners, i