Package htsjdk.samtools.util
Class RelativeIso8601Date
- java.lang.Object
-
- java.util.Date
-
- htsjdk.samtools.util.Iso8601Date
-
- htsjdk.samtools.util.RelativeIso8601Date
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<Date>
public class RelativeIso8601Date extends Iso8601Date
LikeIso8601Date
, but also comes in a "lazy now" flavor. When "lazy now" mode is enabled, this instance's date value is undefined until the first time it is queried, at which time it is set toSystem.currentTimeMillis()
. This value is returned on subsequent queries, so it is consistent. The "lazy state" is conveyed viatoString()
. A "lazy now" instance will answertoString()
withLAZY_NOW_LABEL
if the time has not yet been queried/set, or aIso8601Date
-formatted date of the query time if it has been queried. This characteristic is useful for serialization and persistence purposes. Consumers can create "lazy now" instances via thegenerateLazyNowInstance()
factory method or by passingLAZY_NOW_LABEL
toRelativeIso8601Date(String)
.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
LAZY_NOW_LABEL
-
Constructor Summary
Constructors Constructor Description RelativeIso8601Date(String dateStr)
RelativeIso8601Date(Date date)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
after(Date when)
boolean
before(Date when)
Object
clone()
int
compareTo(Date anotherDate)
boolean
equals(Object obj)
static RelativeIso8601Date
generateLazyNowInstance()
Returns a "lazy now" instance.int
getDate()
Deprecated.int
getDay()
Deprecated.int
getHours()
Deprecated.int
getMinutes()
Deprecated.int
getMonth()
Deprecated.int
getSeconds()
Deprecated.long
getTime()
int
getTimezoneOffset()
Deprecated.int
getYear()
Deprecated.int
hashCode()
void
setDate(int date)
Deprecated.void
setHours(int hours)
Deprecated.void
setMinutes(int minutes)
Deprecated.void
setMonth(int month)
Deprecated.void
setSeconds(int seconds)
Deprecated.void
setTime(long time)
Deprecated.void
setYear(int year)
Deprecated.String
toString()
Returns aString
representation of this date.-
Methods inherited from class java.util.Date
from, parse, toGMTString, toInstant, toLocaleString, UTC
-
-
-
-
Field Detail
-
LAZY_NOW_LABEL
public static final String LAZY_NOW_LABEL
- See Also:
- Constant Field Values
-
-
Method Detail
-
generateLazyNowInstance
public static RelativeIso8601Date generateLazyNowInstance()
Returns a "lazy now" instance.
-
toString
public String toString()
Returns aString
representation of this date.- Overrides:
toString
in classIso8601Date
- Returns:
- An
Iso8601Date
-formatted string, or the value ofLAZY_NOW_LABEL
if this is a "lazy now" instance.
-
compareTo
public int compareTo(Date anotherDate)
- Specified by:
compareTo
in interfaceComparable<Date>
- Overrides:
compareTo
in classDate
-
getDate
@Deprecated public int getDate()
Deprecated.
-
getDay
@Deprecated public int getDay()
Deprecated.
-
getHours
@Deprecated public int getHours()
Deprecated.
-
getMinutes
@Deprecated public int getMinutes()
Deprecated.- Overrides:
getMinutes
in classDate
-
getMonth
@Deprecated public int getMonth()
Deprecated.
-
getSeconds
@Deprecated public int getSeconds()
Deprecated.- Overrides:
getSeconds
in classDate
-
getTimezoneOffset
@Deprecated public int getTimezoneOffset()
Deprecated.- Overrides:
getTimezoneOffset
in classDate
-
getYear
@Deprecated public int getYear()
Deprecated.
-
setDate
@Deprecated public void setDate(int date)
Deprecated.
-
setHours
@Deprecated public void setHours(int hours)
Deprecated.
-
setMinutes
@Deprecated public void setMinutes(int minutes)
Deprecated.- Overrides:
setMinutes
in classDate
-
setMonth
@Deprecated public void setMonth(int month)
Deprecated.
-
setSeconds
@Deprecated public void setSeconds(int seconds)
Deprecated.- Overrides:
setSeconds
in classDate
-
setTime
@Deprecated public void setTime(long time)
Deprecated.
-
setYear
@Deprecated public void setYear(int year)
Deprecated.
-
-