1464-6-8

Object[] ls = this.listenerList.getListenerList(); for (int i = ls.length - 2; i >= 0; i -= 2) { if (ls[i] == RendererChangeListener.class) { ((RendererChangeListener) ls[i + 1]).rendererChanged(event); } }
Object[] listenerList = this.listeners.getListenerList(); for (int i = listenerList.length - 2; i >= 0; i -= 2) { if (listenerList[i] == SeriesChangeListener.class) { ((SeriesChangeListener) listenerList[i + 1]).seriesChanged( event); } }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/AbstractRenderer.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/general/Series.java
Method name: `void notifyListeners(RendererChangeEvent)` |  | Method name: `void notifyListeners(SeriesChangeEvent)`
Number of AST nodes: 4 |  | Number of AST nodes: 4

1

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

1

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

2

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

2

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

3

                if (ls[i] == RendererChangeListener.class) {↵

3

                if (listenerList[i] == SeriesChangeListener.class) {↵

4

                    ((RendererChangeListener) ls[i + 1]).rendererChanged(↵

4

                    ((SeriesChangeListener) listenerList[i + 1]).seriesChanged(↵

5

    event);↵

5

                            event);↵

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

1. {Non-refactorable}

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

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

   1

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

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   ls | listenerList | VARIABLE_NAME_MISMATCH
   listenerList | listeners | VARIABLE_NAME_MISMATCH

   1

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

   2

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

   2 | for (int i = ls.length - 2; i >= 0; i -= 2)
   2 | for (int i = listenerList.length - 2; i >= 0; i -= 2)

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

   2

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

   3

       if (ls[i] == RendererChangeListener.class)

   3 | if (ls[i] == RendererChangeListener.class)
   3 | if (listenerList[i] == SeriesChangeListener.class)

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

   3

       if (listenerList[i] == SeriesChangeListener.class)

   4 | ((SeriesChangeListener)listenerList[i + 1]).seriesChanged(event);

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

   4

       ((SeriesChangeListener)listenerList[i + 1]).seriesChanged(event);

   4

       ((RendererChangeListener)ls[i + 1]).rendererChanged(event);

   4 | ((RendererChangeListener)ls[i + 1]).rendererChanged(event);

   Preondition Violations
   Unmatched statement ((RendererChangeListener)ls[i + 1]).rendererChanged(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 ((SeriesChangeListener)listenerList[i + 1]).seriesChanged(event); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   2 | Unmatched statement ((RendererChangeListener)ls[i + 1]).rendererChanged(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 ls, i , while Clone fragment #2 returns variables listenerList, i