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(); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getName() + " {\n"); for (CheckItem item : this) { sb.append(" " + item.toString() + "\n"); } sb.append(" }"); return sb.toString(); }
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/src/argouml-app/src/org/argouml/cognitive/checklist/Checklist.java
Method name: String ToString() Method name: String toString()
Number of AST nodes: 2 Number of AST nodes: 2
1
public  String ToString()
1
@Override
2
		{
2
    public String toString() {
3
			StringBuilder sb = new StringBuilder();
3
	StringBuilder sb = new StringBuilder();
4
4
	sb.append(getClass().getName() + " {\n");
5
			for (int i = 0; i < this.size(); i++)
5
        for (CheckItem item : this) {
6
			{
6
	    sb.append("    " + item.toString() + "\n");
7
				sb.append(i + "\t" + this.get(i).toString() + "\n");
7
	}
8
			}
8
	sb.append("  }");
9
			return sb.toString();
9
	return sb.toString();
10
		}
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 fragment1
    Time elapsed for statement mapping (ms)0.0
    Similarity Score0.429
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    for (int i = 0; i < this.size(); i++)
    2
    for (int i = 0; i < this.size(); i++)
    3
    for (CheckItem item : this)
    Differences
    Expression1Expression2Difference
    org.argouml.language.csharp.importer.csparser.collections.ParseStateCollectionorg.argouml.cognitive.checklist.ChecklistVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.argouml.language.csharp.importer.csparser.collections.ParseStateCollection of variable this does not match with type org.argouml.cognitive.checklist.Checklist of variable this
    • Make classes org.argouml.language.csharp.importer.csparser.collections.ParseStateCollection and org.argouml.cognitive.checklist.Checklist extend a common superclass
    3
    for (CheckItem item : this)
    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
    sb.append(" " + item.toString() + "\n");
    Preondition Violations
    Unmatched statement sb.append(" " + item.toString() + "\n"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    sb.append("    " + item.toString() + "\n");
    Precondition Violations (4)
    Row Violation
    1Type org.argouml.language.csharp.importer.csparser.collections.ParseStateCollection of variable this does not match with type org.argouml.cognitive.checklist.Checklist of variable this
    2Unmatched 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
    3Unmatched statement sb.append(" " + item.toString() + "\n"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Clone fragment #1 returns variable i with type int , while Clone fragment #2 returns variable item with type org.argouml.cognitive.checklist.CheckItem