git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@910889 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -48,6 +48,7 @@ import org.apache.tools.ant.util.CollectionUtils; | |||
| import org.apache.tools.ant.util.FileUtils; | |||
| import org.apache.tools.ant.util.JavaEnvUtils; | |||
| import org.apache.tools.ant.util.StringUtils; | |||
| import org.apache.tools.ant.util.VectorSet; | |||
| /** | |||
| * Central representation of an Ant project. This class defines an | |||
| @@ -1799,7 +1800,7 @@ public class Project implements ResourceFactory { | |||
| */ | |||
| public final Vector topoSort(String[] root, Hashtable targetTable, | |||
| boolean returnAll) throws BuildException { | |||
| Vector ret = new Vector(); | |||
| Vector ret = new VectorSet(); | |||
| Hashtable state = new Hashtable(); | |||
| Stack visiting = new Stack(); | |||
| @@ -24,7 +24,7 @@ package org.apache.tools.ant.input; | |||
| * @since Ant 1.5 | |||
| */ | |||
| public class InputRequest { | |||
| private String prompt; | |||
| private final String prompt; | |||
| private String input; | |||
| private String defaultValue; | |||
| @@ -18,6 +18,7 @@ | |||
| package org.apache.tools.ant.input; | |||
| import java.util.LinkedHashSet; | |||
| import java.util.Vector; | |||
| /** | |||
| @@ -26,7 +27,7 @@ import java.util.Vector; | |||
| * @since Ant 1.5 | |||
| */ | |||
| public class MultipleChoiceInputRequest extends InputRequest { | |||
| private Vector choices = new Vector(); | |||
| private final LinkedHashSet choices; | |||
| /** | |||
| * @param prompt The prompt to show to the user. Must not be null. | |||
| @@ -38,14 +39,14 @@ public class MultipleChoiceInputRequest extends InputRequest { | |||
| if (choices == null) { | |||
| throw new IllegalArgumentException("choices must not be null"); | |||
| } | |||
| this.choices = choices; | |||
| this.choices = new LinkedHashSet(choices); | |||
| } | |||
| /** | |||
| * @return The possible values. | |||
| */ | |||
| public Vector getChoices() { | |||
| return choices; | |||
| return new Vector(choices); | |||
| } | |||
| /** | |||
| @@ -32,10 +32,12 @@ import java.util.Collection; | |||
| import java.util.Date; | |||
| import java.util.Enumeration; | |||
| import java.util.HashMap; | |||
| import java.util.HashSet; | |||
| import java.util.Hashtable; | |||
| import java.util.Iterator; | |||
| import java.util.Locale; | |||
| import java.util.Map; | |||
| import java.util.Set; | |||
| import java.util.StringTokenizer; | |||
| import java.util.Vector; | |||
| @@ -54,6 +56,7 @@ import org.apache.tools.ant.types.selectors.SelectorUtils; | |||
| import org.apache.tools.ant.util.FileUtils; | |||
| import org.apache.tools.ant.util.RetryHandler; | |||
| import org.apache.tools.ant.util.Retryable; | |||
| import org.apache.tools.ant.util.VectorSet; | |||
| /** | |||
| * Basic FTP client. Performs the following actions: | |||
| @@ -116,7 +119,7 @@ public class FTP extends Task implements FTPTaskConfig { | |||
| private boolean timeDiffAuto = false; | |||
| private int action = SEND_FILES; | |||
| private Vector filesets = new Vector(); | |||
| private Vector dirCache = new Vector(); | |||
| private Set dirCache = new HashSet(); | |||
| private int transferred = 0; | |||
| private String remoteFileSep = "/"; | |||
| private int port = DEFAULT_FTP_PORT; | |||
| @@ -354,12 +357,12 @@ public class FTP extends Task implements FTPTaskConfig { | |||
| excludes = new String[0]; | |||
| } | |||
| filesIncluded = new Vector(); | |||
| filesIncluded = new VectorSet(); | |||
| filesNotIncluded = new Vector(); | |||
| filesExcluded = new Vector(); | |||
| dirsIncluded = new Vector(); | |||
| filesExcluded = new VectorSet(); | |||
| dirsIncluded = new VectorSet(); | |||
| dirsNotIncluded = new Vector(); | |||
| dirsExcluded = new Vector(); | |||
| dirsExcluded = new VectorSet(); | |||
| try { | |||
| String cwd = ftp.printWorkingDirectory(); | |||
| @@ -1919,7 +1922,7 @@ public class FTP extends Task implements FTPTaskConfig { | |||
| + "directory: " + ftp.getReplyString()); | |||
| } | |||
| } | |||
| dirCache.addElement(dir); | |||
| dirCache.add(dir); | |||
| } | |||
| ftp.changeWorkingDirectory(cwd); | |||
| } | |||
| @@ -50,6 +50,7 @@ import org.apache.tools.ant.types.selectors.SelectorUtils; | |||
| import org.apache.tools.ant.util.FileUtils; | |||
| import org.apache.tools.ant.util.RetryHandler; | |||
| import org.apache.tools.ant.util.Retryable; | |||
| import org.apache.tools.ant.util.VectorSet; | |||
| public class FTPTaskMirrorImpl implements FTPTaskMirror { | |||
| @@ -63,7 +64,7 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror { | |||
| private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | |||
| private final FTPTask task; | |||
| private Vector dirCache = new Vector(); | |||
| private Set dirCache = new HashSet(); | |||
| private int transferred = 0; | |||
| private int skipped = 0; | |||
| @@ -257,12 +258,12 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror { | |||
| excludes = new String[0]; | |||
| } | |||
| filesIncluded = new Vector(); | |||
| filesIncluded = new VectorSet(); | |||
| filesNotIncluded = new Vector(); | |||
| filesExcluded = new Vector(); | |||
| dirsIncluded = new Vector(); | |||
| filesExcluded = new VectorSet(); | |||
| dirsIncluded = new VectorSet(); | |||
| dirsNotIncluded = new Vector(); | |||
| dirsExcluded = new Vector(); | |||
| dirsExcluded = new VectorSet(); | |||
| try { | |||
| String cwd = ftp.printWorkingDirectory(); | |||
| @@ -1310,7 +1311,7 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror { | |||
| + "directory: " + ftp.getReplyString()); | |||
| } | |||
| } | |||
| dirCache.addElement(dir); | |||
| dirCache.add(dir); | |||
| } | |||
| ftp.changeWorkingDirectory(cwd); | |||
| } | |||
| @@ -20,6 +20,8 @@ package org.apache.tools.ant.taskdefs.optional.ssh; | |||
| import java.util.ArrayList; | |||
| import java.util.Iterator; | |||
| import java.util.LinkedHashSet; | |||
| import java.util.Set; | |||
| import java.util.StringTokenizer; | |||
| import java.io.File; | |||
| @@ -29,7 +31,7 @@ import java.io.File; | |||
| public class Directory { | |||
| private File directory; | |||
| private ArrayList childDirectories; | |||
| private Set childDirectories; | |||
| private ArrayList files; | |||
| private Directory parent; | |||
| @@ -48,7 +50,7 @@ public class Directory { | |||
| */ | |||
| public Directory(File directory , Directory parent) { | |||
| this.parent = parent; | |||
| this.childDirectories = new ArrayList(); | |||
| this.childDirectories = new LinkedHashSet(); | |||
| this.files = new ArrayList(); | |||
| this.directory = directory; | |||
| } | |||
| @@ -117,8 +119,8 @@ public class Directory { | |||
| * @return the child directory, or null if not found | |||
| */ | |||
| public Directory getChild(File dir) { | |||
| for (int i = 0; i < childDirectories.size(); i++) { | |||
| Directory current = (Directory) childDirectories.get(i); | |||
| for (Iterator i = childDirectories.iterator(); i.hasNext(); ) { | |||
| Directory current = (Directory) i.next(); | |||
| if (current.getDirectory().equals(dir)) { | |||
| return current; | |||
| } | |||
| @@ -27,6 +27,7 @@ import java.util.Vector; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.util.FileUtils; | |||
| import org.apache.tools.ant.util.VectorSet; | |||
| /** | |||
| * A set of filters to be applied to something. | |||
| @@ -575,7 +576,7 @@ public class FilterSet extends DataType implements Cloneable { | |||
| String beginToken = getBeginToken(); | |||
| String endToken = getEndToken(); | |||
| if (recurseDepth == 0) { | |||
| passedTokens = new Vector(); | |||
| passedTokens = new VectorSet(); | |||
| } | |||
| recurseDepth++; | |||
| if (passedTokens.contains(parent) && !duplicateToken) { | |||
| @@ -17,10 +17,8 @@ | |||
| */ | |||
| package org.apache.tools.ant.util; | |||
| import java.util.Arrays; | |||
| import java.util.HashSet; | |||
| import java.util.Iterator; | |||
| import java.util.LinkedList; | |||
| import java.util.LinkedHashSet; | |||
| /** | |||
| * A <CODE>ContainerMapper</CODE> that unites the results of its constituent | |||
| @@ -30,8 +28,7 @@ public class CompositeMapper extends ContainerMapper { | |||
| /** {@inheritDoc}. */ | |||
| public String[] mapFileName(String sourceFileName) { | |||
| HashSet results = new HashSet(); | |||
| LinkedList sortedResults = new LinkedList(); | |||
| LinkedHashSet results = new LinkedHashSet(); | |||
| FileNameMapper mapper = null; | |||
| for (Iterator mIter = getMappers().iterator(); mIter.hasNext();) { | |||
| @@ -40,16 +37,13 @@ public class CompositeMapper extends ContainerMapper { | |||
| String[] mapped = mapper.mapFileName(sourceFileName); | |||
| if (mapped != null) { | |||
| for (int i = 0; i < mapped.length; i++) { | |||
| if (!results.contains(mapped[i])) { | |||
| results.add(mapped[i]); | |||
| sortedResults.addLast(mapped[i]); | |||
| } | |||
| results.add(mapped[i]); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| return (results.size() == 0) ? null | |||
| : (String[]) sortedResults.toArray(new String[results.size()]); | |||
| : (String[]) results.toArray(new String[results.size()]); | |||
| } | |||
| } | |||
| @@ -22,6 +22,7 @@ import java.util.Enumeration; | |||
| import java.util.Vector; | |||
| import java.util.zip.ZipFile; | |||
| import org.apache.tools.ant.types.Path; | |||
| import org.apache.tools.ant.util.VectorSet; | |||
| /** | |||
| * An abstract implementation of the analyzer interface providing support | |||
| @@ -39,7 +40,7 @@ public abstract class AbstractAnalyzer implements DependencyAnalyzer { | |||
| private Path classPath = new Path(null); | |||
| /** The list of root classes */ | |||
| private Vector rootClasses = new Vector(); | |||
| private final Vector rootClasses = new VectorSet(); | |||
| /** true if dependencies have been determined */ | |||
| private boolean determined = false; | |||