File path: /jEdit-4.2/src/org/gjt/sp/jedit/textarea/ChunkCache.java | File path: /jEdit-4.2/src/org/gjt/sp/jedit/textarea/ChunkCache.java | |||
Method name: int getBelowPosition(int, int, int, boolean)
|
Method name: int getAbovePosition(int, int, int, boolean)
|
|||
Number of AST nodes: 8 | Number of AST nodes: 8 | |||
1 | LineInfo[] lineInfos = getLineInfosForPhysicalLine(physicalLine);↵ | 1 | LineInfo[] lineInfos = getLineInfosForPhysicalLine(physicalLine);↵ | |
2 | int subregion = getSubregionOfOffset(offset,lineInfos);↵ | 2 | int subregion = getSubregionOfOffset(offset,lineInfos);↵ | |
3 | if(subregion != lineInfos.length - 1 && !ignoreWrap)↵ | 3 | if(subregion != 0 && !ignoreWrap)↵ | |
4 | {↵ | 4 | {↵ | |
5 | return textArea.getLineStartOffset(physicalLine)↵ | 5 | return textArea.getLineStartOffset(physicalLine)↵ | |
6 | + xToSubregionOffset(lineInfos[subregion + 1],↵ | 6 | + xToSubregionOffset(lineInfos[subregion - 1],↵ | |
7 | x,true);↵ | 7 | x,true);↵ | |
8 | }↵ | 8 | }↵ | |
9 | else↵ | 9 | else↵ | |
10 | {↵ | 10 | {↵ | |
11 | int nextLine = textArea.displayManager↵ | 11 | int prevLine = textArea.displayManager↵ | |
12 | .getNextVisibleLine(physicalLine);↵ | 12 | .getPrevVisibleLine(physicalLine);↵ | |
13 | if(nextLine == -1)↵ | 13 | if(prevLine == -1)↵ | |
14 | return -1;↵ | 14 | return -1;↵ | |
15 | else↵ | 15 | else↵ | |
16 | {↵ | 16 | {↵ | |
17 | return textArea.getLineStartOffset(nextLine)↵ | 17 | return textArea.getLineStartOffset(prevLine)↵ | |
18 | + xToSubregionOffset(nextLine,0,↵ | 18 | + xToSubregionOffset(prevLine,-1,↵ | |
19 | x,true);↵ | 19 | x,true);↵ | |
20 | }↵ | 20 | }↵ | |
21 | } | 21 |
| |
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) | 0.4 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 22 |
Number of mapped statements | 7 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 9.5 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | LineInfo[] lineInfos = getLineInfosForPhysicalLine(physicalLine); | 1 | LineInfo[] lineInfos = getLineInfosForPhysicalLine(physicalLine); | |||||||||||||||||
2 | int subregion = getSubregionOfOffset(offset, lineInfos); | 2 | int subregion = getSubregionOfOffset(offset, lineInfos); | |||||||||||||||||
3 | if (subregion != lineInfos.length - 1 && !ignoreWrap) |
| 3 | if (subregion != 0 && !ignoreWrap) | ||||||||||||||||
|
| 4 | return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion - 1], x, true); | |||||||||||||||||
4 | return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion + 1], x, true); |
| | |||||||||||||||||
else | else | |||||||||||||||||||
5 | int nextLine = textArea.displayManager.getNextVisibleLine(physicalLine); |
| 5 | int prevLine = textArea.displayManager.getPrevVisibleLine(physicalLine); | ||||||||||||||||
6 | if (nextLine == -1) |
| 6 | if (prevLine == -1) | ||||||||||||||||
7 | return -1; | 7 | return -1; | |||||||||||||||||
else | else | |||||||||||||||||||
8 | return textArea.getLineStartOffset(nextLine) + xToSubregionOffset(nextLine, 0, x, true); |
| 8 | return textArea.getLineStartOffset(prevLine) + xToSubregionOffset(prevLine, -1, x, true); |
Row | Violation |
---|---|
1 | Expression lineInfos.length - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion - 1],x,true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Unmatched return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion - 1],x,true); |
4 | Unmatched statement return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion + 1],x,true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
5 | Unmatched return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion + 1],x,true); |
6 | Clone fragment #1 returns variables lineInfos, subregion , while Clone fragment #2 returns variables lineInfos, subregion |