ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/types/selectors SelectSelector.java BaseSelectorContainer.java ContainsSelector.java SelectorContainer.java SizeSelector.java
Date Fri, 10 May 2002 15:40:32 GMT
bodewig     02/05/10 08:40:32

  Modified:    docs/manual Tag: ANT_15_BRANCH conceptstypeslist.html
               src/main/org/apache/tools/ant/types Tag: ANT_15_BRANCH
                        AbstractFileSet.java defaults.properties
               src/main/org/apache/tools/ant/types/selectors Tag:
                        ANT_15_BRANCH BaseSelectorContainer.java
                        ContainsSelector.java SelectorContainer.java
                        SizeSelector.java
  Added:       docs/manual/CoreTypes Tag: ANT_15_BRANCH
                        selectors-program.html selectors.html
               src/main/org/apache/tools/ant/types/selectors Tag:
                        ANT_15_BRANCH SelectSelector.java
  Log:
  document and rename selectors.
  
  Submitted by:       Bruce Atherton <bruce@callenish.com>
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.5.2.1   +1 -0      jakarta-ant/docs/manual/conceptstypeslist.html
  
  Index: conceptstypeslist.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/conceptstypeslist.html,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- conceptstypeslist.html	4 Apr 2002 12:58:23 -0000	1.5
  +++ conceptstypeslist.html	10 May 2002 15:40:31 -0000	1.5.2.1
  @@ -24,6 +24,7 @@
   <a href="CoreTypes/filterchain.html">FilterChains and FilterReaders</a><br>
   <a href="CoreTypes/filterset.html">FilterSet</a><br>
   <a href="CoreTypes/patternset.html">PatternSet</a><br>
  +<a href="CoreTypes/selectors.html">Selectors</a><br>
   <a href="CoreTypes/xmlcatalog.html">XMLCatalog</a><br>
   
   <h3>Optional Types</h3>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +123 -0    jakarta-ant/docs/manual/CoreTypes/Attic/selectors-program.html
  
  
  
  
  1.1.2.1   +760 -0    jakarta-ant/docs/manual/CoreTypes/Attic/selectors.html
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.5.2.2   +16 -9     jakarta-ant/src/main/org/apache/tools/ant/types/AbstractFileSet.java
  
  Index: AbstractFileSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/AbstractFileSet.java,v
  retrieving revision 1.5.2.1
  retrieving revision 1.5.2.2
  diff -u -r1.5.2.1 -r1.5.2.2
  --- AbstractFileSet.java	10 May 2002 12:53:57 -0000	1.5.2.1
  +++ AbstractFileSet.java	10 May 2002 15:40:32 -0000	1.5.2.2
  @@ -446,7 +446,14 @@
           selectors.addElement(selector);
       }
   
  -    /* Methods below all implement the static selectors */
  +    /* Methods below all add specific selectors */
  +
  +    /**
  +     * add a "Select" selector entry on the selector list
  +     */
  +    public void addSelector(SelectSelector selector) {
  +        appendSelector(selector);
  +    }
   
       /**
        * add an "And" selector entry on the selector list
  @@ -486,56 +493,56 @@
       /**
        * add a selector date entry on the selector list
        */
  -    public void addDateselect(DateSelector selector) {
  +    public void addDate(DateSelector selector) {
           appendSelector(selector);
       }
   
       /**
        * add a selector size entry on the selector list
        */
  -    public void addSizeselect(SizeSelector selector) {
  +    public void addSize(SizeSelector selector) {
           appendSelector(selector);
       }
   
       /**
        * add a selector filename entry on the selector list
        */
  -    public void addFilenameselect(FilenameSelector selector) {
  +    public void addFilename(FilenameSelector selector) {
           appendSelector(selector);
       }
   
       /**
        * add an extended selector entry on the selector list
        */
  -    public void addExtendSelect(ExtendSelector selector) {
  +    public void addCustom(ExtendSelector selector) {
           appendSelector(selector);
       }
   
       /**
        * add a contains selector entry on the selector list
        */
  -    public void addContainsSelect(ContainsSelector selector) {
  +    public void addContains(ContainsSelector selector) {
           appendSelector(selector);
       }
   
       /**
        * add a present selector entry on the selector list
        */
  -    public void addPresentSelect(PresentSelector selector) {
  +    public void addPresent(PresentSelector selector) {
           appendSelector(selector);
       }
   
       /**
        * add a depth selector entry on the selector list
        */
  -    public void addDepthSelect(DepthSelector selector) {
  +    public void addDepth(DepthSelector selector) {
           appendSelector(selector);
       }
   
       /**
        * add a depends selector entry on the selector list
        */
  -    public void addDependSelect(DependSelector selector) {
  +    public void addDepend(DependSelector selector) {
           appendSelector(selector);
       }
   
  
  
  
  1.14.2.1  +2 -1      jakarta-ant/src/main/org/apache/tools/ant/types/defaults.properties
  
  Index: defaults.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/defaults.properties,v
  retrieving revision 1.14
  retrieving revision 1.14.2.1
  diff -u -r1.14 -r1.14.2.1
  --- defaults.properties	30 Apr 2002 07:54:57 -0000	1.14
  +++ defaults.properties	10 May 2002 15:40:32 -0000	1.14.2.1
  @@ -14,4 +14,5 @@
   xmlcatalog=org.apache.tools.ant.types.XMLCatalog
   extensionSet=org.apache.tools.ant.taskdefs.optional.extension.ExtensionSet
   extension=org.apache.tools.ant.taskdefs.optional.extension.ExtensionAdapter
  -libfileset=org.apache.tools.ant.taskdefs.optional.extension.LibFileSet
  \ No newline at end of file
  +libfileset=org.apache.tools.ant.taskdefs.optional.extension.LibFileSet
  +selector=org.apache.tools.ant.types.selectors.SelectSelector
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +19 -39    jakarta-ant/src/main/org/apache/tools/ant/types/selectors/BaseSelectorContainer.java
  
  Index: BaseSelectorContainer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/selectors/BaseSelectorContainer.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- BaseSelectorContainer.java	30 Apr 2002 22:38:35 -0000	1.1
  +++ BaseSelectorContainer.java	10 May 2002 15:40:32 -0000	1.1.2.1
  @@ -98,13 +98,9 @@
        * Returns the set of selectors as an array.
        */
       public FileSelector[] getSelectors(Project p) {
  -        if (isReference()) {
  -            return getRef(p).getSelectors(p);
  -        } else {
  -            FileSelector[] result = new FileSelector[selectorsList.size()];
  -            selectorsList.copyInto(result);
  -            return result;
  -        }
  +        FileSelector[] result = new FileSelector[selectorsList.size()];
  +        selectorsList.copyInto(result);
  +        return result;
       }
   
       /**
  @@ -115,26 +111,6 @@
       }
   
       /**
  -     * Performs the check for circular references and returns the
  -     * referenced SelectorContainer.
  -     */
  -    private SelectorContainer getRef(Project p) {
  -        if (!checked) {
  -            Stack stk = new Stack();
  -            stk.push(this);
  -            dieOnCircularReference(stk, p);
  -        }
  -
  -        Object o = ref.getReferencedObject(p);
  -        if (!(o instanceof SelectorContainer)) {
  -            throw new BuildException(ref.getRefId() +
  -                " doesn\'t denote a selector type");
  -        } else {
  -            return (SelectorContainer) o;
  -        }
  -    }
  -
  -    /**
        * Convert the Selectors within this container to a string. This will
        * just be a helper class for the subclasses that put their own name
        * around the contents listed here.
  @@ -163,9 +139,6 @@
        * @return the selector that was added
        */
       public void appendSelector(FileSelector selector) {
  -        if (isReference()) {
  -            throw noChildrenAllowed();
  -        }
           selectorsList.addElement(selector);
       }
   
  @@ -215,7 +188,14 @@
                                          File file);
   
   
  -    /* Methods below all implement the static selectors */
  +    /* Methods below all add specific selectors */
  +
  +    /**
  +     * add a "Select" selector entry on the selector list
  +     */
  +    public void addSelector(SelectSelector selector) {
  +        appendSelector(selector);
  +    }
   
       /**
        * add an "And" selector entry on the selector list
  @@ -255,56 +235,56 @@
       /**
        * add a selector date entry on the selector list
        */
  -    public void addDateselect(DateSelector selector) {
  +    public void addDate(DateSelector selector) {
           appendSelector(selector);
       }
   
       /**
        * add a selector size entry on the selector list
        */
  -    public void addSizeselect(SizeSelector selector) {
  +    public void addSize(SizeSelector selector) {
           appendSelector(selector);
       }
   
       /**
        * add a selector filename entry on the selector list
        */
  -    public void addFilenameselect(FilenameSelector selector) {
  +    public void addFilename(FilenameSelector selector) {
           appendSelector(selector);
       }
   
       /**
        * add an extended selector entry on the selector list
        */
  -    public void addExtendSelect(ExtendSelector selector) {
  +    public void addCustom(ExtendSelector selector) {
           appendSelector(selector);
       }
   
       /**
        * add a contains selector entry on the selector list
        */
  -    public void addContainsSelect(ContainsSelector selector) {
  +    public void addContains(ContainsSelector selector) {
           appendSelector(selector);
       }
   
       /**
        * add a present selector entry on the selector list
        */
  -    public void addPresentSelect(PresentSelector selector) {
  +    public void addPresent(PresentSelector selector) {
           appendSelector(selector);
       }
   
       /**
        * add a depth selector entry on the selector list
        */
  -    public void addDepthSelect(DepthSelector selector) {
  +    public void addDepth(DepthSelector selector) {
           appendSelector(selector);
       }
   
       /**
        * add a depends selector entry on the selector list
        */
  -    public void addDependSelect(DependSelector selector) {
  +    public void addDepend(DependSelector selector) {
           appendSelector(selector);
       }
   
  
  
  
  1.1.2.1   +13 -6     jakarta-ant/src/main/org/apache/tools/ant/types/selectors/ContainsSelector.java
  
  Index: ContainsSelector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/selectors/ContainsSelector.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- ContainsSelector.java	30 Apr 2002 22:38:35 -0000	1.1
  +++ ContainsSelector.java	10 May 2002 15:40:32 -0000	1.1.2.1
  @@ -75,7 +75,7 @@
   
       private String contains = null;
       private boolean casesensitive = true;
  -    public final static String CONTAINS_KEY = "contains";
  +    public final static String CONTAINS_KEY = "text";
       public final static String CASE_KEY = "casesensitive";
   
   
  @@ -83,7 +83,7 @@
       }
   
       public String toString() {
  -        StringBuffer buf = new StringBuffer("{containsselector contains: ");
  +        StringBuffer buf = new StringBuffer("{containsselector text: ");
           buf.append(contains);
           buf.append(" casesensitive: ");
           if (casesensitive) {
  @@ -100,7 +100,7 @@
        *
        * @param contains the string that a file must contain to be selected.
        */
  -    public void setContains(String contains) {
  +    public void setText(String contains) {
           this.contains = contains;
       }
   
  @@ -125,7 +125,7 @@
               for (int i = 0; i < parameters.length; i++) {
                   String paramname = parameters[i].getName();
                   if (CONTAINS_KEY.equalsIgnoreCase(paramname)) {
  -                    setContains(parameters[i].getValue());
  +                    setText(parameters[i].getValue());
                   }
                   else if (CASE_KEY.equalsIgnoreCase(paramname)) {
                       setCasesensitive(Project.toBoolean(
  @@ -145,7 +145,7 @@
        */
       public void verifySettings() {
           if (contains == null) {
  -            setError("The contains attribute is required");
  +            setError("The text attribute is required");
           }
       }
   
  @@ -167,13 +167,20 @@
               return true;
           }
   
  +        String userstr = contains;
  +        if (!casesensitive) {
  +            userstr = contains.toLowerCase();
  +        }
           BufferedReader in = null;
           try {
               in = new BufferedReader(new InputStreamReader(
                       new FileInputStream(file)));
               String teststr = in.readLine();
               while (teststr != null) {
  -                if (teststr.indexOf(contains) > -1) {
  +                if (!casesensitive) {
  +                    teststr = teststr.toLowerCase();
  +                }
  +                if (teststr.indexOf(userstr) > -1) {
                       return true;
                   }
                   teststr = in.readLine();
  
  
  
  1.1.2.1   +15 -10    jakarta-ant/src/main/org/apache/tools/ant/types/selectors/SelectorContainer.java
  
  Index: SelectorContainer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/selectors/SelectorContainer.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- SelectorContainer.java	30 Apr 2002 22:38:36 -0000	1.1
  +++ SelectorContainer.java	10 May 2002 15:40:32 -0000	1.1.2.1
  @@ -64,7 +64,7 @@
   import java.util.Vector;
   
   /**
  - * This is the base class for selectors that can contain other selectors.
  + * This is the interface for selectors that can contain other selectors.
    *
    * @author <a href="mailto:bruce@callenish.com">Bruce Atherton</a>
    * @since 1.5
  @@ -107,7 +107,12 @@
        */
       public void appendSelector(FileSelector selector);
   
  -    /* Methods below all implement the static selectors */
  +    /* Methods below all add specific selectors */
  +
  +    /**
  +     * add a "Select" selector entry on the selector list
  +     */
  +    public void addSelector(SelectSelector selector);
   
       /**
        * add an "And" selector entry on the selector list
  @@ -137,42 +142,42 @@
       /**
        * add a selector date entry on the selector list
        */
  -    public void addDateselect(DateSelector selector);
  +    public void addDate(DateSelector selector);
   
       /**
        * add a selector size entry on the selector list
        */
  -    public void addSizeselect(SizeSelector selector);
  +    public void addSize(SizeSelector selector);
   
       /**
        * add a selector filename entry on the selector list
        */
  -    public void addFilenameselect(FilenameSelector selector);
  +    public void addFilename(FilenameSelector selector);
   
       /**
        * add an extended selector entry on the selector list
        */
  -    public void addExtendSelect(ExtendSelector selector);
  +    public void addCustom(ExtendSelector selector);
   
       /**
        * add a contains selector entry on the selector list
        */
  -    public void addContainsSelect(ContainsSelector selector);
  +    public void addContains(ContainsSelector selector);
   
       /**
        * add a present selector entry on the selector list
        */
  -    public void addPresentSelect(PresentSelector selector);
  +    public void addPresent(PresentSelector selector);
   
       /**
        * add a depth selector entry on the selector list
        */
  -    public void addDepthSelect(DepthSelector selector);
  +    public void addDepth(DepthSelector selector);
   
       /**
        * add a depends selector entry on the selector list
        */
  -    public void addDependSelect(DependSelector selector);
  +    public void addDepend(DependSelector selector);
   
   }
   
  
  
  
  1.1.2.1   +6 -6      jakarta-ant/src/main/org/apache/tools/ant/types/selectors/SizeSelector.java
  
  Index: SizeSelector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/selectors/SizeSelector.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- SizeSelector.java	30 Apr 2002 22:38:36 -0000	1.1
  +++ SizeSelector.java	10 May 2002 15:40:32 -0000	1.1.2.1
  @@ -72,15 +72,15 @@
       private long multiplier = 1;
       private long sizelimit = -1;
       private int cmp = 0;
  -    public final static String SIZE_KEY = "millis";
  -    public final static String UNITS_KEY = "datetime";
  +    public final static String SIZE_KEY = "value";
  +    public final static String UNITS_KEY = "units";
       public final static String WHEN_KEY = "when";
   
       public SizeSelector() {
       }
   
       public String toString() {
  -        StringBuffer buf = new StringBuffer("{sizeselector size: ");
  +        StringBuffer buf = new StringBuffer("{sizeselector value: ");
           buf.append(sizelimit);
           buf.append("compare: ");
           if (cmp == 0) {
  @@ -102,7 +102,7 @@
        *
        * @param size the size to select against expressed in units
        */
  -    public void setSize(long size) {
  +    public void setValue(long size) {
           this.size = size;
           if ((multiplier != 0) && (size > -1)) {
               sizelimit = size * multiplier;
  @@ -191,7 +191,7 @@
                   String paramname = parameters[i].getName();
                   if (SIZE_KEY.equalsIgnoreCase(paramname)) {
                       try {
  -                        setSize(new Long(parameters[i].getValue()
  +                        setValue(new Long(parameters[i].getValue()
                                   ).longValue());
                       } catch (NumberFormatException nfe) {
                           setError("Invalid size setting "
  @@ -227,7 +227,7 @@
        */
       public void verifySettings() {
           if (size < 0) {
  -            setError("The size attribute is required, and must be positive");
  +            setError("The value attribute is required, and must be positive");
           }
           else if (multiplier < 1) {
               setError("Invalid Units supplied, must be K,Ki,M,Mi,G,Gi,T,or Ti");
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +169 -0    jakarta-ant/src/main/org/apache/tools/ant/types/selectors/Attic/SelectSelector.java
  
  
  
  

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


Mime
View raw message