List<Operand> strPieces = new ArrayList<Operand>(); for (Node n : dregexpNode.childNodes()) strPieces.add(build(n, s)); return new Regexp(new CompoundString(strPieces), dregexpNode.getOptions());
List<Operand> strPieces = new ArrayList<Operand>(); for (Node n : node.childNodes()) strPieces.add(build(n, s)); return new DynamicSymbol(new CompoundString(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 buildDRegexp(DRegexpNode, IR_Scope) Method name: Operand buildDSymbol(Node, 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 : dregexpNode.childNodes())
2
        for (Node n : node.childNodes())
3
            strPieces.add(build(n, s));
3
            strPieces.add(build(n, s));
4
        return new Regexp(new CompoundString(strPieces), dregexpNode.getOptions());
4
        return new DynamicSymbol(new CompoundString(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)46.8
    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 : dregexpNode.childNodes())
    2
    for (Node n : dregexpNode.childNodes())
    2
    for (Node n : node.childNodes())
    Differences
    Expression1Expression2Difference
    dregexpNodenodeVARIABLE_NAME_MISMATCH
    org.jruby.ast.DRegexpNodeorg.jruby.ast.NodeSUBCLASS_TYPE_MISMATCH
    2
    for (Node n : node.childNodes())
    3
    strPieces.add(build(n, s));
    3
    strPieces.add(build(n, s));
    4
    return new Regexp(new CompoundString(strPieces), dregexpNode.getOptions());
    4
    return new Regexp(new CompoundString(strPieces), dregexpNode.getOptions());
    4
    return new DynamicSymbol(new CompoundString(strPieces));
    Differences
    Expression1Expression2Difference
    org.jruby.compiler.ir.operands.Regexporg.jruby.compiler.ir.operands.DynamicSymbolSUBCLASS_TYPE_MISMATCH
    new Regexp(new CompoundString(strPieces),dregexpNode.getOptions())new DynamicSymbol(new CompoundString(strPieces))ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression new Regexp(new CompoundString(strPieces),dregexpNode.getOptions()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new DynamicSymbol(new CompoundString(strPieces)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new Regexp(new CompoundString(strPieces),dregexpNode.getOptions()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new DynamicSymbol(new CompoundString(strPieces)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    return new DynamicSymbol(new CompoundString(strPieces));
    Precondition Violations (4)
    Row Violation
    1Expression new Regexp(new CompoundString(strPieces),dregexpNode.getOptions()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new DynamicSymbol(new CompoundString(strPieces)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new Regexp(new CompoundString(strPieces),dregexpNode.getOptions()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression new DynamicSymbol(new CompoundString(strPieces)) cannot be parameterized, because it has dependencies to/from statements that will be extracted