boolean equal = false; if ((obj != null) && (obj instanceof XmlElement)) { XmlElement other = (XmlElement) obj; if (equals(attributes, other.attributes) && equals(data, other.data) && equals(name, other.name) && equals(subElements, other.subElements)) { equal = true; } } return equal;
boolean equal = false; if ((obj != null) && (obj instanceof IDefaultItem)) { final DefaultItem other = (DefaultItem) obj; if ((root == other.root) || ((root != null) && root.equals(other.root))) { equal = true; } } return equal;
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core-api/src/main/java/org/columba/core/xml/XmlElement.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/config/DefaultItem.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 6 Number of AST nodes: 6
1
boolean equal = false;
1
boolean equal = false;
2
		if ((obj != null) && (obj instanceof XmlElement)) {
2
		if ((obj != null) && (obj instanceof 
3
			XmlElement other = (XmlElement) obj;
4
			if (equals(attributes, other.attributes)
5
					&& equals(data, other.data) && equals(name, other.name)
6
					&& equals(subElements, other.subElements
3
IDefaultItem)) {
4
			final DefaultItem other = (DefaultItem) obj;
5
			if ((root == other.root)
7
)) {
6
					|| ((root != null) && root.equals(other.root))) {
8
				equal = true;
7
				equal = true;
9
			}
8
			}
10
		}
9
		}
11
		return equal;
10
		return equal;
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 different classes
Number of node comparisons12
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    boolean equal = false;
    1
    boolean equal = false;
    2
    if ((obj != null) && (obj instanceof XmlElement))
    2
    if ((obj != null) && (obj instanceof XmlElement))
    2
    if ((obj != null) && (obj instanceof IDefaultItem))
    Differences
    Expression1Expression2Difference
    org.columba.core.xml.XmlElementorg.columa.core.config.IDefaultItemVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.columba.core.xml.XmlElement does not match with type org.columa.core.config.IDefaultItem
    • Make classes org.columba.core.xml.XmlElement and org.columa.core.config.IDefaultItem extend a common superclass
    2
    if ((obj != null) && (obj instanceof IDefaultItem))
                                                                                            
    3
    final DefaultItem other = (DefaultItem)obj;
    Preondition Violations
    Unmatched statement final DefaultItem other=(DefaultItem)obj; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    final DefaultItem other = (DefaultItem)obj;
    3
    XmlElement other = (XmlElement)obj;
    3
    XmlElement other = (XmlElement)obj;
    Preondition Violations
    Unmatched statement XmlElement other=(XmlElement)obj; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                            
    4
    if (equals(attributes, other.attributes) && equals(data, other.data) && equals(name, other.name) && equals(subElements, other.subElements))
    4
    if (equals(attributes, other.attributes) && equals(data, other.data) && equals(name, other.name) && equals(subElements, other.subElements))
    4
    if ((root == other.root) || ((root != null) && root.equals(other.root)))
    Differences
    Expression1Expression2Difference
    equals(attributes,other.attributes)(root == other.root)TYPE_COMPATIBLE_REPLACEMENT
    equals(data,other.data)((root != null) && root.equals(other.root))TYPE_COMPATIBLE_REPLACEMENT
    equals(attributes,other.attributes) && equals(data,other.data) && equals(name,other.name)&& equals(subElements,other.subElements)(root == other.root) || ((root != null) && root.equals(other.root))INFIX_EXTENDED_OPERAND_NUMBER_MISMATCH
    &&||OPERATOR_MISMATCH
    Preondition Violations
    Expression equals(attributes,other.attributes) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method equals
    Expression (root == other.root) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression equals(data,other.data) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method equals
    Expression ((root != null) && root.equals(other.root)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression equals(attributes,other.attributes) && equals(data,other.data) && equals(name,other.name)&& equals(subElements,other.subElements) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (root == other.root) || ((root != null) && root.equals(other.root)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    if ((root == other.root) || ((root != null) && root.equals(other.root)))
    5
    equal = true;
    5
    equal = true;
    6
    return equal;
    6
    return equal;
    Precondition Violations (10)
    Row Violation
    1Type org.columba.core.xml.XmlElement does not match with type org.columa.core.config.IDefaultItem
    2Unmatched statement final DefaultItem other=(DefaultItem)obj; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement XmlElement other=(XmlElement)obj; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Expression equals(attributes,other.attributes) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression (root == other.root) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression equals(data,other.data) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression ((root != null) && root.equals(other.root)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression equals(attributes,other.attributes) && equals(data,other.data) && equals(name,other.name)&& equals(subElements,other.subElements) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression (root == other.root) || ((root != null) && root.equals(other.root)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10The refactoring of the clones is infeasible, because classes org.columba.core.xml.XmlElement and org.columba.core.config.DefaultItem do not have a common superclass