CloneSet167


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
50210.998executable_statement
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
15075
plugins/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyPackageFragmentRootOperation.java
250175
plugins/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/MovePackageFragmentRootOperation.java
Clone Instance
1
Line Count
50
Source Line
75
Source File
plugins/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyPackageFragmentRootOperation.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);
                          }
                       }


Clone Instance
2
Line Count
50
Source Line
175
Source File
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().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);
                          }
                       }


Clone AbstractionParameter Count: 1Parameter Bindings

{
  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 Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#b8be9ca0]]
copy 
12[[#b8be9ca0]]
move