public void ToSource(StringBuilder sb)
{
if (attributes != null)
{
attributes.ToSource(sb);
this.NewLine(sb);
}
TraceModifiers(modifiers, sb);
type.ToSource(sb);
sb.append(" ");
if (interfaceType != null)
{
interfaceType.ToSource(sb);
sb.append(".");
}
sb.append("this[");
if (params != null)
{
String comma = "";
for (ParamDeclNode pdn: params)
{
sb.append(comma);
comma = ", ";
pdn.ToSource(sb);
}
}
sb.append("]");
// start block
this.NewLine(sb);
sb.append("{");
indent++;
this.NewLine(sb);
if (getter != null)
{
getter.ToSource(sb);
}
if (setter != null)
{
setter.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);
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);
}
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml-csharp/src/org/argouml/language/csharp/importer/csparser/members/IndexerNode.java
|
|
File path: /ArgoUML-0.34-src/argouml-csharp/src/org/argouml/language/csharp/importer/csparser/members/ConstructorNode.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 | TraceModifiers(modifiers, sb); | | 8 | this.TraceModifiers(this.modifiers, sb); |
9 | | | 9 | |
10 | type.ToSource(sb); | | 10 | if (isStaticConstructor) |
11 | sb.append(" "); | | 11 | { |
12 | if (interfaceType != null) | | 12 | sb.append("static "); |
13 | { | | 13 | } |
14 | interfaceType.ToSource(sb); | | 14 | |
15 | sb.append("."); | | 15 | this.names.get(0).ToSource(sb); |
16 | } | | 16 | sb.append("("); |
17 | sb.append("this["); | | 17 | |
18 | if (params != null) | | 18 | String comma = ""; |
19 | { | | 19 | if (params != null) |
20 | String comma = ""; | | 20 | { |
21 | for (ParamDeclNode pdn: params) | | 21 | for (int i = 0; i < params.size(); i++) |
22 | { | | 22 | { |
23 | sb.append(comma); | | 23 | sb.append(comma); |
24 | comma = ", "; | | 24 | comma = ", "; |
25 | pdn.ToSource(sb); | | 25 | params.get(i).ToSource(sb); |
26 | } | | 26 | } |
27 | } | | 27 | } |
28 | sb.append("]"); | | 28 | sb.append(")"); |
29 | | | 29 | |
30 | // start block | | 30 | // possible :this or :base |
31 | this.NewLine(sb); | | 31 | if (hasBase) |
32 | sb.append("{"); | | 32 | { |
33 | indent++; | | 33 | sb.append(" : base("); |
34 | this.NewLine(sb); | | 34 | } |
35 | | | 35 | else if (hasThis) |
36 | if (getter != null) | | 36 | { |
37 | { | | 37 | sb.append(" : this("); |
38 | getter.ToSource(sb); | | 38 | } |
39 | } | | 39 | if (hasBase || hasThis) |
40 | if (setter != null) | | 40 | { |
41 | { | | 41 | if (thisBaseArgs != null) |
42 | setter.ToSource(sb); | | 42 | { |
43 | } | | 43 | comma = ""; |
44 | | | 44 | for (int i = 0; i < thisBaseArgs.size(); i++) |
45 | indent--; | | 45 | { |
46 | this.NewLine(sb); | | 46 | sb.append(comma); |
47 | sb.append("}"); | | 47 | comma = ", "; |
48 | this.NewLine(sb); | | 48 | thisBaseArgs.get(i).ToSource(sb); |
49 | } | | 49 | } |
| | | 50 | } |
| | | 51 | sb.append(")"); |
| | | 52 | } |
| | | 53 | |
| | | 54 | // start block |
| | | 55 | this.NewLine(sb); |
| | | 56 | |
| | | 57 | statementBlock.ToSource(sb); |
| | | 58 | |
| | | 59 | } |
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.667 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
13 | for (ParamDeclNode pdn : params) | | 11 | for (int i = 0; i < params.size(); i++) |
14 | | | 12 | |
15 | | | 13 | |
16 | | | 14 | params.get(i).ToSource(sb); |
Precondition Violations (1)
Row |
Violation |
1 | Expression pdn cannot be parameterized, because it has dependencies to/from statements that will be extracted |