File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLSaveImpl.java | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLSaveImpl.java | |||
Method name: String convert(String)
|
Method name: String convertText(String)
|
|||
Number of AST nodes: 20 | Number of AST nodes: 20 | |||
1 | if (!XMLChar.isValid(ch))↵ | 1 | if (!XMLChar.isValid(ch))↵ | |
2 | {↵ | 2 | {↵ | |
3 | if (XMLChar.isHighSurrogate(ch))↵ | 3 | if (XMLChar.isHighSurrogate(ch))↵ | |
4 | {↵ | 4 | {↵ | |
5 | char high = ch;↵ | 5 | char high = ch;↵ | |
6 | if (inputLength-- > 0)↵ | 6 | if (inputLength-- > 0)↵ | |
7 | {↵ | 7 | {↵ | |
8 | ch = input.charAt(inputPos++); ↵ | 8 | ch = input.charAt(inputPos++); ↵ | |
9 | if (XMLChar.isLowSurrogate(ch))↵ | 9 | if (XMLChar.isLowSurrogate(ch))↵ | |
10 | {↵ | 10 | {↵ | |
11 | if (mappableLimit == MAX_UTF_MAPPABLE_CODEPOINT)↵ | 11 | if (mappableLimit == MAX_UTF_MAPPABLE_CODEPOINT)↵ | |
12 | {↵ | 12 | {↵ | |
13 | // Every codepoint is supported! ↵ | 13 | // Every codepoint is supported! ↵ | |
14 | value[outputPos++] = high;↵ | 14 | value[outputPos++] = high;↵ | |
15 | value[outputPos++] = ch;↵ | 15 | value[outputPos++] = ch;↵ | |
16 | }↵ | 16 | }↵ | |
17 | else↵ | 17 | else↵ | |
18 | {↵ | 18 | {↵ | |
19 | // Produce the supplemental character as an entity↵ | 19 | // Produce the supplemental character as an entity↵ | |
20 | outputPos = replaceChars(outputPos, ("" + Integer.toHexString(XMLChar.supplemental(high, ch)) + ";").toCharArray(), inputLength);↵ | 20 | outputPos = replaceChars(outputPos, ("" + Integer.toHexString(XMLChar.supplemental(high, ch)) + ";").toCharArray(), inputLength);↵ | |
21 | changed = true;↵ | 21 | changed = true;↵ | |
22 | }↵ | 22 | }↵ | |
23 | break;↵ | 23 | break;↵ | |
24 | }↵ | 24 | }↵ | |
25 | throw new RuntimeException("An invalid low surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);↵ | 25 | throw new RuntimeException("An invalid low surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);↵ | |
26 | }↵ | 26 | }↵ | |
27 | else↵ | 27 | else↵ | |
28 | {↵ | 28 | {↵ | |
29 | throw new RuntimeException("An unpaired high surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);↵ | 29 | throw new RuntimeException("An unpaired high surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);↵ | |
30 | }↵ | 30 | }↵ | |
31 | }↵ | 31 | }↵ | |
32 | else↵ | 32 | else↵ | |
33 | {↵ | 33 | {↵ | |
34 | throw new RuntimeException("An invalid XML character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);↵ | 34 | throw new RuntimeException("An invalid XML character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);↵ | |
35 | }↵ | 35 | }↵ | |
36 | }↵ | 36 | }↵ | |
37 | else↵ | 37 | else↵ | |
38 | {↵ | 38 | {↵ | |
39 | // Normal (BMP) unicode code point. See if we know for a fact that the encoding supports it:↵ | 39 | // Normal (BMP) unicode code point. See if we know for a fact that the encoding supports it:↵ | |
40 | if (ch <= mappableLimit)↵ | 40 | if (ch <= mappableLimit)↵ | |
41 | {↵ | 41 | {↵ | |
42 | value[outputPos++] = ch;↵ | 42 | value[outputPos++] = ch;↵ | |
43 | }↵ | 43 | }↵ | |
44 | else↵ | 44 | else↵ | |
45 | {↵ | 45 | {↵ | |
46 | // We not sure the encoding supports this code point, so we write it as a character entity reference.↵ | 46 | // We not sure the encoding supports this code point, so we write it as a character entity reference.↵ | |
47 | outputPos = replaceChars(outputPos, ("" + Integer.toHexString(ch) + ";").toCharArray(), inputLength);↵ | 47 | outputPos = replaceChars(outputPos, ("" + Integer.toHexString(ch) + ";").toCharArray(), inputLength);↵ | |
48 | changed = true;↵ | 48 | changed = true;↵ | |
49 | }↵ | 49 | }↵ | |
50 | }↵ | 50 | }↵ | |
51 | break; | 51 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 1.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 76 |
Number of mapped statements | 20 |
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) | 14.9 |
Clone type | Type 1 |
ID | Statement | ID | Statement | |
---|---|---|---|---|
68 | if (!XMLChar.isValid(ch)) | 71 | if (!XMLChar.isValid(ch)) | |
69 | if (XMLChar.isHighSurrogate(ch)) | 72 | if (XMLChar.isHighSurrogate(ch)) | |
70 | char high = ch; | 73 | char high = ch; | |
71 | if (inputLength-- > 0) | 74 | if (inputLength-- > 0) | |
72 | ch = input.charAt(inputPos++); | 75 | ch = input.charAt(inputPos++); | |
73 | if (XMLChar.isLowSurrogate(ch)) | 76 | if (XMLChar.isLowSurrogate(ch)) | |
74 | if (mappableLimit == MAX_UTF_MAPPABLE_CODEPOINT) | 77 | if (mappableLimit == MAX_UTF_MAPPABLE_CODEPOINT) | |
75 | value[outputPos++] = high; | 78 | value[outputPos++] = high; | |
76 | value[outputPos++] = ch; | 79 | value[outputPos++] = ch; | |
else | else | |||
77 | outputPos = replaceChars(outputPos, ("" + Integer.toHexString(XMLChar.supplemental(high, ch)) + ";").toCharArray(), inputLength); | 80 | outputPos = replaceChars(outputPos, ("" + Integer.toHexString(XMLChar.supplemental(high, ch)) + ";").toCharArray(), inputLength); | |
78 | changed = true; | 81 | changed = true; | |
79 | break; | 82 | break; | |
80 | throw new RuntimeException("An invalid low surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input); | 83 | throw new RuntimeException("An invalid low surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input); | |
else | else | |||
81 | throw new RuntimeException("An unpaired high surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input); | 84 | throw new RuntimeException("An unpaired high surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input); | |
else | else | |||
82 | throw new RuntimeException("An invalid XML character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input); | 85 | throw new RuntimeException("An invalid XML character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input); | |
else | else | |||
83 | if (ch <= mappableLimit) | 86 | if (ch <= mappableLimit) | |
84 | value[outputPos++] = ch; | 87 | value[outputPos++] = ch; | |
else | else | |||
85 | outputPos = replaceChars(outputPos, ("" + Integer.toHexString(ch) + ";").toCharArray(), inputLength); | 88 | outputPos = replaceChars(outputPos, ("" + Integer.toHexString(ch) + ";").toCharArray(), inputLength); | |
86 | changed = true; | 89 | changed = true; | |
87 | break; | 90 | break; |
Row | Violation |
---|---|
1 | Clone fragment #1 returns variables inputLength, inputPos, outputPos, changed , while Clone fragment #2 returns variables inputLength, inputPos, outputPos, changed |