One thing to keep in mind is that joda instants are effectively one millisecond intervals themselves. An instant x is treated as the interval [x, x + 1ms). If the instants represented zero-length intervals, then we'd be stating they have infinite precision.
A closed interval [x, y] is actually [[x, x + 1ms), [y, y + 1ms)] which reduces to [x, y + 1ms). Given the precision constraint, representing a closed interval by adding 1ms to the end of an open interval seems okay. If the interval could be constructed with more precise instants, then adding 1ms would be incorrect. An open interval [x, y) is actually [x, x + 1ms), [y, y + 1ms)) which reduces back to [x, y). I feel it would be incorrect to say that [9:00, 9:00) is the same as [9:00, 9:00.0000000000000000001). A zero-length interval does make logical sense, even though intervals can only have 1ms precision. One way to handle zero-length intervals is do nothing special at all. That is, when asking questions like "contains", "overlaps" and "abuts" just do the comparisons as usual. Thus [9:00, 10:00) contains [9:00, 9:00), abuts [9:00, 9:00), but it does not overlap. The zero length interval [1:00, 2:00) is not contained. Stephen Colebourne wrote: > On 06/07/06, Nils Kilden-Pedersen <[EMAIL PROTECTED]> wrote: > >> On 7/5/06, Al Major <[EMAIL PROTECTED]> wrote: >> >>> if you look at the interval [9:00, 9:00) as the limit of [9:00, 9:00 + >>> epsilon) as epsilon goes to zero, you have a situation where each of the >>> intervals on the way to the limit (i.e. epsilon > 0) overlaps [9:00, >>> 10:00) and is _not_ contained in [10:00, 11:00). i'm arguing that the >>> limit [9, 9) should be interpreted in a way that is consistent with the >>> behavior of the sequence that defines it [9, 9 + e). this is what i mean >>> by _intuitive_ behavior. i.e. [9:00, 9:00) overlaps [9:00, 10:00) and is >>> not contained in [10:00, 11:00). >>> >>> >> I don't see how [9:00, 9:00) can be legal, provided that for a given >> interval x to y, y >= x. Since "[9:00" is exactly 9:00, and "9:00)" is a >> some value less than 9:00, we now have y < x. This implies that intervals >> such as [9:00, 8:00] should be legal, which is just as nonsensical. >> > > Actually, I like Al's definition. It effectively defines > [9:00, 9:00) as [9:00, 9:00.0000000000000000001) > > The other definitions then fall out naturally, eg [9:00, 10:00) > contains [9:00, 9:00.0000000000000000001) etc > > Stephen > > > Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Joda-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/joda-interest
