What the Duration of negative Infinity mean?

Richard Bair 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?

Richard

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.
> 
> -Martin
> 
> On 01/31/2013 12:22 AM, Richard Bair wrote:
>> http://javafx-jira.kenai.com/browse/RT-23951
>> 
>> 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.
>> 
>> Thoughts?
>> 
>> Richard
> 



More information about the openjfx-dev mailing list