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
Like `Iso8601Date`, 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 to `System.currentTimeMillis()`. This value is returned on subsequent queries, so it is consistent.

The "lazy state" is conveyed via `toString()`. A "lazy now" instance will answer `toString()` with `LAZY_NOW_LABEL` if the time has not yet been queried/set, or a `Iso8601Date`-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 the `generateLazyNowInstance()` factory method or by passing `LAZY_NOW_LABEL` to `RelativeIso8601Date(String)`.

See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`LAZY_NOW_LABEL`

## Constructor Summary

Constructors
Constructor
Description
`RelativeIso8601Date(String dateStr)`
`RelativeIso8601Date(Date date)`

## Method Summary

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 a `String` representation of this date.

### Methods inherited from class java.util.Date

`from, parse, toGMTString, toInstant, toLocaleString, UTC`

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

## Field Details

### LAZY_NOW_LABEL

public static final String LAZY_NOW_LABEL

See Also:
  - Constant Field Values

## Constructor Details

### RelativeIso8601Date

public RelativeIso8601Date(Date date)

### RelativeIso8601Date

public RelativeIso8601Date(String dateStr)

## Method Details

### generateLazyNowInstance

public static RelativeIso8601Date generateLazyNowInstance()
Returns a "lazy now" instance.

### toString

public String toString()
Returns a `String` representation of this date.

Overrides:
  `toString` in class `Iso8601Date`
Returns:
  An `Iso8601Date`-formatted string, or the value of `LAZY_NOW_LABEL` if this is a "lazy now" instance.

### getTime

public long getTime()

Overrides:
  `getTime` in class `Date`

### after

public boolean after(Date when)

Overrides:
  `after` in class `Date`

### before

public boolean before(Date when)

Overrides:
  `before` in class `Date`

### clone

public Object clone()

Overrides:
  `clone` in class `Date`

### compareTo

public int compareTo(Date anotherDate)

Specified by:
  `compareTo` in interface `Comparable<Date>`
Overrides:
  `compareTo` in class `Date`

### equals

public boolean equals(Object obj)

Overrides:
  `equals` in class `Date`

### getDate

@Deprecated public int getDate()
Deprecated.

Overrides:
  `getDate` in class `Date`

### getDay

@Deprecated public int getDay()
Deprecated.

Overrides:
  `getDay` in class `Date`

### getHours

@Deprecated public int getHours()
Deprecated.

Overrides:
  `getHours` in class `Date`

### getMinutes

@Deprecated public int getMinutes()
Deprecated.

Overrides:
  `getMinutes` in class `Date`

### getMonth

@Deprecated public int getMonth()
Deprecated.

Overrides:
  `getMonth` in class `Date`

### getSeconds

@Deprecated public int getSeconds()
Deprecated.

Overrides:
  `getSeconds` in class `Date`

### getTimezoneOffset

@Deprecated public int getTimezoneOffset()
Deprecated.

Overrides:
  `getTimezoneOffset` in class `Date`

### getYear

@Deprecated public int getYear()
Deprecated.

Overrides:
  `getYear` in class `Date`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Date`

### setDate

@Deprecated public void setDate(int date)
Deprecated.

Overrides:
  `setDate` in class `Date`

### setHours

@Deprecated public void setHours(int hours)
Deprecated.

Overrides:
  `setHours` in class `Date`

### setMinutes

@Deprecated public void setMinutes(int minutes)
Deprecated.

Overrides:
  `setMinutes` in class `Date`

### setMonth

@Deprecated public void setMonth(int month)
Deprecated.

Overrides:
  `setMonth` in class `Date`

### setSeconds

@Deprecated public void setSeconds(int seconds)
Deprecated.

Overrides:
  `setSeconds` in class `Date`

### setTime

@Deprecated public void setTime(long time)
Deprecated.

Overrides:
  `setTime` in class `Date`

### setYear

@Deprecated public void setYear(int year)
Deprecated.

Overrides:
  `setYear` in class `Date`