ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/types/selectors SelectorUtils.java
Date Tue, 15 Jul 2003 14:18:07 GMT
bodewig     2003/07/15 07:18:07

  Modified:    src/main/org/apache/tools/ant DirectoryScanner.java
               src/main/org/apache/tools/ant/types/selectors
                        SelectorUtils.java
  Log:
  Only whitespace changes
  
  Revision  Changes    Path
  1.44      +54 -43    ant/src/main/org/apache/tools/ant/DirectoryScanner.java
  
  Index: DirectoryScanner.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/DirectoryScanner.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- DirectoryScanner.java	14 Jul 2003 20:21:10 -0000	1.43
  +++ DirectoryScanner.java	15 Jul 2003 14:18:07 -0000	1.44
  @@ -644,57 +644,66 @@
           }
           checkIncludePatterns();
       }
  +
       /**
  -     *  this routine is actually checking all the include patterns
  -     *  in order to avoid scanning everything under base dir
  -     *  @since ant1.6
  +     * this routine is actually checking all the include patterns in
  +     * order to avoid scanning everything under base dir
  +     * @since ant1.6
        */
       private void checkIncludePatterns() {
  -      Hashtable newroots = new Hashtable();
  -      // put in the newroots vector the include patterns without wildcard tokens
  -      for (int icounter=0; icounter<includes.length; icounter++) {
  -        String newpattern=SelectorUtils.rtrimWildcardTokens(includes[icounter]);
  -        // check whether the candidate new pattern has a parent
  -        boolean hasParent=false;
  -        Enumeration myenum = newroots.keys();
  -        while (myenum.hasMoreElements()) {
  -          String existingpattern=(String)myenum.nextElement();
  -          if (existingpattern.length() <= newpattern.length()) {
  -            if (newpattern.indexOf(existingpattern)==0) {
  -              hasParent=true;
  -            }
  -          }
  -        }
  -        if ( !hasParent) {
  -          newroots.put(newpattern,includes[icounter]);
  -        }
  -      }
  -      Enumeration enum2 = newroots.keys();
  -      while (enum2.hasMoreElements()) {
  -        String currentelement = (String) enum2.nextElement();
  -        File myfile=new File(basedir,currentelement);
  -        if (myfile.exists()) {
  -          if (myfile.isDirectory()) {
  -            if (isIncluded(currentelement) && currentelement.length()>0) {
  -                accountForIncludedDir(currentelement,myfile,true);
  -            }  else {
  -                if (currentelement.length() > 0) {
  -                    if (currentelement.charAt(currentelement.length()-1) != File.separatorChar)
{
  -                        currentelement = currentelement + File.separatorChar;
  +        Hashtable newroots = new Hashtable();
  +        // put in the newroots vector the include patterns without
  +        // wildcard tokens
  +        for (int icounter = 0; icounter < includes.length; icounter++) {
  +            String newpattern = 
  +                SelectorUtils.rtrimWildcardTokens(includes[icounter]);
  +            // check whether the candidate new pattern has a parent
  +            boolean hasParent=false;
  +            Enumeration myenum = newroots.keys();
  +            while (myenum.hasMoreElements()) {
  +                String existingpattern= (String) myenum.nextElement();
  +                if (existingpattern.length() <= newpattern.length()) {
  +                    if (newpattern.indexOf(existingpattern)==0) {
  +                        hasParent=true;
                       }
                   }
  -                scandir(myfile, currentelement, true);
               }
  -          }
  -          else {
  -            String originalpattern=(String)newroots.get(currentelement);
  -            if (originalpattern.equals(currentelement)) {
  -              accountForIncludedFile(currentelement,myfile);
  +            if (!hasParent) {
  +                newroots.put(newpattern,includes[icounter]);
  +            }
  +        }
  +
  +        Enumeration enum2 = newroots.keys();
  +        while (enum2.hasMoreElements()) {
  +            String currentelement = (String) enum2.nextElement();
  +            File myfile=new File(basedir, currentelement);
  +            if (myfile.exists()) {
  +                if (myfile.isDirectory()) {
  +                    if (isIncluded(currentelement) 
  +                        && currentelement.length()>0) {
  +                        accountForIncludedDir(currentelement,myfile,true);
  +                    }  else {
  +                        if (currentelement.length() > 0) {
  +                            if (currentelement.charAt(currentelement.length()
  +                                                      -1 ) 
  +                                != File.separatorChar) {
  +                                currentelement = 
  +                                    currentelement + File.separatorChar;
  +                            }
  +                        }
  +                        scandir(myfile, currentelement, true);
  +                    }
  +                } else {
  +                    String originalpattern= 
  +                        (String) newroots.get(currentelement);
  +                    if (originalpattern.equals(currentelement)) {
  +                        accountForIncludedFile(currentelement,myfile);
  +                    }
  +                }
               }
  -          }
           }
  -      }
       }
  +
       /**
        * Top level invocation for a slow scan. A slow scan builds up a full
        * list of excluded/included files/directories, whereas a fast scan
  @@ -838,9 +847,11 @@
           }
   
       }
  +
       /**
        *
  -     * @param name path of the directory relative to the directory of the fileset
  +     * @param name path of the directory relative to the directory of
  +     * the fileset
        * @param file directory as file
        * @param fast
        */
  
  
  
  1.13      +25 -23    ant/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java
  
  Index: SelectorUtils.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SelectorUtils.java	14 Jul 2003 20:21:11 -0000	1.12
  +++ SelectorUtils.java	15 Jul 2003 14:18:07 -0000	1.13
  @@ -526,29 +526,29 @@
        *
        * @param path Path to tokenize. Must not be <code>null</code>.
        *
  -    * @return a Vector of path elements from the tokenized path
  -    */
  -   public static Vector tokenizePath (String path) {
  -     return tokenizePath(path, File.separator);
  -   }
  - /**
  -  * Breaks a path up into a Vector of path elements, tokenizing on
  -  *
  -  * @param path Path to tokenize. Must not be <code>null</code>.
  -  * @param separator the separator against which to tokenize.
  -  *
  -  * @return a Vector of path elements from the tokenized path
  -  * @since ant 1.6
  -  */
  -   public static Vector tokenizePath (String path, String separator) {
  -     Vector ret = new Vector();
  -     StringTokenizer st = new StringTokenizer(path,separator);
  -     while (st.hasMoreTokens()) {
  -         ret.addElement(st.nextToken());
  -     }
  -     return ret;
  +     * @return a Vector of path elements from the tokenized path
  +     */
  +    public static Vector tokenizePath (String path) {
  +        return tokenizePath(path, File.separator);
  +    }
   
  -   }
  +    /**
  +     * Breaks a path up into a Vector of path elements, tokenizing on
  +     *
  +     * @param path Path to tokenize. Must not be <code>null</code>.
  +     * @param separator the separator against which to tokenize.
  +     *
  +     * @return a Vector of path elements from the tokenized path
  +     * @since Ant 1.6
  +     */
  +    public static Vector tokenizePath (String path, String separator) {
  +        Vector ret = new Vector();
  +        StringTokenizer st = new StringTokenizer(path,separator);
  +        while (st.hasMoreTokens()) {
  +            ret.addElement(st.nextToken());
  +        }
  +        return ret;
  +    }
   
       /**
        * Same as {@link #tokenizePath tokenizePath} but hopefully faster.
  @@ -662,14 +662,16 @@
           }
           return result.toString();
       }
  +
       /**
        * Tests if a string contains stars or question marks
  -     *  @param input a String which one wants to test for containing wildcard
  +     * @param input a String which one wants to test for containing wildcard
        * @return true if the string contains at least a star or a question mark
        */
       public static boolean hasWildcards(String input) {
           return (input.indexOf('*')!=-1 || input.indexOf('?')!=-1);
       }
  +
       /**
        * removes from a pattern all tokens to the right containing wildcards
        * @param input
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message