ParserRule rule = ruleset.ruleMapFirst[i]; while(rule != null) { addRule(rule); rule = rule.next; }
Keyword k = map.map[i]; while(k != null) { add(k.keyword,k.id); k = k.next; }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/syntax/ParserRuleSet.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/syntax/KeywordMap.java
Method name: void resolveImports() Method name: void add(KeywordMap)
Number of AST nodes: 4 Number of AST nodes: 4
1
ParserRule rule = ruleset.ruleMapFirst[i];
1
Keyword k = map.map[i];
2
				while(rule != null)
2
			while(k != null)
3
				{
3
			{
4
					addRule(rule);
4
				add
5
					rule = rule
5
(k.keyword,k.id);
6
.next;
6
				k = k.next;
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.3
Clones locationClones are in different classes
Number of node comparisons11
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    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.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                    
    2
    Keyword k = map.map[i];
    Preondition Violations
    Unmatched statement Keyword k=map.map[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    Keyword k = map.map[i];
    5
    ParserRule rule = ruleset.ruleMapFirst[i];
    5
    ParserRule rule = ruleset.ruleMapFirst[i];
    Preondition Violations
    Unmatched statement ParserRule rule=ruleset.ruleMapFirst[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                          
    6
    while (rule != null)
    6
    while (rule != null)
    3
    while (k != null)
    Differences
    Expression1Expression2Difference
    rulekVARIABLE_NAME_MISMATCH
    org.gjt.sp.jedit.syntax.ParserRuleorg.gjt.sp.jedit.syntax.KeywordMap.KeywordVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.gjt.sp.jedit.syntax.ParserRule of variable rule does not match with type org.gjt.sp.jedit.syntax.KeywordMap.Keyword of variable k
    • Make classes org.gjt.sp.jedit.syntax.ParserRule and org.gjt.sp.jedit.syntax.KeywordMap.Keyword extend a common superclass
    3
    while (k != null)
    7
    addRule(rule);
    7
    addRule(rule);
    4
    add(k.keyword, k.id);
    Differences
    Expression1Expression2Difference
    addRuleaddMETHOD_INVOCATION_NAME_MISMATCH
    addRule(rule)add(k.keyword,k.id)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression addRule(rule) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression add(k.keyword,k.id) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression addRule(rule) is a void method call, and thus it cannot be parameterized
    Expression add(k.keyword,k.id) is a void method call, and thus it cannot be parameterized
    Expression addRule(rule) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression add(k.keyword,k.id) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression addRule(rule) is a void method call, and thus it cannot be parameterized
    Expression add(k.keyword,k.id) is a void method call, and thus it cannot be parameterized
    4
    add(k.keyword, k.id);
                            
    5
    k = k.next;
    Preondition Violations
    Unmatched statement k=k.next; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    k = k.next;
    8
    rule = rule.next;
    8
    rule = rule.next;
    Preondition Violations
    Unmatched statement rule=rule.next; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                        
    Precondition Violations (13)
    Row Violation
    1Unmatched statement Keyword k=map.map[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement ParserRule rule=ruleset.ruleMapFirst[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type org.gjt.sp.jedit.syntax.ParserRule of variable rule does not match with type org.gjt.sp.jedit.syntax.KeywordMap.Keyword of variable k
    4Expression addRule(rule) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression add(k.keyword,k.id) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression addRule(rule) is a void method call, and thus it cannot be parameterized
    7Expression add(k.keyword,k.id) is a void method call, and thus it cannot be parameterized
    8Expression addRule(rule) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression add(k.keyword,k.id) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression addRule(rule) is a void method call, and thus it cannot be parameterized
    11Expression add(k.keyword,k.id) is a void method call, and thus it cannot be parameterized
    12Unmatched statement k=k.next; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13Unmatched statement rule=rule.next; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted