| Previous CloneSet | Next CloneSet | Back to Main Report |
| Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
|---|---|---|---|---|
| 50 | 2 | 1 | 0.998 | executable_statement |
| Clone Abstraction | Parameter Bindings |
| Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
|---|---|---|---|
| 1 | 50 | 75 | plugins/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyPackageFragmentRootOperation.java |
| 2 | 50 | 175 | plugins/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/MovePackageFragmentRootOperation.java |
| ||||
{
final int sourceSegmentCount = rootEntry.getPath().segmentCount();
final IFolder destFolder = workspaceRoot.getFolder(this.destination);
final IPath[] nestedFolders = getNestedFolders(root);
IResourceProxyVisitor visitor = new IResourceProxyVisitor() {
public boolean visit(IResourceProxy proxy) throws CoreException {
if (proxy.getType() == IResource.FOLDER) {
IPath path = proxy.requestFullPath();
if (prefixesOneOf(path, nestedFolders)) {
if (equalsOneOf(path, nestedFolders)) {
// nested source folder
return false;
}
else {
// folder containing nested source folder
IFolder folder = destFolder.getFolder(path.removeFirstSegments(sourceSegmentCount));
if ((updateModelFlags& IPackageFragmentRoot.REPLACE) != 0 &&
folder.exists()) {
return true;
}
folder.create(updateResourceFlags, true, progressMonitor);
return true;
}
}
else {
// subtree doesn't contain any nested source folders
IPath destPath = destination.append(path.removeFirstSegments(sourceSegmentCount));
IResource destRes;
if ((updateModelFlags& IPackageFragmentRoot.REPLACE) != 0 &&
(destRes = workspaceRoot.findMember(destPath)) != null) {
destRes.delete(updateResourceFlags, progressMonitor);
}
proxy.requestResource().copy(destPath, updateResourceFlags, progressMonitor);
return false;
}
}
else {
IPath path = proxy.requestFullPath();
IPath destPath = destination.append(path.removeFirstSegments(sourceSegmentCount));
IResource destRes;
if ((updateModelFlags& IPackageFragmentRoot.REPLACE) != 0 &&
(destRes = workspaceRoot.findMember(destPath)) != null) {
destRes.delete(updateResourceFlags, progressMonitor);
}
proxy.requestResource().copy(destPath, updateResourceFlags, progressMonitor);
return false;
}
}
};
try {
rootResource.accept(visitor, IResource.NONE);
} catch (CoreException e) {
throw new JavaModelException(e);
}
}
|
| ||||
{
final int sourceSegmentCount = rootEntry.getPath().segmentCount();
final IFolder destFolder = workspaceRoot.getFolder(this.destination);
final IPath[] nestedFolders = getNestedFolders(root);
IResourceProxyVisitor visitor = new IResourceProxyVisitor() {
public boolean visit(IResourceProxy proxy) throws CoreException {
if (proxy.getType() == IResource.FOLDER) {
IPath path = proxy.requestFullPath();
if (prefixesOneOf(path, nestedFolders)) {
if (equalsOneOf(path, nestedFolders)) {
// nested source folder
return false;
}
else {
// folder containing nested source folder
IFolder folder = destFolder.getFolder(path.removeFirstSegments(sourceSegmentCount));
if ((updateModelFlags& IPackageFragmentRoot.REPLACE) != 0 &&
folder.exists()) {
return true;
}
folder.create(updateResourceFlags, true, progressMonitor);
return true;
}
}
else {
// subtree doesn't contain any nested source folders
IPath destPath = destination.append(path.removeFirstSegments(sourceSegmentCount));
IResource destRes;
if ((updateModelFlags& IPackageFragmentRoot.REPLACE) != 0 &&
(destRes = workspaceRoot.findMember(destPath)) != null) {
destRes.delete(updateResourceFlags, progressMonitor);
}
proxy.requestResource().move(destPath, updateResourceFlags, progressMonitor);
return false;
}
}
else {
IPath path = proxy.requestFullPath();
IPath destPath = destination.append(path.removeFirstSegments(sourceSegmentCount));
IResource destRes;
if ((updateModelFlags& IPackageFragmentRoot.REPLACE) != 0 &&
(destRes = workspaceRoot.findMember(destPath)) != null) {
destRes.delete(updateResourceFlags, progressMonitor);
}
proxy.requestResource().move(destPath, updateResourceFlags, progressMonitor);
return false;
}
}
};
try {
rootResource.accept(visitor, IResource.NONE);
} catch (CoreException e) {
throw new JavaModelException(e);
}
}
|
| |||
{
final int sourceSegmentCount = rootEntry.getPath().segmentCount();
final IFolder destFolder = workspaceRoot.getFolder(this.destination);
final IPath[] nestedFolders = getNestedFolders(root);
IResourceProxyVisitor visitor = new IResourceProxyVisitor() {
public boolean visit(IResourceProxy proxy) throws CoreException {
if (proxy.getType() == IResource.FOLDER) {
IPath path = proxy.requestFullPath();
if (prefixesOneOf(path, nestedFolders)) {
if (equalsOneOf(path, nestedFolders)) {
// nested source folder
return false;
}
else {
// folder containing nested source folder
IFolder folder = destFolder.getFolder(path.removeFirstSegments(sourceSegmentCount));
if ((updateModelFlags&IPackageFragmentRoot.REPLACE) != 0 && folder.exists()) {
return true;
}
folder.create(updateResourceFlags, true, progressMonitor);
return true;
}
}
else {
// subtree doesn't contain any nested source folders
IPath destPath = destination.append(path.removeFirstSegments(sourceSegmentCount));
IResource destRes;
if ((updateModelFlags&IPackageFragmentRoot.REPLACE) != 0 && (destRes = workspaceRoot.findMember(destPath)) != null) {
destRes.delete(updateResourceFlags, progressMonitor);
}
proxy.requestResource(). [[#variableb8be9ca0]](destPath, updateResourceFlags, progressMonitor);
return false;
}
}
else {
IPath path = proxy.requestFullPath();
IPath destPath = destination.append(path.removeFirstSegments(sourceSegmentCount));
IResource destRes;
if ((updateModelFlags&IPackageFragmentRoot.REPLACE) != 0 && (destRes = workspaceRoot.findMember(destPath)) != null) {
destRes.delete(updateResourceFlags, progressMonitor);
}
proxy.requestResource(). [[#variableb8be9ca0]](destPath, updateResourceFlags, progressMonitor);
return false;
}
}
};
try {
rootResource.accept(visitor, IResource.NONE);
}
catch (CoreException e) {
throw new JavaModelException(e);
}
}
|
| CloneAbstraction |
| Parameter Index | Clone Instance | Parameter Name | Value |
|---|---|---|---|
| 1 | 1 | [[#b8be9ca0]] | copy |
| 1 | 2 | [[#b8be9ca0]] | move |