if (text.equals("<null>")) { if ((c==KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) { // delete when null => original value DataTypeClob.this._textComponent.restoreText(); e.consume(); } else { // non-delete when null => clear field and add text DataTypeClob.this._textComponent.updateText(""); // fall through to normal processing of this key stroke } } else { // check for user deletes last thing in field if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) { if (text.length() <= 1 ) { // about to delete last thing in field, so replace with null DataTypeClob.this._textComponent.updateText("<null>"); e.consume(); } } }
if (text.equals("<null>")) { if ((c==KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) { // delete when null => original value DataTypeLong.this._textComponent.restoreText(); e.consume(); } else { // non-delete when null => clear field and add text DataTypeLong.this._textComponent.updateText(""); // fall through to normal processing of this key stroke } } else { // check for user deletes last thing in field if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) { if (text.length() <= 1 ) { // about to delete last thing in field, so replace with null DataTypeLong.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/DataTypeClob.java File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeLong.java
Method name: void keyTyped(KeyEvent) Method name: void keyTyped(KeyEvent)
Number of AST nodes: 9 Number of AST nodes: 9
1
if (text.equals("<null>")) {
1
if (text.equals("<null>")) {
2
						if ((c==KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {
2
						if ((c==KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {
3
							// delete when null => original value
3
							// delete when null => original value
4
							DataTypeClob.this._textComponent.restoreText();
4
							DataTypeLong.this._textComponent.restoreText();
5
							e.consume();
5
							e.consume();
6
						}
6
						}
7
						else {
7
						else {
8
							// non-delete when null => clear field and add text
8
							// non-delete when null => clear field and add text
9
							DataTypeClob.this._textComponent.updateText("");
9
							DataTypeLong.this._textComponent.updateText("");
10
							// fall through to normal processing of this key stroke
10
							// fall through to normal processing of this key stroke
11
						}
11
						}
12
					}
12
					}
13
					else {
13
					else {
14
						// check for user deletes last thing in field
14
						// check for user deletes last thing in field
15
						if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {
15
						if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {
16
							if (text.length() <= 1 ) {
16
							if (text.length() <= 1 ) {
17
								// about to delete last thing in field, so replace with null
17
								// about to delete last thing in field, so replace with null
18
								DataTypeClob.this._textComponent.updateText("<null>");
18
								DataTypeLong.this._textComponent.updateText("<null>");
19
								e.consume();
19
								e.consume();
20
							}
20
							}
21
						}
21
						}
22
					}
22
					}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)1.1
Clones locationClones are in different classes having the same super class
Number of node comparisons30
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)4.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    5
    if (text.equals("<null>"))
    23
    if (text.equals("<null>"))
    6
    if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE))
    24
    if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE))
    7
    DataTypeClob.this._textComponent.restoreText();
    7
    DataTypeClob.this._textComponent.restoreText();
    25
    DataTypeLong.this._textComponent.restoreText();
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeClobnet.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeLongSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression DataTypeClob cannot be unified with expression DataTypeLong , 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
    25
    DataTypeLong.this._textComponent.restoreText();
    8
    e.consume();
    26
    e.consume();
    else
    else
    9
    DataTypeClob.this._textComponent.updateText("");
    9
    DataTypeClob.this._textComponent.updateText("");
    27
    DataTypeLong.this._textComponent.updateText("");
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeClobnet.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeLongSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression DataTypeClob cannot be unified with expression DataTypeLong , 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
    27
    DataTypeLong.this._textComponent.updateText("");
    else
    else
    10
    if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE))
    28
    if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE))
    11
    if (text.length() <= 1)
    29
    if (text.length() <= 1)
    12
    DataTypeClob.this._textComponent.updateText("<null>");
    12
    DataTypeClob.this._textComponent.updateText("<null>");
    30
    DataTypeLong.this._textComponent.updateText("<null>");
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeClobnet.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeLongSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression DataTypeClob cannot be unified with expression DataTypeLong , 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
    30
    DataTypeLong.this._textComponent.updateText("<null>");
    13
    e.consume();
    31
    e.consume();
    Precondition Violations (3)
    Row Violation
    1Expression DataTypeClob cannot be unified with expression DataTypeLong , 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
    2Expression DataTypeClob cannot be unified with expression DataTypeLong , 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
    3Expression DataTypeClob cannot be unified with expression DataTypeLong , 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