for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == CharsetListener.class) { ((CharsetListener) listeners[i + 1]).charsetChanged(e); } }
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/mail/src/main/java/org/columba/mail/gui/frame/AbstractMailFrameController.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/context/semantic/SemanticContext.java
Method name: void fireCharsetChanged(CharsetEvent) Method name: void fireContextChangedEvent(IStructureValue)
Number of AST nodes: 3 Number of AST nodes: 3
1
for (int i = listeners.length - 2; i >= 0; i -= 2) {
1
for (int i = listeners.length - 2; i >= 0; i -= 2) {
2
			if (listeners[i] == CharsetListener.class) {
2
			if (listeners[i] == IContextListener.class) {
3
				((CharsetListener) listeners[i + 1]).charsetChanged(e);
3
				((IContextListener) listeners[i + 1]).contextChanged(e);
4
			}
4
			}
5
		}
5
		}
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 comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    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.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    for (int i = listeners.length - 2; i >= 0; i -= 2)
    3
    for (int i = listeners.length - 2; i >= 0; i -= 2)
    3
    if (listeners[i] == CharsetListener.class)
    4
    if (listeners[i] == IContextListener.class)
    4
    ((CharsetListener)listeners[i + 1]).charsetChanged(e);
    4
    ((CharsetListener)listeners[i + 1]).charsetChanged(e);
    5
    ((IContextListener)listeners[i + 1]).contextChanged(e);
    Differences
    Expression1Expression2Difference
    charsetChangedcontextChangedMETHOD_INVOCATION_NAME_MISMATCH
    org.columba.core.charset.CharsetEventorg.columba.core.context.semantic.api.IContextEventVARIABLE_TYPE_MISMATCH
    org.columba.core.charset.CharsetListenerorg.columba.core.context.semantic.api.IContextListenerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression ((CharsetListener)listeners[i + 1]).charsetChanged(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 ((CharsetListener)listeners[i + 1]).charsetChanged(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
    Type org.columba.core.charset.CharsetEvent of variable e does not match with type org.columba.core.context.semantic.api.IContextEvent of variable e
    • Make classes org.columba.core.charset.CharsetEvent and org.columba.core.context.semantic.api.IContextEvent extend a common superclass
    Expression (CharsetListener)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.core.charset.CharsetListener of variable (CharsetListener)listeners[i + 1] does not match with type org.columba.core.context.semantic.api.IContextListener of variable (IContextListener)listeners[i + 1]
    • Make classes org.columba.core.charset.CharsetListener and org.columba.core.context.semantic.api.IContextListener extend a common superclass
    5
    ((IContextListener)listeners[i + 1]).contextChanged(e);
    Precondition Violations (8)
    Row Violation
    1Expression ((CharsetListener)listeners[i + 1]).charsetChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression ((IContextListener)listeners[i + 1]).contextChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression ((CharsetListener)listeners[i + 1]).charsetChanged(e) is a void method call, and thus it cannot be parameterized
    4Expression ((IContextListener)listeners[i + 1]).contextChanged(e) is a void method call, and thus it cannot be parameterized
    5Type org.columba.core.charset.CharsetEvent of variable e does not match with type org.columba.core.context.semantic.api.IContextEvent of variable e
    6Expression (CharsetListener)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.core.charset.CharsetListener of variable (CharsetListener)listeners[i + 1] does not match with type org.columba.core.context.semantic.api.IContextListener of variable (IContextListener)listeners[i + 1]