What the Duration of negative Infinity mean?
richard.bair at oracle.com
Thu Jan 31 07:56:24 PST 2013
I was wondering that as well. My hunch is that being able to have negative durations would be useful when creating a duration using math methods on the Duration (add / subtract / etc). I could also imagine somebody using a Duration where the negative value means to go backwards vs. forwards or something.
How does the animation code handle negative duration values?
On Jan 31, 2013, at 12:12 AM, Martin Sladecek <martin.sladecek at oracle.com> wrote:
> Is there a reason why we support negative values in Duration at all? Maybe we should throw IllegalArgumentException when some negative value is set in one of the factory methods.
> On 01/31/2013 12:22 AM, Richard Bair wrote:
>> I recently added to ScheduledService, and it supported all the boundary conditions (isIndefinite, isUnknown) of a Duration. Right now NEGATIVE_INFINITY is not handled at all in Duration. POSITIVE_INFINITY maps to isIndefinite and NaN maps to isUnknown.
>> It seems like NEGATIVE_INFINITY should also cause isIndefinite to return true. Some code (including mine) was assuming isIndefinite was positive, but that would not now necessarily be the case.
More information about the openjfx-dev