protected void WriteLocalSource(StringBuilder sb, String kind)
{
if (attributes != null)
{
attributes.ToSource(sb);
this.NewLine(sb);
}
TraceModifiers(Modifiers, sb);
sb.append(kind + " ");
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(Constants != null)
{
Constants.ToSource(sb);
}
if(Fields != null)
{
Fields.ToSource(sb);
}
if(Properties != null)
{
Properties.ToSource(sb);
}
if (Constructors != null)
{
Constructors.ToSource(sb);
}
if (Methods != null)
{
Methods.ToSource(sb);
}
if (Indexers != null)
{
Indexers.ToSource(sb);
}
if (Events != null)
{
Events.ToSource(sb);
}
if (Destructors != null)
{
Destructors.ToSource(sb);
}
indent--;
this.NewLine(sb);
sb.append("}");
this.NewLine(sb);
}
public void ToSource(StringBuilder sb)
{
if (attributes != null)
{
attributes.ToSource(sb);
this.NewLine(sb);
}
this.TraceModifiers(this.modifiers, sb);
this.type.ToSource(sb);
sb.append(" ");
this.names.get(0).ToSource(sb);
sb.append("(");
if (params != null)
{
String comma = "";
for (int i = 0; i < params.size(); i++)
{
sb.append(comma);
comma = ", ";
params.get(i).ToSource(sb);
}
}
sb.append(")");
this.NewLine(sb);
statementBlock.ToSource(sb);
}
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml-csharp/src/org/argouml/language/csharp/importer/csparser/types/ClassNode.java
|
|
File path: /ArgoUML-0.34-src/argouml-csharp/src/org/argouml/language/csharp/importer/csparser/members/MethodNode.java
|
Method name: void WriteLocalSource(StringBuilder, String)
|
|
Method name: void ToSource(StringBuilder)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | protected void WriteLocalSource(StringBuilder sb, String kind) | | 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 | TraceModifiers(Modifiers, sb); | | 8 | this.TraceModifiers(this.modifiers, sb); |
9 | | | 9 | |
10 | sb.append(kind + " "); | | 10 | this.type.ToSource(sb); |
11 | Name.ToSource(sb); | | 11 | sb.append(" "); |
12 | sb.append(" "); | | 12 | |
13 | | | 13 | this.names.get(0).ToSource(sb); |
14 | if (BaseClasses != null && BaseClasses.size() > 1) | | 14 | sb.append("("); |
15 | { | | 15 | |
16 | sb.append(": "); | | 16 | if (params != null) |
17 | String comma = ""; | | 17 | { |
18 | for(TypeNode bcls:BaseClasses) | | 18 | String comma = ""; |
19 | { | | 19 | for (int i = 0; i < params.size(); i++) |
20 | sb.append(comma); | | 20 | { |
21 | comma = ", "; | | 21 | sb.append(comma); |
22 | bcls.ToSource(sb); | | 22 | comma = ", "; |
23 | } | | 23 | params.get(i).ToSource(sb); |
24 | } | | 24 | } |
25 | | | 25 | } |
26 | this.NewLine(sb); | | 26 | |
27 | sb.append("{"); | | 27 | sb.append(")"); |
28 | indent++; | | 28 | this.NewLine(sb); |
29 | this.NewLine(sb); | | 29 | |
30 | | | 30 | statementBlock.ToSource(sb); |
31 | if(Constants != null) | | 31 | } |
32 | { | | | |
33 | Constants.ToSource(sb); | | | |
34 | } | | | |
35 | if(Fields != null) | | | |
36 | { | | | |
37 | Fields.ToSource(sb); | | | |
38 | } | | | |
39 | if(Properties != null) | | | |
40 | { | | | |
41 | Properties.ToSource(sb); | | | |
42 | } | | | |
43 | if (Constructors != null) | | | |
44 | { | | | |
45 | Constructors.ToSource(sb); | | | |
46 | } | | | |
47 | if (Methods != null) | | | |
48 | { | | | |
49 | Methods.ToSource(sb); | | | |
50 | } | | | |
51 | if (Indexers != null) | | | |
52 | { | | | |
53 | Indexers.ToSource(sb); | | | |
54 | } | | | |
55 | if (Events != null) | | | |
56 | { | | | |
57 | Events.ToSource(sb); | | | |
58 | } | | | |
59 | if (Destructors != null) | | | |
60 | { | | | |
61 | Destructors.ToSource(sb); | | | |
62 | } | | | |
63 | | | | |
64 | indent--; | | | |
65 | this.NewLine(sb); | | | |
66 | sb.append("}"); | | | |
67 | this.NewLine(sb); | | | |
68 | | | | |
69 | } | | | |
See real code fragment |
|
See real code fragment |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.0 |
Similarity Score | 0.429 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
11 | for (TypeNode bcls : BaseClasses) | | 11 | for (int i = 0; i < params.size(); i++) |
12 | | | 12 | |
13 | | | 13 | |
14 | | | 14 | params.get(i).ToSource(sb); |
Precondition Violations (3)
Row |
Violation |
1 | Type java.util.List<org.argouml.language.csharp.importer.csparser.nodes.expressions.TypeNode> of variable BaseClasses does not match with type org.argouml.language.csharp.importer.csparser.collections.NodeCollection<org.argouml.language.csharp.importer.csparser.members.ParamDeclNode> of variable params |
2 | Type java.util.List<org.argouml.language.csharp.importer.csparser.nodes.expressions.TypeNode> of variable BaseClasses does not match with type org.argouml.language.csharp.importer.csparser.collections.NodeCollection<org.argouml.language.csharp.importer.csparser.members.ParamDeclNode> of variable params |
3 | Expression bcls cannot be parameterized, because it has dependencies to/from statements that will be extracted |