Class OceanusDateRange
java.lang.Object
io.github.tonywasher.joceanus.oceanus.date.OceanusDateRange
- All Implemented Interfaces:
Comparable<OceanusDateRange>
Represents a contiguous Range of dates.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstruct an unbounded Range.OceanusDateRange(OceanusDateRange pRange) Construct a range from another range.OceanusDateRange(OceanusDate pStart, OceanusDate pEnd) Construct a Range from a Start Date and an End Date. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(OceanusDateRange pThat) intcompareToDate(OceanusDate pDate) Determine whether a Date is within this range.booleangetEnd()Get the end date for the range.longObtain the number of days in the range.getStart()Get the start date for the range.inthashCode()static booleanisDifferent(OceanusDateRange pCurr, OceanusDateRange pNew) Determine whether two DateDay objects differ.voidSet the locale.toString()
-
Field Details
-
DESC_UNBOUNDED
Unbounded range description. -
DESC_LINK
link range description. -
CHAR_BLANK
protected static final char CHAR_BLANKlink range description.- See Also:
-
-
Constructor Details
-
OceanusDateRange
Construct a Range from a Start Date and an End Date.- Parameters:
pStart- the start datepEnd- the end date
-
OceanusDateRange
Construct a range from another range.- Parameters:
pRange- the range to copy from
-
OceanusDateRange
public OceanusDateRange()Construct an unbounded Range.
-
-
Method Details
-
getStart
Get the start date for the range.- Returns:
- the Start date
-
getEnd
Get the end date for the range.- Returns:
- the End date
-
compareToDate
Determine whether a Date is within this range.- Parameters:
pDate- the date to test- Returns:
- -1 if the date is after the range, 0 if the date is within the range, 1 if the date is before the range
-
compareTo
- Specified by:
compareToin interfaceComparable<OceanusDateRange>
-
toString
-
equals
-
hashCode
public int hashCode() -
setLocale
Set the locale.- Parameters:
pLocale- the locale
-
isDifferent
Determine whether two DateDay objects differ.- Parameters:
pCurr- The current DatepNew- The new Date- Returns:
trueif the objects differ,falseotherwise
-
getNumDays
public long getNumDays()Obtain the number of days in the range.- Returns:
- the number of days (or -1 if unbounded)
-