java.lang.Object
io.github.tonywasher.joceanus.oceanus.date.OceanusDateRange
All Implemented Interfaces:
Comparable<OceanusDateRange>

public class OceanusDateRange extends Object implements Comparable<OceanusDateRange>
Represents a contiguous Range of dates.
  • Field Details

    • DESC_UNBOUNDED

      protected static final String DESC_UNBOUNDED
      Unbounded range description.
    • CHAR_BLANK

      protected static final char CHAR_BLANK
      link range description.
      See Also:
  • Constructor Details

    • OceanusDateRange

      public OceanusDateRange(OceanusDate pStart, OceanusDate pEnd)
      Construct a Range from a Start Date and an End Date.
      Parameters:
      pStart - the start date
      pEnd - the end date
    • OceanusDateRange

      public OceanusDateRange(OceanusDateRange pRange)
      Construct a range from another range.
      Parameters:
      pRange - the range to copy from
    • OceanusDateRange

      public OceanusDateRange()
      Construct an unbounded Range.
  • Method Details

    • getStart

      public OceanusDate getStart()
      Get the start date for the range.
      Returns:
      the Start date
    • getEnd

      public OceanusDate getEnd()
      Get the end date for the range.
      Returns:
      the End date
    • compareToDate

      public int compareToDate(OceanusDate pDate)
      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

      public int compareTo(OceanusDateRange pThat)
      Specified by:
      compareTo in interface Comparable<OceanusDateRange>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object pThat)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • setLocale

      public void setLocale(Locale pLocale)
      Set the locale.
      Parameters:
      pLocale - the locale
    • isDifferent

      public static boolean isDifferent(OceanusDateRange pCurr, OceanusDateRange pNew)
      Determine whether two DateDay objects differ.
      Parameters:
      pCurr - The current Date
      pNew - The new Date
      Returns:
      true if the objects differ, false otherwise
    • getNumDays

      public long getNumDays()
      Obtain the number of days in the range.
      Returns:
      the number of days (or -1 if unbounded)