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] == IStoreListener.class) { ((IStoreListener) listeners[i + 1]).itemRemoved(e); } }
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] == IContextListener.class) { ((IContextListener) listeners[i + 1]).contextChanged(e); } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/calendar/src/main/java/org/columba/calendar/store/AbstractCalendarStore.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/context/semantic/SemanticContext.java
Method name: void fireItemRemoved(Object) Method name: void fireContextChangedEvent(IStructureValue)
Number of AST nodes: 4 Number of AST nodes: 4
1
Object[] listeners = listenerList.getListenerList();
1
Object[] listeners = listenerList.getListenerList();
2
		// Process the listeners last to first, notifying
2
		// Process the listeners last to first, notifying
3
		// those that are interested in this event
3
		// those that are interested in this event
4
		for (int i = listeners.length - 2; i >= 0; i -= 2) {
4
		for (int i = listeners.length - 2; i >= 0; i -= 2) {
5
			if (listeners[i] == IStoreListener.class) {
5
			if (listeners[i] == IContextListener.class) {
6
				((IStoreListener) listeners[i + 1]).itemRemoved(e);
6
				((IContextListener) listeners[i + 1]).contextChanged(e);
7
			}
7
			}
8
		}
8
		}
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.9
Clones locationClones are in different classes
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    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.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    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] == IStoreListener.class)
    4
    if (listeners[i] == IStoreListener.class)
    4
    if (listeners[i] == IContextListener.class)
    Differences
    Expression1Expression2Difference
    IStoreListener.classIContextListener.classLITERAL_VALUE_MISMATCH
    4
    if (listeners[i] == IContextListener.class)
    5
    ((IStoreListener)listeners[i + 1]).itemRemoved(e);
    5
    ((IStoreListener)listeners[i + 1]).itemRemoved(e);
    5
    ((IContextListener)listeners[i + 1]).contextChanged(e);
    Differences
    Expression1Expression2Difference
    org.columba.calendar.store.api.StoreEventorg.columba.core.context.semantic.api.IContextEventVARIABLE_TYPE_MISMATCH
    itemRemovedcontextChangedMETHOD_INVOCATION_NAME_MISMATCH
    org.columba.calendar.store.api.IStoreListenerorg.columba.core.context.semantic.api.IContextListenerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.columba.calendar.store.api.StoreEvent of variable e does not match with type org.columba.core.context.semantic.api.IContextEvent of variable e
    • Make classes org.columba.calendar.store.api.StoreEvent and org.columba.core.context.semantic.api.IContextEvent extend a common superclass
    Expression ((IStoreListener)listeners[i + 1]).itemRemoved(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((IContextListener)listeners[i + 1]).contextChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((IStoreListener)listeners[i + 1]).itemRemoved(e) is a void method call, and thus it cannot be parameterized
    Expression ((IContextListener)listeners[i + 1]).contextChanged(e) is a void method call, and thus it cannot be parameterized
    Expression (IStoreListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (IContextListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.columba.calendar.store.api.IStoreListener does not match with type org.columba.core.context.semantic.api.IContextListener
    • Make classes org.columba.calendar.store.api.IStoreListener and org.columba.core.context.semantic.api.IContextListener extend a common superclass
    5
    ((IContextListener)listeners[i + 1]).contextChanged(e);
    Precondition Violations (8)
    Row Violation
    1Type org.columba.calendar.store.api.StoreEvent of variable e does not match with type org.columba.core.context.semantic.api.IContextEvent of variable e
    2Expression ((IStoreListener)listeners[i + 1]).itemRemoved(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression ((IContextListener)listeners[i + 1]).contextChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression ((IStoreListener)listeners[i + 1]).itemRemoved(e) is a void method call, and thus it cannot be parameterized
    5Expression ((IContextListener)listeners[i + 1]).contextChanged(e) is a void method call, and thus it cannot be parameterized
    6Expression (IStoreListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression (IContextListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Type org.columba.calendar.store.api.IStoreListener does not match with type org.columba.core.context.semantic.api.IContextListener