Package rs.baselib.util
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 Summary
Constructors Constructor Description DateTimePeriod()Constructor.DateTimePeriod(RsDate from, long duration)Constructor.DateTimePeriod(RsDate from, RsDate until)Constructor. -
Method Summary
Modifier and Type Method Description DateTimePerioddeepCopy()Returns a deep copy of this period.booleanequals(java.lang.Object obj)longgetDuration()Returns the time in ms of this period or -1 if infinite.RsDategetFrom()Returns the from.RsDategetUntil()Returns the until.inthashCode()booleanisIn(RsDate date)Tells whether date is in this range.voidsetFrom(RsDate from)Sets the from.voidsetUntil(RsDate until)Sets the until.java.lang.StringtoString()
-
Constructor Details
-
DateTimePeriod
public DateTimePeriod()Constructor. -
DateTimePeriod
Constructor.- Parameters:
from- - the begin of the periodduration- - the duration of the period
-
DateTimePeriod
Constructor.- Parameters:
from- - the begin of the perioduntil- - the end of the period
-
-
Method Details
-
getFrom
Returns the from.- Returns:
- the from
-
setFrom
Sets the from.- Parameters:
from- the from to set
-
getUntil
Returns the until.- Returns:
- the until
-
setUntil
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
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:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
deepCopy
Returns a deep copy of this period.- Returns:
- deep copy
-