Integer topInt = idStack.pop(); int top = topInt.intValue(); idStack.push(new Integer(++top)); idStack.push(new Integer(0)); if (baseId == null) { baseId = "id"; } else { baseId += "."; baseId += topInt.toString(); } RoseToken tok = lexer.getNext(); if (tok.getType() != RoseToken.OBJECT) { System.out.println(" Parsing error in parseObject - expecting object token"); return null; } tok = lexer.getNext(); if (tok.getType() != RoseToken.STRING) { System.out.println(" Parsing error in parseObject - expecting string"); return null; } String label = tok.getValue(); RoseNode root = null;
Integer topInt = idStack.pop(); int top = topInt.intValue(); // top++; idStack.push(new Integer(++top)); idStack.push(new Integer(0)); if (baseId == null) { baseId = "id"; } else { baseId += "."; baseId += topInt.toString(); } RoseToken tok = lexer.getNext(); if (tok.getType() != RoseToken.VALUE) { System.out.println(" Parsing error in parseValue - expecting value token"); return null; } tok = lexer.getNext(); if (tok.getType() != RoseToken.STRING) { System.out.println(" Parsing error in parseValue - expecting string"); return null; } String label = tok.getValue(); RoseNode root = null;
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/importer/rose/parser/RoseParser.java File path: /emf-2.4.1/src/org/eclipse/emf/importer/rose/parser/RoseParser.java
Method name: RoseNode parseObject(String) Method name: RoseNode parseValue(String)
Number of AST nodes: 18 Number of AST nodes: 18
1
Integer topInt = idStack.pop();
1
Integer topInt = idStack.pop();
2
    int top = topInt.intValue();
2
    int top = topInt.intValue();
3
    //    top++;
3
    idStack.push(new Integer(++top));
4
    idStack.push(new Integer(++top));
4
    idStack.push(new Integer(0));
5
    idStack.push(new Integer(0));
5
    if (baseId == null)
6
    if (baseId == null)
6
    {
7
    {
7
      baseId = "id";
8
      baseId = "id";
8
    }
9
    }
9
    else
10
    else
10
    {
11
    {
11
      baseId += ".";
12
      baseId += ".";
12
      baseId += topInt.toString();
13
      baseId += topInt.toString();
13
    }
14
    }
14
    RoseToken tok = lexer.getNext();
15
    RoseToken tok = lexer.getNext();
15
    if (tok.getType() != RoseToken.OBJECT)
16
    if (tok.getType() != RoseToken.VALUE)
16
    {
17
    {
17
      System.out.println("  Parsing error in parseObject - expecting object token");
18
      System.out.println("  Parsing error in parseValue - expecting value token");
18
      return null;
19
      return null;
19
    }
20
    }
20
    tok = lexer.getNext();
21
    tok = lexer.getNext();
21
    if (tok.getType() != RoseToken.STRING)
22
    if (tok.getType() != RoseToken.STRING)
22
    {
23
    {
23
      System.out.println("  Parsing error in parseObject - expecting string");
24
      System.out.println("  Parsing error in parseValue - expecting string");
24
      return null;
25
      return null;
25
    }
26
    }
26
    String label = tok.getValue();
27
    String label = tok.getValue();
27
    RoseNode root = null;
28
    RoseNode root = null;
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.9
Clones locationClones are declared in the same class
Number of node comparisons134
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements18
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)10.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Integer topInt = idStack.pop();
    1
    Integer topInt = idStack.pop();
    2
    int top = topInt.intValue();
    2
    int top = topInt.intValue();
    3
    idStack.push(new Integer(++top));
    3
    idStack.push(new Integer(++top));
    4
    idStack.push(new Integer(0));
    4
    idStack.push(new Integer(0));
    5
    if (baseId == null)
    5
    if (baseId == null)
    6
    baseId = "id";
    6
    baseId = "id";
    else
    else
    7
    baseId += ".";
    7
    baseId += ".";
    8
    baseId += topInt.toString();
    8
    baseId += topInt.toString();
    9
    RoseToken tok = lexer.getNext();
    9
    RoseToken tok = lexer.getNext();
    10
    if (tok.getType() != RoseToken.OBJECT)
    10
    if (tok.getType() != RoseToken.OBJECT)
    10
    if (tok.getType() != RoseToken.VALUE)
    Differences
    Expression1Expression2Difference
    OBJECTVALUEVARIABLE_NAME_MISMATCH
    10
    if (tok.getType() != RoseToken.VALUE)
    11
    System.out.println("  Parsing error in parseObject - expecting object token");
    11
    System.out.println(" Parsing error in parseObject - expecting object token");
    11
    System.out.println(" Parsing error in parseValue - expecting value token");
    Differences
    Expression1Expression2Difference
    " Parsing error in parseObject - expecting object token"" Parsing error in parseValue - expecting value token"LITERAL_VALUE_MISMATCH
    11
    System.out.println("  Parsing error in parseValue - expecting value token");
    12
    return null;
    12
    return null;
    13
    tok = lexer.getNext();
    13
    tok = lexer.getNext();
    14
    if (tok.getType() != RoseToken.STRING)
    14
    if (tok.getType() != RoseToken.STRING)
    15
    System.out.println("  Parsing error in parseObject - expecting string");
    15
    System.out.println(" Parsing error in parseObject - expecting string");
    15
    System.out.println(" Parsing error in parseValue - expecting string");
    Differences
    Expression1Expression2Difference
    " Parsing error in parseObject - expecting string"" Parsing error in parseValue - expecting string"LITERAL_VALUE_MISMATCH
    15
    System.out.println("  Parsing error in parseValue - expecting string");
    16
    return null;
    16
    return null;
    17
    String label = tok.getValue();
    17
    String label = tok.getValue();
    18
    RoseNode root = null;
    18
    RoseNode root = null;
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables label, root , while Clone fragment #2 returns variables label, root