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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]