173-49-50

if (workspaceFile == null) { workspaceFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(getLocation())); } return workspaceFile;
if (project == null) { project = ResourcesPlugin.getWorkspace().getRoot().getProject(getName()); } return project;

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/common/ui/wizard/AbstractExampleInstallerWizard.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/common/ui/wizard/AbstractExampleInstallerWizard.java
Method name: `IFile getWorkspaceFile()` |  | Method name: `IProject getProject()`
Number of AST nodes: 3 |  | Number of AST nodes: 3

1

    if (workspaceFile == null)↵

1

    if (project == null)↵

2

          {↵

2

          {↵

3

            workspaceFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(getLocation()));↵

3

            project = ResourcesPlugin.getWorkspace().getRoot().getProject(getName());↵

4

          }↵

4

          }↵

5

          return workspaceFile;

5

          return project;

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 1
Number of non-refactorable cases | 0
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2
Clones location | Clones are in the same java file
Number of node comparisons | 5

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 2
   Number of unmapped statements in the first code fragment | 1
   Number of unmapped statements in the second code fragment | 1
   Time elapsed for statement mapping (ms) | 1.5
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       if (workspaceFile == null)

   1 | if (workspaceFile == null)
   1 | if (project == null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   workspaceFile | project | VARIABLE_NAME_MISMATCH
   org.eclipse.core.resources.IFile | org.eclipse.core.resources.IProject | SUBCLASS_TYPE_MISMATCH

   1

       if (project == null)

   2 | project = ResourcesPlugin.getWorkspace().getRoot().getProject(getName());

   Preondition Violations
   Unmatched statement project=ResourcesPlugin.getWorkspace().getRoot().getProject(getName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   2

       project = ResourcesPlugin.getWorkspace().getRoot().getProject(getName());

   2

       workspaceFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(getLocation()));

   2 | workspaceFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(getLocation()));

   Preondition Violations
   Unmatched statement workspaceFile=ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(getLocation())); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   3

       return workspaceFile;

   3 | return workspaceFile;
   3 | return project;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   workspaceFile | project | VARIABLE_NAME_MISMATCH
   org.eclipse.core.resources.IFile | org.eclipse.core.resources.IProject | SUBCLASS_TYPE_MISMATCH

   3

       return project;

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Unmatched statement project=ResourcesPlugin.getWorkspace().getRoot().getProject(getName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   2 | Unmatched statement workspaceFile=ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(getLocation())); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted