IMailFolder folder = getSourceFolder(); folder.addFolderListener(this); if (isRecursive()) { FolderChildrenIterator it = new FolderChildrenIterator(folder); while (it.hasMoreChildren()) { IMailFolder next = it.nextChild(); if (!(next instanceof VirtualFolder) && (next instanceof IMailbox)) { next.addFolderListener(this); } } }
IMailFolder folder = getSourceFolder(); folder.removeFolderListener(this); if (isRecursive()) { FolderChildrenIterator it = new FolderChildrenIterator(folder); while (it.hasMoreChildren()) { IMailFolder next = it.nextChild(); if (!(next instanceof VirtualFolder)) { next.removeFolderListener(this); } } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/folder/virtual/VirtualFolder.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/folder/virtual/VirtualFolder.java
Method name: void registerWithSource() Method name: void unregisterWithSource()
Number of AST nodes: 8 Number of AST nodes: 8
1
IMailFolder folder = getSourceFolder();
1
IMailFolder folder = getSourceFolder();
2
		folder.addFolderListener(this);
2
		folder.removeFolderListener(this);
3
		if (isRecursive()) {
3
		if (isRecursive()) {
4
			FolderChildrenIterator it = new FolderChildrenIterator(folder);
4
			FolderChildrenIterator it = new FolderChildrenIterator(folder);
5
			while (it.hasMoreChildren()) {
5
			while (it.hasMoreChildren()) {
6
				IMailFolder next = it.nextChild();
6
				IMailFolder next = it.nextChild();
7
				if (!(next instanceof VirtualFolder)
7
				if (!(next instanceof VirtualFolder)
8
						&& (next instanceof IMailbox)) {
8
) {
9
					next.addFolderListener(this);
9
					next.removeFolderListener(this);
10
				}
10
				}
11
			}
11
			}
12
		}
12
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are declared in the same class
Number of node comparisons13
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)30.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    IMailFolder folder = getSourceFolder();
    1
    IMailFolder folder = getSourceFolder();
    2
    folder.addFolderListener(this);
    2
    folder.addFolderListener(this);
    2
    folder.removeFolderListener(this);
    Differences
    Expression1Expression2Difference
    addFolderListenerremoveFolderListenerMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression folder.addFolderListener(this) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression folder.removeFolderListener(this) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression folder.addFolderListener(this) is a void method call, and thus it cannot be parameterized
    Expression folder.removeFolderListener(this) is a void method call, and thus it cannot be parameterized
    2
    folder.removeFolderListener(this);
    3
    if (isRecursive())
    3
    if (isRecursive())
    4
    FolderChildrenIterator it = new FolderChildrenIterator(folder);
    4
    FolderChildrenIterator it = new FolderChildrenIterator(folder);
    5
    while (it.hasMoreChildren())
    5
    while (it.hasMoreChildren())
    6
    IMailFolder next = it.nextChild();
    6
    IMailFolder next = it.nextChild();
                                                                                  
    7
    if (!(next instanceof VirtualFolder))
    Preondition Violations
    Unmatched statement if(!(next instanceof VirtualFolder)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    if (!(next instanceof VirtualFolder))
                                                                          
    8
    next.removeFolderListener(this);
    Preondition Violations
    Unmatched statement next.removeFolderListener(this); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    next.removeFolderListener(this);
    7
    if (!(next instanceof VirtualFolder) && (next instanceof IMailbox))
    7
    if (!(next instanceof VirtualFolder) && (next instanceof IMailbox))
    Preondition Violations
    Unmatched statement if(!(next instanceof VirtualFolder) && (next instanceof IMailbox)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                              
    8
    next.addFolderListener(this);
    8
    next.addFolderListener(this);
    Preondition Violations
    Unmatched statement next.addFolderListener(this); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                    
    Precondition Violations (8)
    Row Violation
    1Expression folder.addFolderListener(this) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression folder.removeFolderListener(this) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression folder.addFolderListener(this) is a void method call, and thus it cannot be parameterized
    4Expression folder.removeFolderListener(this) is a void method call, and thus it cannot be parameterized
    5Unmatched statement if(!(next instanceof VirtualFolder)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement next.removeFolderListener(this); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement if(!(next instanceof VirtualFolder) && (next instanceof IMailbox)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement next.addFolderListener(this); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted