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_LABELif 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_LABELtoRelativeIso8601Date(String).- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringLAZY_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 booleanafter(Date when)booleanbefore(Date when)Objectclone()intcompareTo(Date anotherDate)booleanequals(Object obj)static RelativeIso8601DategenerateLazyNowInstance()Returns a "lazy now" instance.intgetDate()Deprecated.intgetDay()Deprecated.intgetHours()Deprecated.intgetMinutes()Deprecated.intgetMonth()Deprecated.intgetSeconds()Deprecated.longgetTime()intgetTimezoneOffset()Deprecated.intgetYear()Deprecated.inthashCode()voidsetDate(int date)Deprecated.voidsetHours(int hours)Deprecated.voidsetMinutes(int minutes)Deprecated.voidsetMonth(int month)Deprecated.voidsetSeconds(int seconds)Deprecated.voidsetTime(long time)Deprecated.voidsetYear(int year)Deprecated.StringtoString()Returns aStringrepresentation 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 aStringrepresentation of this date.- Overrides:
toStringin classIso8601Date- Returns:
- An
Iso8601Date-formatted string, or the value ofLAZY_NOW_LABELif this is a "lazy now" instance.
-
compareTo
public int compareTo(Date anotherDate)
- Specified by:
compareToin interfaceComparable<Date>- Overrides:
compareToin 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:
getMinutesin classDate
-
getMonth
@Deprecated public int getMonth()
Deprecated.
-
getSeconds
@Deprecated public int getSeconds()
Deprecated.- Overrides:
getSecondsin classDate
-
getTimezoneOffset
@Deprecated public int getTimezoneOffset()
Deprecated.- Overrides:
getTimezoneOffsetin 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:
setMinutesin classDate
-
setMonth
@Deprecated public void setMonth(int month)
Deprecated.
-
setSeconds
@Deprecated public void setSeconds(int seconds)
Deprecated.- Overrides:
setSecondsin classDate
-
setTime
@Deprecated public void setTime(long time)
Deprecated.
-
setYear
@Deprecated public void setYear(int year)
Deprecated.
-
-