while (i.hasNext()) { ArtifactStatus status = i.next(); if (status.isCoreArtifact()) { i.remove(); } }
while (i.hasNext()) { ArtifactStatus status = i.next(); if (status.isInstalled()) { status.setArtifactAction(ArtifactAction.INSTALL); } }
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/update/gui/UpdateSummaryTable.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/update/gui/UpdateSummaryTable.java
Method name: void setReleaseVersionWillChange(boolean) Method name: void setReleaseVersionWillChange(boolean)
Number of AST nodes: 4 Number of AST nodes: 4
1
while (i.hasNext()) {
1
while (i.hasNext()) {
2
				ArtifactStatus status = i.next();
2
				ArtifactStatus status = i.next();
3
				if (status.isCoreArtifact()) {
3
				if (status.is
4
					i.remove(
4
Installed()) {
5
);
5
					status.setArtifactAction(ArtifactAction.INSTALL);
6
				}
6
				}
7
			}
7
			}
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.2
Clones locationClones are in the same method
Number of node comparisons8
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)6.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    8
    while (i.hasNext())
    4
    while (i.hasNext())
    9
    ArtifactStatus status = i.next();
    5
    ArtifactStatus status = i.next();
    10
    if (status.isCoreArtifact())
    10
    if (status.isCoreArtifact())
    6
    if (status.isInstalled())
    Differences
    Expression1Expression2Difference
    isCoreArtifactisInstalledMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression status.isCoreArtifact() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression status.isInstalled() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    if (status.isInstalled())
                                                                                                            
    7
    status.setArtifactAction(ArtifactAction.INSTALL);
    Preondition Violations
    Unmatched statement status.setArtifactAction(ArtifactAction.INSTALL); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    status.setArtifactAction(ArtifactAction.INSTALL);
    11
    i.remove();
                                  
    Precondition Violations (3)
    Row Violation
    1Expression status.isCoreArtifact() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression status.isInstalled() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement status.setArtifactAction(ArtifactAction.INSTALL); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted