@SuppressWarnings("unchecked") Comparable<Object> comparableObject = (Comparable<Object>)effectiveMin; if (effectiveMinIsInclusive ? comparableObject.compareTo(value) > 0: comparableObject.compareTo(value) >= 0) { if (diagnostics != null) { if (effectiveTotalDigitsMin != -1) { reportTotalDigitsViolation(eDataType, value, effectiveTotalDigitsMin, diagnostics, context); } else { reportMinViolation(eDataType, value, effectiveMin, effectiveMinIsInclusive, diagnostics, context); } } result = false; }
@SuppressWarnings("unchecked") Comparable<Object> comparableObject = (Comparable<Object>)effectiveMax; if (effectiveMaxIsInclusive ? comparableObject.compareTo(value) < 0: comparableObject.compareTo(value) <= 0) { if (diagnostics != null) { if (effectiveTotalDigitsMax != -1) { reportTotalDigitsViolation(eDataType, value, effectiveTotalDigitsMax, diagnostics, context); } else { reportMaxViolation(eDataType, value, effectiveMax, effectiveMaxIsInclusive, diagnostics, context); } } result = false; }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/EObjectValidator.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/EObjectValidator.java
Method name: boolean validate(EDataType, Object, DiagnosticChain, Map) Method name: boolean validate(EDataType, Object, DiagnosticChain, Map)
Number of AST nodes: 7 Number of AST nodes: 7
1
@SuppressWarnings("unchecked") Comparable<Object> comparableObject = (Comparable<Object>)effectiveMin;
1
@SuppressWarnings("unchecked") Comparable<Object> comparableObject = (Comparable<Object>)effectiveMax;
2
        if (effectiveMinIsInclusive ?
2
        if (effectiveMaxIsInclusive ?
3
              comparableObject.compareTo(value) &gt; 0:
3
              comparableObject.compareTo(value) &lt; 0:
4
              comparableObject.compareTo(value) &gt;= 0)
4
              comparableObject.compareTo(value) &lt;= 0)
5
        {
5
        {
6
          if (diagnostics != null)
6
          if (diagnostics != null)
7
          {
7
          {
8
            if (effectiveTotalDigitsMin != -1)
8
            if (effectiveTotalDigitsMax != -1)
9
            {
9
            {
10
              reportTotalDigitsViolation(eDataType, value, effectiveTotalDigitsMin, diagnostics, context);
10
              reportTotalDigitsViolation(eDataType, value, effectiveTotalDigitsMax, diagnostics, context);
11
            }
11
            }
12
            else
12
            else
13
            {
13
            {
14
              reportMinViolation(eDataType, value, effectiveMin, effectiveMinIsInclusive, diagnostics, context);
14
              reportMaxViolation(eDataType, value, effectiveMax, effectiveMaxIsInclusive, diagnostics, context);
15
            }
15
            }
16
          }
16
          }
17
          result = false;
17
          result = false;
18
        }
18
        }
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.5
Clones locationClones are in the same method
Number of node comparisons11
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)325.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    12
    if (diagnostics != null)
    20
    if (diagnostics != null)
    13
    if (effectiveTotalDigitsMin != -1)
    13
    if (effectiveTotalDigitsMin != -1)
    21
    if (effectiveTotalDigitsMax != -1)
    Differences
    Expression1Expression2Difference
    effectiveTotalDigitsMineffectiveTotalDigitsMaxVARIABLE_NAME_MISMATCH
    21
    if (effectiveTotalDigitsMax != -1)
    14
    reportTotalDigitsViolation(eDataType, value, effectiveTotalDigitsMin, diagnostics, context);
    14
    reportTotalDigitsViolation(eDataType, value, effectiveTotalDigitsMin, diagnostics, context);
    22
    reportTotalDigitsViolation(eDataType, value, effectiveTotalDigitsMax, diagnostics, context);
    Differences
    Expression1Expression2Difference
    effectiveTotalDigitsMineffectiveTotalDigitsMaxVARIABLE_NAME_MISMATCH
    22
    reportTotalDigitsViolation(eDataType, value, effectiveTotalDigitsMax, diagnostics, context);
    else
    else
    15
    reportMinViolation(eDataType, value, effectiveMin, effectiveMinIsInclusive, diagnostics, context);
    15
    reportMinViolation(eDataType, value, effectiveMin, effectiveMinIsInclusive, diagnostics, context);
    23
    reportMaxViolation(eDataType, value, effectiveMax, effectiveMaxIsInclusive, diagnostics, context);
    Differences
    Expression1Expression2Difference
    reportMinViolationreportMaxViolationMETHOD_INVOCATION_NAME_MISMATCH
    effectiveMineffectiveMaxVARIABLE_NAME_MISMATCH
    effectiveMinIsInclusiveeffectiveMaxIsInclusiveVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression reportMinViolation(eDataType,value,effectiveMin,effectiveMinIsInclusive,diagnostics,context) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression reportMaxViolation(eDataType,value,effectiveMax,effectiveMaxIsInclusive,diagnostics,context) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression reportMinViolation(eDataType,value,effectiveMin,effectiveMinIsInclusive,diagnostics,context) is a void method call, and thus it cannot be parameterized
    Expression reportMaxViolation(eDataType,value,effectiveMax,effectiveMaxIsInclusive,diagnostics,context) is a void method call, and thus it cannot be parameterized
    23
    reportMaxViolation(eDataType, value, effectiveMax, effectiveMaxIsInclusive, diagnostics, context);
    Precondition Violations (4)
    Row Violation
    1Expression reportMinViolation(eDataType,value,effectiveMin,effectiveMinIsInclusive,diagnostics,context) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression reportMaxViolation(eDataType,value,effectiveMax,effectiveMaxIsInclusive,diagnostics,context) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression reportMinViolation(eDataType,value,effectiveMin,effectiveMinIsInclusive,diagnostics,context) is a void method call, and thus it cannot be parameterized
    4Expression reportMaxViolation(eDataType,value,effectiveMax,effectiveMaxIsInclusive,diagnostics,context) is a void method call, and thus it cannot be parameterized