if (bounds.y > event.y) { break LOOP; } else if (bounds.contains(event.x, event.y)) { if (j != 0 || !tableItems[i].getImageBounds(0).contains(event.x, event.y)) { TableItem tableItem = tableItems[i]; if (tableItem == selectedTableItem || wasActive) { if (tableItem != selectedTableItem) { table.setSelection(i); Event selectionEvent = new Event(); selectionEvent.widget = table; selectionEvent.item = tableItem; table.notifyListeners(SWT.Selection, selectionEvent); selectedTableItem = tableItem; } editTableItem = tableItems[i]; editTableItemColumn = j; } else { TableItem mouseBasedTableItem = table.getItem(point); if (mouseBasedTableItem == null) { table.setSelection(i); Event selectionEvent = new Event(); selectionEvent.widget = table; selectionEvent.item = tableItem; table.notifyListeners(SWT.Selection, selectionEvent); selectedTableItem = tableItem; } } } break LOOP; }
if (bounds.contains(event.x, event.y)) { if (j != 0 || !tableItems[i].getImageBounds(0).contains(event.x, event.y)) { TableItem tableItem = tableItems[i]; if (tableItem == selectedTableItem || wasActive) { if (tableItem != selectedTableItem) { table.setSelection(i); Event selectionEvent = new Event(); selectionEvent.widget = table; selectionEvent.item = tableItem; table.notifyListeners(SWT.Selection, selectionEvent); selectedTableItem = tableItem; } editTableTreeItem = (TableTreeItem)tableItems[i].getData(ExtendedTableTreeViewer.ITEM_ID); editTableTreeItemColumn = j; } else { TableItem mouseBasedTableItem = table.getItem(point); if (mouseBasedTableItem == null) { table.setSelection(i); Event selectionEvent = new Event(); selectionEvent.widget = table; selectionEvent.item = tableItem; table.notifyListeners(SWT.Selection, selectionEvent); selectedTableItem = tableItem; } } } break LOOP; }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/common/ui/celleditor/ExtendedTableEditor.java File path: /emf-2.4.1/src/org/eclipse/emf/common/ui/celleditor/ExtendedTableTreeEditor.java
Method name: void mouseDown(MouseEvent) Method name: void mouseDown(MouseEvent)
Number of AST nodes: 24 Number of AST nodes: 22
1
if (bounds.y > event.y)
2
          {
3
            break LOOP;
4
          }
5
          else if (bounds.contains(event.x, event.y))
