Stephen Colebourne wrote:
>
> We have the following operations to define:
> - contains
> - abuts
> - overlaps
> - overlap (the amount of overlap of two intervals)
> - gap (the gap between two intervals)
>
> a = [08:00,09:00)
> b = [09:00,09:00)
> c = [09:00,10:00)
>
> One option is to define an empty interval as returning false to the
> first three and null to the last two:
> - a abuts c
> - neither a or c abut or contain b
> But what does the interval start/end datetime represent in this case?
>
maybe there's a need for an explicit constant value
EMPTY_INTERVAL that represents an empty zero-length interval? if it
doesn't have specific start/end times (returns null for boundary
instants?) there's no question of interpreting it as the limit of a
series of finite length intervals. then all of Barend's (and Claudio and
JBs) comments apply. so whenever an interval of the form [x,x) is about
to be returned, EMPTY_INTERVAL would be returned instead. does this seem
like sophistry?
if the other interval types were added to joda later,
EMPTY_INTERVAL would have to be used in place of [x, x) (x, x] and (x,
x). but [x, x] would be a non-empty zero-length interval and need a
different representation.
> A second non-maths option is to make the empty interval lie between two
> real intervals:
> - a, b and c all abut each other at 09:00
> - neither a nor c contains b
>
this seems too ad-hoc.
> A third option is to define the empty interval as a point on the
> timeline at 09:00 that is therefore contained in c:
> - a, b and c all abut each other at 09:00
> - c contains b, thus b and c overlap
>
as i said in another email, this is like defining a closed interval for
the zero-length case. having thought some more about it, i think it's
not such a great idea to special-case a closed zero length interval as
an instant. it would probably need to be deprecated if other interval
types were introduced at a later time.
overall, option a) seems to make the most sense.
my 2c FWIW.
al
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