mbenson     2005/01/26 11:25:41

  Modified:    src/main/org/apache/tools/ant/types/optional/depend Tag:
                        ANT_16_BRANCH DependScanner.java
  Log:
  sync with HEAD
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.14.2.5  +31 -41    
ant/src/main/org/apache/tools/ant/types/optional/depend/DependScanner.java
  
  Index: DependScanner.java
  ===================================================================
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/types/optional/depend/DependScanner.java,v
  retrieving revision 1.14.2.4
  retrieving revision 1.14.2.5
  diff -u -r1.14.2.4 -r1.14.2.5
  --- DependScanner.java        9 Mar 2004 17:01:56 -0000       1.14.2.4
  +++ DependScanner.java        26 Jan 2005 19:25:40 -0000      1.14.2.5
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2001-2002,2004 The Apache Software Foundation
  + * Copyright  2001-2002, 2004-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -27,9 +27,7 @@
   
   
   /**
  - * An interface used to describe the actions required by any type of
  - * directory scanner.
  - *
  + * DirectoryScanner for finding class dependencies.
    */
   public class DependScanner extends DirectoryScanner {
       /**
  @@ -39,24 +37,19 @@
           = "org.apache.tools.ant.util.depend.bcel.FullAnalyzer";
   
       /**
  -     * The base directory for the scan
  -     */
  -    private File basedir;
  -
  -    /**
  -     * The root classes to drive the search for dependent classes
  +     * The root classes to drive the search for dependent classes.
        */
       private Vector rootClasses;
   
       /**
  -     * The names of the classes to include in the fileset
  +     * The names of the classes to include in the fileset.
        */
       private Vector included;
   
       /**
        * The parent scanner which gives the basic set of files. Only files 
which
        * are in this set and which can be reached from a root class will end
  -     * up being included in the result set
  +     * up being included in the result set.
        */
       private DirectoryScanner parentScanner;
   
  @@ -72,51 +65,43 @@
       }
   
       /**
  -     * Sets the basedir for scanning. This is the directory that is scanned
  -     * recursively.
  -     *
  -     * @param basedir the basedir for scanning
  -     */
  -    public void setBasedir(File basedir) {
  -        this.basedir = basedir;
  -    }
  -
  -    /**
  -     * Gets the basedir that is used for scanning.
  -     *
  -     * @return the basedir that is used for scanning
  -     */
  -    public File getBasedir() { return basedir; }
  -
  -    /**
        * Sets the root classes to be used to drive the scan.
        *
  -     * @param rootClasses the rootClasses to be used for this scan
  +     * @param rootClasses the rootClasses to be used for this scan.
        */
  -    public void setRootClasses(Vector rootClasses) {
  +    public synchronized void setRootClasses(Vector rootClasses) {
           this.rootClasses = rootClasses;
       }
   
       /**
  -     * Get the names of the class files, baseClass depends on
  +     * Get the names of the class files on which baseClass depends.
        *
  -     * @return the names of the files
  +     * @return the names of the files.
        */
       public String[] getIncludedFiles() {
  -        int count = included.size();
  -        String[] files = new String[count];
  -        for (int i = 0; i < count; i++) {
  +        String[] files = new String[getIncludedFilesCount()];
  +        for (int i = 0; i < files.length; i++) {
               files[i] = (String) included.elementAt(i);
           }
           return files;
       }
   
       /**
  -     * Scans the base directory for files that baseClass depends on
  +     * @see DirectoryScanner#getIncludedFilesCount
  +     */
  +    public synchronized int getIncludedFilesCount() {
  +        if (included == null) {
  +            throw new IllegalStateException();
  +        }
  +        return included.size();
  +    }
  +
  +    /**
  +     * Scans the base directory for files on which baseClass depends.
        *
  -     * @exception IllegalStateException when basedir was set incorrecly
  +     * @exception IllegalStateException when basedir was set incorrectly.
        */
  -    public void scan() throws IllegalStateException {
  +    public synchronized void scan() throws IllegalStateException {
           included = new Vector();
           String analyzerClassName = DEFAULT_ANALYZER_CLASS;
           DependencyAnalyzer analyzer = null;
  @@ -133,7 +118,6 @@
               String rootClass = (String) e.nextElement();
               analyzer.addRootClass(rootClass);
           }
  -
           Enumeration e = analyzer.getClassDependencies();
   
           String[] parentFiles = parentScanner.getIncludedFiles();
  @@ -141,7 +125,6 @@
           for (int i = 0; i < parentFiles.length; ++i) {
               parentSet.put(parentFiles[i], parentFiles[i]);
           }
  -
           while (e.hasMoreElements()) {
               String classname = (String) e.nextElement();
               String filename = classname.replace('.', File.separatorChar);
  @@ -182,6 +165,13 @@
       }
   
       /**
  +     * @see DirectoryScanner#getIncludedDirsCount
  +     */
  +    public int getIncludedDirsCount() {
  +        return 0;
  +    }
  +
  +    /**
        * @see DirectoryScanner#getNotIncludedDirectories
        */
       public String[] getNotIncludedDirectories() {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to