commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ole Ersoy <ole.er...@gmail.com>
Subject Re: [math] Negative max in class Incrementor
Date Sun, 30 Aug 2015 03:21:55 GMT
I'm deleting most of the discussion, because I think I may be throwing too many ingredients
on the table.  For further context please see the previous thread.

> I don't get that.  Here the main purpose is to set a hard limit
> that will raise an exception (to avoid that some algo from running
> forever).
Well there are two concerns here.  One is the precise number of steps that should be executed
and the other is whether we need to raise the exception.

To stop the algorithm from running forever we let the `end` callback notify the thing doing
the incrementing that we are done.  Does that make sense?

Secondly suppose we expect a sequence like 5, 10, 15, 20...but the max is 17.  Do we loop
past 17 and let that be the final loop, thus passing in 20 to the increment listener / cb,
or do we stop at 15? By letting the developer calculate the number of steps, avoiding the
use of a max, we gain simplicity and flexibility.

Lastly perhaps the `increment` callback wants to notify the `incrementer / algorithm` that
it's done.  In this case we only specify the `start` and `stepSize` arguments and leave it
up to the `increment` callback to realize the termination point and stop the algorithm.

Cheers,
- Ole


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


Mime
View raw message