You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Herve Quiroz <he...@esil.univ-mrs.fr> on 2003/11/06 14:31:20 UTC
Re: [functor] [patch] contributions
Here are the loop ones: DoWhileProcedure and WhileDoProcedure. With some
unit tests.
Regards,
Herve
Re: [functor] [patch] contributions
Posted by Herve Quiroz <he...@esil.univ-mrs.fr>.
Well I thought of that before actually... And I believe this could be
done using *BoundProcedure. But I have some trouble trying to define
what the arguments would/should represent and where they would get
passed.
What do you think the run(Object left, Object right) method from
WhileDoBinaryProcedure should do ? IMHO, it should run(left, right) on
the 'action' binary procedure until the condition is false.
Then what should we do about the 'condition' ? Would it still be a
Predicate or instead a BinaryPredicate (used against the 'left' and
'right' parameters each iteration of the loop) ?
I don't know if there's a way to re-use the DoWhile/WhileDo
procedures... or at least re-use the AbstractLoopProcedure. In the later
case, the 'action' constructor argument should probably be Object typed.
Have you ever thought of a Functor interface for such a purpose ? I
don't know if it's a good idea though... This would get to the
following:
public abstract class AbstractLoopFunctor implements Functor, ...
{
public AbstractLoopFunctor(Predicate condition, Functor action)
{
...
}
}
..and the subclasses would implement the right interface themselves.
Okay, I'm late now but I will think of it so we may discuss it further
in the next few days.
Herve
On Tue, Nov 11, 2003 at 04:10:07PM -0800, Rodney Waldhoff wrote:
> This opens the door for Unary and Binary variations of DoWhile and
> WhileDo, of course. Herve, were you planning on introducing those as
> well?
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [functor] [patch] contributions
Posted by Rodney Waldhoff <rw...@apache.org>.
This opens the door for Unary and Binary variations of DoWhile and
WhileDo, of course. Herve, were you planning on introducing those as
well?
- Rod <http://radio.weblogs.com/0122027/>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [functor] [patch] contributions
Posted by Rodney Waldhoff <rw...@apache.org>.
Committed, with minor modifications (to reduce the amount of cut-and-paste
code between DoWhile and WhileDo).
Thanks Herve.
On Thu, 6 Nov 2003, Herve Quiroz wrote:
> Here are the loop ones: DoWhileProcedure and WhileDoProcedure. With some
> unit tests.
>
> Regards,
>
>
> Herve
>
--
- Rod <http://radio.weblogs.com/0122027/>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org