File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeBlob.java | File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeClob.java | |||
Method name: void keyTyped(KeyEvent)
|
Method name: void keyTyped(KeyEvent)
|
|||
Number of AST nodes: 14 | Number of AST nodes: 14 | |||
1 | char c = e.getKeyChar();↵ | 1 | char c = e.getKeyChar();↵ | |
2 | // as a coding convenience, create a reference to the text component↵ | 2 | // as a coding convenience, create a reference to the text component↵ | |
3 | // that is typecast to JTextComponent. this is not essential, as we↵ | 3 | // that is typecast to JTextComponent. this is not essential, as we↵ | |
4 | // could typecast every reference, but this makes the code cleaner↵ | 4 | // could typecast every reference, but this makes the code cleaner↵ | |
5 | JTextComponent _theComponent = (JTextComponent)DataTypeBlob.this._textComponent;↵ | 5 | JTextComponent _theComponent = (JTextComponent)DataTypeClob.this._textComponent;↵ | |
6 | String text = _theComponent.getText();↵ | 6 | String text = _theComponent.getText();↵ | |
7 | // handle cases of null↵ | 7 | // handle cases of null↵ | |
8 | // The processing is different when nulls are allowed and when they are not.↵ | 8 | // The processing is different when nulls are allowed and when they are not.↵ | |
9 | //↵ | 9 | //↵ | |
10 | if ( DataTypeBlob.this._isNullable) {↵ | 10 | if ( DataTypeClob.this._isNullable) {↵ | |
11 | // user enters something when field is null↵ | 11 | // user enters something when field is null↵ | |
12 | if (text.equals("<null>")) {↵ | 12 | if (text.equals("<null>")) {↵ | |
13 | if ((c==KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {↵ | 13 | if ((c==KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {↵ | |
14 | // delete when null => original value↵ | 14 | // delete when null => original value↵ | |
15 | DataTypeBlob.this._textComponent.restoreText();↵ | 15 | DataTypeClob.this._textComponent.restoreText();↵ | |
16 | e.consume();↵ | 16 | e.consume();↵ | |
17 | }↵ | 17 | }↵ | |
18 | else {↵ | 18 | else {↵ | |
19 | // non-delete when null => clear field and add text↵ | 19 | // non-delete when null => clear field and add text↵ | |
20 | DataTypeBlob.this._textComponent.updateText("");↵ | 20 | DataTypeClob.this._textComponent.updateText("");↵ | |
21 | // fall through to normal processing of this key stroke↵ | 21 | // fall through to normal processing of this key stroke↵ | |
22 | }↵ | 22 | }↵ | |
23 | }↵ | 23 | }↵ | |
24 | else {↵ | 24 | else {↵ | |
25 | // check for user deletes last thing in field↵ | 25 | // check for user deletes last thing in field↵ | |
26 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {↵ | 26 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {↵ | |
27 | if (text.length() <= 1 ) {↵ | 27 | if (text.length() <= 1 ) {↵ | |
28 | // about to delete last thing in field, so replace with null↵ | 28 | // about to delete last thing in field, so replace with null↵ | |
29 | DataTypeBlob.this._textComponent.updateText("<null>");↵ | 29 | DataTypeClob.this._textComponent.updateText("<null>");↵ | |
30 | e.consume();↵ | 30 | e.consume();↵ | |
31 | }↵ | 31 | }↵ | |
32 | }↵ | 32 | }↵ | |
33 | }↵ | 33 | }↵ | |
34 | }↵ | 34 | }↵ | |
35 | else {↵ | 35 | else {↵ | |
36 | // field is not nullable↵ | 36 | // field is not nullable↵ | |
37 | //↵ | 37 | //↵ | |
38 | handleNotNullableField(text, c, e, _textComponent);↵ | 38 | handleNotNullableField(text, c, e, _textComponent);↵ | |
39 | } | 39 |
| |
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) | 3.7 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 42 |
Number of mapped statements | 14 |
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) | 116.4 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | char c = e.getKeyChar(); | 1 | char c = e.getKeyChar(); | ||||||||||||
2 | JTextComponent _theComponent = (JTextComponent)DataTypeBlob.this._textComponent; |
| 2 | JTextComponent _theComponent = (JTextComponent)DataTypeClob.this._textComponent; | |||||||||||
3 | String text = _theComponent.getText(); | 3 | String text = _theComponent.getText(); | ||||||||||||
4 | if (DataTypeBlob.this._isNullable) |
| 4 | if (DataTypeClob.this._isNullable) | |||||||||||
5 | if (text.equals("<null>")) | 5 | if (text.equals("<null>")) | ||||||||||||
6 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) | 6 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) | ||||||||||||
7 | DataTypeBlob.this._textComponent.restoreText(); |
| 7 | DataTypeClob.this._textComponent.restoreText(); | |||||||||||
8 | e.consume(); | 8 | e.consume(); | ||||||||||||
else | else | ||||||||||||||
9 | DataTypeBlob.this._textComponent.updateText(""); |
| 9 | DataTypeClob.this._textComponent.updateText(""); | |||||||||||
else | else | ||||||||||||||
10 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) | 10 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) | ||||||||||||
11 | if (text.length() <= 1) | 11 | if (text.length() <= 1) | ||||||||||||
12 | DataTypeBlob.this._textComponent.updateText("<null>"); |
| 12 | DataTypeClob.this._textComponent.updateText("<null>"); | |||||||||||
13 | e.consume(); | 13 | e.consume(); | ||||||||||||
else | else | ||||||||||||||
14 | handleNotNullableField(text, c, e, _textComponent); | 14 | handleNotNullableField(text, c, e, _textComponent); |
Row | Violation |
---|---|
1 | Expression DataTypeBlob cannot be unified with expression DataTypeClob , because common superclass net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BaseDataTypeComponent does not declare member(s) private net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.IRestorableTextComponent _textComponent |
2 | Expression DataTypeBlob cannot be unified with expression DataTypeClob , because common superclass net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BaseDataTypeComponent does not declare member(s) private boolean _isNullable |
3 | Expression DataTypeBlob cannot be unified with expression DataTypeClob , because common superclass net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BaseDataTypeComponent does not declare member(s) private net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.IRestorableTextComponent _textComponent |
4 | Expression DataTypeBlob cannot be unified with expression DataTypeClob , because common superclass net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BaseDataTypeComponent does not declare member(s) private net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.IRestorableTextComponent _textComponent |
5 | Expression DataTypeBlob cannot be unified with expression DataTypeClob , because common superclass net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BaseDataTypeComponent does not declare member(s) private net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.IRestorableTextComponent _textComponent |