Element child = getParentElement().getChild(key); if (child == null) { child = new Element(key); getParentElement().addContent(child); } Element prefixchild = child.getChild(prefix); if (prefixchild == null) { prefixchild = new Element(prefix); child.addContent(prefixchild); } prefixchild.setText(value);
Element child = getParentElement().getChild(key); if (child == null) { child = new Element(key); getParentElement().addContent(child); } Element prefixchild = child.getChild(prefix); if (prefixchild == null) { prefixchild = new Element(prefix); child.addContent(prefixchild); } return prefixchild.getTextNormalize();
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/calendar/src/main/java/org/columba/calendar/parser/XCSDocumentParser.java File path: /columba-1.4-src/calendar/src/main/java/org/columba/calendar/parser/XCSDocumentParser.java
Method name: void set(String, String, String) Method name: String get(String, String)
Number of AST nodes: 9 Number of AST nodes: 9
1
Element child = getParentElement().getChild(key);
1
Element child = getParentElement().getChild(key);
2
		if (child == null) {
2
		if (child == null) {
3
			child = new Element(key);
3
			child = new Element(key);
4
			getParentElement().addContent(child);
4
			getParentElement().addContent(child);
5
		}
5
		}
6
		Element prefixchild = child.getChild(prefix);
6
		Element prefixchild = child.getChild(prefix);
7
		if (prefixchild == null) {
7
		if (prefixchild == null) {
8
			prefixchild = new Element(prefix);
8
			prefixchild = new Element(prefix);
9
			child.addContent(prefixchild);
9
			child.addContent(prefixchild);
10
		}
10
		}
11
		prefixchild.setText(value);
11
		return prefixchild.getTextNormalize();
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.4
Clones locationClones are declared in the same class
Number of node comparisons37
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)3.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Element child = getParentElement().getChild(key);
    1
    Element child = getParentElement().getChild(key);
    2
    if (child == null)
    2
    if (child == null)
    3
    child = new Element(key);
    3
    child = new Element(key);
    4
    getParentElement().addContent(child);
    4
    getParentElement().addContent(child);
    5
    Element prefixchild = child.getChild(prefix);
    5
    Element prefixchild = child.getChild(prefix);
    6
    if (prefixchild == null)
    6
    if (prefixchild == null)
    7
    prefixchild = new Element(prefix);
    7
    prefixchild = new Element(prefix);
    8
    child.addContent(prefixchild);
    8
    child.addContent(prefixchild);
                                                                                      
    9
    return prefixchild.getTextNormalize();
    Preondition Violations
    Unmatched statement return prefixchild.getTextNormalize(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return prefixchild.getTextNormalize();
    9
    return prefixchild.getTextNormalize();
    9
    prefixchild.setText(value);
    9
    prefixchild.setText(value);
    Preondition Violations
    Unmatched statement prefixchild.setText(value); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                
    Precondition Violations (3)
    Row Violation
    1Unmatched statement return prefixchild.getTextNormalize(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched return prefixchild.getTextNormalize();
    3Unmatched statement prefixchild.setText(value); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted