ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/types/selectors AndSelector.java BaseExtendSelector.java BaseSelector.java BaseSelectorContainer.java ContainsRegexpSelector.java ContainsSelector.java DateSelector.java DependSelector.java DepthSelector.java DifferentSelector.java ExtendFileSelector.java ExtendSelector.java FileSelector.java FilenameSelector.java MajoritySelector.java MappingSelector.java NoneSelector.java NotSelector.java OrSelector.java PresentSelector.java SelectSelector.java SelectorContainer.java SelectorScanner.java SelectorUtils.java SizeSelector.java TypeSelector.java
Date Fri, 04 Jul 2003 23:18:50 GMT
bruce       2003/07/04 16:18:50

  Modified:    src/main/org/apache/tools/ant/types/selectors
                        AndSelector.java BaseExtendSelector.java
                        BaseSelector.java BaseSelectorContainer.java
                        ContainsRegexpSelector.java ContainsSelector.java
                        DateSelector.java DependSelector.java
                        DepthSelector.java DifferentSelector.java
                        ExtendFileSelector.java ExtendSelector.java
                        FileSelector.java FilenameSelector.java
                        MajoritySelector.java MappingSelector.java
                        NoneSelector.java NotSelector.java OrSelector.java
                        PresentSelector.java SelectSelector.java
                        SelectorContainer.java SelectorScanner.java
                        SelectorUtils.java SizeSelector.java
                        TypeSelector.java
  Log:
  First pass at fixing checkstyle issues by using IDEA to reformat code and identify problem spots
  
  Revision  Changes    Path
  1.3       +3 -3      ant/src/main/org/apache/tools/ant/types/selectors/AndSelector.java
  
  Index: AndSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/AndSelector.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AndSelector.java	10 Feb 2003 14:14:35 -0000	1.2
  +++ AndSelector.java	4 Jul 2003 23:18:49 -0000	1.3
  @@ -97,9 +97,9 @@
           Enumeration e = selectorElements();
           boolean result;
   
  -        while(e.hasMoreElements()) {
  -            result = ((FileSelector)e.nextElement()).isSelected(basedir,
  -                    filename,file);
  +        while (e.hasMoreElements()) {
  +            result = ((FileSelector) e.nextElement()).isSelected(basedir,
  +                    filename, file);
               if (!result) {
                   return false;
               }
  
  
  
  1.5       +3 -2      ant/src/main/org/apache/tools/ant/types/selectors/BaseExtendSelector.java
  
  Index: BaseExtendSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/BaseExtendSelector.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BaseExtendSelector.java	10 Feb 2003 14:14:35 -0000	1.4
  +++ BaseExtendSelector.java	4 Jul 2003 23:18:49 -0000	1.5
  @@ -54,6 +54,7 @@
   package org.apache.tools.ant.types.selectors;
   
   import java.io.File;
  +
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.types.Parameter;
   
  @@ -67,8 +68,8 @@
    * @since 1.5
    */
   public abstract class BaseExtendSelector
  -    extends BaseSelector
  -    implements ExtendFileSelector {
  +        extends BaseSelector
  +        implements ExtendFileSelector {
   
       /** The passed in parameter array. */
       protected Parameter[] parameters = null;
  
  
  
  1.5       +2 -2      ant/src/main/org/apache/tools/ant/types/selectors/BaseSelector.java
  
  Index: BaseSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/BaseSelector.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BaseSelector.java	10 Feb 2003 14:14:35 -0000	1.4
  +++ BaseSelector.java	4 Jul 2003 23:18:49 -0000	1.5
  @@ -55,6 +55,7 @@
   package org.apache.tools.ant.types.selectors;
   
   import java.io.File;
  +
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.types.DataType;
   
  @@ -111,7 +112,6 @@
       }
   
   
  -
       /**
        * Subclasses can use this to throw the requisite exception
        * in isSelected() in the case of an error condition.
  @@ -137,7 +137,7 @@
        * @return whether the file should be selected or not
        */
       public abstract boolean isSelected(File basedir, String filename,
  -            File file);
  +                                       File file);
   
   }
   
  
  
  
  1.10      +7 -6      ant/src/main/org/apache/tools/ant/types/selectors/BaseSelectorContainer.java
  
  Index: BaseSelectorContainer.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/BaseSelectorContainer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- BaseSelectorContainer.java	28 May 2003 16:27:37 -0000	1.9
  +++ BaseSelectorContainer.java	4 Jul 2003 23:18:49 -0000	1.10
  @@ -57,6 +57,7 @@
   import java.io.File;
   import java.util.Enumeration;
   import java.util.Vector;
  +
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Project;
   
  @@ -118,7 +119,7 @@
           StringBuffer buf = new StringBuffer();
           Enumeration e = selectorElements();
           if (e.hasMoreElements()) {
  -            while(e.hasMoreElements()) {
  +            while (e.hasMoreElements()) {
                   buf.append(e.nextElement().toString());
                   if (e.hasMoreElements()) {
                       buf.append(", ");
  @@ -161,10 +162,10 @@
               throw new BuildException(errmsg);
           }
           Enumeration e = selectorElements();
  -        while(e.hasMoreElements()) {
  +        while (e.hasMoreElements()) {
               Object o = e.nextElement();
               if (o instanceof BaseSelector) {
  -                ((BaseSelector)o).validate();
  +                ((BaseSelector) o).validate();
               }
           }
       }
  @@ -290,14 +291,14 @@
       public void addDifferent(DifferentSelector selector) {
           appendSelector(selector);
       }
  - 
  +
       /**
        * adds a type selector to the selector list
        */
       public void addType(TypeSelector selector) {
           appendSelector(selector);
       }
  -   
  +
       /**
        * add a regular expression selector entry on the selector list
        */
  @@ -305,7 +306,7 @@
           appendSelector(selector);
       }
   
  -    
  +
       /**
        * add an arbitary selector
        * @since Ant 1.6
  
  
  
  1.3       +19 -19    ant/src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java
  
  Index: ContainsRegexpSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ContainsRegexpSelector.java	18 Apr 2003 23:40:30 -0000	1.2
  +++ ContainsRegexpSelector.java	4 Jul 2003 23:18:49 -0000	1.3
  @@ -82,7 +82,8 @@
       }
   
       public String toString() {
  -        StringBuffer buf = new StringBuffer("{containsregexpselector expression: ");
  +        StringBuffer buf = new StringBuffer(
  +                "{containsregexpselector expression: ");
           buf.append(userProvidedExpression);
           buf.append("}");
           return buf.toString();
  @@ -91,8 +92,7 @@
       /**
        * The regular expression used to search the file.
        *
  -     * @param regular expression that must match a line in the file to
  -     * be selected.
  +     * @param theexpression this must match a line in the file to be selected.
        */
       public void setExpression(String theexpression) {
           this.userProvidedExpression = theexpression;
  @@ -139,15 +139,15 @@
       public boolean isSelected(File basedir, String filename, File file) {
           String teststr = null;
           BufferedReader in = null;
  -        
  +
           // throw BuildException on error
  -        
  +
           validate();
   
           if (file.isDirectory()) {
               return true;
           }
  -        
  +
           if (myRegExp == null) {
               myRegExp = new RegularExpression();
               myRegExp.setPattern(userProvidedExpression);
  @@ -155,20 +155,20 @@
           }
   
           try {
  -              in = new BufferedReader(new InputStreamReader(
  +            in = new BufferedReader(new InputStreamReader(
                       new FileInputStream(file)));
  -                    
  -              teststr = in.readLine();
  -              
  -              while (teststr != null) {
  -              
  -                  if (myExpression.matches(teststr) == true) {
  -                      return true;
  -                  }
  -                  teststr = in.readLine();
  -              }
  -              
  -              return false;
  +
  +            teststr = in.readLine();
  +
  +            while (teststr != null) {
  +
  +                if (myExpression.matches(teststr) == true) {
  +                    return true;
  +                }
  +                teststr = in.readLine();
  +            }
  +
  +            return false;
           } catch (IOException ioe) {
               throw new BuildException("Could not read file " + filename);
           } finally {
  
  
  
  1.7       +10 -15    ant/src/main/org/apache/tools/ant/types/selectors/ContainsSelector.java
  
  Index: ContainsSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/ContainsSelector.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ContainsSelector.java	10 Feb 2003 14:14:35 -0000	1.6
  +++ ContainsSelector.java	4 Jul 2003 23:18:49 -0000	1.7
  @@ -59,6 +59,7 @@
   import java.io.FileInputStream;
   import java.io.IOException;
   import java.io.InputStreamReader;
  +
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.types.Parameter;
  @@ -123,7 +124,7 @@
       /**
        * Whether to ignore whitespace in the string being searched.
        *
  -     * @param whitespace whether to ignore any whitespace (spaces, tabs, etc.) in the searchstring
  +     * @param ignorewhitespace whether to ignore any whitespace (spaces, tabs, etc.) in the searchstring
        */
       public void setIgnorewhitespace(boolean ignorewhitespace) {
           this.ignorewhitespace = ignorewhitespace;
  @@ -142,16 +143,13 @@
                   String paramname = parameters[i].getName();
                   if (CONTAINS_KEY.equalsIgnoreCase(paramname)) {
                       setText(parameters[i].getValue());
  -                }
  -                else if (CASE_KEY.equalsIgnoreCase(paramname)) {
  +                } else if (CASE_KEY.equalsIgnoreCase(paramname)) {
                       setCasesensitive(Project.toBoolean(
  -                        parameters[i].getValue()));
  -                }
  -                else if (WHITESPACE_KEY.equalsIgnoreCase(paramname)) {
  +                            parameters[i].getValue()));
  +                } else if (WHITESPACE_KEY.equalsIgnoreCase(paramname)) {
                       setIgnorewhitespace(Project.toBoolean(
  -                        parameters[i].getValue()));
  -                }
  -                else {
  +                            parameters[i].getValue()));
  +                } else {
                       setError("Invalid parameter " + paramname);
                   }
               }
  @@ -212,15 +210,12 @@
                   teststr = in.readLine();
               }
               return false;
  -        }
  -        catch (IOException ioe) {
  +        } catch (IOException ioe) {
               throw new BuildException("Could not read file " + filename);
  -        }
  -        finally {
  +        } finally {
               try {
                   in.close();
  -            }
  -            catch (Exception e) {
  +            } catch (Exception e) {
                   throw new BuildException("Could not close file " + filename);
               }
           }
  
  
  
  1.5       +25 -33    ant/src/main/org/apache/tools/ant/types/selectors/DateSelector.java
  
  Index: DateSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/DateSelector.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DateSelector.java	10 Feb 2003 14:14:35 -0000	1.4
  +++ DateSelector.java	4 Jul 2003 23:18:49 -0000	1.5
  @@ -58,6 +58,7 @@
   import java.text.DateFormat;
   import java.text.ParseException;
   import java.util.Locale;
  +
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.taskdefs.condition.Os;
   import org.apache.tools.ant.types.EnumeratedAttribute;
  @@ -94,8 +95,7 @@
           buf.append(" compare: ");
           if (cmp == 0) {
               buf.append("before");
  -        }
  -        else if (cmp == 1) {
  +        } else if (cmp == 1) {
               buf.append("after");
           } else {
               buf.append("equal");
  @@ -133,18 +133,18 @@
           this.dateTime = dateTime;
           if (dateTime != null) {
               DateFormat df = DateFormat.getDateTimeInstance(
  -                                                    DateFormat.SHORT,
  -                                                    DateFormat.SHORT,
  -                                                    Locale.US);
  +                    DateFormat.SHORT,
  +                    DateFormat.SHORT,
  +                    Locale.US);
               try {
                   setMillis(df.parse(dateTime).getTime());
                   if (millis < 0) {
                       setError("Date of " + dateTime
  -                        + " results in negative milliseconds value relative"
  -                        + " to epoch (January 1, 1970, 00:00:00 GMT).");
  +                            + " results in negative milliseconds value relative"
  +                            + " to epoch (January 1, 1970, 00:00:00 GMT).");
                   }
               } catch (ParseException pe) {
  -                    setError("Date of " + dateTime
  +                setError("Date of " + dateTime
                           + " Cannot be parsed correctly. It should be in"
                           + " MM/DD/YYYY HH:MM AM_PM format.");
               }
  @@ -192,33 +192,28 @@
                   if (MILLIS_KEY.equalsIgnoreCase(paramname)) {
                       try {
                           setMillis(new Long(parameters[i].getValue()
  -                                ).longValue());
  +                        ).longValue());
                       } catch (NumberFormatException nfe) {
                           setError("Invalid millisecond setting " +
  -                            parameters[i].getValue());
  +                                parameters[i].getValue());
                       }
  -                }
  -                else if (DATETIME_KEY.equalsIgnoreCase(paramname)) {
  +                } else if (DATETIME_KEY.equalsIgnoreCase(paramname)) {
                       setDatetime(parameters[i].getValue());
  -                }
  -                else if (CHECKDIRS_KEY.equalsIgnoreCase(paramname)) {
  +                } else if (CHECKDIRS_KEY.equalsIgnoreCase(paramname)) {
                       setCheckdirs(Project.toBoolean(parameters[i].getValue()));
  -                }
  -                else if (GRANULARITY_KEY.equalsIgnoreCase(paramname)) {
  +                } else if (GRANULARITY_KEY.equalsIgnoreCase(paramname)) {
                       try {
                           setGranularity(new Integer(parameters[i].getValue()
  -                                ).intValue());
  +                        ).intValue());
                       } catch (NumberFormatException nfe) {
                           setError("Invalid granularity setting " +
  -                            parameters[i].getValue());
  +                                parameters[i].getValue());
                       }
  -                }
  -                else if (WHEN_KEY.equalsIgnoreCase(paramname)) {
  +                } else if (WHEN_KEY.equalsIgnoreCase(paramname)) {
                       TimeComparisons cmp = new TimeComparisons();
                       cmp.setValue(parameters[i].getValue());
                       setWhen(cmp);
  -                }
  -                else {
  +                } else {
                       setError("Invalid parameter " + paramname);
                   }
               }
  @@ -232,12 +227,11 @@
       public void verifySettings() {
           if (dateTime == null && millis < 0) {
               setError("You must provide a datetime or the number of "
  -                + "milliseconds.");
  -        }
  -        else if (millis < 0) {
  +                    + "milliseconds.");
  +        } else if (millis < 0) {
               setError("Date of " + dateTime
  -                + " results in negative milliseconds"
  -                + " value relative to epoch (January 1, 1970, 00:00:00 GMT).");
  +                    + " results in negative milliseconds value"
  +                    + " relative to epoch (January 1, 1970, 00:00:00 GMT).");
           }
       }
   
  @@ -257,12 +251,10 @@
           }
           if (cmp == 0) {
               return ((file.lastModified() - granularity) < millis);
  -        }
  -        else if (cmp == 1) {
  +        } else if (cmp == 1) {
               return ((file.lastModified() + granularity) > millis);
  -        }
  -        else {
  -            return (Math.abs(file.lastModified() -  millis) <= granularity);
  +        } else {
  +            return (Math.abs(file.lastModified() - millis) <= granularity);
           }
       }
   
  @@ -272,7 +264,7 @@
        */
       public static class TimeComparisons extends EnumeratedAttribute {
           public String[] getValues() {
  -            return new String[] {"before", "after", "equal"};
  +            return new String[]{"before", "after", "equal"};
           }
       }
   
  
  
  
  1.10      +4 -5      ant/src/main/org/apache/tools/ant/types/selectors/DependSelector.java
  
  Index: DependSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/DependSelector.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DependSelector.java	18 Apr 2003 23:40:30 -0000	1.9
  +++ DependSelector.java	4 Jul 2003 23:18:49 -0000	1.10
  @@ -75,8 +75,7 @@
           StringBuffer buf = new StringBuffer("{dependselector targetdir: ");
           if (targetdir == null) {
               buf.append("NOT YET SET");
  -        }
  -        else {
  +        } else {
               buf.append(targetdir.getName());
           }
           buf.append(" granularity: ");
  @@ -84,8 +83,7 @@
           if (map != null) {
               buf.append(" mapper: ");
               buf.append(map.toString());
  -        }
  -        else if (mapperElement != null) {
  +        } else if (mapperElement != null) {
               buf.append(" mapper: ");
               buf.append(mapperElement.toString());
           }
  @@ -101,7 +99,8 @@
        * @return
        */
       public boolean selectionTest(File srcfile, File destfile) {
  -        boolean selected=SelectorUtils.isOutOfDate(srcfile, destfile, granularity);
  +        boolean selected = SelectorUtils.isOutOfDate(srcfile, destfile,
  +                granularity);
           return selected;
       }
   
  
  
  
  1.5       +19 -20    ant/src/main/org/apache/tools/ant/types/selectors/DepthSelector.java
  
  Index: DepthSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/DepthSelector.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DepthSelector.java	10 Feb 2003 14:14:35 -0000	1.4
  +++ DepthSelector.java	4 Jul 2003 23:18:49 -0000	1.5
  @@ -56,6 +56,7 @@
   
   import java.io.File;
   import java.util.StringTokenizer;
  +
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.types.Parameter;
   
  @@ -97,7 +98,7 @@
       /**
        * The minimum depth below the basedir before a file is selected.
        *
  -     * @param min maximum directory levels below basedir to go
  +     * @param max maximum directory levels below basedir to go
        */
       public void setMax(int max) {
           this.max = max;
  @@ -117,22 +118,18 @@
                   if (MIN_KEY.equalsIgnoreCase(paramname)) {
                       try {
                           setMin(Integer.parseInt(parameters[i].getValue()));
  -                    }
  -                    catch (NumberFormatException nfe1) {
  +                    } catch (NumberFormatException nfe1) {
                           setError("Invalid minimum value "
  -                            + parameters[i].getValue());
  +                                + parameters[i].getValue());
                       }
  -                }
  -                else if (MAX_KEY.equalsIgnoreCase(paramname)) {
  +                } else if (MAX_KEY.equalsIgnoreCase(paramname)) {
                       try {
                           setMax(Integer.parseInt(parameters[i].getValue()));
  -                    }
  -                    catch (NumberFormatException nfe1) {
  +                    } catch (NumberFormatException nfe1) {
                           setError("Invalid maximum value "
  -                            + parameters[i].getValue());
  +                                + parameters[i].getValue());
                       }
  -                }
  -                else {
  +                } else {
                       setError("Invalid parameter " + paramname);
                   }
               }
  @@ -145,8 +142,8 @@
        */
       public void verifySettings() {
           if (min < 0 && max < 0) {
  -            setError("You must set at least one of the min or the " +
  -                    "max levels.");
  +            setError("You must set at least one of the min or the "
  +                    + "max levels.");
           }
           if (max < min && max > -1) {
               setError("The maximum depth is lower than the minimum.");
  @@ -174,19 +171,21 @@
           // If you felt daring, you could cache the basedir absolute path
           String abs_base = basedir.getAbsolutePath();
           String abs_file = file.getAbsolutePath();
  -        StringTokenizer tok_base = new StringTokenizer(abs_base, File.separator);
  -        StringTokenizer tok_file = new StringTokenizer(abs_file, File.separator);
  +        StringTokenizer tok_base = new StringTokenizer(abs_base,
  +                File.separator);
  +        StringTokenizer tok_file = new StringTokenizer(abs_file,
  +                File.separator);
           while (tok_file.hasMoreTokens()) {
               String filetoken = tok_file.nextToken();
               if (tok_base.hasMoreTokens()) {
                   String basetoken = tok_base.nextToken();
                   // Sanity check. Ditch it if you want faster performance
                   if (!basetoken.equals(filetoken)) {
  -                    throw new BuildException("File " + filename +
  -                        " does not appear within " + abs_base + "directory");
  +                    throw new BuildException("File " + filename
  +                            + " does not appear within " + abs_base
  +                            + "directory");
                   }
  -            }
  -            else {
  +            } else {
                   depth += 1;
                   if (max > -1 && depth > max) {
                       return false;
  @@ -195,7 +194,7 @@
           }
           if (tok_base.hasMoreTokens()) {
               throw new BuildException("File " + filename +
  -                " is outside of " + abs_base + "directory tree");
  +                    " is outside of " + abs_base + "directory tree");
           }
           if (min > -1 && depth < min) {
               return false;
  
  
  
  1.7       +19 -16    ant/src/main/org/apache/tools/ant/types/selectors/DifferentSelector.java
  
  Index: DifferentSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/DifferentSelector.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DifferentSelector.java	4 Jul 2003 14:04:56 -0000	1.6
  +++ DifferentSelector.java	4 Jul 2003 23:18:49 -0000	1.7
  @@ -61,27 +61,29 @@
   import java.io.IOException;
   
   /**
  - * This selector selects files against a mapped set of target files, selecting all those
  - * files which are different. A byte-by-byte comparision is performed on equal length files;
  - * files with different lengths are deemed different automatically; files with identical timestamps
  - * are viewed as matching by default, unless you specify otherwise.
  + * This selector selects files against a mapped set of target files, selecting
  + * all those files which are different. A byte-by-byte comparision is performed
  + * on equal length files; files with different lengths are deemed different
  + * automatically; files with identical timestamps are viewed as matching by
  + * default, unless you specify otherwise.
    * <p>
    * This is a useful selector to work with programs and tasks that don't handle
    * dependency checking properly; Even if a predecessor task always creates its
  - * output files, followup tasks can be driven off copies made with a different selector,
  - * so their dependencies are driven on the absolute state of the files, not a timestamp.
  + * output files, followup tasks can be driven off copies made with a different
  + * selector, so their dependencies are driven on the absolute state of the
  + * files, not a timestamp.
    * <p>
  - * Clearly, however, bulk file comparisons is inefficient; anything that can use
  - * timestamps is to be preferred. If this selector must be used, use it over as few files
  - * as possible, perhaps following it with an &lt;uptodate;&gt to keep the descendent
  - * routines conditional.
  + * Clearly, however, bulk file comparisons is inefficient; anything that can
  + * use timestamps is to be preferred. If this selector must be used, use it
  + * over as few files as possible, perhaps following it with an &lt;uptodate;&gt
  + * to keep the descendent routines conditional.
    *
    */
   public class DifferentSelector extends MappingSelector {
   
  -    private FileUtils fileUtils= FileUtils.newFileUtils();
  +    private FileUtils fileUtils = FileUtils.newFileUtils();
   
  -    private boolean ignoreFileTimes=true;
  +    private boolean ignoreFileTimes = true;
   
   
       /**
  @@ -114,19 +116,20 @@
               //same date if dest timestamp is within granularity of the srcfile
               boolean sameDate;
               sameDate = destfile.lastModified() >= srcfile.lastModified() - granularity
  -                && destfile.lastModified() <= srcfile.lastModified() + granularity;
  +                    && destfile.lastModified() <= srcfile.lastModified() + granularity;
   
               // different dates => different files
  -            if(!sameDate) {
  +            if (!sameDate) {
                   return true;
               }
           }
   
           //here do a bulk comparison
           try {
  -            return !fileUtils.contentEquals(srcfile,destfile);
  +            return !fileUtils.contentEquals(srcfile, destfile);
           } catch (IOException e) {
  -            throw new BuildException("while comparing "+srcfile+" and "+destfile,e);
  +            throw new BuildException("while comparing " + srcfile + " and "
  +                    + destfile, e);
           }
       }
   }
  
  
  
  1.5       +2 -2      ant/src/main/org/apache/tools/ant/types/selectors/ExtendFileSelector.java
  
  Index: ExtendFileSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/ExtendFileSelector.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ExtendFileSelector.java	10 Feb 2003 14:14:35 -0000	1.4
  +++ ExtendFileSelector.java	4 Jul 2003 23:18:49 -0000	1.5
  @@ -70,7 +70,7 @@
    */
   public interface ExtendFileSelector extends FileSelector, Parameterizable {
   
  -  // No further methods necessary. This is just an amalgamation of two other
  -  // interfaces.
  +    // No further methods necessary. This is just an amalgamation of two other
  +    // interfaces.
   }
   
  
  
  
  1.9       +11 -15    ant/src/main/org/apache/tools/ant/types/selectors/ExtendSelector.java
  
  Index: ExtendSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/ExtendSelector.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ExtendSelector.java	15 Apr 2003 17:23:16 -0000	1.8
  +++ ExtendSelector.java	4 Jul 2003 23:18:49 -0000	1.9
  @@ -56,6 +56,7 @@
   
   import java.io.File;
   import java.util.Vector;
  +
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.AntClassLoader;
   import org.apache.tools.ant.BuildException;
  @@ -102,25 +103,22 @@
                       c = Class.forName(classname);
                   } else {
                       AntClassLoader al
  -                        = getProject().createClassLoader(classpath);
  +                            = getProject().createClassLoader(classpath);
                       c = al.loadClass(classname);
                       AntClassLoader.initializeClass(c);
                   }
                   dynselector = (FileSelector) c.newInstance();
                   final Project project = getProject();
  -                if ( project != null ) {
  -                    project.setProjectReference( dynselector );
  +                if (project != null) {
  +                    project.setProjectReference(dynselector);
                   }
  -            }
  -            catch (ClassNotFoundException cnfexcept) {
  +            } catch (ClassNotFoundException cnfexcept) {
                   setError("Selector " + classname +
                           " not initialized, no such class");
  -            }
  -            catch (InstantiationException iexcept) {
  +            } catch (InstantiationException iexcept) {
                   setError("Selector " + classname +
                           " not initialized, could not create class");
  -            }
  -            catch (IllegalAccessException iaexcept) {
  +            } catch (IllegalAccessException iaexcept) {
                   setError("Selector " + classname +
                           " not initialized, class not accessible");
               }
  @@ -198,11 +196,9 @@
           }
           if (classname == null || classname.length() < 1) {
               setError("The classname attribute is required");
  -        }
  -        else if (dynselector == null) {
  +        } else if (dynselector == null) {
               setError("Internal Error: The custom selector was not created");
  -        }
  -        else if (!(dynselector instanceof ExtendFileSelector) &&
  +        } else if (!(dynselector instanceof ExtendFileSelector) &&
                   (paramVec.size() > 0)) {
               setError("Cannot set parameters on custom selector that does not "
                       + "implement ExtendFileSelector");
  @@ -224,9 +220,9 @@
               Parameter[] paramArray = new Parameter[paramVec.size()];
               paramVec.copyInto(paramArray);
               // We know that dynselector must be non-null if no error message
  -            ((ExtendFileSelector)dynselector).setParameters(paramArray);
  +            ((ExtendFileSelector) dynselector).setParameters(paramArray);
           }
  -        return dynselector.isSelected(basedir,filename,file);
  +        return dynselector.isSelected(basedir, filename, file);
       }
   
   }
  
  
  
  1.4       +1 -0      ant/src/main/org/apache/tools/ant/types/selectors/FileSelector.java
  
  Index: FileSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/FileSelector.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FileSelector.java	10 Feb 2003 14:14:35 -0000	1.3
  +++ FileSelector.java	4 Jul 2003 23:18:49 -0000	1.4
  @@ -55,6 +55,7 @@
   package org.apache.tools.ant.types.selectors;
   
   import java.io.File;
  +
   import org.apache.tools.ant.BuildException;
   
   /**
  
  
  
  1.5       +7 -9      ant/src/main/org/apache/tools/ant/types/selectors/FilenameSelector.java
  
  Index: FilenameSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/FilenameSelector.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FilenameSelector.java	10 Feb 2003 14:14:35 -0000	1.4
  +++ FilenameSelector.java	4 Jul 2003 23:18:49 -0000	1.5
  @@ -55,6 +55,7 @@
   package org.apache.tools.ant.types.selectors;
   
   import java.io.File;
  +
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.types.Parameter;
   
  @@ -103,7 +104,7 @@
        *                against in order to be selected.
        */
       public void setName(String pattern) {
  -        pattern = pattern.replace('/',File.separatorChar).replace('\\',
  +        pattern = pattern.replace('/', File.separatorChar).replace('\\',
                   File.separatorChar);
           if (pattern.endsWith(File.separator)) {
               pattern += "**";
  @@ -145,15 +146,12 @@
                   String paramname = parameters[i].getName();
                   if (NAME_KEY.equalsIgnoreCase(paramname)) {
                       setName(parameters[i].getValue());
  -                }
  -                else if (CASE_KEY.equalsIgnoreCase(paramname)) {
  +                } else if (CASE_KEY.equalsIgnoreCase(paramname)) {
                       setCasesensitive(Project.toBoolean(
  -                        parameters[i].getValue()));
  -                }
  -                else if (NEGATE_KEY.equalsIgnoreCase(paramname)) {
  +                            parameters[i].getValue()));
  +                } else if (NEGATE_KEY.equalsIgnoreCase(paramname)) {
                       setNegate(Project.toBoolean(parameters[i].getValue()));
  -                }
  -                else {
  +                } else {
                       setError("Invalid parameter " + paramname);
                   }
               }
  @@ -186,7 +184,7 @@
       public boolean isSelected(File basedir, String filename, File file) {
           validate();
   
  -        return (SelectorUtils.matchPath(pattern,filename,
  +        return (SelectorUtils.matchPath(pattern, filename,
                   casesensitive) == !(negated));
       }
   
  
  
  
  1.3       +6 -9      ant/src/main/org/apache/tools/ant/types/selectors/MajoritySelector.java
  
  Index: MajoritySelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/MajoritySelector.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MajoritySelector.java	10 Feb 2003 14:14:35 -0000	1.2
  +++ MajoritySelector.java	4 Jul 2003 23:18:49 -0000	1.3
  @@ -111,21 +111,18 @@
           Enumeration e = selectorElements();
           boolean result;
   
  -        while(e.hasMoreElements()) {
  -            result = ((FileSelector)e.nextElement()).isSelected(basedir,
  -                    filename,file);
  +        while (e.hasMoreElements()) {
  +            result = ((FileSelector) e.nextElement()).isSelected(basedir,
  +                    filename, file);
               if (result) {
                   yesvotes = yesvotes + 1;
  -            }
  -            else {
  +            } else {
                   novotes = novotes + 1;
               }
           }
  -        if (yesvotes > novotes)
  -        {
  +        if (yesvotes > novotes) {
               return true;
  -        }
  -        else if (novotes > yesvotes) {
  +        } else if (novotes > yesvotes) {
               return false;
           }
           // At this point, we know we have a tie.
  
  
  
  1.5       +5 -6      ant/src/main/org/apache/tools/ant/types/selectors/MappingSelector.java
  
  Index: MappingSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/MappingSelector.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MappingSelector.java	4 Jul 2003 14:04:56 -0000	1.4
  +++ MappingSelector.java	4 Jul 2003 23:18:49 -0000	1.5
  @@ -110,8 +110,7 @@
           }
           if (mapperElement == null) {
               map = new IdentityMapper();
  -        }
  -        else {
  +        } else {
               map = mapperElement.getImplementation();
           }
           if (map == null) {
  @@ -143,10 +142,10 @@
           // Sanity check
           if (destfiles.length != 1 || destfiles[0] == null) {
               throw new BuildException("Invalid destination file results for "
  -                + targetdir.getName() + " with filename " + filename);
  +                    + targetdir.getName() + " with filename " + filename);
           }
           String destname = destfiles[0];
  -        File destfile = new File(targetdir,destname);
  +        File destfile = new File(targetdir, destname);
   
           boolean selected = selectionTest(file, destfile);
           return selected;
  @@ -162,8 +161,8 @@
   
       /**
        * Sets the number of milliseconds leeway we will give before we consider
  -     * a file out of date. Defaults to 2000 on MS-DOS derivatives as the FAT file
  -     * system.
  +     * a file out of date. Defaults to 2000 on MS-DOS derivatives as the FAT
  +     * file system.
        */
       public void setGranularity(int granularity) {
           this.granularity = granularity;
  
  
  
  1.3       +3 -3      ant/src/main/org/apache/tools/ant/types/selectors/NoneSelector.java
  
  Index: NoneSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/NoneSelector.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NoneSelector.java	10 Feb 2003 14:14:35 -0000	1.2
  +++ NoneSelector.java	4 Jul 2003 23:18:49 -0000	1.3
  @@ -98,9 +98,9 @@
           Enumeration e = selectorElements();
           boolean result;
   
  -        while(e.hasMoreElements()) {
  -            result = ((FileSelector)e.nextElement()).isSelected(basedir,
  -                    filename,file);
  +        while (e.hasMoreElements()) {
  +            result = ((FileSelector) e.nextElement()).isSelected(basedir,
  +                    filename, file);
               if (result) {
                   return false;
               }
  
  
  
  1.4       +0 -1      ant/src/main/org/apache/tools/ant/types/selectors/NotSelector.java
  
  Index: NotSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/NotSelector.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NotSelector.java	10 Feb 2003 14:14:35 -0000	1.3
  +++ NotSelector.java	4 Jul 2003 23:18:49 -0000	1.4
  @@ -55,7 +55,6 @@
   package org.apache.tools.ant.types.selectors;
   
   
  -
   /**
    * This selector has one other selectors whose meaning it inverts. It
    * actually relies on NoneSelector for its implementation of the
  
  
  
  1.3       +3 -3      ant/src/main/org/apache/tools/ant/types/selectors/OrSelector.java
  
  Index: OrSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/OrSelector.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- OrSelector.java	10 Feb 2003 14:14:35 -0000	1.2
  +++ OrSelector.java	4 Jul 2003 23:18:49 -0000	1.3
  @@ -98,9 +98,9 @@
           boolean result;
   
           // First, check that all elements are correctly configured
  -        while(e.hasMoreElements()) {
  -            result = ((FileSelector)e.nextElement()).isSelected(basedir,
  -                    filename,file);
  +        while (e.hasMoreElements()) {
  +            result = ((FileSelector) e.nextElement()).isSelected(basedir,
  +                    filename, file);
               if (result) {
                   return true;
               }
  
  
  
  1.7       +7 -9      ant/src/main/org/apache/tools/ant/types/selectors/PresentSelector.java
  
  Index: PresentSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/PresentSelector.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PresentSelector.java	10 Feb 2003 14:14:35 -0000	1.6
  +++ PresentSelector.java	4 Jul 2003 23:18:49 -0000	1.7
  @@ -55,6 +55,7 @@
   package org.apache.tools.ant.types.selectors;
   
   import java.io.File;
  +
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.types.EnumeratedAttribute;
   import org.apache.tools.ant.types.Mapper;
  @@ -84,8 +85,7 @@
           StringBuffer buf = new StringBuffer("{presentselector targetdir: ");
           if (targetdir == null) {
               buf.append("NOT YET SET");
  -        }
  -        else {
  +        } else {
               buf.append(targetdir.getName());
           }
           buf.append(" present: ");
  @@ -96,8 +96,7 @@
           }
           if (map != null) {
               buf.append(map.toString());
  -        }
  -        else if (mapperElement != null) {
  +        } else if (mapperElement != null) {
               buf.append(mapperElement.toString());
           }
           buf.append("}");
  @@ -154,8 +153,7 @@
           }
           if (mapperElement == null) {
               map = new IdentityMapper();
  -        }
  -        else {
  +        } else {
               map = mapperElement.getImplementation();
           }
           if (map == null) {
  @@ -187,10 +185,10 @@
           // Sanity check
           if (destfiles.length != 1 || destfiles[0] == null) {
               throw new BuildException("Invalid destination file results for "
  -                + targetdir + " with filename " + filename);
  +                    + targetdir + " with filename " + filename);
           }
           String destname = destfiles[0];
  -        File destfile = new File(targetdir,destname);
  +        File destfile = new File(targetdir, destname);
           return destfile.exists() == destmustexist;
       }
   
  @@ -200,7 +198,7 @@
        */
       public static class FilePresence extends EnumeratedAttribute {
           public String[] getValues() {
  -            return new String[] {"srconly", "both"};
  +            return new String[]{"srconly", "both"};
           }
       }
   
  
  
  
  1.7       +5 -7      ant/src/main/org/apache/tools/ant/types/selectors/SelectSelector.java
  
  Index: SelectSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/SelectSelector.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SelectSelector.java	10 Feb 2003 14:14:35 -0000	1.6
  +++ SelectSelector.java	4 Jul 2003 23:18:49 -0000	1.7
  @@ -153,7 +153,6 @@
        * Add a new selector into this container.
        *
        * @param selector the new selector to add
  -     * @return the selector that was added
        */
       public void appendSelector(FileSelector selector) {
           if (isReference()) {
  @@ -163,7 +162,6 @@
       }
   
   
  -
       /**
        * Makes sure that there is only one entry, sets an error message if
        * not.
  @@ -172,7 +170,7 @@
           int cnt = selectorCount();
           if (cnt < 0 || cnt > 1) {
               setError("Only one selector is allowed within the " +
  -                     "<selector> tag");
  +                    "<selector> tag");
           }
       }
   
  @@ -182,10 +180,10 @@
        */
       public boolean passesConditions() {
           if (ifProperty != null &&
  -            getProject().getProperty(ifProperty) == null) {
  +                getProject().getProperty(ifProperty) == null) {
               return false;
           } else if (unlessProperty != null &&
  -                   getProject().getProperty(unlessProperty) != null) {
  +                getProject().getProperty(unlessProperty) != null) {
               return false;
           }
           return true;
  @@ -232,8 +230,8 @@
           if (!(e.hasMoreElements())) {
               return true;
           }
  -        FileSelector f = (FileSelector)e.nextElement();
  -        return f.isSelected(basedir,filename,file);
  +        FileSelector f = (FileSelector) e.nextElement();
  +        return f.isSelected(basedir, filename, file);
       }
   }
   
  
  
  
  1.8       +2 -2      ant/src/main/org/apache/tools/ant/types/selectors/SelectorContainer.java
  
  Index: SelectorContainer.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/SelectorContainer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SelectorContainer.java	28 May 2003 16:27:37 -0000	1.7
  +++ SelectorContainer.java	4 Jul 2003 23:18:49 -0000	1.8
  @@ -55,6 +55,7 @@
   package org.apache.tools.ant.types.selectors;
   
   import java.util.Enumeration;
  +
   import org.apache.tools.ant.Project;
   
   /**
  @@ -97,7 +98,6 @@
        * Add a new selector into this container.
        *
        * @param selector the new selector to add
  -     * @return the selector that was added
        */
       public void appendSelector(FileSelector selector);
   
  @@ -172,7 +172,7 @@
        * add a depends selector entry on the selector list
        */
       public void addDepend(DependSelector selector);
  -    
  +
       /**
        * add a regular expression selector entry on the selector list
        */
  
  
  
  1.3       +2 -2      ant/src/main/org/apache/tools/ant/types/selectors/SelectorScanner.java
  
  Index: SelectorScanner.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/SelectorScanner.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SelectorScanner.java	10 Feb 2003 14:14:35 -0000	1.2
  +++ SelectorScanner.java	4 Jul 2003 23:18:49 -0000	1.3
  @@ -71,14 +71,14 @@
       /**
        * Directories which were selected out of a scan.
        *
  -     * @param selectors list selector objects
  +     * @return list of directories not selected
        */
       public String[] getDeselectedDirectories();
   
       /**
        * Files which were selected out of a scan.
        *
  -     * @param selectors list selector objects
  +     * @return list of files not selected
        */
       public String[] getDeselectedFiles();
   
  
  
  
  1.11      +88 -80    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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SelectorUtils.java	4 Jul 2003 08:43:39 -0000	1.10
  +++ SelectorUtils.java	4 Jul 2003 23:18:49 -0000	1.11
  @@ -84,9 +84,10 @@
       private SelectorUtils() {
       }
   
  -     /**
  -      * Retrieves the instance of the Singleton.
  -      */
  +    /**
  +     * Retrieves the instance of the Singleton.
  +     * @return singleton instance
  +     */
       public static SelectorUtils getInstance() {
           return instance;
       }
  @@ -110,6 +111,7 @@
       public static boolean matchPatternStart(String pattern, String str) {
           return matchPatternStart(pattern, str, true);
       }
  +
       /**
        * Tests whether or not a given path matches the start of a given
        * pattern up to the first "**".
  @@ -129,13 +131,13 @@
        * pattern up to the first "**".
        */
       public static boolean matchPatternStart(String pattern, String str,
  -                                               boolean isCaseSensitive) {
  +                                            boolean isCaseSensitive) {
           // When str starts with a File.separator, pattern has to start with a
           // File.separator.
           // When pattern starts with a File.separator, str has to start with a
           // File.separator.
  -        if (str.startsWith(File.separator) !=
  -            pattern.startsWith(File.separator)) {
  +        if (str.startsWith(File.separator)
  +                != pattern.startsWith(File.separator)) {
               return false;
           }
   
  @@ -143,9 +145,9 @@
           String[] strDirs = tokenizePathAsArray(str);
   
           int patIdxStart = 0;
  -        int patIdxEnd   = patDirs.length-1;
  +        int patIdxEnd = patDirs.length - 1;
           int strIdxStart = 0;
  -        int strIdxEnd   = strDirs.length-1;
  +        int strIdxEnd = strDirs.length - 1;
   
           // up to first '**'
           while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) {
  @@ -153,8 +155,7 @@
               if (patDir.equals("**")) {
                   break;
               }
  -            if (!match(patDir,strDirs[strIdxStart],
  -                    isCaseSensitive)) {
  +            if (!match(patDir, strDirs[strIdxStart], isCaseSensitive)) {
                   return false;
               }
               patIdxStart++;
  @@ -203,13 +204,13 @@
        *         or <code>false</code> otherwise.
        */
       public static boolean matchPath(String pattern, String str,
  -            boolean isCaseSensitive) {
  +                                    boolean isCaseSensitive) {
           // When str starts with a File.separator, pattern has to start with a
           // File.separator.
           // When pattern starts with a File.separator, str has to start with a
           // File.separator.
  -        if (str.startsWith(File.separator) !=
  -            pattern.startsWith(File.separator)) {
  +        if (str.startsWith(File.separator)
  +                != pattern.startsWith(File.separator)) {
               return false;
           }
   
  @@ -217,9 +218,9 @@
           String[] strDirs = tokenizePathAsArray(str);
   
           int patIdxStart = 0;
  -        int patIdxEnd   = patDirs.length-1;
  +        int patIdxEnd = patDirs.length - 1;
           int strIdxStart = 0;
  -        int strIdxEnd   = strDirs.length-1;
  +        int strIdxEnd = strDirs.length - 1;
   
           // up to first '**'
           while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) {
  @@ -227,9 +228,9 @@
               if (patDir.equals("**")) {
                   break;
               }
  -            if (!match(patDir,strDirs[strIdxStart],
  -                    isCaseSensitive)) {
  -                patDirs = null; strDirs = null;
  +            if (!match(patDir, strDirs[strIdxStart], isCaseSensitive)) {
  +                patDirs = null;
  +                strDirs = null;
                   return false;
               }
               patIdxStart++;
  @@ -239,7 +240,8 @@
               // String is exhausted
               for (int i = patIdxStart; i <= patIdxEnd; i++) {
                   if (!patDirs[i].equals("**")) {
  -                    patDirs = null; strDirs = null;
  +                    patDirs = null;
  +                    strDirs = null;
                       return false;
                   }
               }
  @@ -247,7 +249,8 @@
           } else {
               if (patIdxStart > patIdxEnd) {
                   // String not exhausted, but pattern is. Failure.
  -                patDirs = null; strDirs = null;
  +                patDirs = null;
  +                strDirs = null;
                   return false;
               }
           }
  @@ -258,9 +261,9 @@
               if (patDir.equals("**")) {
                   break;
               }
  -            if (!match(patDir,strDirs[strIdxEnd],
  -                    isCaseSensitive)) {
  -                patDirs = null; strDirs = null;
  +            if (!match(patDir, strDirs[strIdxEnd], isCaseSensitive)) {
  +                patDirs = null;
  +                strDirs = null;
                   return false;
               }
               patIdxEnd--;
  @@ -270,7 +273,8 @@
               // String is exhausted
               for (int i = patIdxStart; i <= patIdxEnd; i++) {
                   if (!patDirs[i].equals("**")) {
  -                    patDirs = null; strDirs = null;
  +                    patDirs = null;
  +                    strDirs = null;
                       return false;
                   }
               }
  @@ -279,48 +283,50 @@
   
           while (patIdxStart != patIdxEnd && strIdxStart <= strIdxEnd) {
               int patIdxTmp = -1;
  -            for (int i = patIdxStart+1; i <= patIdxEnd; i++) {
  +            for (int i = patIdxStart + 1; i <= patIdxEnd; i++) {
                   if (patDirs[i].equals("**")) {
                       patIdxTmp = i;
                       break;
                   }
               }
  -            if (patIdxTmp == patIdxStart+1) {
  +            if (patIdxTmp == patIdxStart + 1) {
                   // '**/**' situation, so skip one
                   patIdxStart++;
                   continue;
               }
               // Find the pattern between padIdxStart & padIdxTmp in str between
               // strIdxStart & strIdxEnd
  -            int patLength = (patIdxTmp-patIdxStart-1);
  -            int strLength = (strIdxEnd-strIdxStart+1);
  -            int foundIdx  = -1;
  -strLoop:
  -            for (int i = 0; i <= strLength - patLength; i++) {
  -                for (int j = 0; j < patLength; j++) {
  -                    String subPat = patDirs[patIdxStart+j+1];
  -                    String subStr = strDirs[strIdxStart+i+j];
  -                    if (!match(subPat,subStr, isCaseSensitive)) {
  -                        continue strLoop;
  -                    }
  -                }
  +            int patLength = (patIdxTmp - patIdxStart - 1);
  +            int strLength = (strIdxEnd - strIdxStart + 1);
  +            int foundIdx = -1;
  +            strLoop:
  +                        for (int i = 0; i <= strLength - patLength; i++) {
  +                            for (int j = 0; j < patLength; j++) {
  +                                String subPat = patDirs[patIdxStart + j + 1];
  +                                String subStr = strDirs[strIdxStart + i + j];
  +                                if (!match(subPat, subStr, isCaseSensitive)) {
  +                                    continue strLoop;
  +                                }
  +                            }
   
  -                foundIdx = strIdxStart+i;
  -                break;
  -            }
  +                            foundIdx = strIdxStart + i;
  +                            break;
  +                        }
   
               if (foundIdx == -1) {
  -                patDirs = null; strDirs = null;
  +                patDirs = null;
  +                strDirs = null;
                   return false;
               }
   
               patIdxStart = patIdxTmp;
  -            strIdxStart = foundIdx+patLength;
  +            strIdxStart = foundIdx + patLength;
           }
   
           for (int i = patIdxStart; i <= patIdxEnd; i++) {
               if (!patDirs[i].equals("**")) {
  -                patDirs = null; strDirs = null;
  +                patDirs = null;
  +                strDirs = null;
                   return false;
               }
           }
  @@ -364,13 +370,13 @@
        *         or <code>false</code> otherwise.
        */
       public static boolean match(String pattern, String str,
  -            boolean isCaseSensitive) {
  +                                boolean isCaseSensitive) {
           char[] patArr = pattern.toCharArray();
           char[] strArr = str.toCharArray();
           int patIdxStart = 0;
  -        int patIdxEnd   = patArr.length-1;
  +        int patIdxEnd = patArr.length - 1;
           int strIdxStart = 0;
  -        int strIdxEnd   = strArr.length-1;
  +        int strIdxEnd = strArr.length - 1;
           char ch;
   
           boolean containsStar = false;
  @@ -390,12 +396,12 @@
                   ch = patArr[i];
                   if (ch != '?') {
                       if (isCaseSensitive && ch != strArr[i]) {
  -                        return false;// Character mismatch
  -                    }
  -                    if (!isCaseSensitive && Character.toUpperCase(ch) !=
  -                        Character.toUpperCase(strArr[i])) {
                           return false; // Character mismatch
                       }
  +                    if (!isCaseSensitive && Character.toUpperCase(ch)
  +                            != Character.toUpperCase(strArr[i])) {
  +                        return false;  // Character mismatch
  +                    }
                   }
               }
               return true; // String matches against pattern
  @@ -406,14 +412,14 @@
           }
   
           // Process characters before first star
  -        while((ch = patArr[patIdxStart]) != '*' && strIdxStart <= strIdxEnd) {
  +        while ((ch = patArr[patIdxStart]) != '*' && strIdxStart <= strIdxEnd) {
               if (ch != '?') {
                   if (isCaseSensitive && ch != strArr[strIdxStart]) {
  -                    return false;// Character mismatch
  +                    return false; // Character mismatch
                   }
  -                if (!isCaseSensitive && Character.toUpperCase(ch) !=
  -                    Character.toUpperCase(strArr[strIdxStart])) {
  -                    return false;// Character mismatch
  +                if (!isCaseSensitive && Character.toUpperCase(ch)
  +                        != Character.toUpperCase(strArr[strIdxStart])) {
  +                    return false; // Character mismatch
                   }
               }
               patIdxStart++;
  @@ -431,14 +437,14 @@
           }
   
           // Process characters after last star
  -        while((ch = patArr[patIdxEnd]) != '*' && strIdxStart <= strIdxEnd) {
  +        while ((ch = patArr[patIdxEnd]) != '*' && strIdxStart <= strIdxEnd) {
               if (ch != '?') {
                   if (isCaseSensitive && ch != strArr[strIdxEnd]) {
  -                    return false;// Character mismatch
  +                    return false; // Character mismatch
                   }
  -                if (!isCaseSensitive && Character.toUpperCase(ch) !=
  -                    Character.toUpperCase(strArr[strIdxEnd])) {
  -                    return false;// Character mismatch
  +                if (!isCaseSensitive && Character.toUpperCase(ch)
  +                        != Character.toUpperCase(strArr[strIdxEnd])) {
  +                    return false; // Character mismatch
                   }
               }
               patIdxEnd--;
  @@ -459,38 +465,40 @@
           // always to a '*'.
           while (patIdxStart != patIdxEnd && strIdxStart <= strIdxEnd) {
               int patIdxTmp = -1;
  -            for (int i = patIdxStart+1; i <= patIdxEnd; i++) {
  +            for (int i = patIdxStart + 1; i <= patIdxEnd; i++) {
                   if (patArr[i] == '*') {
                       patIdxTmp = i;
                       break;
                   }
               }
  -            if (patIdxTmp == patIdxStart+1) {
  +            if (patIdxTmp == patIdxStart + 1) {
                   // Two stars next to each other, skip the first one.
                   patIdxStart++;
                   continue;
               }
               // Find the pattern between padIdxStart & padIdxTmp in str between
               // strIdxStart & strIdxEnd
  -            int patLength = (patIdxTmp-patIdxStart-1);
  -            int strLength = (strIdxEnd-strIdxStart+1);
  -            int foundIdx  = -1;
  +            int patLength = (patIdxTmp - patIdxStart - 1);
  +            int strLength = (strIdxEnd - strIdxStart + 1);
  +            int foundIdx = -1;
               strLoop:
               for (int i = 0; i <= strLength - patLength; i++) {
                   for (int j = 0; j < patLength; j++) {
  -                    ch = patArr[patIdxStart+j+1];
  +                    ch = patArr[patIdxStart + j + 1];
                       if (ch != '?') {
  -                        if (isCaseSensitive && ch != strArr[strIdxStart+i+j]) {
  +                        if (isCaseSensitive && ch != strArr[strIdxStart + i
  +                                + j]) {
                               continue strLoop;
                           }
                           if (!isCaseSensitive && Character.toUpperCase(ch) !=
  -                            Character.toUpperCase(strArr[strIdxStart+i+j])) {
  +                                Character.toUpperCase(strArr[strIdxStart + i
  +                                + j])) {
                               continue strLoop;
                           }
                       }
                   }
   
  -                foundIdx = strIdxStart+i;
  +                foundIdx = strIdxStart + i;
                   break;
               }
   
  @@ -499,7 +507,7 @@
               }
   
               patIdxStart = patIdxTmp;
  -            strIdxStart = foundIdx+patLength;
  +            strIdxStart = foundIdx + patLength;
           }
   
           // All characters in the string are used. Check if only '*'s are left
  @@ -520,15 +528,15 @@
        *
        * @return a Vector of path elements from the tokenized path
        */
  -    public static Vector tokenizePath (String path) {
  +    public static Vector tokenizePath(String path) {
           Vector ret = new Vector();
  -        StringTokenizer st = new StringTokenizer(path,File.separator);
  +        StringTokenizer st = new StringTokenizer(path, File.separator);
           while (st.hasMoreTokens()) {
               ret.addElement(st.nextToken());
           }
           return ret;
       }
  -    
  +
       /**
        * Same as {@link #tokenizePath tokenizePath} but hopefully faster.
        */
  @@ -609,7 +617,7 @@
        *        determining out of dateness
        * @return whether the target is out of date
        */
  -    public static boolean isOutOfDate(Resource src, Resource target, 
  +    public static boolean isOutOfDate(Resource src, Resource target,
                                         int granularity) {
           if (!src.isExists()) {
               return false;
  @@ -623,7 +631,7 @@
           return false;
       }
   
  -   /**
  +    /**
        * "Flattens" a string by removing all whitespace (space, tab, linefeed,
        * carriage return, and formfeed). This uses StringTokenizer and the
        * default set of tokens as documented in the single arguement constructor.
  @@ -634,10 +642,10 @@
       public static String removeWhitespace(String input) {
           StringBuffer result = new StringBuffer();
           if (input != null) {
  -           StringTokenizer st = new StringTokenizer(input);
  -           while (st.hasMoreTokens()){
  -              result.append(st.nextToken());
  -           }
  +            StringTokenizer st = new StringTokenizer(input);
  +            while (st.hasMoreTokens()) {
  +                result.append(st.nextToken());
  +            }
           }
           return result.toString();
       }
  
  
  
  1.5       +28 -43    ant/src/main/org/apache/tools/ant/types/selectors/SizeSelector.java
  
  Index: SizeSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/SizeSelector.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SizeSelector.java	10 Feb 2003 14:14:35 -0000	1.4
  +++ SizeSelector.java	4 Jul 2003 23:18:49 -0000	1.5
  @@ -55,6 +55,7 @@
   package org.apache.tools.ant.types.selectors;
   
   import java.io.File;
  +
   import org.apache.tools.ant.types.EnumeratedAttribute;
   import org.apache.tools.ant.types.Parameter;
   
  @@ -83,8 +84,7 @@
           buf.append("compare: ");
           if (cmp == 0) {
               buf.append("less");
  -        }
  -        else if (cmp == 1) {
  +        } else if (cmp == 1) {
               buf.append("more");
           } else {
               buf.append("equal");
  @@ -138,26 +138,19 @@
           multiplier = 0;
           if ((i > -1) && (i < 4)) {
               multiplier = 1000;
  -        }
  -        else if ((i > 3) && (i < 9)) {
  +        } else if ((i > 3) && (i < 9)) {
               multiplier = 1024;
  -        }
  -        else if ((i > 8) && (i < 13)) {
  +        } else if ((i > 8) && (i < 13)) {
               multiplier = 1000000;
  -        }
  -        else if ((i > 12) && (i < 18)) {
  +        } else if ((i > 12) && (i < 18)) {
               multiplier = 1048576;
  -        }
  -        else if ((i > 17) && (i < 22)) {
  +        } else if ((i > 17) && (i < 22)) {
               multiplier = 1000000000L;
  -        }
  -        else if ((i > 21) && (i < 27)) {
  +        } else if ((i > 21) && (i < 27)) {
               multiplier = 1073741824L;
  -        }
  -        else if ((i > 26) && (i < 31)) {
  +        } else if ((i > 26) && (i < 31)) {
               multiplier = 1000000000000L;
  -        }
  -        else if ((i > 30) && (i < 36)) {
  +        } else if ((i > 30) && (i < 36)) {
               multiplier = 1099511627776L;
           }
           if ((multiplier > 0) && (size > -1)) {
  @@ -190,23 +183,20 @@
                   if (SIZE_KEY.equalsIgnoreCase(paramname)) {
                       try {
                           setValue(new Long(parameters[i].getValue()
  -                                ).longValue());
  +                        ).longValue());
                       } catch (NumberFormatException nfe) {
                           setError("Invalid size setting "
  -                            + parameters[i].getValue());
  +                                + parameters[i].getValue());
                       }
  -                }
  -                else if (UNITS_KEY.equalsIgnoreCase(paramname)) {
  +                } else if (UNITS_KEY.equalsIgnoreCase(paramname)) {
                       ByteUnits units = new ByteUnits();
                       units.setValue(parameters[i].getValue());
                       setUnits(units);
  -                }
  -                else if (WHEN_KEY.equalsIgnoreCase(paramname)) {
  +                } else if (WHEN_KEY.equalsIgnoreCase(paramname)) {
                       SizeComparisons cmp = new SizeComparisons();
                       cmp.setValue(parameters[i].getValue());
                       setWhen(cmp);
  -                }
  -                else {
  +                } else {
                       setError("Invalid parameter " + paramname);
                   }
               }
  @@ -226,11 +216,9 @@
       public void verifySettings() {
           if (size < 0) {
               setError("The value attribute is required, and must be positive");
  -        }
  -        else if (multiplier < 1) {
  +        } else if (multiplier < 1) {
               setError("Invalid Units supplied, must be K,Ki,M,Mi,G,Gi,T,or Ti");
  -        }
  -        else if (sizelimit < 0) {
  +        } else if (sizelimit < 0) {
               setError("Internal error: Code is not setting sizelimit correctly");
           }
       }
  @@ -255,17 +243,14 @@
           }
           if (cmp == 0) {
               return (file.length() < sizelimit);
  -        }
  -        else if (cmp == 1) {
  +        } else if (cmp == 1) {
               return (file.length() > sizelimit);
  -        }
  -        else {
  +        } else {
               return (file.length() == sizelimit);
           }
       }
   
   
  -
       /**
        * Enumerated attribute with the values for units.
        * <p>
  @@ -286,15 +271,15 @@
        */
       public static class ByteUnits extends EnumeratedAttribute {
           public String[] getValues() {
  -            return new String[] {"K", "k", "kilo", "KILO",
  -                                 "Ki", "KI", "ki", "kibi", "KIBI",
  -                                 "M", "m", "mega", "MEGA",
  -                                 "Mi", "MI", "mi", "mebi", "MEBI",
  -                                 "G", "g", "giga", "GIGA",
  -                                 "Gi", "GI", "gi", "gibi", "GIBI",
  -                                 "T", "t", "tera", "TERA",
  -            /* You wish! */      "Ti", "TI", "ti", "tebi", "TEBI"
  -                                 };
  +            return new String[]{"K", "k", "kilo", "KILO",
  +                                "Ki", "KI", "ki", "kibi", "KIBI",
  +                                "M", "m", "mega", "MEGA",
  +                                "Mi", "MI", "mi", "mebi", "MEBI",
  +                                "G", "g", "giga", "GIGA",
  +                                "Gi", "GI", "gi", "gibi", "GIBI",
  +                                "T", "t", "tera", "TERA",
  +           /* You wish! */      "Ti", "TI", "ti", "tebi", "TEBI"
  +            };
           }
       }
   
  @@ -303,7 +288,7 @@
        */
       public static class SizeComparisons extends EnumeratedAttribute {
           public String[] getValues() {
  -            return new String[] {"less", "more", "equal"};
  +            return new String[]{"less", "more", "equal"};
           }
       }
   
  
  
  
  1.4       +9 -6      ant/src/main/org/apache/tools/ant/types/selectors/TypeSelector.java
  
  Index: TypeSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/TypeSelector.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TypeSelector.java	4 Jul 2003 14:04:56 -0000	1.3
  +++ TypeSelector.java	4 Jul 2003 23:18:49 -0000	1.4
  @@ -55,6 +55,7 @@
   package org.apache.tools.ant.types.selectors;
   
   import java.io.File;
  +
   import org.apache.tools.ant.types.EnumeratedAttribute;
   import org.apache.tools.ant.types.Parameter;
   
  @@ -102,8 +103,7 @@
                       FileType type = new FileType();
                       type.setValue(parameters[i].getValue());
                       setType(type);
  -                }
  -                else {
  +                } else {
                       setError("Invalid parameter " + paramname);
                   }
               }
  @@ -137,17 +137,20 @@
   
           if (file.isDirectory()) {
               return type.equals(FileType.DIR);
  -        } else return type.equals(FileType.FILE);
  +        } else {
  +            return type.equals(FileType.FILE);
  +        }
       }
   
       /**
        * Enumerated attribute with the values for types of file
        */
       public static class FileType extends EnumeratedAttribute {
  -        public static final String FILE="file";
  -        public static final String DIR="dir";
  +        public static final String FILE = "file";
  +        public static final String DIR = "dir";
  +
           public String[] getValues() {
  -            return new String[] {FILE, DIR};
  +            return new String[]{FILE, DIR};
           }
       }
   
  
  
  

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


Mime
View raw message