Class DateTimePeriod

java.lang.Object
rs.baselib.util.DateTimePeriod
All Implemented Interfaces:
java.io.Serializable

public class DateTimePeriod
extends java.lang.Object
implements java.io.Serializable
A period of time.
Author:
ralph
See Also:
Serialized Form
  • Constructor Details

    • DateTimePeriod

      public DateTimePeriod()
      Constructor.
    • DateTimePeriod

      public DateTimePeriod​(RsDate from, long duration)
      Constructor.
      Parameters:
      from - - the begin of the period
      duration - - the duration of the period
    • DateTimePeriod

      public DateTimePeriod​(RsDate from, RsDate until)
      Constructor.
      Parameters:
      from - - the begin of the period
      until - - the end of the period
  • Method Details

    • getFrom

      public RsDate getFrom()
      Returns the from.
      Returns:
      the from
    • setFrom

      public void setFrom​(RsDate from)
      Sets the from.
      Parameters:
      from - the from to set
    • getUntil

      public RsDate getUntil()
      Returns the until.
      Returns:
      the until
    • setUntil

      public void setUntil​(RsDate until)
      Sets the until.
      Parameters:
      until - the until to set
    • getDuration

      public long getDuration()
      Returns the time in ms of this period or -1 if infinite.
      Returns:
      the duration in ms
    • isIn

      public boolean isIn​(RsDate date)
      Tells whether date is in this range.
      Parameters:
      date - date to be checked
      Returns:
      true when date falls in this period
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • equals

      public boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • deepCopy

      public DateTimePeriod deepCopy()
      Returns a deep copy of this period.
      Returns:
      deep copy