String textTillCarret = getText().substring(0, getCaretPosition());
int lineFeedIndex = textTillCarret.lastIndexOf('\n');
if(- 1 == lineFeedIndex)
{
return getCaretPosition();
}
else
{
return getCaretPosition() - lineFeedIndex - 1;
}
String textTillCarret = getText().substring(0, getCaretPosition());
int lineFeedIndex = textTillCarret.lastIndexOf('\n');
if (-1 == lineFeedIndex)
{
return getCaretPosition();
} else
{
return getCaretPosition() - lineFeedIndex - 1;
}
Clone fragments detected by clone detection tool
File path: /sql12/plugins/syntax/src/net/sourceforge/squirrel_sql/plugins/syntax/oster/OsterSQLEntryPanel.java
|
|
File path: /sql12/plugins/syntax/src/net/sourceforge/squirrel_sql/plugins/syntax/netbeans/NetbeansSQLEntryPanel.java
|
Method name: int getCaretLinePosition()
|
|
Method name: int getCaretLinePosition()
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | String textTillCarret = getText().substring(0, getCaretPosition());↵ | | 1 | String textTillCarret = getText().substring(0, getCaretPosition());↵
|
|
2 | int lineFeedIndex = textTillCarret.lastIndexOf('\n');↵ | | 2 | int lineFeedIndex = textTillCarret.lastIndexOf('\n');↵
|
3 | if(- 1 == lineFeedIndex)↵ | | 3 | if (-1 == lineFeedIndex)↵
|
4 | {↵ | | |
|
5 | ↵ | | 4 | {↵
|
6 | return getCaretPosition();↵ | | 5 | return getCaretPosition();↵
|
7 | }↵ | | |
|
8 | else↵ | | |
|
9 | {↵ | | |
|
10 | ↵ | | 6 | } else↵
|
| | | 7 | {↵
|
11 | return getCaretPosition() - lineFeedIndex - 1;↵ | | 8 | return getCaretPosition() - lineFeedIndex - 1;↵
|
12 | } | | 9 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 13 |
-
{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) | 1.5 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | String textTillCarret = getText().substring(0, getCaretPosition()); | | 1 | String textTillCarret = getText().substring(0, getCaretPosition()); |
2 | int lineFeedIndex = textTillCarret.lastIndexOf('\n'); | | 2 | int lineFeedIndex = textTillCarret.lastIndexOf('\n'); |
3 | if (-1 == lineFeedIndex) | | 3 | if (-1 == lineFeedIndex) |
4 | return getCaretPosition(); | | 4 | return getCaretPosition(); |
| | | | |
5 | return getCaretPosition() - lineFeedIndex - 1; | | 5 | return getCaretPosition() - lineFeedIndex - 1; |
Precondition Violations (0)
Row |
Violation |