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]) .visibilityChanged(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 fireVisibilityChanged(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
						.visibilityChanged(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)2.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    FrameEvent e = new FrameEvent(this, mediator);
    1
    FrameEvent e = new FrameEvent(this, mediator);
    1
    FrameEvent e = new FrameEvent(this, visible);
    Differences
    Expression1Expression2Difference
    mediatorvisibleVARIABLE_NAME_MISMATCH
    org.columba.api.gui.frame.IFrameMediatorbooleanVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.columba.api.gui.frame.IFrameMediator of variable mediator 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] == IContainerListener.class)
    4
    if (listeners[i] == IContainerListener.class)
    4
    if (listeners[i] == IFrameMediatorListener.class)
    Differences
    Expression1Expression2Difference
    IContainerListener.classIFrameMediatorListener.classLITERAL_VALUE_MISMATCH
    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]).visibilityChanged(e);
    Differences
    Expression1Expression2Difference
    switchedComponentvisibilityChangedMETHOD_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]).visibilityChanged(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]).visibilityChanged(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 does not match with type org.columba.api.gui.frame.event.IFrameMediatorListener
    • 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]).visibilityChanged(e);
    Precondition Violations (9)
    Row Violation
    1Type org.columba.api.gui.frame.IFrameMediator of variable mediator does not match with type boolean of variable visible
    2Expression ((IContainerListener)listeners[i + 1]).switchedComponent(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression ((IFrameMediatorListener)listeners[i + 1]).visibilityChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression ((IContainerListener)listeners[i + 1]).switchedComponent(e) is a void method call, and thus it cannot be parameterized
    5Expression ((IFrameMediatorListener)listeners[i + 1]).visibilityChanged(e) is a void method call, and thus it cannot be parameterized
    6Expression (IContainerListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression (IFrameMediatorListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Type org.columba.api.gui.frame.event.IContainerListener does not match with type org.columba.api.gui.frame.event.IFrameMediatorListener
    9The refactoring of the clones is infeasible, because classes org.columba.core.gui.frame.DefaultContainer and org.columba.core.gui.frame.DefaultFrameController do not have a common superclass