ITableItemColorProvider tableItemColorProvider = (ITableItemColorProvider)adapterFactory.adapt(object, ITableItemColorProvider.class); // No color is a good default. // Object result = null; // Now we could check that the adapter implements interface ITableItemColorProvider. // if (tableItemColorProvider != null) { // And delegate the call. // result = tableItemColorProvider.getBackground(object, columnIndex); } // Otherwise, we could check that the adapter implements interface IItemColorProvider. // else { IItemColorProvider itemColorProvider = (IItemColorProvider)adapterFactory.adapt(object, IItemColorProvider.class); if (itemColorProvider != null) { // And delegate the call. // result = itemColorProvider.getBackground(object); } } return result;
ITableItemColorProvider tableItemColorProvider = (ITableItemColorProvider)adapterFactory.adapt(object, ITableItemColorProvider.class); // No color is a good default. // Object result = null; // Now we could check that the adapter implements interface ITableItemColorProvider. // if (tableItemColorProvider != null) { // And delegate the call. // result = tableItemColorProvider.getForeground(object, columnIndex); } // Otherwise, we could check that the adapter implements interface IItemColorProvider. // else { IItemColorProvider itemColorProvider = (IItemColorProvider)adapterFactory.adapt(object, IItemColorProvider.class); if (itemColorProvider != null) { // And delegate the call. // result = itemColorProvider.getForeground(object); } } return result;
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/edit/provider/AdapterFactoryItemDelegator.java File path: /emf-2.4.1/src/org/eclipse/emf/edit/provider/AdapterFactoryItemDelegator.java
Method name: Object getBackground(Object, int) Method name: Object getForeground(Object, int)
Number of AST nodes: 8 Number of AST nodes: 8
1
ITableItemColorProvider tableItemColorProvider = (ITableItemColorProvider)adapterFactory.adapt(object, ITableItemColorProvider.class);
1
ITableItemColorProvider tableItemColorProvider = (ITableItemColorProvider)adapterFactory.adapt(object, ITableItemColorProvider.class);
2
    // No color is a good default.
2
    // No color is a good default.
3
    //
3
    //
4
    Object result = null;
4
    Object result = null;
5
    // Now we could check that the adapter implements interface ITableItemColorProvider.
5
    // Now we could check that the adapter implements interface ITableItemColorProvider.
6
    //
6
    //
7
    if (tableItemColorProvider  != null)
7
    if (tableItemColorProvider  != null)
8
    {
8
    {
9
      // And delegate the call.
9
      // And delegate the call.
10
      //
10
      //
11
      result = tableItemColorProvider.getBackground(object, columnIndex);
11
      result = tableItemColorProvider.getForeground(object, columnIndex);
12
    }
12
    }
13
    // Otherwise, we could check that the adapter implements interface IItemColorProvider.
13
    // Otherwise, we could check that the adapter implements interface IItemColorProvider.
14
    //
14
    //
15
    else
15
    else
16
    {
16
    {
17
      IItemColorProvider itemColorProvider = (IItemColorProvider)adapterFactory.adapt(object, IItemColorProvider.class);
17
      IItemColorProvider itemColorProvider = (IItemColorProvider)adapterFactory.adapt(object, IItemColorProvider.class);
18
      if (itemColorProvider != null)
18
      if (itemColorProvider != null)
19
      {
19
      {
20
        // And delegate the call.
20
        // And delegate the call.
21
        //
21
        //
22
        result = itemColorProvider.getBackground(object);
22
        result = itemColorProvider.getForeground(object);
23
      }
23
      }
24
    }
24
    }
25
    return result;
25
    return result;
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)0.1
Clones locationClones are declared in the same class
Number of node comparisons22
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    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.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    ITableItemColorProvider tableItemColorProvider = (ITableItemColorProvider)adapterFactory.adapt(object, ITableItemColorProvider.class);
    1
    ITableItemColorProvider tableItemColorProvider = (ITableItemColorProvider)adapterFactory.adapt(object, ITableItemColorProvider.class);
    2
    Object result = null;
    2
    Object result = null;
    3
    if (tableItemColorProvider != null)
    3
    if (tableItemColorProvider != null)
    4
    result = tableItemColorProvider.getBackground(object, columnIndex);
    4
    result = tableItemColorProvider.getBackground(object, columnIndex);
    4
    result = tableItemColorProvider.getForeground(object, columnIndex);
    Differences
    Expression1Expression2Difference
    getBackgroundgetForegroundMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression tableItemColorProvider.getBackground(object,columnIndex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression tableItemColorProvider.getForeground(object,columnIndex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    result = tableItemColorProvider.getForeground(object, columnIndex);
    else
    else
    5
    IItemColorProvider itemColorProvider = (IItemColorProvider)adapterFactory.adapt(object, IItemColorProvider.class);
    5
    IItemColorProvider itemColorProvider = (IItemColorProvider)adapterFactory.adapt(object, IItemColorProvider.class);
    6
    if (itemColorProvider != null)
    6
    if (itemColorProvider != null)
    7
    result = itemColorProvider.getBackground(object);
    7
    result = itemColorProvider.getBackground(object);
    7
    result = itemColorProvider.getForeground(object);
    Differences
    Expression1Expression2Difference
    getBackgroundgetForegroundMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression itemColorProvider.getBackground(object) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression itemColorProvider.getForeground(object) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7
    result = itemColorProvider.getForeground(object);
    8
    return result;
    8
    return result;
    Precondition Violations (4)
    Row Violation
    1Expression tableItemColorProvider.getBackground(object,columnIndex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression tableItemColorProvider.getForeground(object,columnIndex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression itemColorProvider.getBackground(object) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression itemColorProvider.getForeground(object) cannot be parameterized, because it has dependencies to/from statements that will be extracted