Class DoWhileProcedure

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Runnable, Functor, NullaryFunctor, Procedure

    public class DoWhileProcedure
    extends AbstractLoopProcedure
    A Procedure implementation of a while loop. Given a Predicate c and an Procedure p, runs do { p.run(); } while(c.test()).

    Note that although this class implements Serializable, a given instance will only be truly Serializable if all the underlying functors are. Attempts to serialize an instance whose delegates are not all Serializable will result in an exception.

    Version:
    $Revision$ $Date$
    See Also:
    Serialized Form
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        serialVersionUID declaration.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DoWhileProcedure

        public DoWhileProcedure​(Procedure action,
                                Predicate condition)
        Create a new DoWhileProcedure.
        Parameters:
        action - to do
        condition - while true
    • Method Detail

      • run

        public final void run()
        Execute this procedure.
      • toString

        public java.lang.String toString()
        Returns a human readable description of this functor. Implementators are strongly encouraged but not strictly required to override the default Object implementation of this method.
        Specified by:
        toString in interface Functor
        Overrides:
        toString in class AbstractLoopProcedure
        Returns:
        a human readable description of this functor