public String ToString() { StringBuilder sb = new StringBuilder(); for (int i = 0; i < this.size(); i++) { sb.append(i + "\t" + this.get(i).toString() + "\n"); } return sb.toString(); }
protected void TraceDottedIdent(String[] target, StringBuilder sb) { String dot = ""; for(String s:target) { sb.append(dot + s); dot = "."; } }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml-csharp/src/org/argouml/language/csharp/importer/csparser/collections/ParseStateCollection.java File path: /ArgoUML-0.34-src/argouml-csharp/src/org/argouml/language/csharp/importer/csparser/nodes/expressions/BaseNode.java
Method name: String ToString() Method name: void TraceDottedIdent(String[], StringBuilder)
Number of AST nodes: 2 Number of AST nodes: 3
1
public  String ToString()
1
protected void TraceDottedIdent(String[] target, StringBuilder sb)
2
		{
2
        {
3
			StringBuilder sb = new StringBuilder();
3
            String dot = "";
4
4
            for(String s:target)
5
			for (int i = 0; i < this.size(); i++)
5
            {
6
			{
6
                sb.append(dot + s);
7
				sb.append(i + "\t" + this.get(i).toString() + "\n");
7
                dot = ".";
8
			}
8
            }
9
			return sb.toString();
9
        }
10
		}
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.0
    Similarity Score0.600
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    2
    for (int i = 0; i < this.size(); i++)
    2
    for (int i = 0; i < this.size(); i++)
    2
    for (String s : target)
    Differences
    Expression1Expression2Difference
    org.argouml.language.csharp.importer.csparser.collections.ParseStateCollectionjava.lang.String[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.argouml.language.csharp.importer.csparser.collections.ParseStateCollection of variable this does not match with type java.lang.String[] of variable target
    • Make classes org.argouml.language.csharp.importer.csparser.collections.ParseStateCollection and java.lang.String[] extend a common superclass
    2
    for (String s : target)
                                                
    3
    sb.append(dot + s);
    Preondition Violations
    Unmatched statement sb.append(dot + s); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    sb.append(dot + s);
    3
    sb.append(i + "\t" + this.get(i).toString() + "\n");
    3
    sb.append(i + "\t" + this.get(i).toString() + "\n");
    Preondition Violations
    Unmatched statement sb.append(i + "\t" + this.get(i).toString()+ "\n"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                
                          
    4
    dot = ".";
    Preondition Violations
    Unmatched statement dot="."; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    dot = ".";
    Precondition Violations (5)
    Row Violation
    1Type org.argouml.language.csharp.importer.csparser.collections.ParseStateCollection of variable this does not match with type java.lang.String[] of variable target
    2Unmatched statement sb.append(dot + s); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement sb.append(i + "\t" + this.get(i).toString()+ "\n"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement dot="."; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Clone fragment #1 returns variable i with type int , while Clone fragment #2 returns variable s with type java.lang.String