String condition = getCriteriaString(); int c = -1; for (int i = 0; i < criteria.length; i++) { if (criteria[i].equals(condition)) c = i; } return c;
int result = -1; String h = getTypeString(); for (int i = 0; i < type.length; i++) { if (h.equals(type[i])) result = i; } return result;
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/filter/FilterCriteria.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/filter/MailFilterCriteria.java
Method name: int getCriteria() Method name: int getType()
Number of AST nodes: 6 Number of AST nodes: 6
1
String condition = getCriteriaString();
2
		int c = -1
1
int result = -1;
3
;
2
		String h = getTypeString();
4
		for (int i = 0; i < criteria.length; i++) {
3
		for (int i = 0; i < type.length; i++) {
5
			if (criteria[i].equals(condition))
4
			if (h.equals(type[i]))
6
				c = i;
5
				result = i;
7
		}
6
		}
8
		return c;
7
		return result;
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 having the same super class
Number of node comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    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.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    String condition = getCriteriaString();
    1
    String condition = getCriteriaString();
    2
    String h = getTypeString();
    Differences
    Expression1Expression2Difference
    conditionhVARIABLE_NAME_MISMATCH
    getCriteriaStringgetTypeStringMETHOD_INVOCATION_NAME_MISMATCH
    2
    String h = getTypeString();
    2
    int c = -1;
    2
    int c = -1;
    1
    int result = -1;
    Differences
    Expression1Expression2Difference
    cresultVARIABLE_NAME_MISMATCH
    1
    int result = -1;
    3
    for (int i = 0; i < criteria.length; i++)
    3
    for (int i = 0; i < criteria.length; i++)
    3
    for (int i = 0; i < type.length; i++)
    Differences
    Expression1Expression2Difference
    criteriatypeVARIABLE_NAME_MISMATCH
    3
    for (int i = 0; i < type.length; i++)
    4
    if (criteria[i].equals(condition))
    4
    if (criteria[i].equals(condition))
    4
    if (h.equals(type[i]))
    Differences
    Expression1Expression2Difference
    conditiontype[i]TYPE_COMPATIBLE_REPLACEMENT
    criteria[i]hTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression condition cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression type[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression criteria[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression h cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    if (h.equals(type[i]))
    5
    c = i;
    5
    c = i;
    5
    result = i;
    Differences
    Expression1Expression2Difference
    cresultVARIABLE_NAME_MISMATCH
    5
    result = i;
    6
    return c;
    6
    return c;
    6
    return result;
    Differences
    Expression1Expression2Difference
    cresultVARIABLE_NAME_MISMATCH
    6
    return result;
    Precondition Violations (4)
    Row Violation
    1Expression condition cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression type[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression criteria[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression h cannot be parameterized, because it has dependencies to/from statements that will be extracted