public void ToSource(StringBuilder sb) { if (attributes != null) { attributes.ToSource(sb); this.NewLine(sb); } this.TraceModifiers(this.modifiers, sb); if (isStaticConstructor) { sb.append("static "); } this.names.get(0).ToSource(sb); sb.append("("); String comma = ""; if (params != null) { for (int i = 0; i < params.size(); i++) { sb.append(comma); comma = ", "; params.get(i).ToSource(sb); } } sb.append(")"); // possible :this or :base if (hasBase) { sb.append(" : base("); } else if (hasThis) { sb.append(" : this("); } if (hasBase || hasThis) { if (thisBaseArgs != null) { comma = ""; for (int i = 0; i < thisBaseArgs.size(); i++) { sb.append(comma); comma = ", "; thisBaseArgs.get(i).ToSource(sb); } } sb.append(")"); } // start block this.NewLine(sb); statementBlock.ToSource(sb); }
public void ToSource(StringBuilder sb) { if (attributes != null) { attributes.ToSource(sb); this.NewLine(sb); } TraceModifiers(Modifiers, sb); sb.append("interface "); Name.ToSource(sb); sb.append(" "); if (BaseClasses != null && BaseClasses.size() > 1) { sb.append(": "); String comma = ""; for (TypeNode bcls:BaseClasses) { sb.append(comma); comma = ", "; bcls.ToSource(sb); } } this.NewLine(sb); sb.append("{"); indent++; this.NewLine(sb); if (Properties != null) { Properties.ToSource(sb); } if (Methods != null) { Methods.ToSource(sb); } if (Indexers != null) { Indexers.ToSource(sb); } if (Events != null) { Events.ToSource(sb); } indent--; this.NewLine(sb); sb.append("}"); this.NewLine(sb); }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml-csharp/src/org/argouml/language/csharp/importer/csparser/members/ConstructorNode.java File path: /ArgoUML-0.34-src/argouml-csharp/src/org/argouml/language/csharp/importer/csparser/types/InterfaceNode.java
Method name: void ToSource(StringBuilder) Method name: void ToSource(StringBuilder)
Number of AST nodes: 4 Number of AST nodes: 4
1
public  void ToSource(StringBuilder sb)
1
public  void ToSource(StringBuilder sb)
2
		{
2
		{
3
			if (attributes != null)
3
			if (attributes != null)
4
			{
4
			{
5
				attributes.ToSource(sb);
5
				attributes.ToSource(sb);
6
				this.NewLine(sb);
6
				this.NewLine(sb);
7
			}
7
			}
8
			this.TraceModifiers(this.modifiers, sb);
8
			TraceModifiers(Modifiers, sb);
9
9
10
			if (isStaticConstructor)
10
			sb.append("interface ");
11
			{
11
			Name.ToSource(sb);
12
				sb.append("static ");
12
			sb.append(" ");
13
			}
13
14
14
			if (BaseClasses != null && BaseClasses.size() > 1)
15
			this.names.get(0).ToSource(sb);
15
			{
16
			sb.append("(");
16
				sb.append(": ");
17
17
				String comma = "";
18
			String comma = "";
18
				for (TypeNode bcls:BaseClasses)
19
			if (params != null)
19
				{
20
			{
20
					sb.append(comma);
21
				for (int i = 0; i < params.size(); i++)
21
					comma = ", ";
22
				{
22
					bcls.ToSource(sb);
23
					sb.append(comma);
23
				}
24
					comma = ", ";
24
			}
25
					params.get(i).ToSource(sb);
25
26
				}
26
			this.NewLine(sb);
27
			}
27
			sb.append("{");
28
			sb.append(")");
28
			indent++;
29
29
			this.NewLine(sb);
30
			// possible :this or :base
30
31
			if (hasBase)
31
			if (Properties != null)
32
			{
32
			{
33
				sb.append(" : base(");
33
				Properties.ToSource(sb);
34
			}
34
			}
35
			else if (hasThis)
35
			if (Methods != null)
36
			{
36
			{
37
				sb.append(" : this(");
37
				Methods.ToSource(sb);
38
			}
38
			}
39
			if (hasBase || hasThis)
39
			if (Indexers != null)
40
			{
40
			{
41
				if (thisBaseArgs != null)
41
				Indexers.ToSource(sb);
42
				{
42
			}
43
					comma = "";
43
			if (Events != null)
44
					for (int i = 0; i < thisBaseArgs.size(); i++)
44
			{
45
					{
45
				Events.ToSource(sb);
46
						sb.append(comma);
46
			}
47
						comma = ", ";
47
48
						thisBaseArgs.get(i).ToSource(sb);
48
			indent--;
49
					}
49
			this.NewLine(sb);
50
				}
50
			sb.append("}");
51
				sb.append(")");
51
			this.NewLine(sb);
52
			}
52
53
53
		}
54
			// start block
55
			this.NewLine(sb);
56
57
			statementBlock.ToSource(sb);
58
59
        }
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Similarity Score0.429
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    23
    for (int i = 0; i < thisBaseArgs.size(); i++)
    23
    for (int i = 0; i < thisBaseArgs.size(); i++)
    11
    for (TypeNode bcls : BaseClasses)
    Differences
    Expression1Expression2Difference
    org.argouml.language.csharp.importer.csparser.collections.NodeCollectionjava.util.ListVARIABLE_TYPE_MISMATCH
    org.argouml.language.csharp.importer.csparser.collections.NodeCollectionjava.util.ListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.argouml.language.csharp.importer.csparser.collections.NodeCollection<org.argouml.language.csharp.importer.csparser.nodes.expressions.ArgumentNode> of variable thisBaseArgs does not match with type java.util.List<org.argouml.language.csharp.importer.csparser.nodes.expressions.TypeNode> of variable BaseClasses
    • Make classes org.argouml.language.csharp.importer.csparser.collections.NodeCollection and java.util.List extend a common superclass
    Type org.argouml.language.csharp.importer.csparser.collections.NodeCollection<org.argouml.language.csharp.importer.csparser.nodes.expressions.ArgumentNode> of variable thisBaseArgs does not match with type java.util.List<org.argouml.language.csharp.importer.csparser.nodes.expressions.TypeNode> of variable BaseClasses
    • Make classes org.argouml.language.csharp.importer.csparser.collections.NodeCollection and java.util.List extend a common superclass
    11
    for (TypeNode bcls : BaseClasses)
    24
    sb.append(comma);
    12
    sb.append(comma);
    25
    comma = ", ";
    13
    comma = ", ";
    26
    thisBaseArgs.get(i).ToSource(sb);
    26
    thisBaseArgs.get(i).ToSource(sb);
    14
    bcls.ToSource(sb);
    Differences
    Expression1Expression2Difference
    thisBaseArgs.get(i)bclsTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression bcls cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14
    bcls.ToSource(sb);
    Precondition Violations (3)
    Row Violation
    1Type org.argouml.language.csharp.importer.csparser.collections.NodeCollection<org.argouml.language.csharp.importer.csparser.nodes.expressions.ArgumentNode> of variable thisBaseArgs does not match with type java.util.List<org.argouml.language.csharp.importer.csparser.nodes.expressions.TypeNode> of variable BaseClasses
    2Type org.argouml.language.csharp.importer.csparser.collections.NodeCollection<org.argouml.language.csharp.importer.csparser.nodes.expressions.ArgumentNode> of variable thisBaseArgs does not match with type java.util.List<org.argouml.language.csharp.importer.csparser.nodes.expressions.TypeNode> of variable BaseClasses
    3Expression bcls cannot be parameterized, because it has dependencies to/from statements that will be extracted