FloatNode floatNode = (FloatNode) node; if (RubyInstanceConfig.PEEPHOLE_OPTZ) { if (expr) context.createNewFloat(floatNode.getValue()); } else { context.createNewFloat(floatNode.getValue()); if (!expr) context.consumeCurrentValue(); }
InstVarNode instVarNode = (InstVarNode) node; if (RubyInstanceConfig.PEEPHOLE_OPTZ) { if (expr) context.retrieveInstanceVariable(instVarNode.getName()); } else { context.retrieveInstanceVariable(instVarNode.getName()); if (!expr) context.consumeCurrentValue(); }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/compiler/ASTCompiler.java File path: /jruby-1.4.0/src/org/jruby/compiler/ASTCompiler.java
Method name: void compileFloat(Node, BodyCompiler, boolean) Method name: void compileInstVar(Node, BodyCompiler, boolean)
Number of AST nodes: 7 Number of AST nodes: 7
1
FloatNode floatNode = (FloatNode) node;
1
InstVarNode instVarNode = (InstVarNode) node;
2
        if (RubyInstanceConfig.PEEPHOLE_OPTZ) {
2
        if (RubyInstanceConfig.PEEPHOLE_OPTZ) {
3
            if (expr) context.createNewFloat(floatNode.getValue());
3
            if (expr) context.retrieveInstanceVariable(instVarNode.getName());
4
        } else {
4
        } else {
5
            context.createNewFloat(floatNode.getValue());
5
            context.retrieveInstanceVariable(instVarNode.getName());
6
            if (!expr) context.consumeCurrentValue();
6
            if (!expr) context.consumeCurrentValue();
7
        }
7
        }
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.4
Clones locationClones are declared in the same class
Number of node comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)3.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    FloatNode floatNode = (FloatNode)node;
    1
    FloatNode floatNode = (FloatNode)node;
    1
    InstVarNode instVarNode = (InstVarNode)node;
    Differences
    Expression1Expression2Difference
    org.jruby.ast.FloatNodeorg.jruby.ast.InstVarNodeSUBCLASS_TYPE_MISMATCH
    floatNodeinstVarNodeVARIABLE_NAME_MISMATCH
    org.jruby.ast.FloatNodeorg.jruby.ast.InstVarNodeSUBCLASS_TYPE_MISMATCH
    org.jruby.ast.FloatNodeorg.jruby.ast.InstVarNodeSUBCLASS_TYPE_MISMATCH
    1
    InstVarNode instVarNode = (InstVarNode)node;
    2
    if (RubyInstanceConfig.PEEPHOLE_OPTZ)
    2
    if (RubyInstanceConfig.PEEPHOLE_OPTZ)
    2
    if (RubyInstanceConfig.PEEPHOLE_OPTZ)
    Differences
    Expression1Expression2Difference
    RubyInstanceConfig.PEEPHOLE_OPTZRubyInstanceConfig.PEEPHOLE_OPTZIF_ELSE_SYMMETRICAL_MATCH
    2
    if (RubyInstanceConfig.PEEPHOLE_OPTZ)
    3
    if (expr)
    3
    if (expr)
    6
    if (!expr)
    Differences
    Expression1Expression2Difference
    expr!exprTYPE_COMPATIBLE_REPLACEMENT
    6
    if (!expr)
    4
    context.createNewFloat(floatNode.getValue());
    4
    context.createNewFloat(floatNode.getValue());
    7
    context.consumeCurrentValue();
    Differences
    Expression1Expression2Difference
    createNewFloatconsumeCurrentValueMETHOD_INVOCATION_NAME_MISMATCH
    context.createNewFloat(floatNode.getValue())context.consumeCurrentValue()ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression context.createNewFloat(floatNode.getValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression context.createNewFloat(floatNode.getValue()) is a void method call, and thus it cannot be parameterized
    Expression context.consumeCurrentValue() is a void method call, and thus it cannot be parameterized
    Expression context.createNewFloat(floatNode.getValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression context.createNewFloat(floatNode.getValue()) is a void method call, and thus it cannot be parameterized
    Expression context.consumeCurrentValue() is a void method call, and thus it cannot be parameterized
    7
    context.consumeCurrentValue();
    else
    else
    5
    context.createNewFloat(floatNode.getValue());
                                                                                                    
    6
    if (!expr)
    6
    if (!expr)
    3
    if (expr)
    Differences
    Expression1Expression2Difference
    !exprexprTYPE_COMPATIBLE_REPLACEMENT
    3
    if (expr)
    7
    context.consumeCurrentValue();
    7
    context.consumeCurrentValue();
    4
    context.retrieveInstanceVariable(instVarNode.getName());
    Differences
    Expression1Expression2Difference
    consumeCurrentValueretrieveInstanceVariableMETHOD_INVOCATION_NAME_MISMATCH
    context.consumeCurrentValue()context.retrieveInstanceVariable(instVarNode.getName())ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression context.retrieveInstanceVariable(instVarNode.getName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression context.consumeCurrentValue() is a void method call, and thus it cannot be parameterized
    Expression context.retrieveInstanceVariable(instVarNode.getName()) is a void method call, and thus it cannot be parameterized
    Expression context.retrieveInstanceVariable(instVarNode.getName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression context.consumeCurrentValue() is a void method call, and thus it cannot be parameterized
    Expression context.retrieveInstanceVariable(instVarNode.getName()) is a void method call, and thus it cannot be parameterized
    4
    context.retrieveInstanceVariable(instVarNode.getName());
                                                                                                                          
    5
    context.retrieveInstanceVariable(instVarNode.getName());
    Precondition Violations (13)
    Row Violation
    1Expression context.createNewFloat(floatNode.getValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression context.createNewFloat(floatNode.getValue()) is a void method call, and thus it cannot be parameterized
    3Expression context.consumeCurrentValue() is a void method call, and thus it cannot be parameterized
    4Expression context.createNewFloat(floatNode.getValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression context.createNewFloat(floatNode.getValue()) is a void method call, and thus it cannot be parameterized
    6Expression context.consumeCurrentValue() is a void method call, and thus it cannot be parameterized
    7Expression context.retrieveInstanceVariable(instVarNode.getName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression context.consumeCurrentValue() is a void method call, and thus it cannot be parameterized
    9Expression context.retrieveInstanceVariable(instVarNode.getName()) is a void method call, and thus it cannot be parameterized
    10Expression context.retrieveInstanceVariable(instVarNode.getName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression context.consumeCurrentValue() is a void method call, and thus it cannot be parameterized
    12Expression context.retrieveInstanceVariable(instVarNode.getName()) is a void method call, and thus it cannot be parameterized
    13Clone fragment #1 returns variable floatNode with type org.jruby.ast.FloatNode , while Clone fragment #2 returns variable instVarNode with type org.jruby.ast.InstVarNode