List<Operand> strPieces = new ArrayList<Operand>(); for (Node n : dstrNode.childNodes()) strPieces.add(build(n, s)); return new CompoundString(strPieces);
List<Operand> strPieces = new ArrayList<Operand>(); for (Node nextNode : dstrNode.childNodes()) strPieces.add(build(nextNode, m)); return new BacktickString(strPieces);
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/compiler/ir/IR_Builder.java File path: /jruby-1.4.0/src/org/jruby/compiler/ir/IR_Builder.java
Method name: Operand buildDStr(DStrNode, IR_Scope) Method name: Operand buildDXStr(DXStrNode, IR_Scope)
Number of AST nodes: 4 Number of AST nodes: 4
1
List<Operand> strPieces = new ArrayList<Operand>();
1
List<Operand> strPieces = new ArrayList<Operand>();
2
        for (Node n : dstrNode.childNodes())
2
        for (Node nextNode : dstrNode.childNodes())
3
            strPieces.add(build(n, s));
3
            strPieces.add(build(nextNode, m));
4
        return new CompoundString(strPieces);
4
        return new BacktickString(strPieces);
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 comparisons8
  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)48.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    List<Operand> strPieces = new ArrayList<Operand>();
    1
    List<Operand> strPieces = new ArrayList<Operand>();
    2
    for (Node n : dstrNode.childNodes())
    2
    for (Node n : dstrNode.childNodes())
    2
    for (Node nextNode : dstrNode.childNodes())
    Differences
    Expression1Expression2Difference
    nnextNodeVARIABLE_NAME_MISMATCH
    org.jruby.ast.DStrNodeorg.jruby.ast.DXStrNodeSUBCLASS_TYPE_MISMATCH
    2
    for (Node nextNode : dstrNode.childNodes())
    3
    strPieces.add(build(n, s));
    3
    strPieces.add(build(n, s));
    3
    strPieces.add(build(nextNode, m));
    Differences
    Expression1Expression2Difference
    nnextNodeVARIABLE_NAME_MISMATCH
    smVARIABLE_NAME_MISMATCH
    3
    strPieces.add(build(nextNode, m));
    4
    return new CompoundString(strPieces);
    4
    return new CompoundString(strPieces);
    4
    return new BacktickString(strPieces);
    Differences
    Expression1Expression2Difference
    org.jruby.compiler.ir.operands.CompoundStringorg.jruby.compiler.ir.operands.BacktickStringSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new CompoundString(strPieces) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new BacktickString(strPieces) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    return new BacktickString(strPieces);
    Precondition Violations (2)
    Row Violation
    1Expression new CompoundString(strPieces) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new BacktickString(strPieces) cannot be parameterized, because it has dependencies to/from statements that will be extracted