for (int i = 0; i < editableColumns.length; i++) { if (colIdx == editableColumns[i]) { return true; } } return false;
for (int i = 0; i < STOP_AT.length; i++) { if(toCheck == STOP_AT[i]) { return true; } } return false;
Clone fragments detected by clone detection tool
File path: /sql12/test/src/net/sourceforge/squirrel_sql/client/update/gui/AbstractTableModelTest.java File path: /sql12/plugins/syntax/src/net/sourceforge/squirrel_sql/plugins/syntax/KeyManager.java
Method name: boolean isEditableColumn(int) Method name: boolean isInStopAtArray(char)
Number of AST nodes: 4 Number of AST nodes: 4
1
for (int i = 0; i < editableColumns.length; i++) {
1
for (int i = 0; i < 
2
   		if (colIdx == editableColumns[i]) {
3
   			
2
STOP_AT.length; i++)
3
      {
4
         if(toCheck == STOP_AT[i])
5
         {
4
return true;
6
            return true;
5
   		}
7
   
6
   	}
8
      }
9
      }
7
      return false;
10
      return false;
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.2
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)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    for (int i = 0; i < editableColumns.length; i++)
    1
    for (int i = 0; i < editableColumns.length; i++)
    1
    for (int i = 0; i < STOP_AT.length; i++)
    Differences
    Expression1Expression2Difference
    editableColumnsSTOP_ATVARIABLE_NAME_MISMATCH
    int[]char[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable editableColumns.length does not match with type int of variable STOP_AT.length
    • Make classes int[] and char[] extend a common superclass
    1
    for (int i = 0; i < STOP_AT.length; i++)
    2
    if (colIdx == editableColumns[i])
    2
    if (colIdx == editableColumns[i])
    2
    if (toCheck == STOP_AT[i])
    Differences
    Expression1Expression2Difference
    colIdxtoCheckVARIABLE_NAME_MISMATCH
    intcharVARIABLE_TYPE_MISMATCH
    editableColumnsSTOP_ATVARIABLE_NAME_MISMATCH
    int[]char[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable colIdx does not match with type char of variable toCheck
    Type int[] of variable editableColumns does not match with type char[] of variable STOP_AT
    • Make classes int[] and char[] extend a common superclass
    2
    if (toCheck == STOP_AT[i])
    3
    return true;
    3
    return true;
    4
    return false;
    4
    return false;
    Precondition Violations (3)
    Row Violation
    1Type int of variable editableColumns.length does not match with type int of variable STOP_AT.length
    2Type int of variable colIdx does not match with type char of variable toCheck
    3Type int[] of variable editableColumns does not match with type char[] of variable STOP_AT