ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/condition IsFalse.java IsTrue.java ConditionBase.java
Date Fri, 19 Apr 2002 07:15:44 GMT
stevel      02/04/19 00:15:44

  Modified:    src/main/org/apache/tools/ant/taskdefs/condition
                        ConditionBase.java
  Added:       src/main/org/apache/tools/ant/taskdefs/condition
                        IsFalse.java IsTrue.java
  Log:
  new istrue/isfalse conditions
  
  Revision  Changes    Path
  1.14      +22 -8     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/condition/ConditionBase.java
  
  Index: ConditionBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/condition/ConditionBase.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ConditionBase.java	15 Apr 2002 12:16:31 -0000	1.13
  +++ ConditionBase.java	19 Apr 2002 07:15:43 -0000	1.14
  @@ -70,7 +70,7 @@
    *
    * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
    * @since Ant 1.4
  - * @version $Revision: 1.13 $
  + * @version $Revision: 1.14 $
    */
   public abstract class ConditionBase extends ProjectComponent {
       private Vector conditions = new Vector();
  @@ -152,36 +152,50 @@
       /**
        * Add an &lt;isset&gt; condition.
        *
  -     * @since 1.2, Ant 1.5
  +     * @since Ant 1.5
        */
       public void addIsSet(IsSet i) {conditions.addElement(i);}
   
       /**
        * Add an &lt;http&gt; condition.
        *
  -     * @since 1.7, Ant 1.5
  +     * @since Ant 1.5
        */
       public void addHttp(Http h) {conditions.addElement(h);}
   
       /**
        * Add a &lt;socket&gt; condition.
        *
  -     * @since 1.7, Ant 1.5
  +     * @since Ant 1.5
        */
       public void addSocket(Socket s) {conditions.addElement(s);}
   
       /**
        * Add a &lt;filesmatch&gt; condition.
        *
  -     * @since 1.8, Ant 1.5
  +     * @since Ant 1.5
        */
       public void addFilesMatch(FilesMatch test) {conditions.addElement(test);}
       
       /**
  -     * Add a &lt;filesmatch&gt; condition.
  +     * Add a &lt;contains&gt; condition.
        *
  -     * @since 1.10, Ant 1.5
  +     * @since Ant 1.5
        */
       public void addContains(Contains test) {conditions.addElement(test);}
  -    
  +
  +    /**
  +     * Add a &lt;istrue&gt; condition.
  +     *
  +     * @since Ant 1.5
  +     */
  +    public void addIsTrue(IsTrue test) {conditions.addElement(test);}
  +
  +    /**
  +     * Add a &lt;isfalse&gt; condition.
  +     *
  +     * @since Ant 1.5
  +     */
  +    public void addIsFalse(IsFalse test) {conditions.addElement(test);}
  +      
   }
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/condition/IsFalse.java
  
  Index: IsFalse.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Ant", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.tools.ant.taskdefs.condition;
  
  import org.apache.tools.ant.BuildException;
  import org.apache.tools.ant.ProjectComponent;
  
  /**
   * Condition that tests whether a given string evals to false
   *
   * @author Steve Loughran
   * @since Ant 1.5
   */
  public class IsFalse extends ProjectComponent implements Condition {
      /**  
       * what we eval
       */ 
      private Boolean value=null;
  
      /**
       * set the value to be tested; let ant eval it to true/false
       */ 
      public void setValue(boolean value) {
          this.value = new Boolean(value);
      }
  
      /**
       * return the inverted value;
       * @throws BuildException if someone forgot to spec a value
       */ 
      public boolean eval() throws BuildException {
          if (value == null) {
              throw new BuildException("Nothing to test for falsehood");
          }
          return !value.booleanValue();
      }
  
  }
  
  
  
  
  1.1                  jakarta-ant/src/main/org/apache/tools/ant/taskdefs/condition/IsTrue.java
  
  Index: IsTrue.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Ant", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.tools.ant.taskdefs.condition;
  
  import org.apache.tools.ant.BuildException;
  import org.apache.tools.ant.ProjectComponent;
  
  /**
   * Condition that tests whether a given string evals to true
   *
   * @author Steve Loughran
   * @since Ant 1.5
   */
  public class IsTrue extends ProjectComponent implements Condition {
      /**  
       * what we eval
       */ 
      private Boolean value=null;
  
      /**
       * set the value to be tested; let ant eval it to true/false
       */ 
      public void setValue(boolean value) {
          this.value = new Boolean(value);
      }
  
      /**
       * return the value;
       * @throws BuildException if someone forgot to spec a value
       */ 
      public boolean eval() throws BuildException {
          if (value == null) {
              throw new BuildException("Nothing to test for truth");
          }
          return value.booleanValue();
      }
  
  }
  
  
  
  

--
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