DateRangeChangedEvent e = new DateRangeChangedEvent(this, dateRange); // 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] == IDateRangeChangedListener.class) { ((IDateRangeChangedListener) listeners[i + 1]) .selectionChanged(e); } }
FrameEvent e = new FrameEvent(this, mediator); // 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] == IContainerListener.class) { ((IContainerListener) listeners[i + 1]).switchedComponent(e); } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/calendar/src/main/java/org/columba/calendar/ui/navigation/NavigationController.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/frame/DefaultContainer.java
Method name: void fireSelectionChanged(IDateRange) Method name: void fireComponentChanged(IFrameMediator)
Number of AST nodes: 5 Number of AST nodes: 5
1
DateRangeChangedEvent e = new DateRangeChangedEvent(this, dateRange);
1
FrameEvent e = new FrameEvent(this, mediator);
2
		// Guaranteed to return a non-null array
2
		// Guaranteed to return a non-null array
3
		Object[] listeners = listenerList.getListenerList();
3
		Object[] listeners = listenerList.getListenerList();
4
		// Process the listeners last to first, notifying
4
		// Process the listeners last to first, notifying
5
		// those that are interested in this event
5
		// those that are interested in this event
6
		for (int i = listeners.length - 2; i >= 0; i -= 2) {
6
		for (int i = listeners.length - 2; i >= 0; i -= 2) {
7
			if (listeners[i] == IDateRangeChangedListener.class) {
7
			if (listeners[i] == IContainerListener.class) {
8
				((IDateRangeChangedListener) listeners[i + 1])
8
				((IContainerListener) listeners[i + 1])
9
						.selectionChanged(e);
9
.switchedComponent(e);
10
			}
10
			}
11
		}
11
		}
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.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    DateRangeChangedEvent e = new DateRangeChangedEvent(this, dateRange);
    1
    DateRangeChangedEvent e = new DateRangeChangedEvent(this, dateRange);
    1
    FrameEvent e = new FrameEvent(this, mediator);
    Differences
    Expression1Expression2Difference
    org.columba.calendar.ui.navigation.api.DateRangeChangedEventorg.columba.api.gui.frame.event.FrameEventSUBCLASS_TYPE_MISMATCH
    org.columba.calendar.ui.navigation.api.DateRangeChangedEventorg.columba.api.gui.frame.event.FrameEventSUBCLASS_TYPE_MISMATCH
    org.columba.calendar.ui.navigation.api.DateRangeChangedEventorg.columba.api.gui.frame.event.FrameEventSUBCLASS_TYPE_MISMATCH
    dateRangemediatorVARIABLE_NAME_MISMATCH
    org.columba.calendar.model.api.IDateRangeorg.columba.api.gui.frame.IFrameMediatorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression new DateRangeChangedEvent(this,dateRange) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new FrameEvent(this,mediator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.columba.calendar.model.api.IDateRange of variable dateRange does not match with type org.columba.api.gui.frame.IFrameMediator of variable mediator
    • Make classes org.columba.calendar.model.api.IDateRange and org.columba.api.gui.frame.IFrameMediator extend a common superclass
    1
    FrameEvent e = new FrameEvent(this, mediator);
    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] == IDateRangeChangedListener.class)
    4
    if (listeners[i] == IDateRangeChangedListener.class)
    4
    if (listeners[i] == IContainerListener.class)
    Differences
    Expression1Expression2Difference
    IDateRangeChangedListener.classIContainerListener.classLITERAL_VALUE_MISMATCH
    4
    if (listeners[i] == IContainerListener.class)
    5
    ((IDateRangeChangedListener)listeners[i + 1]).selectionChanged(e);
    5
    ((IDateRangeChangedListener)listeners[i + 1]).selectionChanged(e);
    5
    ((IContainerListener)listeners[i + 1]).switchedComponent(e);
    Differences
    Expression1Expression2Difference
    org.columba.calendar.ui.navigation.api.DateRangeChangedEventorg.columba.api.gui.frame.event.FrameEventSUBCLASS_TYPE_MISMATCH
    selectionChangedswitchedComponentMETHOD_INVOCATION_NAME_MISMATCH
    org.columba.calendar.ui.navigation.api.IDateRangeChangedListenerorg.columba.api.gui.frame.event.IContainerListenerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression ((IDateRangeChangedListener)listeners[i + 1]).selectionChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((IContainerListener)listeners[i + 1]).switchedComponent(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((IDateRangeChangedListener)listeners[i + 1]).selectionChanged(e) is a void method call, and thus it cannot be parameterized
    Expression ((IContainerListener)listeners[i + 1]).switchedComponent(e) is a void method call, and thus it cannot be parameterized
    Expression (IDateRangeChangedListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (IContainerListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.columba.calendar.ui.navigation.api.IDateRangeChangedListener does not match with type org.columba.api.gui.frame.event.IContainerListener
    • Make classes org.columba.calendar.ui.navigation.api.IDateRangeChangedListener and org.columba.api.gui.frame.event.IContainerListener extend a common superclass
    5
    ((IContainerListener)listeners[i + 1]).switchedComponent(e);
    Precondition Violations (11)
    Row Violation
    1Expression new DateRangeChangedEvent(this,dateRange) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new FrameEvent(this,mediator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type org.columba.calendar.model.api.IDateRange of variable dateRange does not match with type org.columba.api.gui.frame.IFrameMediator of variable mediator
    4Expression ((IDateRangeChangedListener)listeners[i + 1]).selectionChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression ((IContainerListener)listeners[i + 1]).switchedComponent(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression ((IDateRangeChangedListener)listeners[i + 1]).selectionChanged(e) is a void method call, and thus it cannot be parameterized
    7Expression ((IContainerListener)listeners[i + 1]).switchedComponent(e) is a void method call, and thus it cannot be parameterized
    8Expression (IDateRangeChangedListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression (IContainerListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Type org.columba.calendar.ui.navigation.api.IDateRangeChangedListener does not match with type org.columba.api.gui.frame.event.IContainerListener
    11The refactoring of the clones is infeasible, because classes org.columba.calendar.ui.navigation.NavigationController and org.columba.core.gui.frame.DefaultContainer do not have a common superclass