1
if (bounds.contains(event.x, event.y))
6
          {
2
          {
7
            if (j != 0 || !tableItems[i].getImageBounds(0).contains(event.x, event.y))
3
            if (j != 0 || !tableItems[i].getImageBounds(0).contains(event.x, event.y))
8
            {
4
            {
9
              TableItem tableItem = tableItems[i];
5
              TableItem tableItem = tableItems[i];
10
              if (tableItem == selectedTableItem || wasActive)
6
              if (tableItem == selectedTableItem || wasActive)
11
              {
7
              {
12
                if (tableItem != selectedTableItem)
8
                if (tableItem != selectedTableItem)
13
                {
9
                {
14
                  table.setSelection(i);
10
                  table.setSelection(i);
15
                  Event selectionEvent = new Event();
11
                  Event selectionEvent = new Event();
16
                  selectionEvent.widget = table;
12
                  selectionEvent.widget = table;
17
                  selectionEvent.item = tableItem;
13
                  selectionEvent.item = tableItem;
18
                  table.notifyListeners(SWT.Selection, selectionEvent);
14
                  table.notifyListeners(SWT.Selection, selectionEvent);
19
                  selectedTableItem = tableItem;
15
                  selectedTableItem = tableItem;
20
                }
16
                }
21
                editTableItem = tableItems[i];
17
                editTableTreeItem = (TableTreeItem)tableItems[i].getData(ExtendedTableTreeViewer.ITEM_ID);
22
                editTableItemColumn = j;
18
                editTableTreeItemColumn = j;
23
              }
19
              }
24
              else
20
              else
25
              {
21
              {
26
                TableItem mouseBasedTableItem = table.getItem(point);
22
                TableItem mouseBasedTableItem = table.getItem(point);
27
                if (mouseBasedTableItem == null)
23
                if (mouseBasedTableItem == null)
28
                {
24
                {
29
                  table.setSelection(i);
25
                  table.setSelection(i);
30
                  Event selectionEvent = new Event();
26
                  Event selectionEvent = new Event();
31
                  selectionEvent.widget = table;
27
                  selectionEvent.widget = table;
32
                  selectionEvent.item = tableItem;
28
                  selectionEvent.item = tableItem;
33
                  table.notifyListeners(SWT.Selection, selectionEvent);
29
                  table.notifyListeners(SWT.Selection, selectionEvent);
34
                  selectedTableItem = tableItem;
30
                  selectedTableItem = tableItem;
35
                }
31
                }
36
              }
32
              }
37
            }
33
            }
38
            break LOOP;
34
            break LOOP;
39
          }
35
          }
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 comparisons171
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements20
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)9.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    14
    if (j != 0 || !tableItems[i].getImageBounds(0).contains(event.x, event.y))
    14
    if (j != 0 || !tableItems[i].getImageBounds(0).contains(event.x, event.y))
    15
    TableItem tableItem = tableItems[i];
    15
    TableItem tableItem = tableItems[i];
    16
    if (tableItem == selectedTableItem || wasActive)
    16
    if (tableItem == selectedTableItem || wasActive)
    17
    if (tableItem != selectedTableItem)
    17
    if (tableItem != selectedTableItem)
    18
    table.setSelection(i);
    18
    table.setSelection(i);
    19
    Event selectionEvent = new Event();
    19
    Event selectionEvent = new Event();
    20
    selectionEvent.widget = table;
    20
    selectionEvent.widget = table;
    21
    selectionEvent.item = tableItem;
    21
    selectionEvent.item = tableItem;
    22
    table.notifyListeners(SWT.Selection, selectionEvent);
    22
    table.notifyListeners(SWT.Selection, selectionEvent);
    23
    selectedTableItem = tableItem;
    23
    selectedTableItem = tableItem;
    24
    editTableItem = tableItems[i];
    24
    editTableItem = tableItems[i];
    24
    editTableTreeItem = (TableTreeItem)tableItems[i].getData(ExtendedTableTreeViewer.ITEM_ID);
    Differences
    Expression1Expression2Difference
    editTableItemeditTableTreeItemVARIABLE_NAME_MISMATCH
    org.eclipse.swt.widgets.TableItemorg.eclipse.swt.custom.TableTreeItemSUBCLASS_TYPE_MISMATCH
    tableItems[i](TableTreeItem)tableItems[i].getData(ExtendedTableTreeViewer.ITEM_ID)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression editTableItem is a field being modified, and thus it cannot be parameterized
    Expression editTableTreeItem is a field being modified, and thus it cannot be parameterized
    24
    editTableTreeItem = (TableTreeItem)tableItems[i].getData(ExtendedTableTreeViewer.ITEM_ID);
    25
    editTableItemColumn = j;
    25
    editTableItemColumn = j;
    25
    editTableTreeItemColumn = j;
    Differences
    Expression1Expression2Difference
    editTableItemColumneditTableTreeItemColumnVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression editTableItemColumn is a field being modified, and thus it cannot be parameterized
    Expression editTableTreeItemColumn is a field being modified, and thus it cannot be parameterized
    25
    editTableTreeItemColumn = j;
    else
    else
    26
    TableItem mouseBasedTableItem = table.getItem(point);
    26
    TableItem mouseBasedTableItem = table.getItem(point);
    27
    if (mouseBasedTableItem == null)
    27
    if (mouseBasedTableItem == null)
    28
    table.setSelection(i);
    28
    table.setSelection(i);
    29
    Event selectionEvent = new Event();
    29
    Event selectionEvent = new Event();
    30
    selectionEvent.widget = table;
    30
    selectionEvent.widget = table;
    31
    selectionEvent.item = tableItem;
    31
    selectionEvent.item = tableItem;
    32
    table.notifyListeners(SWT.Selection, selectionEvent);
    32
    table.notifyListeners(SWT.Selection, selectionEvent);
    33
    selectedTableItem = tableItem;
    33
    selectedTableItem = tableItem;
    Precondition Violations (4)
    Row Violation
    1Expression editTableItem is a field being modified, and thus it cannot be parameterized
    2Expression editTableTreeItem is a field being modified, and thus it cannot be parameterized
    3Expression editTableItemColumn is a field being modified, and thus it cannot be parameterized
    4Expression editTableTreeItemColumn is a field being modified, and thus it cannot be parameterized