for (int i = 1; i < s.length(); i++) { if (!isIdentChar(s.charAt(i))) { return false; } }
for (int i = 0; i < length; i++) { if (!Character.isDigit(s.charAt(i))) { return false; } }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubySymbol.java File path: /jruby-1.4.0/src/org/jruby/RubySymbol.java
Method name: boolean isIdentifier(String) Method name: boolean isSpecialGlobalName(String)
Number of AST nodes: 3 Number of AST nodes: 3
1
for (int i = 1; i < s.length(); i++) {
1
for (int i = 0; i < length; i++) {
2
            if (!isIdentChar(s.charAt(i))) {
2
                if (!Character.isDigit(s.charAt(i))) {
3
                return false;
3
                    return false;
4
            }
4
            
5
    }
5
        }
6
            }
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 declared in the same class
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.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    5
    for (int i = 1; i < s.length(); i++)
    5
    for (int i = 1; i < s.length(); i++)
    30
    for (int i = 0; i < length; i++)
    Differences
    Expression1Expression2Difference
    10LITERAL_VALUE_MISMATCH
    s.length()lengthTYPE_COMPATIBLE_REPLACEMENT
    30
    for (int i = 0; i < length; i++)
    6
    if (!isIdentChar(s.charAt(i)))
    6
    if (!isIdentChar(s.charAt(i)))
    31
    if (!Character.isDigit(s.charAt(i)))
    Differences
    Expression1Expression2Difference
    isIdentCharisDigitMETHOD_INVOCATION_NAME_MISMATCH
    CharacterMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression isIdentChar(s.charAt(i)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method isIdentChar
    Expression Character.isDigit(s.charAt(i)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression isIdentChar(s.charAt(i)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method isIdentChar
    Expression Character.isDigit(s.charAt(i)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    31
    if (!Character.isDigit(s.charAt(i)))
    7
    return false;
    7
    return false;
    32
    return false;
    Preondition Violations
    Conditional return false;
    Conditional return false;
    32
    return false;
    Precondition Violations (6)
    Row Violation
    1Expression isIdentChar(s.charAt(i)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression Character.isDigit(s.charAt(i)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression isIdentChar(s.charAt(i)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression Character.isDigit(s.charAt(i)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Conditional return false;
    6Conditional return false;