CalendarSelectionChangedEvent e = new CalendarSelectionChangedEvent( this, selection); // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == ICalendarSelectionChangedListener.class) { ((ICalendarSelectionChangedListener) listeners[i + 1]) .selectionChanged(e); } }
FrameEvent e = new FrameEvent(this, visible); // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == IFrameMediatorListener.class) { ((IFrameMediatorListener) listeners[i + 1]) .visibilityChanged(e); } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/calendar/src/main/java/org/columba/calendar/ui/list/CalendarListController.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/frame/DefaultFrameController.java
Method name: void fireSelectionChanged(ICalendarItem) Method name: void fireVisibilityChanged(boolean)
Number of AST nodes: 5 Number of AST nodes: 5
1
CalendarSelectionChangedEvent e = new CalendarSelectionChangedEvent(
1
FrameEvent e = new FrameEvent(
2
				this, selection);
2
this, visible);
3
		// Guaranteed to return a non-null array
3
		// Guaranteed to return a non-null array
4
		Object[] listeners = listenerList.getListenerList();
4
		Object[] listeners = listenerList.getListenerList();
5
		// Process the listeners last to first, notifying
5
		// Process the listeners last to first, notifying
6
		// those that are interested in this event
6
		// those that are interested in this event
7
		for (int i = listeners.length - 2; i >= 0; i -= 2) {
7
		for (int i = listeners.length - 2; i >= 0; i -= 2) {
8
			if (listeners[i] == ICalendarSelectionChangedListener.class) {
8
			if (listeners[i] == IFrameMediatorListener.class) {
9
				((ICalendarSelectionChangedListener) listeners[i + 1])
9
				((IFrameMediatorListener) listeners[i + 1])
10
						.selectionChanged(e);
10
						.visibilityChanged(e);
11
			}
11
			}
12
		}
12
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.6
Clones locationClones are in different classes
Number of node comparisons7
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)5.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    CalendarSelectionChangedEvent e = new CalendarSelectionChangedEvent(this, selection);
    1
    CalendarSelectionChangedEvent e = new CalendarSelectionChangedEvent(this, selection);
    1
    FrameEvent e = new FrameEvent(this, visible);
    Differences
    Expression1Expression2Difference
    org.columba.calendar.ui.list.api.CalendarSelectionChangedEventorg.columba.api.gui.frame.event.FrameEventSUBCLASS_TYPE_MISMATCH
    org.columba.calendar.ui.list.api.CalendarSelectionChangedEventorg.columba.api.gui.frame.event.FrameEventSUBCLASS_TYPE_MISMATCH
    org.columba.calendar.ui.list.api.CalendarSelectionChangedEventorg.columba.api.gui.frame.event.FrameEventSUBCLASS_TYPE_MISMATCH
    selectionvisibleVARIABLE_NAME_MISMATCH
    org.columba.calendar.base.api.ICalendarItembooleanVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression new CalendarSelectionChangedEvent(this,selection) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new FrameEvent(this,visible) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.columba.calendar.base.api.ICalendarItem of variable selection does not match with type boolean of variable visible
    1
    FrameEvent e = new FrameEvent(this, visible);
    2
    Object[] listeners = listenerList.getListenerList();
    2
    Object[] listeners = 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] == ICalendarSelectionChangedListener.class)
    4
    if (listeners[i] == ICalendarSelectionChangedListener.class)
    4
    if (listeners[i] == IFrameMediatorListener.class)
    Differences
    Expression1Expression2Difference
    ICalendarSelectionChangedListener.classIFrameMediatorListener.classLITERAL_VALUE_MISMATCH
    4
    if (listeners[i] == IFrameMediatorListener.class)
    5
    ((ICalendarSelectionChangedListener)listeners[i + 1]).selectionChanged(e);
    5
    ((ICalendarSelectionChangedListener)listeners[i + 1]).selectionChanged(e);
    5
    ((IFrameMediatorListener)listeners[i + 1]).visibilityChanged(e);
    Differences
    Expression1Expression2Difference
    org.columba.calendar.ui.list.api.CalendarSelectionChangedEventorg.columba.api.gui.frame.event.FrameEventSUBCLASS_TYPE_MISMATCH
    selectionChangedvisibilityChangedMETHOD_INVOCATION_NAME_MISMATCH
    org.columba.calendar.ui.list.api.ICalendarSelectionChangedListenerorg.columba.api.gui.frame.event.IFrameMediatorListenerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression ((ICalendarSelectionChangedListener)listeners[i + 1]).selectionChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((IFrameMediatorListener)listeners[i + 1]).visibilityChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((ICalendarSelectionChangedListener)listeners[i + 1]).selectionChanged(e) is a void method call, and thus it cannot be parameterized
    Expression ((IFrameMediatorListener)listeners[i + 1]).visibilityChanged(e) is a void method call, and thus it cannot be parameterized
    Expression (ICalendarSelectionChangedListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (IFrameMediatorListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.columba.calendar.ui.list.api.ICalendarSelectionChangedListener does not match with type org.columba.api.gui.frame.event.IFrameMediatorListener
    • Make classes org.columba.calendar.ui.list.api.ICalendarSelectionChangedListener and org.columba.api.gui.frame.event.IFrameMediatorListener extend a common superclass
    5
    ((IFrameMediatorListener)listeners[i + 1]).visibilityChanged(e);
    Precondition Violations (11)
    Row Violation
    1Expression new CalendarSelectionChangedEvent(this,selection) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new FrameEvent(this,visible) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type org.columba.calendar.base.api.ICalendarItem of variable selection does not match with type boolean of variable visible
    4Expression ((ICalendarSelectionChangedListener)listeners[i + 1]).selectionChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression ((IFrameMediatorListener)listeners[i + 1]).visibilityChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression ((ICalendarSelectionChangedListener)listeners[i + 1]).selectionChanged(e) is a void method call, and thus it cannot be parameterized
    7Expression ((IFrameMediatorListener)listeners[i + 1]).visibilityChanged(e) is a void method call, and thus it cannot be parameterized
    8Expression (ICalendarSelectionChangedListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression (IFrameMediatorListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Type org.columba.calendar.ui.list.api.ICalendarSelectionChangedListener does not match with type org.columba.api.gui.frame.event.IFrameMediatorListener
    11The refactoring of the clones is infeasible, because classes org.columba.calendar.ui.list.CalendarListController and org.columba.core.gui.frame.DefaultFrameController do not have a common superclass