if ( DataTypeBinary.this._isNullable) { // user enters something when field is null if (text.equals("<null>")) { if ((c==KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) { // delete when null => original value DataTypeBinary.this._textComponent.restoreText(); e.consume(); } else { // non-delete when null => clear field and add text DataTypeBinary.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 DataTypeBinary.this._textComponent.updateText("<null>"); e.consume(); } } } } else { // field is not nullable // handleNotNullableField(text, c, e, _textComponent); }
if ( DataTypeDate.this._isNullable) { // user enters something when field is null if (text.equals("<null>")) { if ((c==KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) { // delete when null => original value DataTypeDate.this._textComponent.restoreText(); e.consume(); } else { // non-delete when null => clear field and add text DataTypeDate.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 DataTypeDate.this._textComponent.updateText("<null>"); e.consume(); } } } } else { // field is not nullable // handleNotNullableField(text, c, e, _textComponent); }
Clone fragments detected by clone detection tool
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeBinary.java File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeDate.java
Method name: void keyTyped(KeyEvent) Method name: void keyTyped(KeyEvent)
Number of AST nodes: 11 Number of AST nodes: 11
1
if ( DataTypeBinary.this._isNullable) {
1
if ( DataTypeDate.this._isNullable) {
2
					// user enters something when field is null
2
					// user enters something when field is null
3
					if (text.equals("<null>")) {
3
					if (text.equals("<null>")) {
4
						if ((c==KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {
4
						if ((c==KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {
5
							// delete when null => original value
5
							// delete when null => original value
6
							DataTypeBinary.this._textComponent.restoreText();
6
							DataTypeDate.this._textComponent.restoreText();
7
							e.consume();
7
							e.consume();
8
						}
8
						}
9
						else {
9
						else {
10
							// non-delete when null => clear field and add text
10
							// non-delete when null => clear field and add text
11
							DataTypeBinary.this._textComponent.updateText("");
11
							DataTypeDate.this._textComponent.updateText("");
12
							// fall through to normal processing of this key stroke
12
							// fall through to normal processing of this key stroke
13
						}
13
						}
14
					}
14
					}
15
					else {
15
					else {
16
						// check for user deletes last thing in field
16
						// check for user deletes last thing in field
17
						if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {
17
						if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {
18
							if (text.length() <= 1 ) {
18
							if (text.length() <= 1 ) {
19
								// about to delete last thing in field, so replace with null
19
								// about to delete last thing in field, so replace with null
20
								DataTypeBinary.this._textComponent.updateText("<null>");
20
								DataTypeDate.this._textComponent.updateText("<null>");
21
								e.consume();
21
								e.consume();
22
							}
22
							}
23
						}
23
						}
24
					}
24
					}
25
				}
25
				}
26
				else {
26
				else {
27
                    // field is not nullable
27
						  // field is not nullable
28
                    //
29
                  
28
						  //
30
  handleNotNullableField(text, c, e, _textComponent);
29
						  handleNotNullableField(text, c, e, _textComponent);
31
				}
30
				}
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.5
Clones locationClones are in different classes having the same super class
Number of node comparisons33
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)8.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    13
    if (DataTypeBinary.this._isNullable)
    13
    if (DataTypeBinary.this._isNullable)
    13
    if (DataTypeDate.this._isNullable)
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeBinarynet.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeDateSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression DataTypeBinary cannot be unified with expression DataTypeDate , because common superclass net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BaseDataTypeComponent does not declare member(s) private boolean _isNullable
    13
    if (DataTypeDate.this._isNullable)
    14
    if (text.equals("<null>"))
    14
    if (text.equals("<null>"))
    15
    if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE))
    15
    if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE))
    16
    DataTypeBinary.this._textComponent.restoreText();
    16
    DataTypeBinary.this._textComponent.restoreText();
    16
    DataTypeDate.this._textComponent.restoreText();
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeBinarynet.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeDateSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression DataTypeBinary cannot be unified with expression DataTypeDate , 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
    16
    DataTypeDate.this._textComponent.restoreText();
    17
    e.consume();
    17
    e.consume();
    else
    else
    18
    DataTypeBinary.this._textComponent.updateText("");
    18
    DataTypeBinary.this._textComponent.updateText("");
    18
    DataTypeDate.this._textComponent.updateText("");
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeBinarynet.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeDateSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression DataTypeBinary cannot be unified with expression DataTypeDate , 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
    18
    DataTypeDate.this._textComponent.updateText("");
    else
    else
    19
    if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE))
    19
    if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE))
    20
    if (text.length() <= 1)
    20
    if (text.length() <= 1)
    21
    DataTypeBinary.this._textComponent.updateText("<null>");
    21
    DataTypeBinary.this._textComponent.updateText("<null>");
    21
    DataTypeDate.this._textComponent.updateText("<null>");
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeBinarynet.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeDateSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression DataTypeBinary cannot be unified with expression DataTypeDate , 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
    21
    DataTypeDate.this._textComponent.updateText("<null>");
    22
    e.consume();
    22
    e.consume();
    else
    else
    23
    handleNotNullableField(text, c, e, _textComponent);
    23
    handleNotNullableField(text, c, e, _textComponent);
    Precondition Violations (4)
    Row Violation
    1Expression DataTypeBinary cannot be unified with expression DataTypeDate , because common superclass net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BaseDataTypeComponent does not declare member(s) private boolean _isNullable
    2Expression DataTypeBinary cannot be unified with expression DataTypeDate , 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 DataTypeBinary cannot be unified with expression DataTypeDate , 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
    4Expression DataTypeBinary cannot be unified with expression DataTypeDate , 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