if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE))
{
if (text.length() == 0)
{
// about to delete last thing in field, so replace with null
_textComponent.updateText(BaseDataTypeComponent.NULL_VALUE_PATTERN);
e.consume();
}
}
if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {
if (text.length() == 0 ) {
// about to delete last thing in field, so replace with null
DataTypeString.this._textComponent.updateText("<null>");
e.consume();
}
}
Clone fragments detected by clone detection tool
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/StringFieldKeyTextHandler.java
|
|
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeString.java
|
Method name: void keyTyped(KeyEvent)
|
|
Method name: void keyTyped(KeyEvent)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE))↵ | | 1 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {↵
|
2 | {↵ | | 2 | ↵
|
3 | if (text.length() == 0)↵ | | 3 | if (text.length() == 0↵
|
4 | {↵ | | |
|
| | | 4 | ) {↵
|
5 | // about to delete last thing in field, so replace with null↵ | | 5 | // about to delete last thing in field, so replace with null↵
|
6 | _textComponent.updateText(BaseDataTypeComponent.NULL_VALUE_PATTERN);↵ | | 6 | DataTypeString.this._textComponent.updateText("<null>");↵
|
7 | e.consume();↵ | | 7 | e.consume();↵
|
8 | }↵ | | 8 | }↵
|
9 | } | | 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.8 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 12 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 4 |
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.9 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
13 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) | | 13 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) |
14 | | | 14 | |
15 | _textComponent.updateText(BaseDataTypeComponent.NULL_VALUE_PATTERN); | | 15 | DataTypeString.this._textComponent.updateText("<null>"); |
16 | | | 16 | |
Precondition Violations (0)
Row |
Violation |