switch (value1.xmlGregorianCalendar.compare(value2.xmlGregorianCalendar)) { case DatatypeConstants.EQUAL: { return XMLCalendar.EQUALS; } case DatatypeConstants.LESSER: { return XMLCalendar.LESS_THAN; } case DatatypeConstants.GREATER: { return XMLCalendar.GREATER_THAN; } default: { return XMLCalendar.INDETERMINATE; } }
switch (value1.duration.compare(value2.duration)) { case DatatypeConstants.EQUAL: { return XMLCalendar.EQUALS; } case DatatypeConstants.LESSER: { return XMLCalendar.LESS_THAN; } case DatatypeConstants.GREATER: { return XMLCalendar.GREATER_THAN; } default: { return XMLCalendar.INDETERMINATE; } }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/internal/XMLCalendar.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/internal/XMLDuration.java
Method name: int compare(XMLCalendar, XMLCalendar) Method name: int compare(XMLDuration, XMLDuration)
Number of AST nodes: 9 Number of AST nodes: 9
1
switch (value1.xmlGregorianCalendar.compare(value2.xmlGregorianCalendar))
1
switch (value1.duration.compare(value2.duration))
2
    {
2
    {
3
      case DatatypeConstants.EQUAL:
3
      case DatatypeConstants.EQUAL:
4
      {
4
      {
5
        return XMLCalendar.EQUALS;
5
        return XMLCalendar.EQUALS;
6
      }
6
      }
7
      case DatatypeConstants.LESSER:
7
      case DatatypeConstants.LESSER:
8
      {
8
      {
9
        return XMLCalendar.LESS_THAN;
9
        return XMLCalendar.LESS_THAN;
10
      }
10
      }
11
      case DatatypeConstants.GREATER:
11
      case DatatypeConstants.GREATER:
12
      {
12
      {
13
        return XMLCalendar.GREATER_THAN;
13
        return XMLCalendar.GREATER_THAN;
14
      }
14
      }
15
      default:
15
      default:
16
      {
16
      {
17
        return XMLCalendar.INDETERMINATE;
17
        return XMLCalendar.INDETERMINATE;
18
      }
18
      }
19
    }
19
    }
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.2
Clones locationClones are in different classes
Number of node comparisons41
  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)1.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    switch (value1.xmlGregorianCalendar.compare(value2.xmlGregorianCalendar))
    1
    switch (value1.xmlGregorianCalendar.compare(value2.xmlGregorianCalendar))
    1
    switch (value1.duration.compare(value2.duration))
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.ecore.xml.type.internal.XMLCalendarorg.eclipse.emf.ecore.xml.type.internal.XMLDurationVARIABLE_TYPE_MISMATCH
    xmlGregorianCalendardurationVARIABLE_NAME_MISMATCH
    javax.xml.datatype.XMLGregorianCalendarjavax.xml.datatype.DurationVARIABLE_TYPE_MISMATCH
    org.eclipse.emf.ecore.xml.type.internal.XMLCalendarorg.eclipse.emf.ecore.xml.type.internal.XMLDurationVARIABLE_TYPE_MISMATCH
    xmlGregorianCalendardurationVARIABLE_NAME_MISMATCH
    javax.xml.datatype.XMLGregorianCalendarjavax.xml.datatype.DurationVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.xml.type.internal.XMLCalendar of variable value2 does not match with type org.eclipse.emf.ecore.xml.type.internal.XMLDuration of variable value2
    • Make classes org.eclipse.emf.ecore.xml.type.internal.XMLCalendar and org.eclipse.emf.ecore.xml.type.internal.XMLDuration extend a common superclass
    Type javax.xml.datatype.XMLGregorianCalendar of variable value2.xmlGregorianCalendar does not match with type javax.xml.datatype.Duration of variable value2.duration
    • Make classes javax.xml.datatype.XMLGregorianCalendar and javax.xml.datatype.Duration extend a common superclass
    Type org.eclipse.emf.ecore.xml.type.internal.XMLCalendar of variable value1 does not match with type org.eclipse.emf.ecore.xml.type.internal.XMLDuration of variable value1
    • Make classes org.eclipse.emf.ecore.xml.type.internal.XMLCalendar and org.eclipse.emf.ecore.xml.type.internal.XMLDuration extend a common superclass
    Type javax.xml.datatype.XMLGregorianCalendar of variable value1.xmlGregorianCalendar does not match with type javax.xml.datatype.Duration of variable value1.duration
    • Make classes javax.xml.datatype.XMLGregorianCalendar and javax.xml.datatype.Duration extend a common superclass
    1
    switch (value1.duration.compare(value2.duration))
    2
    case DatatypeConstants.EQUAL:
    2
    case DatatypeConstants.EQUAL:
    3
    return XMLCalendar.EQUALS;
    3
    return XMLCalendar.EQUALS;
    4
    case DatatypeConstants.LESSER:
    4
    case DatatypeConstants.LESSER:
    5
    return XMLCalendar.LESS_THAN;
    5
    return XMLCalendar.LESS_THAN;
    6
    case DatatypeConstants.GREATER:
    6
    case DatatypeConstants.GREATER:
    7
    return XMLCalendar.GREATER_THAN;
    7
    return XMLCalendar.GREATER_THAN;
    8
    default:
    8
    default:
    9
    return XMLCalendar.INDETERMINATE;
    9
    return XMLCalendar.INDETERMINATE;
    Precondition Violations (4)
    Row Violation
    1Type org.eclipse.emf.ecore.xml.type.internal.XMLCalendar of variable value2 does not match with type org.eclipse.emf.ecore.xml.type.internal.XMLDuration of variable value2
    2Type javax.xml.datatype.XMLGregorianCalendar of variable value2.xmlGregorianCalendar does not match with type javax.xml.datatype.Duration of variable value2.duration
    3Type org.eclipse.emf.ecore.xml.type.internal.XMLCalendar of variable value1 does not match with type org.eclipse.emf.ecore.xml.type.internal.XMLDuration of variable value1
    4Type javax.xml.datatype.XMLGregorianCalendar of variable value1.xmlGregorianCalendar does not match with type javax.xml.datatype.Duration of variable value1.duration