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); } }
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]) .toolBarVisibilityChanged(e); } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/frame/DefaultContainer.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/frame/DefaultFrameController.java
Method name: void fireComponentChanged(IFrameMediator) Method name: void fireToolBarVisibilityChanged(boolean)
Number of AST nodes: 5 Number of AST nodes: 5
1
FrameEvent e = new FrameEvent(this, mediator);
1
FrameEvent e = new FrameEvent(this, visible);
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] == IContainerListener.class) {
7
			if (listeners[i] == IFrameMediatorListener.class) {
8
				((IContainerListener) listeners[i + 1]).switchedComponent
8
				((IFrameMediatorListener) listeners[i + 1])
9
(e);
9
						.toolBarVisibilityChanged(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.3
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)0.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    FrameEvent e = new FrameEvent(this, mediator);
    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] == IContainerListener.class)
    4
    if (listeners[i] == IFrameMediatorListener.class)
    5
    ((IContainerListener)listeners[i + 1]).switchedComponent(e);
    5
    ((IContainerListener)listeners[i + 1]).switchedComponent(e);
    5
    ((IFrameMediatorListener)listeners[i + 1]).toolBarVisibilityChanged(e);
    Differences
    Expression1Expression2Difference
    switchedComponenttoolBarVisibilityChangedMETHOD_INVOCATION_NAME_MISMATCH
    org.columba.api.gui.frame.event.IContainerListenerorg.columba.api.gui.frame.event.IFrameMediatorListenerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression ((IContainerListener)listeners[i + 1]).switchedComponent(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((IFrameMediatorListener)listeners[i + 1]).toolBarVisibilityChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((IContainerListener)listeners[i + 1]).switchedComponent(e) is a void method call, and thus it cannot be parameterized
    Expression ((IFrameMediatorListener)listeners[i + 1]).toolBarVisibilityChanged(e) is a void method call, and thus it cannot be parameterized
    Expression (IContainerListener)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.api.gui.frame.event.IContainerListener of variable (IContainerListener)listeners[i + 1] does not match with type org.columba.api.gui.frame.event.IFrameMediatorListener of variable (IFrameMediatorListener)listeners[i + 1]
    • Make classes org.columba.api.gui.frame.event.IContainerListener and org.columba.api.gui.frame.event.IFrameMediatorListener extend a common superclass
    5
    ((IFrameMediatorListener)listeners[i + 1]).toolBarVisibilityChanged(e);
    Precondition Violations (7)
    Row Violation
    1Expression ((IContainerListener)listeners[i + 1]).switchedComponent(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression ((IFrameMediatorListener)listeners[i + 1]).toolBarVisibilityChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression ((IContainerListener)listeners[i + 1]).switchedComponent(e) is a void method call, and thus it cannot be parameterized
    4Expression ((IFrameMediatorListener)listeners[i + 1]).toolBarVisibilityChanged(e) is a void method call, and thus it cannot be parameterized
    5Expression (IContainerListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression (IFrameMediatorListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Type org.columba.api.gui.frame.event.IContainerListener of variable (IContainerListener)listeners[i + 1] does not match with type org.columba.api.gui.frame.event.IFrameMediatorListener of variable (IFrameMediatorListener)listeners[i + 1]