while ( child < numchild ) { node = jjtGetChild(child++); if ( node instanceof BSHSwitchLabel ) continue; // eval it Object value = ((SimpleNode)node).eval( callstack, interpreter ); // should check to disallow continue here? if ( value instanceof ReturnControl ) { returnControl = (ReturnControl)value; break; } }
while ( child < numchild ) { node = jjtGetChild(child++); if ( node instanceof BSHSwitchLabel ) { label = (BSHSwitchLabel)node; break; } }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/bsh/BSHSwitchStatement.java File path: /jEdit-4.2/src/bsh/BSHSwitchStatement.java
Method name: Object eval(CallStack, Interpreter) Method name: Object eval(CallStack, Interpreter)
Number of AST nodes: 8 Number of AST nodes: 5
1
while ( child < numchild ) 
1
while ( child < numchild ) 
2
				{
2
				{
3
					node = jjtGetChild(child++);
3
					node = jjtGetChild(child++);
4
					if ( node instanceof BSHSwitchLabel )
4
					if ( node instanceof BSHSwitchLabel )
5
						continue;
6
					// eval it
7
					Object value = 
8
						((SimpleNode)node).eval( callstack, interpreter ); 
9
					// should check to disallow continue here?
10
					if ( value instanceof ReturnControl ) {
11
						returnControl = (ReturnControl)valu
5
 {
12
e;
6
						label = (BSHSwitchLabel)node;
13
						break;
7
						break;
14
					}
8
					}
15
				}
9
				}
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.3
Clones locationClones are in the same method
Number of node comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    13
    while (child < numchild)
    21
    while (child < numchild)
    14
    node = jjtGetChild(child++);
    22
    node = jjtGetChild(child++);
    15
    if (node instanceof BSHSwitchLabel)
    23
    if (node instanceof BSHSwitchLabel)
    16
    continue;
    16
    continue;
    Preondition Violations
    Unmatched continue;
                              
                                                                  
    24
    label = (BSHSwitchLabel)node;
    Preondition Violations
    Unmatched statement label=(BSHSwitchLabel)node; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    24
    label = (BSHSwitchLabel)node;
                        
    25
    break;
    Preondition Violations
    Unmatched break;
    25
    break;
    17
    Object value = ((SimpleNode)node).eval(callstack, interpreter);
    17
    Object value = ((SimpleNode)node).eval(callstack, interpreter);
    Preondition Violations
    Unmatched statement Object value=((SimpleNode)node).eval(callstack,interpreter); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                    
    Precondition Violations (5)
    Row Violation
    1Unmatched continue;
    2Unmatched statement label=(BSHSwitchLabel)node; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched break;
    4Unmatched statement Object value=((SimpleNode)node).eval(callstack,interpreter); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Clone fragment #1 returns variables child, node , while Clone fragment #2 returns variables child, node