int operand = I.intValue(); switch(kind) { case PLUS: return operand; case MINUS: return -operand; case TILDE: return ~operand; case INCR: return operand + 1; case DECR: return operand - 1; default: throw new InterpreterError("bad integer unaryOperation"); }
long operand = L.longValue(); switch(kind) { case PLUS: return operand; case MINUS: return -operand; case TILDE: return ~operand; case INCR: return operand + 1; case DECR: return operand - 1; default: throw new InterpreterError("bad long unaryOperation"); }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/bsh/Primitive.java File path: /jEdit-4.2/src/bsh/Primitive.java
Method name: int intUnaryOperation(Integer, int) Method name: long longUnaryOperation(Long, int)
Number of AST nodes: 14 Number of AST nodes: 14
1
int operand = I.intValue();
1
long operand = L.longValue();
2
        switch(kind)
2
        switch(kind)
3
        {
3
        {
4
            case PLUS:
4
            case PLUS:
5
                return operand;
5
                return operand;
6
            case MINUS:
6
            case MINUS:
7
                return -operand;
7
                return -operand;
8
            case TILDE:
8
            case TILDE:
9
                return ~operand;
9
                return ~operand;
10
            case INCR:
10
            case INCR:
11
                return operand + 1;
11
                return operand + 1;
12
            case DECR:
12
            case DECR:
13
                return operand - 1;
13
                return operand - 1;
14
            default:
14
            default:
15
                throw new InterpreterError("bad integer unaryOperation");
15
                throw new InterpreterError("bad long unaryOperation");
16
        }
16
        }
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.1
Clones locationClones are declared in the same class
Number of node comparisons96
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment6
    Number of unmapped statements in the second code fragment6
    Time elapsed for statement mapping (ms)6.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                
    1
    long operand = L.longValue();
    1
    int operand = I.intValue();
                                                            
    2
    switch (kind)
    2
    switch (kind)
    3
    case PLUS:
    3
    case PLUS:
                                        
    4
    return operand;
    Preondition Violations
    Unmatched return operand;
    4
    return operand;
    4
    return operand;
    4
    return operand;
    Preondition Violations
    Unmatched return operand;
                                        
    5
    case MINUS:
    5
    case MINUS:
                                          
    6
    return -operand;
    Preondition Violations
    Unmatched return -operand;
    6
    return -operand;
    6
    return -operand;
    6
    return -operand;
    Preondition Violations
    Unmatched return -operand;
                                          
    7
    case TILDE:
    7
    case TILDE:
                                          
    8
    return ~operand;
    Preondition Violations
    Unmatched return ~operand;
    8
    return ~operand;
    8
    return ~operand;
    8
    return ~operand;
    Preondition Violations
    Unmatched return ~operand;
                                          
    9
    case INCR:
    9
    case INCR:
                                                  
    10
    return operand + 1;
    Preondition Violations
    Unmatched return operand + 1;
    10
    return operand + 1;
    10
    return operand + 1;
    10
    return operand + 1;
    Preondition Violations
    Unmatched return operand + 1;
                                                  
    11
    case DECR:
    11
    case DECR:
                                                  
    12
    return operand - 1;
    Preondition Violations
    Unmatched return operand - 1;
    12
    return operand - 1;
    12
    return operand - 1;
    12
    return operand - 1;
    Preondition Violations
    Unmatched return operand - 1;
                                                  
    13
    default:
    13
    default:
    14
    throw new InterpreterError("bad integer unaryOperation");
    14
    throw new InterpreterError("bad integer unaryOperation");
    14
    throw new InterpreterError("bad long unaryOperation");
    Differences
    Expression1Expression2Difference
    "bad integer unaryOperation""bad long unaryOperation"LITERAL_VALUE_MISMATCH
    14
    throw new InterpreterError("bad long unaryOperation");
    Precondition Violations (10)
    Row Violation
    1Unmatched return operand;
    2Unmatched return operand;
    3Unmatched return -operand;
    4Unmatched return -operand;
    5Unmatched return ~operand;
    6Unmatched return ~operand;
    7Unmatched return operand + 1;
    8Unmatched return operand + 1;
    9Unmatched return operand - 1;
    10Unmatched return operand - 1;