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
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes having the same super class
Number of node comparisons13
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 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();
    else
    else
    5
    return getCaretPosition() - lineFeedIndex - 1;
    5
    return getCaretPosition() - lineFeedIndex - 1;
    Precondition Violations (0)
    Row Violation