final IContextResultEvent e = new ContextResultEvent(this); // Guaranteed to return a non-null array final 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] == IContextResultListener.class) { ((IContextResultListener) listeners[i + 1]).finished(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/core/src/main/java/org/columba/core/context/ContextSearchManager.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/frame/DefaultContainer.java
Method name: void fireFinished() Method name: void fireComponentChanged(IFrameMediator)
Number of AST nodes: 5 Number of AST nodes: 5
1
final IContextResultEvent e = new ContextResultEvent(this);
1
FrameEvent e = new FrameEvent(this, mediator);
2
		// Guaranteed to return a non-null array
2
		// Guaranteed to return a non-null array
3
		final 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] == IContextResultListener.class) {
7
			if (listeners[i] == IContainerListener.class) {
8
				((IContextResultListener) listeners[i + 1]).finished(e);
8
				((IContainerListener) listeners[i + 1]).switchedComponent(e);
9
			}
9
			}
10
		}
10
		}
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 comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)2.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                
    1
    FrameEvent e = new FrameEvent(this, mediator);
    Preondition Violations
    Unmatched statement FrameEvent e=new FrameEvent(this,mediator); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    1
    FrameEvent e = new FrameEvent(this, mediator);
    1
    final IContextResultEvent e = new ContextResultEvent(this);
                                                                                                                            
                                                                                                              
    2
    Object[] listeners = listenerList.getListenerList();
    2
    final 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] == IContextResultListener.class)
    4
    if (listeners[i] == IContextResultListener.class)
    4
    if (listeners[i] == IContainerListener.class)
    Differences
    Expression1Expression2Difference
    IContextResultListener.classIContainerListener.classLITERAL_VALUE_MISMATCH
    4
    if (listeners[i] == IContainerListener.class)
    5
    ((IContextResultListener)listeners[i + 1]).finished(e);
    5
    ((IContextResultListener)listeners[i + 1]).finished(e);
    5
    ((IContainerListener)listeners[i + 1]).switchedComponent(e);
    Differences
    Expression1Expression2Difference
    org.columba.core.context.api.IContextResultEventorg.columba.api.gui.frame.event.FrameEventVARIABLE_TYPE_MISMATCH
    finishedswitchedComponentMETHOD_INVOCATION_NAME_MISMATCH
    org.columba.core.context.api.IContextResultListenerorg.columba.api.gui.frame.event.IContainerListenerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.columba.core.context.api.IContextResultEvent of variable e does not match with type org.columba.api.gui.frame.event.FrameEvent of variable e
    • Make classes org.columba.core.context.api.IContextResultEvent and org.columba.api.gui.frame.event.FrameEvent extend a common superclass
    Expression ((IContextResultListener)listeners[i + 1]).finished(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 ((IContextResultListener)listeners[i + 1]).finished(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 (IContextResultListener)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.core.context.api.IContextResultListener does not match with type org.columba.api.gui.frame.event.IContainerListener
    • Make classes org.columba.core.context.api.IContextResultListener and org.columba.api.gui.frame.event.IContainerListener extend a common superclass
    5
    ((IContainerListener)listeners[i + 1]).switchedComponent(e);
    Precondition Violations (10)
    Row Violation
    1Unmatched statement FrameEvent e=new FrameEvent(this,mediator); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Type org.columba.core.context.api.IContextResultEvent of variable e does not match with type org.columba.api.gui.frame.event.FrameEvent of variable e
    3Expression ((IContextResultListener)listeners[i + 1]).finished(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression ((IContainerListener)listeners[i + 1]).switchedComponent(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression ((IContextResultListener)listeners[i + 1]).finished(e) is a void method call, and thus it cannot be parameterized
    6Expression ((IContainerListener)listeners[i + 1]).switchedComponent(e) is a void method call, and thus it cannot be parameterized
    7Expression (IContextResultListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression (IContainerListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Type org.columba.core.context.api.IContextResultListener does not match with type org.columba.api.gui.frame.event.IContainerListener
    10The refactoring of the clones is infeasible, because classes org.columba.core.context.ContextSearchManager and org.columba.core.gui.frame.DefaultContainer do not have a common superclass