I mentioned many moons ago that I had created a DateRange class for some
vicious date mangling that I had to do. I have now modified it to fit
into lang.time, and attached the class + unit test to a bug:
http://issues.apache.org/bugzilla/show_bug.cgi?id=38800
I've been away from the commons scene for awhile, so I may have missed
some protocol-related details. It'd be great if someone could take a
look at what I've done.
Below is a quick API description of what is there. I think that
subtract is a little iffy (although I did have a need for it), but the
rest seems to be fairly simple.
Assuming that my commit rights are still in effect, I could add this to
the codebase myself -- but I wanted to get some feedback to make sure we
were all on the same page.
Thanks!
----------------
DateRange(Date startDate, Date endDate)
equals, compareTo, toString
-- basic stuff
long getTime()
-- endDate.getTime() - startDate.getTime()
boolean contains(Date)
boolean contains(DateRange)
-- true if this range contains the specified Date or DateRange
boolean intersects(DateRange)
-- true if this range intersects with the specified DateRange
DateRange intersection(DateRange)
-- returns a DateRange representing the intersection between this and
the specified range.
List subtract(DateRange)
-- returns one or more DateRanges representing the difference between
the two ranges. If the specified range is larger than this, than the
list is empty (representing a null range). If this contains the
specified range, then the result will have two parts, a range from the
start of this to the start of the specified range, and a range from the
end of the specified range to the end of this.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]