You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rw...@apache.org on 2003/11/12 01:50:44 UTC

cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/composite WhileDoProcedure.java DoWhileProcedure.java

rwaldhoff    2003/11/11 16:50:44

  Modified:    functor/src/java/org/apache/commons/functor/generator
                        Generator.java
               functor/src/java/org/apache/commons/functor Algorithms.java
               functor/src/java/org/apache/commons/functor/generator/util
                        NumberRange.java
               functor/src/java/org/apache/commons/functor/core/composite
                        WhileDoProcedure.java DoWhileProcedure.java
  Log:
  javadoc fixes
  
  Revision  Changes    Path
  1.4       +10 -10    jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/Generator.java
  
  Index: Generator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/Generator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Generator.java	17 Jul 2003 22:44:45 -0000	1.3
  +++ Generator.java	12 Nov 2003 00:50:44 -0000	1.4
  @@ -75,23 +75,23 @@
       public abstract void stop();
       /** Check if the generator is stopped. */
       public abstract boolean isStopped();
  -    /** See {@link Algorithms#apply}. */
  +    /** See {@link org.apache.commons.functor.Algorithms#apply}. */
       public abstract Generator apply(UnaryFunction func);
  -    /** See {@link Algorithms#contains}. */
  +    /** See {@link org.apache.commons.functor.Algorithms#contains}. */
       public abstract boolean contains(UnaryPredicate pred);
  -    /** See {@link Algorithms#detect}. */
  +    /** See {@link org.apache.commons.functor.Algorithms#detect}. */
       public abstract Object detect(UnaryPredicate pred);
  -    /** See {@link Algorithms#detect}. */
  +    /** See {@link org.apache.commons.functor.Algorithms#detect}. */
       public abstract Object detect(UnaryPredicate pred, Object ifNone);
       /** Synonym for run. */
       public abstract void foreach(UnaryProcedure proc);
  -    /** See {@link Algorithms#inject}. */
  +    /** See {@link org.apache.commons.functor.Algorithms#inject}. */
       public abstract Object inject(Object seed, BinaryFunction func);
  -    /** See {@link Algorithms#reject}. */
  +    /** See {@link org.apache.commons.functor.Algorithms#reject}. */
       public abstract Generator reject(UnaryPredicate pred);
  -    /** See {@link Algorithms#select}. */
  +    /** See {@link org.apache.commons.functor.Algorithms#select}. */
       public abstract Generator select(UnaryPredicate pred);
  -    /** See {@link Algorithms#until}. */
  +    /** See {@link org.apache.commons.functor.Algorithms#until}. */
       public abstract Generator until(UnaryPredicate pred);
       /**
        * {@link Transformer Transforms} this generator using the passed in
  
  
  
  1.6       +19 -19    jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java
  
  Index: Algorithms.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Algorithms.java	17 Jul 2003 22:44:45 -0000	1.5
  +++ Algorithms.java	12 Nov 2003 00:50:44 -0000	1.6
  @@ -65,10 +65,10 @@
   import org.apache.commons.functor.generator.IteratorToGeneratorAdapter;
   
   /**
  - * Utility methods and algorithms for applying functors to {@link IfaceGenerator}s.
  - * {@link IfaceGenerator}s also define these utility methods as instance methods. The
  + * Utility methods and algorithms for applying functors to {@link Generator}s.
  + * {@link Generator}s also define these utility methods as instance methods. The
    * {@link #apply}, {@link #select}, and {@link #reject} methods return new
  - * IfaceGenerators. This becomes useful for constructing nested expressions. For
  + * Generators. This becomes useful for constructing nested expressions. For
    * example:
    *
    * <pre>
  @@ -94,7 +94,7 @@
       }
   
       /**
  -     * Returns a {@link IfaceGenerator} that will apply the given {@link UnaryFunction} to each
  +     * Returns a {@link Generator} that will apply the given {@link UnaryFunction} to each
        * generated element.
        */
       public static final Generator apply(final Generator gen, final UnaryFunction func) {
  @@ -117,10 +117,10 @@
       }
   
       /**
  -     * Return <code>true</code> if some element in the given {@link IfaceGenerator}
  +     * Return <code>true</code> if some element in the given {@link Generator}
        * that matches the given {@link UnaryPredicate UnaryPredicate}.
        *
  -     * @see #detect(IfaceGenerator,UnaryPredicate)
  +     * @see #detect(Generator,UnaryPredicate)
        */
       public static final boolean contains(final Generator gen, final UnaryPredicate pred) {
           // javas' inner classes suck, i should do this a different way i guess
  @@ -154,12 +154,12 @@
       }
   
       /**
  -     * Return the first element within the given {@link IfaceGenerator} that matches
  +     * Return the first element within the given {@link Generator} that matches
        * the given {@link UnaryPredicate UnaryPredicate}, or throw {@link
        * java.util.NoSuchElementException NoSuchElementException} if no
        * matching element can be found.
        *
  -     * @see #detect(IfaceGenerator,UnaryPredicate,Object)
  +     * @see #detect(Generator,UnaryPredicate,Object)
        * @throws NoSuchElementException If no element could be found.
        */
       public static final Object detect(final Generator gen, final UnaryPredicate pred) {
  @@ -181,12 +181,12 @@
       }
   
       /**
  -     * Return the first element within the given {@link IfaceGenerator} that matches
  +     * Return the first element within the given {@link Generator} that matches
        * the given {@link UnaryPredicate UnaryPredicate}, or return the given
        * (possibly <code>null</code> <code>Object</code> if no matching element
        * can be found.
        *
  -     * @see #detect(IfaceGenerator,UnaryPredicate)
  +     * @see #detect(Generator,UnaryPredicate)
        */
       public static final Object detect(final Generator gen, final UnaryPredicate pred, Object ifNone) {
           final Object[] foundObj = new Object[1];
  @@ -215,7 +215,7 @@
   
       /**
        * {@link UnaryProcedure#run Apply} the given {@link UnaryProcedure
  -     * UnaryProcedure} to each element in the given {@link IfaceGenerator}.
  +     * UnaryProcedure} to each element in the given {@link Generator}.
        */
       public static final void foreach(Generator gen, UnaryProcedure proc) {
           gen.run(proc);
  @@ -230,7 +230,7 @@
   
       /**
        * {@link BinaryFunction#evaluate Evaluate} the pair <i>( previousResult,
  -     * element )</i> for each element in the given {@link IfaceGenerator} where
  +     * element )</i> for each element in the given {@link Generator} where
        * previousResult is initially <i>seed</i>, and thereafter the result of the
        * evaluation of the previous element in the iterator. Returns the result
        * of the final evaluation.
  @@ -266,7 +266,7 @@
       }
   
       /**
  -     * Returns a {@link IfaceGenerator} that will only "generate" elements that DO
  +     * Returns a {@link Generator} that will only "generate" elements that DO
        * NOT match the given predicate.
        */
       public static Generator reject(final Generator gen, final UnaryPredicate pred) {
  @@ -291,7 +291,7 @@
       }
   
       /**
  -     * Returns a {@link IfaceGenerator} that will only "generate" elements that DO
  +     * Returns a {@link Generator} that will only "generate" elements that DO
        * match the given predicate.
        */
       public static final Generator select(final Generator gen, final UnaryPredicate pred) {
  @@ -316,14 +316,14 @@
       }
   
       /**
  -     * Returns a {@link IfaceGenerator} that will stop when the predicate becomes
  -     * true. This is useful for imposing {@link IfaceGenerator} limits. For example:
  +     * Returns a {@link Generator} that will stop when the predicate becomes
  +     * true. This is useful for imposing {@link Generator} limits. For example:
        *
        * <pre>
        *  EachLine.open(file).until(new MaxIterations(1));
        * </pre>
        *
  -     * Would only "generate" 1 line from the file before {@link IfaceGenerator#stop
  +     * Would only "generate" 1 line from the file before {@link Generator#stop
        * stopping} the generator.
        */
       public static final Generator until(final Generator gen, final UnaryPredicate pred) {
  
  
  
  1.3       +4 -4      jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util/NumberRange.java
  
  Index: NumberRange.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util/NumberRange.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NumberRange.java	17 Jul 2003 22:44:46 -0000	1.2
  +++ NumberRange.java	12 Nov 2003 00:50:44 -0000	1.3
  @@ -61,8 +61,8 @@
   import org.apache.commons.functor.generator.BaseGenerator;
   
   /**
  - * Generator for a numeric range. If {@link #min} <= {@link #max} generation
  - * will be forward, if {@link #min} > {@link #max} generation will be backward.
  + * Generator for a numeric range. If {@link #getMin min} <= {@link #getMax max} generation
  + * will be forward, if {@link #getMin min} > {@link #getMax max} generation will be backward.
    *
    * @since 1.0
    * @version $Revision$ $Date$
  
  
  
  1.2       +108 -108  jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/composite/WhileDoProcedure.java
  
  Index: WhileDoProcedure.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/composite/WhileDoProcedure.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WhileDoProcedure.java	11 Nov 2003 23:36:00 -0000	1.1
  +++ WhileDoProcedure.java	12 Nov 2003 00:50:44 -0000	1.2
  @@ -1,108 +1,108 @@
  -/*
  - * $Header$
  - * ====================================================================
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 2003 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 acknowledgment:
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowledgment may appear in the software itself,
  - *    if and wherever such third-party acknowledgments normally appear.
  - *
  - * 4. The names "The Jakarta Project", "Commons", 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 name, without prior written
  - *    permission of the Apache Software Foundation.
  - *
  - * 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.commons.functor.core.composite;
  -
  -import org.apache.commons.functor.Predicate;
  -import org.apache.commons.functor.Procedure;
  -
  -
  -/**
  - * A {@link Procedure} implementation of a while loop. Given a {@link Predicate} 
  - * <i>c</i> and an {@link Procedure} <i>p</i>, {@link #run runs}
  - * <code>while(c.test()) { p.run(); }</code>.
  - * <p>
  - * Note that although this class implements 
  - * {@link Serializable}, a given instance will
  - * only be truly <code>Serializable</code> if all the
  - * underlying functors are.  Attempts to serialize
  - * an instance whose delegates are not all 
  - * <code>Serializable</code> will result in an exception.
  - * </p>
  - * @version $Revision$ $Date$
  - * @author Herve Quiroz
  - * @author Rodney Waldhoff
  - */
  -public class WhileDoProcedure extends AbstractLoopProcedure {
  -    public WhileDoProcedure(Predicate condition, Procedure action) {
  -        super(condition, action);
  -    }
  -
  -
  -    public void run() {
  -        while(getCondition().test())
  -            getAction().run();
  -    }
  -
  -
  -    public boolean equals(Object object) {
  -        if (object instanceof WhileDoProcedure) {
  -        	return super.equals(object);
  -        } else {
  -			return false;
  -        }
  -    }
  -
  -
  -    public int hashCode() {
  -    	return super.hashCode("WhileDoProcedure".hashCode());
  -    }
  -
  -
  -    public String toString() {
  -        return "WhileDoProcedure<while("+getCondition()+") do("+getAction()+")>";
  -    }
  -}
  +/*
  + * $Header$
  + * ====================================================================
  + * The Apache Software License, Version 1.1
  + *
  + * Copyright (c) 2003 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 acknowledgment:
  + *       "This product includes software developed by the
  + *        Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself,
  + *    if and wherever such third-party acknowledgments normally appear.
  + *
  + * 4. The names "The Jakarta Project", "Commons", 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 name, without prior written
  + *    permission of the Apache Software Foundation.
  + *
  + * 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.commons.functor.core.composite;
  +
  +import org.apache.commons.functor.Predicate;
  +import org.apache.commons.functor.Procedure;
  +
  +
  +/**
  + * A {@link Procedure} implementation of a while loop. Given a {@link Predicate} 
  + * <i>c</i> and an {@link Procedure} <i>p</i>, {@link #run runs}
  + * <code>while(c.test()) { p.run(); }</code>.
  + * <p>
  + * Note that although this class implements 
  + * {@link java.io.Serializable}, a given instance will
  + * only be truly <code>Serializable</code> if all the
  + * underlying functors are.  Attempts to serialize
  + * an instance whose delegates are not all 
  + * <code>Serializable</code> will result in an exception.
  + * </p>
  + * @version $Revision$ $Date$
  + * @author Herve Quiroz
  + * @author Rodney Waldhoff
  + */
  +public class WhileDoProcedure extends AbstractLoopProcedure {
  +    public WhileDoProcedure(Predicate condition, Procedure action) {
  +        super(condition, action);
  +    }
  +
  +
  +    public void run() {
  +        while(getCondition().test())
  +            getAction().run();
  +    }
  +
  +
  +    public boolean equals(Object object) {
  +        if (object instanceof WhileDoProcedure) {
  +        	return super.equals(object);
  +        } else {
  +			return false;
  +        }
  +    }
  +
  +
  +    public int hashCode() {
  +    	return super.hashCode("WhileDoProcedure".hashCode());
  +    }
  +
  +
  +    public String toString() {
  +        return "WhileDoProcedure<while("+getCondition()+") do("+getAction()+")>";
  +    }
  +}
  
  
  
  1.2       +106 -106  jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/composite/DoWhileProcedure.java
  
  Index: DoWhileProcedure.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/composite/DoWhileProcedure.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DoWhileProcedure.java	11 Nov 2003 23:36:00 -0000	1.1
  +++ DoWhileProcedure.java	12 Nov 2003 00:50:44 -0000	1.2
  @@ -1,106 +1,106 @@
  -/*
  - * $Header$
  - * ====================================================================
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 2003 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 acknowledgment:
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowledgment may appear in the software itself,
  - *    if and wherever such third-party acknowledgments normally appear.
  - *
  - * 4. The names "The Jakarta Project", "Commons", 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 name, without prior written
  - *    permission of the Apache Software Foundation.
  - *
  - * 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.commons.functor.core.composite;
  -
  -import org.apache.commons.functor.Predicate;
  -import org.apache.commons.functor.Procedure;
  -
  -
  -/**
  - * A {@link Procedure} implementation of a while loop. Given a {@link Predicate} 
  - * <i>c</i> and an {@link Procedure} <i>p</i>, {@link #run runs}
  - * <code>do { p.run(); } while(c.test())</code>.
  - * <p>
  - * Note that although this class implements 
  - * {@link Serializable}, a given instance will
  - * only be truly <code>Serializable</code> if all the
  - * underlying functors are.  Attempts to serialize
  - * an instance whose delegates are not all 
  - * <code>Serializable</code> will result in an exception.
  - * </p>
  - * @version $Revision$ $Date$
  - * @author Herve Quiroz
  - * @author Rodney Waldhoff
  - */
  -public class DoWhileProcedure extends AbstractLoopProcedure {
  -    public DoWhileProcedure(Procedure action, Predicate condition) {
  -        super(condition, action);
  -    }
  -
  -    public void run() {
  -        do {
  -            getAction().run();
  -        } while(getCondition().test());
  -    }
  -
  -
  -    public boolean equals(Object object) {
  -        if (object instanceof DoWhileProcedure) {
  -        	return super.equals(object);
  -        } else {
  -        	return false;
  -        }
  -    }
  -
  -    public int hashCode() {
  -    	return super.hashCode("DoWhileProcedure".hashCode());
  -    }
  -
  -    public String toString() {
  -        return "DoWhileProcedure<do("+getAction()+") while("+getCondition()+")>";
  -    }
  -}
  +/*
  + * $Header$
  + * ====================================================================
  + * The Apache Software License, Version 1.1
  + *
  + * Copyright (c) 2003 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 acknowledgment:
  + *       "This product includes software developed by the
  + *        Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself,
  + *    if and wherever such third-party acknowledgments normally appear.
  + *
  + * 4. The names "The Jakarta Project", "Commons", 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 name, without prior written
  + *    permission of the Apache Software Foundation.
  + *
  + * 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.commons.functor.core.composite;
  +
  +import org.apache.commons.functor.Predicate;
  +import org.apache.commons.functor.Procedure;
  +
  +
  +/**
  + * A {@link Procedure} implementation of a while loop. Given a {@link Predicate} 
  + * <i>c</i> and an {@link Procedure} <i>p</i>, {@link #run runs}
  + * <code>do { p.run(); } while(c.test())</code>.
  + * <p>
  + * Note that although this class implements 
  + * {@link java.io.Serializable}, a given instance will
  + * only be truly <code>Serializable</code> if all the
  + * underlying functors are.  Attempts to serialize
  + * an instance whose delegates are not all 
  + * <code>Serializable</code> will result in an exception.
  + * </p>
  + * @version $Revision$ $Date$
  + * @author Herve Quiroz
  + * @author Rodney Waldhoff
  + */
  +public class DoWhileProcedure extends AbstractLoopProcedure {
  +    public DoWhileProcedure(Procedure action, Predicate condition) {
  +        super(condition, action);
  +    }
  +
  +    public void run() {
  +        do {
  +            getAction().run();
  +        } while(getCondition().test());
  +    }
  +
  +
  +    public boolean equals(Object object) {
  +        if (object instanceof DoWhileProcedure) {
  +        	return super.equals(object);
  +        } else {
  +        	return false;
  +        }
  +    }
  +
  +    public int hashCode() {
  +    	return super.hashCode("DoWhileProcedure".hashCode());
  +    }
  +
  +    public String toString() {
  +        return "DoWhileProcedure<do("+getAction()+") while("+getCondition()+")>";
  +    }
  +}
  
  
  

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