From 7b6ae411b7a413c336d8ca7307a31bf5a449367b Mon Sep 17 00:00:00 2001 From: incastrix Date: Wed, 23 Dec 2009 17:52:40 +0000 Subject: [PATCH] Refactory: remove unused classes, imports, fields and methods. --- .../builder/AbortIncrementalBuildException.java | 4 + .../internal/core/builder/BatchImageBuilder.java | 344 ++++---- .../builder/ImageBuilderInternalException.java | 4 + .../core/builder/IncrementalImageBuilder.java | 66 +- .../core/builder/MissingClassFileException.java | 4 + .../core/builder/MissingSourceFileException.java | 4 + .../internal/core/builder/NameEnvironment.java | 24 +- .../phpdt/internal/core/builder/PHPBuilder.java | 8 +- .../phpdt/internal/core/builder/State.java | 6 +- .../phpdt/internal/core/jdom/DOMField.java | 94 +- .../phpdt/internal/core/jdom/DOMType.java | 6 +- .../phpdt/internal/core/jdom/SimpleDOMBuilder.java | 12 +- .../phpdt/internal/core/util/ASTNodeFinder.java | 196 ---- .../phpdt/internal/core/util/CharArrayBuffer.java | 12 +- .../phpdt/internal/core/util/CharArrayOps.java | 16 +- .../internal/core/util/CommentRecorderParser.java | 124 ++-- .../phpdt/internal/core/util/LRUCache.java | 92 +- .../internal/core/util/SimpleLookupTable.java | 92 +- .../phpdt/internal/core/util/SimpleSet.java | 122 --- .../phpdt/internal/core/util/SimpleWordSet.java | 80 -- .../sourceforge/phpdt/internal/core/util/Util.java | 972 ++++++++++---------- 21 files changed, 950 insertions(+), 1332 deletions(-) delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/ASTNodeFinder.java delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleSet.java delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleWordSet.java diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/AbortIncrementalBuildException.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/AbortIncrementalBuildException.java index 7420960..8c1fda1 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/AbortIncrementalBuildException.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/AbortIncrementalBuildException.java @@ -17,6 +17,10 @@ package net.sourceforge.phpdt.internal.core.builder; */ public class AbortIncrementalBuildException extends RuntimeException { + /** + * + */ + private static final long serialVersionUID = -3469654039264522109L; protected String qualifiedTypeName; public AbortIncrementalBuildException(String qualifiedTypeName) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/BatchImageBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/BatchImageBuilder.java index 0eb0d43..c25da3e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/BatchImageBuilder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/BatchImageBuilder.java @@ -12,16 +12,16 @@ package net.sourceforge.phpdt.internal.core.builder; import java.util.ArrayList; -import net.sourceforge.phpdt.core.JavaCore; +//import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.core.util.Util; -import org.eclipse.core.resources.IContainer; +//import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceProxy; import org.eclipse.core.resources.IResourceProxyVisitor; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; +//import org.eclipse.core.runtime.IPath; public class BatchImageBuilder extends AbstractImageBuilder { @@ -104,179 +104,179 @@ public class BatchImageBuilder extends AbstractImageBuilder { } } - protected void cleanOutputFolders() throws CoreException { - boolean deleteAll = JavaCore.CLEAN.equals(javaBuilder.javaProject - .getOption(JavaCore.CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, true)); - if (deleteAll) { - ArrayList visited = new ArrayList(sourceLocations.length); - for (int i = 0, l = sourceLocations.length; i < l; i++) { - notifier.subTask(Util.bind("build.cleaningOutput")); //$NON-NLS-1$ - ClasspathMultiDirectory sourceLocation = sourceLocations[i]; - if (sourceLocation.hasIndependentOutputFolder) { - IContainer outputFolder = sourceLocation.binaryFolder; - if (!visited.contains(outputFolder)) { - visited.add(outputFolder); - IResource[] members = outputFolder.members(); - for (int j = 0, m = members.length; j < m; j++) - members[j].delete(IResource.FORCE, null); - } - notifier.checkCancel(); - copyExtraResourcesBack(sourceLocation, deleteAll); - } else { - boolean isOutputFolder = sourceLocation.sourceFolder - .equals(sourceLocation.binaryFolder); - final char[][] exclusionPatterns = isOutputFolder ? sourceLocation.exclusionPatterns - : null; // ignore exclusionPatterns if output folder - // == another source folder... not this one - sourceLocation.binaryFolder.accept( - new IResourceProxyVisitor() { - public boolean visit(IResourceProxy proxy) - throws CoreException { - IResource resource = null; - if (exclusionPatterns != null) { - resource = proxy.requestResource(); - if (Util.isExcluded(resource, - exclusionPatterns)) - return false; - } - if (proxy.getType() == IResource.FILE) { - // if - // (ProjectPrefUtil.isClassFileName(proxy.getName())) - // { - // if (resource == null) - // resource = proxy.requestResource(); - // resource.delete(IResource.FORCE, - // null); - // } - return false; - } - notifier.checkCancel(); - return true; - } - }, IResource.NONE); - if (!isOutputFolder) { - notifier.checkCancel(); - copyPackages(sourceLocation); - } - } - notifier.checkCancel(); - } - } else { - for (int i = 0, l = sourceLocations.length; i < l; i++) { - ClasspathMultiDirectory sourceLocation = sourceLocations[i]; - if (sourceLocation.hasIndependentOutputFolder) - copyExtraResourcesBack(sourceLocation, deleteAll); - else if (!sourceLocation.sourceFolder - .equals(sourceLocation.binaryFolder)) - copyPackages(sourceLocation); // output folder is - // different from source - // folder - notifier.checkCancel(); - } - } - } +// protected void cleanOutputFolders() throws CoreException { +// boolean deleteAll = JavaCore.CLEAN.equals(javaBuilder.javaProject +// .getOption(JavaCore.CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, true)); +// if (deleteAll) { +// ArrayList visited = new ArrayList(sourceLocations.length); +// for (int i = 0, l = sourceLocations.length; i < l; i++) { +// notifier.subTask(Util.bind("build.cleaningOutput")); //$NON-NLS-1$ +// ClasspathMultiDirectory sourceLocation = sourceLocations[i]; +// if (sourceLocation.hasIndependentOutputFolder) { +// IContainer outputFolder = sourceLocation.binaryFolder; +// if (!visited.contains(outputFolder)) { +// visited.add(outputFolder); +// IResource[] members = outputFolder.members(); +// for (int j = 0, m = members.length; j < m; j++) +// members[j].delete(IResource.FORCE, null); +// } +// notifier.checkCancel(); +// copyExtraResourcesBack(sourceLocation, deleteAll); +// } else { +// boolean isOutputFolder = sourceLocation.sourceFolder +// .equals(sourceLocation.binaryFolder); +// final char[][] exclusionPatterns = isOutputFolder ? sourceLocation.exclusionPatterns +// : null; // ignore exclusionPatterns if output folder +// // == another source folder... not this one +// sourceLocation.binaryFolder.accept( +// new IResourceProxyVisitor() { +// public boolean visit(IResourceProxy proxy) +// throws CoreException { +// IResource resource = null; +// if (exclusionPatterns != null) { +// resource = proxy.requestResource(); +// if (Util.isExcluded(resource, +// exclusionPatterns)) +// return false; +// } +// if (proxy.getType() == IResource.FILE) { +// // if +// // (ProjectPrefUtil.isClassFileName(proxy.getName())) +// // { +// // if (resource == null) +// // resource = proxy.requestResource(); +// // resource.delete(IResource.FORCE, +// // null); +// // } +// return false; +// } +// notifier.checkCancel(); +// return true; +// } +// }, IResource.NONE); +// if (!isOutputFolder) { +// notifier.checkCancel(); +// copyPackages(sourceLocation); +// } +// } +// notifier.checkCancel(); +// } +// } else { +// for (int i = 0, l = sourceLocations.length; i < l; i++) { +// ClasspathMultiDirectory sourceLocation = sourceLocations[i]; +// if (sourceLocation.hasIndependentOutputFolder) +// copyExtraResourcesBack(sourceLocation, deleteAll); +// else if (!sourceLocation.sourceFolder +// .equals(sourceLocation.binaryFolder)) +// copyPackages(sourceLocation); // output folder is +// // different from source +// // folder +// notifier.checkCancel(); +// } +// } +// } - protected void copyExtraResourcesBack( - ClasspathMultiDirectory sourceLocation, final boolean deletedAll) - throws CoreException { - // When, if ever, does a builder need to copy resources files (not .java - // or .class) into the output folder? - // If we wipe the output folder at the beginning of the build then all - // 'extra' resources must be copied to the output folder. - - notifier.subTask(Util.bind("build.copyingResources")); //$NON-NLS-1$ - final int segmentCount = sourceLocation.sourceFolder.getFullPath() - .segmentCount(); - final char[][] exclusionPatterns = sourceLocation.exclusionPatterns; - final IContainer outputFolder = sourceLocation.binaryFolder; - final boolean isAlsoProject = sourceLocation.sourceFolder - .equals(javaBuilder.currentProject); - sourceLocation.sourceFolder.accept(new IResourceProxyVisitor() { - public boolean visit(IResourceProxy proxy) throws CoreException { - IResource resource = null; - switch (proxy.getType()) { - case IResource.FILE: - if (net.sourceforge.phpdt.internal.compiler.util.Util - .isJavaFileName(proxy.getName())) - return false;// || - // ProjectPrefUtil.isClassFileName(proxy.getName())) - // return false; - - resource = proxy.requestResource(); - if (javaBuilder.filterExtraResource(resource)) - return false; - if (exclusionPatterns != null - && Util.isExcluded(resource, exclusionPatterns)) - return false; - - IPath partialPath = resource.getFullPath() - .removeFirstSegments(segmentCount); - IResource copiedResource = outputFolder - .getFile(partialPath); - if (copiedResource.exists()) { - if (deletedAll) { - createErrorFor(resource, Util - .bind("build.duplicateResource")); //$NON-NLS-1$ - return false; - } - copiedResource.delete(IResource.FORCE, null); // last - // one - // wins - } - resource.copy(copiedResource.getFullPath(), - IResource.FORCE, null); - copiedResource.setDerived(true); - return false; - case IResource.FOLDER: - resource = proxy.requestResource(); - if (javaBuilder.filterExtraResource(resource)) - return false; - if (exclusionPatterns != null - && Util.isExcluded(resource, exclusionPatterns)) - return false; - - IPath folderPath = resource.getFullPath(); - if (isAlsoProject && isExcludedFromProject(folderPath)) - return false; // the sourceFolder == project - // createFolder(folderPath.removeFirstSegments(segmentCount), - // outputFolder); - } - return true; - } - }, IResource.NONE); - } - - protected void copyPackages(ClasspathMultiDirectory sourceLocation) - throws CoreException { +// protected void copyExtraResourcesBack( +// ClasspathMultiDirectory sourceLocation, final boolean deletedAll) +// throws CoreException { +// // When, if ever, does a builder need to copy resources files (not .java +// // or .class) into the output folder? +// // If we wipe the output folder at the beginning of the build then all +// // 'extra' resources must be copied to the output folder. +// +// notifier.subTask(Util.bind("build.copyingResources")); //$NON-NLS-1$ // final int segmentCount = sourceLocation.sourceFolder.getFullPath() // .segmentCount(); - final char[][] exclusionPatterns = sourceLocation.exclusionPatterns; - //final IContainer outputFolder = sourceLocation.binaryFolder; - final boolean isAlsoProject = sourceLocation.sourceFolder - .equals(javaBuilder.currentProject); - sourceLocation.sourceFolder.accept(new IResourceProxyVisitor() { - public boolean visit(IResourceProxy proxy) throws CoreException { - switch (proxy.getType()) { - case IResource.FILE: - return false; - case IResource.FOLDER: - IResource resource = proxy.requestResource(); - if (javaBuilder.filterExtraResource(resource)) - return false; - if (exclusionPatterns != null - && Util.isExcluded(resource, exclusionPatterns)) - return false; +// final char[][] exclusionPatterns = sourceLocation.exclusionPatterns; +// final IContainer outputFolder = sourceLocation.binaryFolder; +// final boolean isAlsoProject = sourceLocation.sourceFolder +// .equals(javaBuilder.currentProject); +// sourceLocation.sourceFolder.accept(new IResourceProxyVisitor() { +// public boolean visit(IResourceProxy proxy) throws CoreException { +// IResource resource = null; +// switch (proxy.getType()) { +// case IResource.FILE: +// if (net.sourceforge.phpdt.internal.compiler.util.Util +// .isJavaFileName(proxy.getName())) +// return false;// || +// // ProjectPrefUtil.isClassFileName(proxy.getName())) +// // return false; +// +// resource = proxy.requestResource(); +// if (javaBuilder.filterExtraResource(resource)) +// return false; +// if (exclusionPatterns != null +// && Util.isExcluded(resource, exclusionPatterns)) +// return false; +// +// IPath partialPath = resource.getFullPath() +// .removeFirstSegments(segmentCount); +// IResource copiedResource = outputFolder +// .getFile(partialPath); +// if (copiedResource.exists()) { +// if (deletedAll) { +// createErrorFor(resource, Util +// .bind("build.duplicateResource")); //$NON-NLS-1$ +// return false; +// } +// copiedResource.delete(IResource.FORCE, null); // last +// // one +// // wins +// } +// resource.copy(copiedResource.getFullPath(), +// IResource.FORCE, null); +// copiedResource.setDerived(true); +// return false; +// case IResource.FOLDER: +// resource = proxy.requestResource(); +// if (javaBuilder.filterExtraResource(resource)) +// return false; +// if (exclusionPatterns != null +// && Util.isExcluded(resource, exclusionPatterns)) +// return false; +// +// IPath folderPath = resource.getFullPath(); +// if (isAlsoProject && isExcludedFromProject(folderPath)) +// return false; // the sourceFolder == project +// // createFolder(folderPath.removeFirstSegments(segmentCount), +// // outputFolder); +// } +// return true; +// } +// }, IResource.NONE); +// } - IPath folderPath = resource.getFullPath(); - if (isAlsoProject && isExcludedFromProject(folderPath)) - return false; // the sourceFolder == project - // createFolder(folderPath.removeFirstSegments(segmentCount), - // outputFolder); - } - return true; - } - }, IResource.NONE); - } +// protected void copyPackages(ClasspathMultiDirectory sourceLocation) +// throws CoreException { +//// final int segmentCount = sourceLocation.sourceFolder.getFullPath() +//// .segmentCount(); +// final char[][] exclusionPatterns = sourceLocation.exclusionPatterns; +// //final IContainer outputFolder = sourceLocation.binaryFolder; +// final boolean isAlsoProject = sourceLocation.sourceFolder +// .equals(javaBuilder.currentProject); +// sourceLocation.sourceFolder.accept(new IResourceProxyVisitor() { +// public boolean visit(IResourceProxy proxy) throws CoreException { +// switch (proxy.getType()) { +// case IResource.FILE: +// return false; +// case IResource.FOLDER: +// IResource resource = proxy.requestResource(); +// if (javaBuilder.filterExtraResource(resource)) +// return false; +// if (exclusionPatterns != null +// && Util.isExcluded(resource, exclusionPatterns)) +// return false; +// +// IPath folderPath = resource.getFullPath(); +// if (isAlsoProject && isExcludedFromProject(folderPath)) +// return false; // the sourceFolder == project +// // createFolder(folderPath.removeFirstSegments(segmentCount), +// // outputFolder); +// } +// return true; +// } +// }, IResource.NONE); +// } public String toString() { return "batch image builder for:\n\tnew state: " + newState; //$NON-NLS-1$ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/ImageBuilderInternalException.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/ImageBuilderInternalException.java index 5c1c6bb..2ad336f 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/ImageBuilderInternalException.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/ImageBuilderInternalException.java @@ -18,6 +18,10 @@ import org.eclipse.core.runtime.CoreException; */ public class ImageBuilderInternalException extends RuntimeException { + /** + * + */ + private static final long serialVersionUID = 6513327092634795515L; protected CoreException coreException; public ImageBuilderInternalException(CoreException e) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/IncrementalImageBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/IncrementalImageBuilder.java index 20e5913..3a47e0e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/IncrementalImageBuilder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/IncrementalImageBuilder.java @@ -632,39 +632,39 @@ public class IncrementalImageBuilder extends AbstractImageBuilder { } } - protected void finishedWith(String sourceLocator, CompilationResult result, - char[] mainTypeName, ArrayList definedTypeNames, - ArrayList duplicateTypeNames) throws CoreException { - // char[][] previousTypeNames = - // newState.getDefinedTypeNamesFor(sourceLocator); - // if (previousTypeNames == null) - // previousTypeNames = new char[][]{mainTypeName}; - // IPath packagePath = null; - // next : for (int i = 0, l = previousTypeNames.length; i < l; i++) { - // char[] previous = previousTypeNames[i]; - // for (int j = 0, m = definedTypeNames.size(); j < m; j++) - // if (CharOperation.equals(previous, (char[]) definedTypeNames.get(j))) - // continue next; - // SourceFile sourceFile = (SourceFile) result.getCompilationUnit(); - // if (packagePath == null) { - // int count = sourceFile.sourceLocation.sourceFolder.getFullPath() - // .segmentCount(); - // packagePath = sourceFile.resource.getFullPath().removeFirstSegments( - // count).removeLastSegments(1); - // } - // if (secondaryTypesToRemove == null) - // this.secondaryTypesToRemove = new SimpleLookupTable(); - // ArrayList types = (ArrayList) secondaryTypesToRemove - // .get(sourceFile.sourceLocation.binaryFolder); - // if (types == null) - // types = new ArrayList(definedTypeNames.size()); - // types.add(packagePath.append(new String(previous))); - // secondaryTypesToRemove.put(sourceFile.sourceLocation.binaryFolder, - // types); - // } - // super.finishedWith(sourceLocator, result, mainTypeName, - // definedTypeNames, duplicateTypeNames); - } +// protected void finishedWith(String sourceLocator, CompilationResult result, +// char[] mainTypeName, ArrayList definedTypeNames, +// ArrayList duplicateTypeNames) throws CoreException { +// // char[][] previousTypeNames = +// // newState.getDefinedTypeNamesFor(sourceLocator); +// // if (previousTypeNames == null) +// // previousTypeNames = new char[][]{mainTypeName}; +// // IPath packagePath = null; +// // next : for (int i = 0, l = previousTypeNames.length; i < l; i++) { +// // char[] previous = previousTypeNames[i]; +// // for (int j = 0, m = definedTypeNames.size(); j < m; j++) +// // if (CharOperation.equals(previous, (char[]) definedTypeNames.get(j))) +// // continue next; +// // SourceFile sourceFile = (SourceFile) result.getCompilationUnit(); +// // if (packagePath == null) { +// // int count = sourceFile.sourceLocation.sourceFolder.getFullPath() +// // .segmentCount(); +// // packagePath = sourceFile.resource.getFullPath().removeFirstSegments( +// // count).removeLastSegments(1); +// // } +// // if (secondaryTypesToRemove == null) +// // this.secondaryTypesToRemove = new SimpleLookupTable(); +// // ArrayList types = (ArrayList) secondaryTypesToRemove +// // .get(sourceFile.sourceLocation.binaryFolder); +// // if (types == null) +// // types = new ArrayList(definedTypeNames.size()); +// // types.add(packagePath.append(new String(previous))); +// // secondaryTypesToRemove.put(sourceFile.sourceLocation.binaryFolder, +// // types); +// // } +// // super.finishedWith(sourceLocator, result, mainTypeName, +// // definedTypeNames, duplicateTypeNames); +// } // protected void removeClassFile(IPath typePath, IContainer outputFolder) // throws CoreException { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/MissingClassFileException.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/MissingClassFileException.java index bc3aaf3..a15d828 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/MissingClassFileException.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/MissingClassFileException.java @@ -16,6 +16,10 @@ package net.sourceforge.phpdt.internal.core.builder; */ public class MissingClassFileException extends RuntimeException { + /** + * + */ + private static final long serialVersionUID = 2297170822280656238L; protected String missingClassFile; public MissingClassFileException(String missingClassFile) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/MissingSourceFileException.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/MissingSourceFileException.java index bb5848b..2a71698 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/MissingSourceFileException.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/MissingSourceFileException.java @@ -16,6 +16,10 @@ package net.sourceforge.phpdt.internal.core.builder; */ public class MissingSourceFileException extends RuntimeException { + /** + * + */ + private static final long serialVersionUID = 2990201129498727559L; protected String missingSourceFile; public MissingSourceFileException(String missingSourceFile) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/NameEnvironment.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/NameEnvironment.java index 3a97ad7..32a8696 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/NameEnvironment.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/NameEnvironment.java @@ -13,7 +13,7 @@ package net.sourceforge.phpdt.internal.core.builder; import java.util.ArrayList; import net.sourceforge.phpdt.core.IClasspathEntry; -import net.sourceforge.phpdt.core.IJavaProject; +//import net.sourceforge.phpdt.core.IJavaProject; import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.compiler.CharOperation; import net.sourceforge.phpdt.internal.compiler.env.INameEnvironment; @@ -54,17 +54,17 @@ public class NameEnvironment implements INameEnvironment { setNames(null, null); } - public NameEnvironment(IJavaProject javaProject) { - this.isIncrementalBuild = false; - try { - computeClasspathLocations(javaProject.getProject().getWorkspace() - .getRoot(), (JavaProject) javaProject, null); - } catch (CoreException e) { - // this.sourceLocations = new ClasspathMultiDirectory[0]; - // this.binaryLocations = new ClasspathLocation[0]; - } - setNames(null, null); - } +// public NameEnvironment(IJavaProject javaProject) { +// this.isIncrementalBuild = false; +// try { +// computeClasspathLocations(javaProject.getProject().getWorkspace() +// .getRoot(), (JavaProject) javaProject, null); +// } catch (CoreException e) { +// // this.sourceLocations = new ClasspathMultiDirectory[0]; +// // this.binaryLocations = new ClasspathLocation[0]; +// } +// setNames(null, null); +// } /* * Some examples of resolved class path entries. Remember to search class diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/PHPBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/PHPBuilder.java index b6eebad..a462141 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/PHPBuilder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/PHPBuilder.java @@ -37,7 +37,7 @@ import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; +//import org.eclipse.core.resources.IResourceChangeEvent; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceVisitor; import org.eclipse.core.resources.IWorkspaceRoot; @@ -101,9 +101,9 @@ public class PHPBuilder extends IncrementalProjectBuilder { return new IMarker[0]; } - public static void finishedBuilding(IResourceChangeEvent event) { - BuildNotifier.resetProblemCounters(); - } +// public static void finishedBuilding(IResourceChangeEvent event) { +// BuildNotifier.resetProblemCounters(); +// } /** * Hook allowing to initialize some static state before a complete build diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/State.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/State.java index f610700..67b551f 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/State.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/State.java @@ -45,7 +45,7 @@ public class State { SimpleLookupTable structuralBuildTimes; - private String[] knownPackageNames; // of the form "p1/p2" + //private String[] knownPackageNames; // of the form "p1/p2" static final byte VERSION = 0x0007; @@ -59,7 +59,7 @@ public class State { } protected State(PHPBuilder javaBuilder) { - this.knownPackageNames = null; + //this.knownPackageNames = null; this.javaProjectName = javaBuilder.currentProject.getName(); this.sourceLocations = javaBuilder.nameEnvironment.sourceLocations; // this.binaryLocations = javaBuilder.nameEnvironment.binaryLocations; @@ -73,7 +73,7 @@ public class State { void copyFrom(State lastState) { // try { - this.knownPackageNames = null; + //this.knownPackageNames = null; this.buildNumber = lastState.buildNumber + 1; this.lastStructuralBuildTime = lastState.lastStructuralBuildTime; // this.references = (SimpleLookupTable) lastState.references.clone(); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/DOMField.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/DOMField.java index f40cff6..746ce4f 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/DOMField.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/DOMField.java @@ -381,19 +381,19 @@ class DOMField extends DOMMember implements IDOMField { * Returns the last field document fragment in this muli-declarator * statement. */ - protected DOMField getLastFieldDeclaration() { - DOMField field = this; - while (field.isVariableDeclarator() - || field.hasMultipleVariableDeclarators()) { - if (field.fNextNode instanceof DOMField - && ((DOMField) field.fNextNode).isVariableDeclarator()) { - field = (DOMField) field.fNextNode; - } else { - break; - } - } - return field; - } +// protected DOMField getLastFieldDeclaration() { +// DOMField field = this; +// while (field.isVariableDeclarator() +// || field.hasMultipleVariableDeclarators()) { +// if (field.fNextNode instanceof DOMField +// && ((DOMField) field.fNextNode).isVariableDeclarator()) { +// field = (DOMField) field.fNextNode; +// } else { +// break; +// } +// } +// return field; +// } /** * @see DOMMember#getMemberDeclarationStartPosition() @@ -413,40 +413,40 @@ class DOMField extends DOMMember implements IDOMField { * Returns a String representing this field declaration as a field * declaration with one variable declarator. */ - protected char[] getSingleVariableDeclaratorContents() { - - CharArrayBuffer buffer = new CharArrayBuffer(); - DOMField first = getFirstFieldDeclaration(); - if (first.isDetailed()) { - first.appendMemberHeaderFragment(buffer); - buffer.append(getType()); - if (isVariableDeclarator()) { - buffer.append(' '); - } else { - buffer.append(fDocument, fTypeRange[1] + 1, fNameRange[0] - - fTypeRange[1] - 1); - } - } else { - buffer.append(first.fDocument, first.fSourceRange[0], - first.fNameRange[0] - first.fSourceRange[0]); - } - - buffer.append(getName()); - if (hasInitializer()) { - if (fInitializerRange[0] < 0) { - buffer.append('=').append(fInitializer).append(';').append( - Util.LINE_SEPARATOR); - } else { - buffer.append(fDocument, fNameRange[1] + 1, - fInitializerRange[0] - fNameRange[1] - 1).append( - getInitializer()).append(';').append( - Util.LINE_SEPARATOR); - } - } else { - buffer.append(';').append(Util.LINE_SEPARATOR); - } - return buffer.getContents(); - } +// protected char[] getSingleVariableDeclaratorContents() { +// +// CharArrayBuffer buffer = new CharArrayBuffer(); +// DOMField first = getFirstFieldDeclaration(); +// if (first.isDetailed()) { +// first.appendMemberHeaderFragment(buffer); +// buffer.append(getType()); +// if (isVariableDeclarator()) { +// buffer.append(' '); +// } else { +// buffer.append(fDocument, fTypeRange[1] + 1, fNameRange[0] +// - fTypeRange[1] - 1); +// } +// } else { +// buffer.append(first.fDocument, first.fSourceRange[0], +// first.fNameRange[0] - first.fSourceRange[0]); +// } +// +// buffer.append(getName()); +// if (hasInitializer()) { +// if (fInitializerRange[0] < 0) { +// buffer.append('=').append(fInitializer).append(';').append( +// Util.LINE_SEPARATOR); +// } else { +// buffer.append(fDocument, fNameRange[1] + 1, +// fInitializerRange[0] - fNameRange[1] - 1).append( +// getInitializer()).append(';').append( +// Util.LINE_SEPARATOR); +// } +// } else { +// buffer.append(';').append(Util.LINE_SEPARATOR); +// } +// return buffer.getContents(); +// } /** * @see IDOMField#getType() diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/DOMType.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/DOMType.java index cc587d8..d0c21dc 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/DOMType.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/DOMType.java @@ -776,9 +776,9 @@ import net.sourceforge.phpdt.internal.core.util.CharArrayOps; /** * Sets the type keyword */ - void setTypeKeyword(String keyword) { - fTypeKeyword = keyword; - } +// void setTypeKeyword(String keyword) { +// fTypeKeyword = keyword; +// } /** * @see DOMNode#shareContents(DOMNode) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/SimpleDOMBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/SimpleDOMBuilder.java index 90bcd3d..786ce36 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/SimpleDOMBuilder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/SimpleDOMBuilder.java @@ -157,12 +157,12 @@ public class SimpleDOMBuilder extends AbstractDOMBuilder implements /** * */ - public void enterInitializer(int declarationSourceStart, int modifiers) { - int[] sourceRange = { declarationSourceStart, -1 }; - fNode = new DOMInitializer(fDocument, sourceRange, modifiers); - addChild(fNode); - fStack.push(fNode); - } +// public void enterInitializer(int declarationSourceStart, int modifiers) { +// int[] sourceRange = { declarationSourceStart, -1 }; +// fNode = new DOMInitializer(fDocument, sourceRange, modifiers); +// addChild(fNode); +// fStack.push(fNode); +// } /** */ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/ASTNodeFinder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/ASTNodeFinder.java deleted file mode 100644 index 4c10a87..0000000 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/ASTNodeFinder.java +++ /dev/null @@ -1,196 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package net.sourceforge.phpdt.internal.core.util; - -import java.util.ArrayList; - -import net.sourceforge.phpdt.core.IField; -import net.sourceforge.phpdt.core.IJavaElement; -import net.sourceforge.phpdt.core.IMethod; -import net.sourceforge.phpdt.core.IType; -import net.sourceforge.phpdt.core.compiler.CharOperation; -import net.sourceforge.phpdt.internal.compiler.ASTVisitor; -import net.sourceforge.phpdt.internal.compiler.ast.AbstractMethodDeclaration; -import net.sourceforge.phpdt.internal.compiler.ast.Argument; -import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration; -import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration; -import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration; -import net.sourceforge.phpdt.internal.compiler.ast.TypeReference; -import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope; -import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope; - -/** - * Finds an ASTNode given an IJavaElement in a CompilationUnitDeclaration - */ -public class ASTNodeFinder { - private CompilationUnitDeclaration unit; - - public ASTNodeFinder(CompilationUnitDeclaration unit) { - this.unit = unit; - } - - /* - * Finds the FieldDeclaration in the given ast corresponding to the given - * field handle. Returns null if not found. - */ - public FieldDeclaration findField(IField fieldHandle) { - TypeDeclaration typeDecl = findType((IType) fieldHandle.getParent()); - if (typeDecl == null) - return null; - FieldDeclaration[] fields = typeDecl.fields; - if (fields != null) { - char[] fieldName = fieldHandle.getElementName().toCharArray(); - for (int i = 0, length = fields.length; i < length; i++) { - FieldDeclaration field = fields[i]; - if (CharOperation.equals(fieldName, field.name)) { - return field; - } - } - } - return null; - } - - /* - * Finds the Initializer in the given ast corresponding to the given - * initializer handle. Returns null if not found. - */ - // public Initializer findInitializer(IInitializer initializerHandle) { - // TypeDeclaration typeDecl = - // findType((IType)initializerHandle.getParent()); - // if (typeDecl == null) return null; - // FieldDeclaration[] fields = typeDecl.fields; - // if (fields != null) { - // int occurenceCount = ((JavaElement)initializerHandle).occurrenceCount; - // for (int i = 0, length = fields.length; i < length; i++) { - // FieldDeclaration field = fields[i]; - // if (field instanceof Initializer && --occurenceCount == 0) { - // return (Initializer)field; - // } - // } - // } - // return null; - // } - /* - * Finds the AbstractMethodDeclaration in the given ast corresponding to the - * given method handle. Returns null if not found. - */ - public AbstractMethodDeclaration findMethod(IMethod methodHandle) { - TypeDeclaration typeDecl = findType((IType) methodHandle.getParent()); - if (typeDecl == null) - return null; - AbstractMethodDeclaration[] methods = typeDecl.methods; - if (methods != null) { - char[] selector = methodHandle.getElementName().toCharArray(); - String[] parameterTypeSignatures = methodHandle.getParameterTypes(); - int parameterCount = parameterTypeSignatures.length; - nextMethod: for (int i = 0, length = methods.length; i < length; i++) { - AbstractMethodDeclaration method = methods[i]; - if (CharOperation.equals(selector, method.selector)) { - Argument[] args = method.arguments; - int argsLength = args == null ? 0 : args.length; - if (argsLength == parameterCount) { - for (int j = 0; j < parameterCount; j++) { - TypeReference type = args[j].type; - String signature = Util.typeSignature(type); - if (!signature.equals(parameterTypeSignatures[j])) { - continue nextMethod; - } - } - return method; - } - } - } - } - return null; - } - - /* - * Finds the TypeDeclaration in the given ast corresponding to the given - * type handle. Returns null if not found. - */ - public TypeDeclaration findType(IType typeHandle) { - IJavaElement parent = typeHandle.getParent(); - final char[] typeName = typeHandle.getElementName().toCharArray(); - // final int occurenceCount = ((SourceType)typeHandle).occurrenceCount; - final boolean findAnonymous = typeName.length == 0; - class Visitor extends ASTVisitor { - TypeDeclaration result; - - int count = 0; - - public boolean visit(TypeDeclaration typeDeclaration, - BlockScope scope) { - if (result != null) - return false; - // if ((typeDeclaration.bits & ASTNode.IsAnonymousTypeMASK) != - // 0) { - // if (findAnonymous && ++count == occurenceCount) { - // result = typeDeclaration; - // } - // } else { - if (!findAnonymous - && CharOperation.equals(typeName, typeDeclaration.name)) { - result = typeDeclaration; - } - // } - return false; // visit only one level - } - } - switch (parent.getElementType()) { - case IJavaElement.COMPILATION_UNIT: - ArrayList types = this.unit.types; - if (types != null) { - for (int i = 0, length = types.size(); i < length; i++) { - TypeDeclaration type = (TypeDeclaration) types.get(i);// [i]; - if (CharOperation.equals(typeName, type.name)) { - return type; - } - } - } - break; - case IJavaElement.TYPE: - TypeDeclaration parentDecl = findType((IType) parent); - if (parentDecl == null) - return null; - // types = parentDecl.memberTypes; - // if (types != null) { - // for (int i = 0, length = types.length; i < length; i++) { - // TypeDeclaration type = types[i]; - // if (CharOperation.equals(typeName, type.name)) { - // return type; - // } - // } - // } - break; - case IJavaElement.FIELD: - FieldDeclaration fieldDecl = findField((IField) parent); - if (fieldDecl == null) - return null; - Visitor visitor = new Visitor(); - fieldDecl.traverse(visitor, null); - return visitor.result; - // case IJavaElement.INITIALIZER: - // Initializer initializer = findInitializer((IInitializer)parent); - // if (initializer == null) return null; - // visitor = new Visitor(); - // initializer.traverse(visitor, null); - // return visitor.result; - case IJavaElement.METHOD: - AbstractMethodDeclaration methodDecl = findMethod((IMethod) parent); - if (methodDecl == null) - return null; - visitor = new Visitor(); - methodDecl.traverse(visitor, (ClassScope) null); - return visitor.result; - } - return null; - } -} diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CharArrayBuffer.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CharArrayBuffer.java index 8aecc50..059b4f7 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CharArrayBuffer.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CharArrayBuffer.java @@ -73,9 +73,9 @@ public class CharArrayBuffer { * @param first - * the first element to be placed in the buffer, ignored if null */ - public CharArrayBuffer(char[] first) { - this(first, DEFAULT_BUFFER_SIZE); - } +// public CharArrayBuffer(char[] first) { +// this(first, DEFAULT_BUFFER_SIZE); +// } /** * Creates a CharArrayBuffer with the given buffer size, and @@ -102,9 +102,9 @@ public class CharArrayBuffer { * @param size - * the size of the buffer. */ - public CharArrayBuffer(int size) { - this(null, size); - } +// public CharArrayBuffer(int size) { +// this(null, size); +// } /** * Appends the entire given char array. Given for convenience. diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CharArrayOps.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CharArrayOps.java index 119b1f6..ab09a12 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CharArrayOps.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CharArrayOps.java @@ -90,14 +90,14 @@ public class CharArrayOps { // TODO: should promote to CharOperation * Returns the index of the first occurrence of character in buffer, * starting from offset, or -1 if not found. */ - public static int indexOf(char character, char[] buffer, int offset) { - for (int i = offset; i < buffer.length; i++) { - if (buffer[i] == character) { - return i; - } - } - return -1; - } +// public static int indexOf(char character, char[] buffer, int offset) { +// for (int i = offset; i < buffer.length; i++) { +// if (buffer[i] == character) { +// return i; +// } +// } +// return -1; +// } /** * Extracts a sub-array from the given array, starting at the given diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CommentRecorderParser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CommentRecorderParser.java index a3bee75..8ec7bd3 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CommentRecorderParser.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CommentRecorderParser.java @@ -170,68 +170,68 @@ public class CommentRecorderParser extends UnitParser { * * @see net.sourceforge.phpdt.internal.compiler.parser.Parser#flushCommentsDefinedPriorTo(int) */ - public int flushCommentsDefinedPriorTo(int position) { - - int lastCommentIndex = this.scanner.commentPtr; - if (lastCommentIndex < 0) - return position; // no comment - - // compute the index of the first obsolete comment - int index = lastCommentIndex; - int validCount = 0; - while (index >= 0) { - int commentEnd = this.scanner.commentStops[index]; - if (commentEnd < 0) - commentEnd = -commentEnd; // negative end position for - // non-javadoc comments - if (commentEnd <= position) { - break; - } - index--; - validCount++; - } - // if the source at is immediately followed by a line - // comment, then - // flush this comment and shift to the comment end. - if (validCount > 0) { - int immediateCommentEnd = 0; - while (index < lastCommentIndex - && (immediateCommentEnd = -this.scanner.commentStops[index + 1]) > 0) { // only - // tolerating - // non-javadoc - // comments - // (non-javadoc - // comment - // end - // positions - // are - // negative) - // is there any line break until the end of the immediate - // comment ? (thus only tolerating line comment) - immediateCommentEnd--; // comment end in one char too far - if (this.scanner.getLineNumber(position) != this.scanner - .getLineNumber(immediateCommentEnd)) - break; - position = immediateCommentEnd; - validCount--; // flush this comment - index++; - } - } - - if (index < 0) - return position; // no obsolete comment - pushOnCommentsStack(0, index); // store comment before flushing them - - if (validCount > 0) { // move valid comment infos, overriding obsolete - // comment infos - System.arraycopy(this.scanner.commentStarts, index + 1, - this.scanner.commentStarts, 0, validCount); - System.arraycopy(this.scanner.commentStops, index + 1, - this.scanner.commentStops, 0, validCount); - } - this.scanner.commentPtr = validCount - 1; - return position; - } +// public int flushCommentsDefinedPriorTo(int position) { +// +// int lastCommentIndex = this.scanner.commentPtr; +// if (lastCommentIndex < 0) +// return position; // no comment +// +// // compute the index of the first obsolete comment +// int index = lastCommentIndex; +// int validCount = 0; +// while (index >= 0) { +// int commentEnd = this.scanner.commentStops[index]; +// if (commentEnd < 0) +// commentEnd = -commentEnd; // negative end position for +// // non-javadoc comments +// if (commentEnd <= position) { +// break; +// } +// index--; +// validCount++; +// } +// // if the source at is immediately followed by a line +// // comment, then +// // flush this comment and shift to the comment end. +// if (validCount > 0) { +// int immediateCommentEnd = 0; +// while (index < lastCommentIndex +// && (immediateCommentEnd = -this.scanner.commentStops[index + 1]) > 0) { // only +// // tolerating +// // non-javadoc +// // comments +// // (non-javadoc +// // comment +// // end +// // positions +// // are +// // negative) +// // is there any line break until the end of the immediate +// // comment ? (thus only tolerating line comment) +// immediateCommentEnd--; // comment end in one char too far +// if (this.scanner.getLineNumber(position) != this.scanner +// .getLineNumber(immediateCommentEnd)) +// break; +// position = immediateCommentEnd; +// validCount--; // flush this comment +// index++; +// } +// } +// +// if (index < 0) +// return position; // no obsolete comment +// pushOnCommentsStack(0, index); // store comment before flushing them +// +// if (validCount > 0) { // move valid comment infos, overriding obsolete +// // comment infos +// System.arraycopy(this.scanner.commentStarts, index + 1, +// this.scanner.commentStarts, 0, validCount); +// System.arraycopy(this.scanner.commentStops, index + 1, +// this.scanner.commentStops, 0, validCount); +// } +// this.scanner.commentPtr = validCount - 1; +// return position; +// } /* * Build a n*2 matrix of comments positions. For each position, 0 is for diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/LRUCache.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/LRUCache.java index 9f80e04..87e863a 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/LRUCache.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/LRUCache.java @@ -131,10 +131,10 @@ public class LRUCache implements Cloneable { * Creates a new cache. Size of cache is defined by * DEFAULT_SPACELIMIT. */ - public LRUCache() { - - this(DEFAULT_SPACELIMIT); - } +// public LRUCache() { +// +// this(DEFAULT_SPACELIMIT); +// } /** * Creates a new cache. @@ -191,18 +191,18 @@ public class LRUCache implements Cloneable { * @param key * Key of object to flush */ - public void flush(Object key) { - - LRUCacheEntry entry; - - entry = (LRUCacheEntry) fEntryTable.get(key); - - /* If entry does not exist, return */ - if (entry == null) - return; - - this.privateRemoveEntry(entry, false); - } +// public void flush(Object key) { +// +// LRUCacheEntry entry; +// +// entry = (LRUCacheEntry) fEntryTable.get(key); +// +// /* If entry does not exist, return */ +// if (entry == null) +// return; +// +// this.privateRemoveEntry(entry, false); +// } /** * Answers the value in the cache at the given key. If the value is not in @@ -249,30 +249,30 @@ public class LRUCache implements Cloneable { * Returns an enumeration that iterates over all the keys and values * currently in the cache. */ - public ICacheEnumeration keysAndValues() { - return new ICacheEnumeration() { - - Enumeration fValues = fEntryTable.elements(); - - LRUCacheEntry fEntry; - - public boolean hasMoreElements() { - return fValues.hasMoreElements(); - } - - public Object nextElement() { - fEntry = (LRUCacheEntry) fValues.nextElement(); - return fEntry._fKey; - } - - public Object getValue() { - if (fEntry == null) { - throw new java.util.NoSuchElementException(); - } - return fEntry._fValue; - } - }; - } +// public ICacheEnumeration keysAndValues() { +// return new ICacheEnumeration() { +// +// Enumeration fValues = fEntryTable.elements(); +// +// LRUCacheEntry fEntry; +// +// public boolean hasMoreElements() { +// return fValues.hasMoreElements(); +// } +// +// public Object nextElement() { +// fEntry = (LRUCacheEntry) fValues.nextElement(); +// return fEntry._fKey; +// } +// +// public Object getValue() { +// if (fEntry == null) { +// throw new java.util.NoSuchElementException(); +// } +// return fEntry._fValue; +// } +// }; +// } /** * Ensures there is the specified amount of free space in the receiver, by @@ -463,12 +463,12 @@ public class LRUCache implements Cloneable { * @param limit * Number of units of cache space */ - public void setSpaceLimit(int limit) { - if (limit < fSpaceLimit) { - makeSpace(fSpaceLimit - limit); - } - fSpaceLimit = limit; - } +// public void setSpaceLimit(int limit) { +// if (limit < fSpaceLimit) { +// makeSpace(fSpaceLimit - limit); +// } +// fSpaceLimit = limit; +// } /** * Returns the space taken by the given key and value. diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleLookupTable.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleLookupTable.java index 0caafdd..0292b38 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleLookupTable.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleLookupTable.java @@ -26,9 +26,9 @@ public final class SimpleLookupTable implements Cloneable { public int threshold; - public SimpleLookupTable() { - this(13); - } +// public SimpleLookupTable() { +// this(13); +// } public SimpleLookupTable(int size) { if (size < 3) @@ -81,13 +81,13 @@ public final class SimpleLookupTable implements Cloneable { return null; } - public Object keyForValue(Object valueToMatch) { - if (valueToMatch != null) - for (int i = 0, l = valueTable.length; i < l; i++) - if (valueToMatch.equals(valueTable[i])) - return keyTable[i]; - return null; - } +// public Object keyForValue(Object valueToMatch) { +// if (valueToMatch != null) +// for (int i = 0, l = valueTable.length; i < l; i++) +// if (valueToMatch.equals(valueTable[i])) +// return keyTable[i]; +// return null; +// } public Object put(Object key, Object value) { int length = keyTable.length; @@ -108,42 +108,42 @@ public final class SimpleLookupTable implements Cloneable { return value; } - public Object removeKey(Object key) { - int length = keyTable.length; - int index = (key.hashCode() & 0x7FFFFFFF) % length; - Object currentKey; - while ((currentKey = keyTable[index]) != null) { - if (currentKey.equals(key)) { - elementSize--; - Object oldValue = valueTable[index]; - keyTable[index] = null; - valueTable[index] = null; - if (keyTable[index + 1 == length ? 0 : index + 1] != null) - rehash(); // only needed if a possible collision existed - return oldValue; - } - if (++index == length) - index = 0; - } - return null; - } - - public void removeValue(Object valueToRemove) { - boolean rehash = false; - for (int i = 0, l = valueTable.length; i < l; i++) { - Object value = valueTable[i]; - if (value != null && value.equals(valueToRemove)) { - elementSize--; - keyTable[i] = null; - valueTable[i] = null; - if (!rehash && keyTable[i + 1 == l ? 0 : i + 1] != null) - rehash = true; // only needed if a possible collision - // existed - } - } - if (rehash) - rehash(); - } +// public Object removeKey(Object key) { +// int length = keyTable.length; +// int index = (key.hashCode() & 0x7FFFFFFF) % length; +// Object currentKey; +// while ((currentKey = keyTable[index]) != null) { +// if (currentKey.equals(key)) { +// elementSize--; +// Object oldValue = valueTable[index]; +// keyTable[index] = null; +// valueTable[index] = null; +// if (keyTable[index + 1 == length ? 0 : index + 1] != null) +// rehash(); // only needed if a possible collision existed +// return oldValue; +// } +// if (++index == length) +// index = 0; +// } +// return null; +// } + +// public void removeValue(Object valueToRemove) { +// boolean rehash = false; +// for (int i = 0, l = valueTable.length; i < l; i++) { +// Object value = valueTable[i]; +// if (value != null && value.equals(valueToRemove)) { +// elementSize--; +// keyTable[i] = null; +// valueTable[i] = null; +// if (!rehash && keyTable[i + 1 == l ? 0 : i + 1] != null) +// rehash = true; // only needed if a possible collision +// // existed +// } +// } +// if (rehash) +// rehash(); +// } private void rehash() { SimpleLookupTable newLookupTable = new SimpleLookupTable( diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleSet.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleSet.java deleted file mode 100644 index d5d20f5..0000000 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleSet.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package net.sourceforge.phpdt.internal.core.util; - -/** - * A simple lookup table is a non-synchronized Hashtable, whose keys and values - * are Objects. It also uses linear probing to resolve collisions rather than a - * linked list of hash table entries. - */ -public final class SimpleSet implements Cloneable { - - // to avoid using Enumerations, walk the individual values skipping nulls - public Object[] values; - - public int elementSize; // number of elements in the table - - public int threshold; - - public SimpleSet() { - this(13); - } - - public SimpleSet(int size) { - if (size < 3) - size = 3; - this.elementSize = 0; - this.threshold = size + 1; // size is the expected number of elements - this.values = new Object[2 * size + 1]; - } - - public Object add(Object object) { - int length = values.length; - int index = (object.hashCode() & 0x7FFFFFFF) % length; - Object current; - while ((current = values[index]) != null) { - if (current.equals(object)) - return values[index] = object; - if (++index == length) - index = 0; - } - values[index] = object; - - // assumes the threshold is never equal to the size of the table - if (++elementSize > threshold) - rehash(); - return object; - } - - public Object clone() throws CloneNotSupportedException { - SimpleSet result = (SimpleSet) super.clone(); - result.elementSize = this.elementSize; - result.threshold = this.threshold; - - int length = this.values.length; - result.values = new Object[length]; - System.arraycopy(this.values, 0, result.values, 0, length); - return result; - } - - public boolean includes(Object object) { - int length = values.length; - int index = (object.hashCode() & 0x7FFFFFFF) % length; - Object current; - while ((current = values[index]) != null) { - if (current.equals(object)) - return true; - if (++index == length) - index = 0; - } - return false; - } - - public Object remove(Object object) { - int length = values.length; - int index = (object.hashCode() & 0x7FFFFFFF) % length; - Object current; - while ((current = values[index]) != null) { - if (current.equals(object)) { - elementSize--; - Object oldValue = values[index]; - values[index] = null; - if (values[index + 1 == length ? 0 : index + 1] != null) - rehash(); // only needed if a possible collision existed - return oldValue; - } - if (++index == length) - index = 0; - } - return null; - } - - private void rehash() { - SimpleSet newSet = new SimpleSet(elementSize * 2); // double the number - // of expected - // elements - Object current; - for (int i = values.length; --i >= 0;) - if ((current = values[i]) != null) - newSet.add(current); - - this.values = newSet.values; - this.elementSize = newSet.elementSize; - this.threshold = newSet.threshold; - } - - public String toString() { - String s = ""; //$NON-NLS-1$ - Object object; - for (int i = 0, l = values.length; i < l; i++) - if ((object = values[i]) != null) - s += object.toString() + "\n"; //$NON-NLS-1$ - return s; - } -} diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleWordSet.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleWordSet.java deleted file mode 100644 index 7ed0065..0000000 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/SimpleWordSet.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package net.sourceforge.phpdt.internal.core.util; - -import net.sourceforge.phpdt.core.compiler.CharOperation; - -public final class SimpleWordSet { - - // to avoid using Enumerations, walk the individual values skipping nulls - public char[][] words; - - public int elementSize; // number of elements in the table - - public int threshold; - - public SimpleWordSet(int size) { - this.elementSize = 0; - this.threshold = size; // size represents the expected number of - // elements - int extraRoom = (int) (size * 1.5f); - if (this.threshold == extraRoom) - extraRoom++; - this.words = new char[extraRoom][]; - } - - public char[] add(char[] word) { - int length = this.words.length; - int index = CharOperation.hashCode(word) % length; - char[] current; - while ((current = words[index]) != null) { - if (CharOperation.equals(current, word)) - return current; - if (++index == length) - index = 0; - } - words[index] = word; - - // assumes the threshold is never equal to the size of the table - if (++elementSize > threshold) - rehash(); - return word; - } - - public boolean includes(char[] word) { - int length = this.words.length; - int index = CharOperation.hashCode(word) % length; - char[] current; - while ((current = words[index]) != null) { - if (CharOperation.equals(current, word)) - return true; - if (++index == length) - index = 0; - } - return false; - } - - private void rehash() { - SimpleWordSet newSet = new SimpleWordSet(elementSize * 2); // double - // the - // number of - // expected - // elements - char[] current; - for (int i = words.length; --i >= 0;) - if ((current = words[i]) != null) - newSet.add(current); - - this.words = newSet.words; - this.elementSize = newSet.elementSize; - this.threshold = newSet.threshold; - } -} \ No newline at end of file diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/Util.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/Util.java index 0661b89..590624d 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/Util.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/Util.java @@ -11,17 +11,17 @@ package net.sourceforge.phpdt.internal.core.util; import java.io.BufferedInputStream; -import java.io.DataInput; -import java.io.EOFException; +//import java.io.DataInput; +//import java.io.EOFException; import java.io.IOException; import java.io.InputStream; -import java.io.OutputStream; +//import java.io.OutputStream; import java.io.PrintStream; -import java.io.UTFDataFormatException; +//import java.io.UTFDataFormatException; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; -import java.util.StringTokenizer; +//import java.util.StringTokenizer; import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.IJavaModelStatusConstants; @@ -30,10 +30,10 @@ import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.JavaModelException; import net.sourceforge.phpdt.core.Signature; import net.sourceforge.phpdt.core.compiler.CharOperation; -import net.sourceforge.phpdt.internal.compiler.ast.TypeReference; +//import net.sourceforge.phpdt.internal.compiler.ast.TypeReference; //incastrix //import net.sourceforge.phpdt.internal.corext.Assert; -import org.eclipse.core.runtime.Assert; +//import org.eclipse.core.runtime.Assert; //import net.sourceforge.phpdt.internal.core.PackageFragmentRoot; import net.sourceforge.phpdt.internal.core.util.PHPFileUtil; @@ -305,19 +305,19 @@ public class Util { * * @see #concat(String, String) */ - public static String concat(String s1, char c, String s2) { - if (s1 == null) - s1 = "null"; //$NON-NLS-1$ - if (s2 == null) - s2 = "null"; //$NON-NLS-1$ - int l1 = s1.length(); - int l2 = s2.length(); - char[] buf = new char[l1 + 1 + l2]; - s1.getChars(0, l1, buf, 0); - buf[l1] = c; - s2.getChars(0, l2, buf, l1 + 1); - return new String(buf); - } +// public static String concat(String s1, char c, String s2) { +// if (s1 == null) +// s1 = "null"; //$NON-NLS-1$ +// if (s2 == null) +// s2 = "null"; //$NON-NLS-1$ +// int l1 = s1.length(); +// int l2 = s2.length(); +// char[] buf = new char[l1 + 1 + l2]; +// s1.getChars(0, l1, buf, 0); +// buf[l1] = c; +// s2.getChars(0, l2, buf, l1 + 1); +// return new String(buf); +// } /** * Concatenate two strings. Much faster than using +, which: - creates a @@ -344,22 +344,22 @@ public class Util { * * @see #concat(String, String) */ - public static String concat(String s1, String s2, String s3) { - if (s1 == null) - s1 = "null"; //$NON-NLS-1$ - if (s2 == null) - s2 = "null"; //$NON-NLS-1$ - if (s3 == null) - s3 = "null"; //$NON-NLS-1$ - int l1 = s1.length(); - int l2 = s2.length(); - int l3 = s3.length(); - char[] buf = new char[l1 + l2 + l3]; - s1.getChars(0, l1, buf, 0); - s2.getChars(0, l2, buf, l1); - s3.getChars(0, l3, buf, l1 + l2); - return new String(buf); - } +// public static String concat(String s1, String s2, String s3) { +// if (s1 == null) +// s1 = "null"; //$NON-NLS-1$ +// if (s2 == null) +// s2 = "null"; //$NON-NLS-1$ +// if (s3 == null) +// s3 = "null"; //$NON-NLS-1$ +// int l1 = s1.length(); +// int l2 = s2.length(); +// int l3 = s3.length(); +// char[] buf = new char[l1 + l2 + l3]; +// s1.getChars(0, l1, buf, 0); +// s2.getChars(0, l2, buf, l1); +// s3.getChars(0, l3, buf, l1 + l2); +// return new String(buf); +// } /** * Converts a type signature from the IBinaryType representation to the DC @@ -400,25 +400,25 @@ public class Util { * Returns true iff str.toLowerCase().endsWith(end.toLowerCase()) * implementation is not creating extra strings. */ - public final static boolean endsWithIgnoreCase(String str, String end) { - - int strLength = str == null ? 0 : str.length(); - int endLength = end == null ? 0 : end.length(); - - // return false if the string is smaller than the end. - if (endLength > strLength) - return false; - - // return false if any character of the end are - // not the same in lower case. - for (int i = 1; i <= endLength; i++) { - if (Character.toLowerCase(end.charAt(endLength - i)) != Character - .toLowerCase(str.charAt(strLength - i))) - return false; - } - - return true; - } +// public final static boolean endsWithIgnoreCase(String str, String end) { +// +// int strLength = str == null ? 0 : str.length(); +// int endLength = end == null ? 0 : end.length(); +// +// // return false if the string is smaller than the end. +// if (endLength > strLength) +// return false; +// +// // return false if any character of the end are +// // not the same in lower case. +// for (int i = 1; i <= endLength; i++) { +// if (Character.toLowerCase(end.charAt(endLength - i)) != Character +// .toLowerCase(str.charAt(strLength - i))) +// return false; +// } +// +// return true; +// } /** * Compares two arrays using equals() on the elements. Either or both arrays @@ -426,20 +426,20 @@ public class Util { * null. If both are arrays, returns true iff they have the same length and * all elements are equal. */ - public static boolean equalArraysOrNull(int[] a, int[] b) { - if (a == b) - return true; - if (a == null || b == null) - return false; - int len = a.length; - if (len != b.length) - return false; - for (int i = 0; i < len; ++i) { - if (a[i] != b[i]) - return false; - } - return true; - } +// public static boolean equalArraysOrNull(int[] a, int[] b) { +// if (a == b) +// return true; +// if (a == null || b == null) +// return false; +// int len = a.length; +// if (len != b.length) +// return false; +// for (int i = 0; i < len; ++i) { +// if (a[i] != b[i]) +// return false; +// } +// return true; +// } /** * Compares two arrays using equals() on the elements. Either or both arrays @@ -476,25 +476,25 @@ public class Util { * elements compare true with equals. The original arrays are left * untouched. */ - public static boolean equalArraysOrNullSortFirst(Comparable[] a, - Comparable[] b) { - if (a == b) - return true; - if (a == null || b == null) - return false; - int len = a.length; - if (len != b.length) - return false; - if (len >= 2) { // only need to sort if more than two items - a = sortCopy(a); - b = sortCopy(b); - } - for (int i = 0; i < len; ++i) { - if (!a[i].equals(b[i])) - return false; - } - return true; - } +// public static boolean equalArraysOrNullSortFirst(Comparable[] a, +// Comparable[] b) { +// if (a == b) +// return true; +// if (a == null || b == null) +// return false; +// int len = a.length; +// if (len != b.length) +// return false; +// if (len >= 2) { // only need to sort if more than two items +// a = sortCopy(a); +// b = sortCopy(b); +// } +// for (int i = 0; i < len; ++i) { +// if (!a[i].equals(b[i])) +// return false; +// } +// return true; +// } /** * Compares two String arrays using equals() on the elements. The arrays are @@ -504,95 +504,95 @@ public class Util { * elements compare true with equals. The original arrays are left * untouched. */ - public static boolean equalArraysOrNullSortFirst(String[] a, String[] b) { - if (a == b) - return true; - if (a == null || b == null) - return false; - int len = a.length; - if (len != b.length) - return false; - if (len >= 2) { // only need to sort if more than two items - a = sortCopy(a); - b = sortCopy(b); - } - for (int i = 0; i < len; ++i) { - if (!a[i].equals(b[i])) - return false; - } - return true; - } +// public static boolean equalArraysOrNullSortFirst(String[] a, String[] b) { +// if (a == b) +// return true; +// if (a == null || b == null) +// return false; +// int len = a.length; +// if (len != b.length) +// return false; +// if (len >= 2) { // only need to sort if more than two items +// a = sortCopy(a); +// b = sortCopy(b); +// } +// for (int i = 0; i < len; ++i) { +// if (!a[i].equals(b[i])) +// return false; +// } +// return true; +// } /** * Compares two objects using equals(). Either or both array may be null. * Returns true if both are null. Returns false if only one is null. * Otherwise, return the result of comparing with equals(). */ - public static boolean equalOrNull(Object a, Object b) { - if (a == b) { - return true; - } - if (a == null || b == null) { - return false; - } - return a.equals(b); - } +// public static boolean equalOrNull(Object a, Object b) { +// if (a == b) { +// return true; +// } +// if (a == null || b == null) { +// return false; +// } +// return a.equals(b); +// } /** * Given a qualified name, extract the last component. If the input is not * qualified, the same string is answered. */ - public static String extractLastName(String qualifiedName) { - int i = qualifiedName.lastIndexOf('.'); - if (i == -1) - return qualifiedName; - return qualifiedName.substring(i + 1); - } +// public static String extractLastName(String qualifiedName) { +// int i = qualifiedName.lastIndexOf('.'); +// if (i == -1) +// return qualifiedName; +// return qualifiedName.substring(i + 1); +// } /** * Extracts the parameter types from a method signature. */ - public static String[] extractParameterTypes(char[] sig) { - int count = getParameterCount(sig); - String[] result = new String[count]; - if (count == 0) - return result; - int i = CharOperation.indexOf('(', sig) + 1; - count = 0; - int len = sig.length; - int start = i; - for (;;) { - if (i == len) - break; - char c = sig[i]; - if (c == ')') - break; - if (c == '[') { - ++i; - } else if (c == 'L') { - i = CharOperation.indexOf(';', sig, i + 1) + 1; - Assert.isTrue(i != 0); - result[count++] = convertTypeSignature(CharOperation.subarray( - sig, start, i)); - start = i; - } else { - ++i; - result[count++] = convertTypeSignature(CharOperation.subarray( - sig, start, i)); - start = i; - } - } - return result; - } +// public static String[] extractParameterTypes(char[] sig) { +// int count = getParameterCount(sig); +// String[] result = new String[count]; +// if (count == 0) +// return result; +// int i = CharOperation.indexOf('(', sig) + 1; +// count = 0; +// int len = sig.length; +// int start = i; +// for (;;) { +// if (i == len) +// break; +// char c = sig[i]; +// if (c == ')') +// break; +// if (c == '[') { +// ++i; +// } else if (c == 'L') { +// i = CharOperation.indexOf(';', sig, i + 1) + 1; +// Assert.isTrue(i != 0); +// result[count++] = convertTypeSignature(CharOperation.subarray( +// sig, start, i)); +// start = i; +// } else { +// ++i; +// result[count++] = convertTypeSignature(CharOperation.subarray( +// sig, start, i)); +// start = i; +// } +// } +// return result; +// } /** * Extracts the return type from a method signature. */ - public static String extractReturnType(String sig) { - int i = sig.lastIndexOf(')'); - Assert.isTrue(i != -1); - return sig.substring(i + 1); - } +// public static String extractReturnType(String sig) { +// int i = sig.lastIndexOf(')'); +// Assert.isTrue(i != -1); +// return sig.substring(i + 1); +// } // private static IFile findFirstClassFile(IFolder folder) { // try { @@ -773,30 +773,30 @@ public class Util { /** * Returns the number of parameter types in a method signature. */ - public static int getParameterCount(char[] sig) { - int i = CharOperation.indexOf('(', sig) + 1; - Assert.isTrue(i != 0); - int count = 0; - int len = sig.length; - for (;;) { - if (i == len) - break; - char c = sig[i]; - if (c == ')') - break; - if (c == '[') { - ++i; - } else if (c == 'L') { - ++count; - i = CharOperation.indexOf(';', sig, i + 1) + 1; - Assert.isTrue(i != 0); - } else { - ++count; - ++i; - } - } - return count; - } +// public static int getParameterCount(char[] sig) { +// int i = CharOperation.indexOf('(', sig) + 1; +// Assert.isTrue(i != 0); +// int count = 0; +// int len = sig.length; +// for (;;) { +// if (i == len) +// break; +// char c = sig[i]; +// if (c == ')') +// break; +// if (c == '[') { +// ++i; +// } else if (c == 'L') { +// ++count; +// i = CharOperation.indexOf(';', sig, i + 1) + 1; +// Assert.isTrue(i != 0); +// } else { +// ++count; +// ++i; +// } +// } +// return count; +// } /** * Put all the arguments in one String. @@ -825,40 +825,40 @@ public class Util { * Separate all the arguments of a String made by * getProblemArgumentsForMarker */ - public static String[] getProblemArgumentsFromMarker(String argumentsString) { - if (argumentsString == null) - return null; - int index = argumentsString.indexOf(':'); - if (index == -1) - return null; - - int length = argumentsString.length(); - int numberOfArg; - try { - numberOfArg = Integer.parseInt(argumentsString.substring(0, index)); - } catch (NumberFormatException e) { - return null; - } - argumentsString = argumentsString.substring(index + 1, length); - - String[] args = new String[length]; - int count = 0; - - StringTokenizer tokenizer = new StringTokenizer(argumentsString, - ARGUMENTS_DELIMITER); - while (tokenizer.hasMoreTokens()) { - String argument = tokenizer.nextToken(); - if (argument.equals(EMPTY_ARGUMENT)) - argument = ""; //$NON-NLS-1$ - args[count++] = argument; - } - - if (count != numberOfArg) - return null; - - System.arraycopy(args, 0, args = new String[count], 0, count); - return args; - } +// public static String[] getProblemArgumentsFromMarker(String argumentsString) { +// if (argumentsString == null) +// return null; +// int index = argumentsString.indexOf(':'); +// if (index == -1) +// return null; +// +// int length = argumentsString.length(); +// int numberOfArg; +// try { +// numberOfArg = Integer.parseInt(argumentsString.substring(0, index)); +// } catch (NumberFormatException e) { +// return null; +// } +// argumentsString = argumentsString.substring(index + 1, length); +// +// String[] args = new String[length]; +// int count = 0; +// +// StringTokenizer tokenizer = new StringTokenizer(argumentsString, +// ARGUMENTS_DELIMITER); +// while (tokenizer.hasMoreTokens()) { +// String argument = tokenizer.nextToken(); +// if (argument.equals(EMPTY_ARGUMENT)) +// argument = ""; //$NON-NLS-1$ +// args[count++] = argument; +// } +// +// if (count != numberOfArg) +// return null; +// +// System.arraycopy(args, 0, args = new String[count], 0, count); +// return args; +// } /** * Returns the given file's contents as a byte array. @@ -979,17 +979,17 @@ public class Util { * Returns the index of the first argument paths which is strictly nested * inside the path to check */ - public static int indexOfNestedPath(IPath checkedPath, IPath[] paths, - int pathCount) { - - for (int i = 0; i < pathCount; i++) { - if (checkedPath.equals(paths[i])) - continue; - if (checkedPath.isPrefixOf(paths[i])) - return i; - } - return -1; - } +// public static int indexOfNestedPath(IPath checkedPath, IPath[] paths, +// int pathCount) { +// +// for (int i = 0; i < pathCount; i++) { +// if (checkedPath.equals(paths[i])) +// continue; +// if (checkedPath.isPrefixOf(paths[i])) +// return i; +// } +// return -1; +// } /* * Returns whether the given java element is exluded from its root's @@ -1308,51 +1308,51 @@ public class Util { /** * Returns the length of the common prefix between s1 and s2. */ - public static int prefixLength(char[] s1, char[] s2) { - int len = 0; - int max = Math.min(s1.length, s2.length); - for (int i = 0; i < max && s1[i] == s2[i]; ++i) - ++len; - return len; - } +// public static int prefixLength(char[] s1, char[] s2) { +// int len = 0; +// int max = Math.min(s1.length, s2.length); +// for (int i = 0; i < max && s1[i] == s2[i]; ++i) +// ++len; +// return len; +// } /** * Returns the length of the common prefix between s1 and s2. */ - public static int prefixLength(String s1, String s2) { - int len = 0; - int max = Math.min(s1.length(), s2.length()); - for (int i = 0; i < max && s1.charAt(i) == s2.charAt(i); ++i) - ++len; - return len; - } +// public static int prefixLength(String s1, String s2) { +// int len = 0; +// int max = Math.min(s1.length(), s2.length()); +// for (int i = 0; i < max && s1.charAt(i) == s2.charAt(i); ++i) +// ++len; +// return len; +// } - private static void quickSort(char[][] list, int left, int right) { - int original_left = left; - int original_right = right; - char[] mid = list[(left + right) / 2]; - do { - while (compare(list[left], mid) < 0) { - left++; - } - while (compare(mid, list[right]) < 0) { - right--; - } - if (left <= right) { - char[] tmp = list[left]; - list[left] = list[right]; - list[right] = tmp; - left++; - right--; - } - } while (left <= right); - if (original_left < right) { - quickSort(list, original_left, right); - } - if (left < original_right) { - quickSort(list, left, original_right); - } - } +// private static void quickSort(char[][] list, int left, int right) { +// int original_left = left; +// int original_right = right; +// char[] mid = list[(left + right) / 2]; +// do { +// while (compare(list[left], mid) < 0) { +// left++; +// } +// while (compare(mid, list[right]) < 0) { +// right--; +// } +// if (left <= right) { +// char[] tmp = list[left]; +// list[left] = list[right]; +// list[right] = tmp; +// left++; +// right--; +// } +// } while (left <= right); +// if (original_left < right) { +// quickSort(list, original_left, right); +// } +// if (left < original_right) { +// quickSort(list, left, original_right); +// } +// } /** * Sort the comparable objects in the given collection. @@ -1385,32 +1385,32 @@ public class Util { } } - private static void quickSort(int[] list, int left, int right) { - int original_left = left; - int original_right = right; - int mid = list[(left + right) / 2]; - do { - while (list[left] < mid) { - left++; - } - while (mid < list[right]) { - right--; - } - if (left <= right) { - int tmp = list[left]; - list[left] = list[right]; - list[right] = tmp; - left++; - right--; - } - } while (left <= right); - if (original_left < right) { - quickSort(list, original_left, right); - } - if (left < original_right) { - quickSort(list, left, original_right); - } - } +// private static void quickSort(int[] list, int left, int right) { +// int original_left = left; +// int original_right = right; +// int mid = list[(left + right) / 2]; +// do { +// while (list[left] < mid) { +// left++; +// } +// while (mid < list[right]) { +// right--; +// } +// if (left <= right) { +// int tmp = list[left]; +// list[left] = list[right]; +// list[right] = tmp; +// left++; +// right--; +// } +// } while (left <= right); +// if (original_left < right) { +// quickSort(list, original_left, right); +// } +// if (left < original_right) { +// quickSort(list, left, original_right); +// } +// } /** * Sort the objects in the given collection using the given comparer. @@ -1510,33 +1510,33 @@ public class Util { /** * Sort the strings in the given collection in reverse alphabetical order. */ - private static void quickSortReverse(String[] sortedCollection, int left, - int right) { - int original_left = left; - int original_right = right; - String mid = sortedCollection[(left + right) / 2]; - do { - while (sortedCollection[left].compareTo(mid) > 0) { - left++; - } - while (mid.compareTo(sortedCollection[right]) > 0) { - right--; - } - if (left <= right) { - String tmp = sortedCollection[left]; - sortedCollection[left] = sortedCollection[right]; - sortedCollection[right] = tmp; - left++; - right--; - } - } while (left <= right); - if (original_left < right) { - quickSortReverse(sortedCollection, original_left, right); - } - if (left < original_right) { - quickSortReverse(sortedCollection, left, original_right); - } - } +// private static void quickSortReverse(String[] sortedCollection, int left, +// int right) { +// int original_left = left; +// int original_right = right; +// String mid = sortedCollection[(left + right) / 2]; +// do { +// while (sortedCollection[left].compareTo(mid) > 0) { +// left++; +// } +// while (mid.compareTo(sortedCollection[right]) > 0) { +// right--; +// } +// if (left <= right) { +// String tmp = sortedCollection[left]; +// sortedCollection[left] = sortedCollection[right]; +// sortedCollection[right] = tmp; +// left++; +// right--; +// } +// } while (left <= right); +// if (original_left < right) { +// quickSortReverse(sortedCollection, original_left, right); +// } +// if (left < original_right) { +// quickSortReverse(sortedCollection, left, original_right); +// } +// } /** * Reads in a string from the specified data input stream. The string has @@ -1563,60 +1563,60 @@ public class Util { * Unicode string. * @see java.io.DataInputStream#readUnsignedShort() */ - public final static char[] readUTF(DataInput in) throws IOException { - int utflen = in.readUnsignedShort(); - char str[] = new char[utflen]; - int count = 0; - int strlen = 0; - while (count < utflen) { - int c = in.readUnsignedByte(); - int char2, char3; - switch (c >> 4) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - // 0xxxxxxx - count++; - str[strlen++] = (char) c; - break; - case 12: - case 13: - // 110x xxxx 10xx xxxx - count += 2; - if (count > utflen) - throw new UTFDataFormatException(); - char2 = in.readUnsignedByte(); - if ((char2 & 0xC0) != 0x80) - throw new UTFDataFormatException(); - str[strlen++] = (char) (((c & 0x1F) << 6) | (char2 & 0x3F)); - break; - case 14: - // 1110 xxxx 10xx xxxx 10xx xxxx - count += 3; - if (count > utflen) - throw new UTFDataFormatException(); - char2 = in.readUnsignedByte(); - char3 = in.readUnsignedByte(); - if (((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80)) - throw new UTFDataFormatException(); - str[strlen++] = (char) (((c & 0x0F) << 12) - | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0)); - break; - default: - // 10xx xxxx, 1111 xxxx - throw new UTFDataFormatException(); - } - } - if (strlen < utflen) { - System.arraycopy(str, 0, str = new char[strlen], 0, strlen); - } - return str; - } +// public final static char[] readUTF(DataInput in) throws IOException { +// int utflen = in.readUnsignedShort(); +// char str[] = new char[utflen]; +// int count = 0; +// int strlen = 0; +// while (count < utflen) { +// int c = in.readUnsignedByte(); +// int char2, char3; +// switch (c >> 4) { +// case 0: +// case 1: +// case 2: +// case 3: +// case 4: +// case 5: +// case 6: +// case 7: +// // 0xxxxxxx +// count++; +// str[strlen++] = (char) c; +// break; +// case 12: +// case 13: +// // 110x xxxx 10xx xxxx +// count += 2; +// if (count > utflen) +// throw new UTFDataFormatException(); +// char2 = in.readUnsignedByte(); +// if ((char2 & 0xC0) != 0x80) +// throw new UTFDataFormatException(); +// str[strlen++] = (char) (((c & 0x1F) << 6) | (char2 & 0x3F)); +// break; +// case 14: +// // 1110 xxxx 10xx xxxx 10xx xxxx +// count += 3; +// if (count > utflen) +// throw new UTFDataFormatException(); +// char2 = in.readUnsignedByte(); +// char3 = in.readUnsignedByte(); +// if (((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80)) +// throw new UTFDataFormatException(); +// str[strlen++] = (char) (((c & 0x0F) << 12) +// | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0)); +// break; +// default: +// // 10xx xxxx, 1111 xxxx +// throw new UTFDataFormatException(); +// } +// } +// if (strlen < utflen) { +// System.arraycopy(str, 0, str = new char[strlen], 0, strlen); +// } +// return str; +// } /** * Creates a NLS catalog for the given locale. @@ -1631,10 +1631,10 @@ public class Util { } } - public static void sort(char[][] list) { - if (list.length > 1) - quickSort(list, 0, list.length - 1); - } +// public static void sort(char[][] list) { +// if (list.length > 1) +// quickSort(list, 0, list.length - 1); +// } /** * Sorts an array of Comparable objects in place. @@ -1644,10 +1644,10 @@ public class Util { quickSort(objects, 0, objects.length - 1); } - public static void sort(int[] list) { - if (list.length > 1) - quickSort(list, 0, list.length - 1); - } +// public static void sort(int[] list) { +// if (list.length > 1) +// quickSort(list, 0, list.length - 1); +// } /** * Sorts an array of objects in place. The given comparer compares pairs of @@ -1679,68 +1679,68 @@ public class Util { * Sorts an array of Comparable objects, returning a new array with the * sorted items. The original array is left untouched. */ - public static Comparable[] sortCopy(Comparable[] objects) { - int len = objects.length; - Comparable[] copy = new Comparable[len]; - System.arraycopy(objects, 0, copy, 0, len); - sort(copy); - return copy; - } +// public static Comparable[] sortCopy(Comparable[] objects) { +// int len = objects.length; +// Comparable[] copy = new Comparable[len]; +// System.arraycopy(objects, 0, copy, 0, len); +// sort(copy); +// return copy; +// } /** * Sorts an array of Strings, returning a new array with the sorted items. * The original array is left untouched. */ - public static Object[] sortCopy(Object[] objects, Comparer comparer) { - int len = objects.length; - Object[] copy = new Object[len]; - System.arraycopy(objects, 0, copy, 0, len); - sort(copy, comparer); - return copy; - } +// public static Object[] sortCopy(Object[] objects, Comparer comparer) { +// int len = objects.length; +// Object[] copy = new Object[len]; +// System.arraycopy(objects, 0, copy, 0, len); +// sort(copy, comparer); +// return copy; +// } /** * Sorts an array of Strings, returning a new array with the sorted items. * The original array is left untouched. */ - public static String[] sortCopy(String[] objects) { - int len = objects.length; - String[] copy = new String[len]; - System.arraycopy(objects, 0, copy, 0, len); - sort(copy); - return copy; - } +// public static String[] sortCopy(String[] objects) { +// int len = objects.length; +// String[] copy = new String[len]; +// System.arraycopy(objects, 0, copy, 0, len); +// sort(copy); +// return copy; +// } /** * Sorts an array of strings in place using quicksort in reverse * alphabetical order. */ - public static void sortReverseOrder(String[] strings) { - if (strings.length > 1) - quickSortReverse(strings, 0, strings.length - 1); - } +// public static void sortReverseOrder(String[] strings) { +// if (strings.length > 1) +// quickSortReverse(strings, 0, strings.length - 1); +// } /** * Converts a String[] to char[][]. */ - public static char[][] toCharArrays(String[] a) { - int len = a.length; - char[][] result = new char[len][]; - for (int i = 0; i < len; ++i) { - result[i] = toChars(a[i]); - } - return result; - } +// public static char[][] toCharArrays(String[] a) { +// int len = a.length; +// char[][] result = new char[len][]; +// for (int i = 0; i < len; ++i) { +// result[i] = toChars(a[i]); +// } +// return result; +// } /** * Converts a String to char[]. */ - public static char[] toChars(String s) { - int len = s.length(); - char[] chars = new char[len]; - s.getChars(0, len, chars, 0); - return chars; - } +// public static char[] toChars(String s) { +// int len = s.length(); +// char[] chars = new char[len]; +// s.getChars(0, len, chars, 0); +// return chars; +// } /** * Converts a String to char[][], where segments are separate by '.'. @@ -1790,17 +1790,17 @@ public class Util { * Converts a char[][] and a char[] to String, where segments are separated * by '.'. */ - public static String toString(char[][] c, char[] d) { - if (c == null) - return new String(d); - StringBuffer sb = new StringBuffer(); - for (int i = 0, max = c.length; i < max; ++i) { - sb.append(c[i]); - sb.append('.'); - } - sb.append(d); - return sb.toString(); - } +// public static String toString(char[][] c, char[] d) { +// if (c == null) +// return new String(d); +// StringBuffer sb = new StringBuffer(); +// for (int i = 0, max = c.length; i < max; ++i) { +// sb.append(c[i]); +// sb.append('.'); +// } +// sb.append(d); +// return sb.toString(); +// } /* * Returns the unresolved type parameter signatures of the given method e.g. @@ -1839,31 +1839,31 @@ public class Util { * Returns the unresolved type signature of the given type reference, e.g. * "QString;", "[int", "[[Qjava.util.Vector;" */ - public static String typeSignature(TypeReference type) { - char[][] compoundName = type.getTypeName(); - char[] typeName = CharOperation.concatWith(compoundName, '.'); - String signature = Signature - .createTypeSignature(typeName, false/* don't resolve */); - int dimensions = type.dimensions(); - if (dimensions > 0) { - signature = Signature.createArraySignature(signature, dimensions); - } - return signature; - } +// public static String typeSignature(TypeReference type) { +// char[][] compoundName = type.getTypeName(); +// char[] typeName = CharOperation.concatWith(compoundName, '.'); +// String signature = Signature +// .createTypeSignature(typeName, false/* don't resolve */); +// int dimensions = type.dimensions(); +// if (dimensions > 0) { +// signature = Signature.createArraySignature(signature, dimensions); +// } +// return signature; +// } /** * Asserts that the given method signature is valid. */ - public static void validateMethodSignature(String sig) { - Assert.isTrue(isValidMethodSignature(sig)); - } +// public static void validateMethodSignature(String sig) { +// Assert.isTrue(isValidMethodSignature(sig)); +// } /** * Asserts that the given type signature is valid. */ - public static void validateTypeSignature(String sig, boolean allowVoid) { - Assert.isTrue(isValidTypeSignature(sig, allowVoid)); - } +// public static void validateTypeSignature(String sig, boolean allowVoid) { +// Assert.isTrue(isValidTypeSignature(sig, allowVoid)); +// } public static void verbose(String log) { verbose(log, System.out); @@ -1899,41 +1899,41 @@ public class Util { * if an I/O error occurs. * @since JDK1.0 */ - public static int writeUTF(OutputStream out, char[] str) throws IOException { - int strlen = str.length; - int utflen = 0; - for (int i = 0; i < strlen; i++) { - int c = str[i]; - if ((c >= 0x0001) && (c <= 0x007F)) { - utflen++; - } else if (c > 0x07FF) { - utflen += 3; - } else { - utflen += 2; - } - } - if (utflen > 65535) - throw new UTFDataFormatException(); - out.write((utflen >>> 8) & 0xFF); - out.write((utflen >>> 0) & 0xFF); - if (strlen == utflen) { - for (int i = 0; i < strlen; i++) - out.write(str[i]); - } else { - for (int i = 0; i < strlen; i++) { - int c = str[i]; - if ((c >= 0x0001) && (c <= 0x007F)) { - out.write(c); - } else if (c > 0x07FF) { - out.write(0xE0 | ((c >> 12) & 0x0F)); - out.write(0x80 | ((c >> 6) & 0x3F)); - out.write(0x80 | ((c >> 0) & 0x3F)); - } else { - out.write(0xC0 | ((c >> 6) & 0x1F)); - out.write(0x80 | ((c >> 0) & 0x3F)); - } - } - } - return utflen + 2; // the number of bytes written to the stream - } +// public static int writeUTF(OutputStream out, char[] str) throws IOException { +// int strlen = str.length; +// int utflen = 0; +// for (int i = 0; i < strlen; i++) { +// int c = str[i]; +// if ((c >= 0x0001) && (c <= 0x007F)) { +// utflen++; +// } else if (c > 0x07FF) { +// utflen += 3; +// } else { +// utflen += 2; +// } +// } +// if (utflen > 65535) +// throw new UTFDataFormatException(); +// out.write((utflen >>> 8) & 0xFF); +// out.write((utflen >>> 0) & 0xFF); +// if (strlen == utflen) { +// for (int i = 0; i < strlen; i++) +// out.write(str[i]); +// } else { +// for (int i = 0; i < strlen; i++) { +// int c = str[i]; +// if ((c >= 0x0001) && (c <= 0x007F)) { +// out.write(c); +// } else if (c > 0x07FF) { +// out.write(0xE0 | ((c >> 12) & 0x0F)); +// out.write(0x80 | ((c >> 6) & 0x3F)); +// out.write(0x80 | ((c >> 0) & 0x3F)); +// } else { +// out.write(0xC0 | ((c >> 6) & 0x1F)); +// out.write(0x80 | ((c >> 0) & 0x3F)); +// } +// } +// } +// return utflen + 2; // the number of bytes written to the stream +// } } \ No newline at end of file -- 1.7.1