|
|
|
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.torweg.pulse.util.time.Duration
@Embeddable public final class Duration
represents a duration in time.
| Constructor Summary | |
|---|---|
Duration()
creates a Duration starting now and lasting zero
milliseconds. |
|
Duration(java.util.Calendar a,
java.util.Calendar b)
creates a new Duration with a positive TimeSpan , making
the less recent Calendar the reference date. |
|
Duration(java.util.Date a,
java.util.Date b)
creates a new Duration with a positive TimeSpan , making
the less recent Date the reference date. |
|
Duration(java.util.Date d,
java.lang.String ts)
creates a new Duration lasting for the given time span and the
given reference date. |
|
Duration(java.util.Date d, TimeSpan ts)
creates a new Duration lasting for the given time span and the
given reference date. |
|
Duration(Duration duration)
Creates a new Duration from the given Duration. |
|
Duration(long a,
long b)
creates a new Duration with a positive TimeSpan , making
the less recent time-stamp the reference date. |
|
Duration(java.lang.String ts)
creates a new Duration lasting for the given time span string and
now as the reference date. |
|
Duration(TimeSpan ts)
creates a new Duration lasting for the given time span. |
|
| Method Summary | |
|---|---|
TimeSpan |
add(TimeSpan s)
adds a given time span to this time span. |
java.util.Date |
addTo(java.util.Date d)
returns a new Date with the time span added to the Date. |
Duration |
applyOffset(java.lang.Long offset)
Applies the given offset to the start/end time stamp of Duration
if the offset is not null. |
int |
compareTo(TimeSpan o)
compare the time spans of the duration with the given time span. |
boolean |
contains(java.util.Date date)
returns whether a given date is contained in the duration. |
boolean |
contains(Duration duration)
Checks if the given duration is within or equal the duration. |
boolean |
contains(long time)
returns whether a given time stamp is contained in the duration. |
boolean |
equals(java.lang.Object obj)
checks whether the given object is equal to the duration. |
Duration |
getDuration()
Returns a new Duration with the values of the Duration. |
java.util.Date |
getEndDate()
returns the end date. |
java.lang.String |
getEndDateUTCString()
returns the UTC end date. |
long |
getEndMillis()
Returns the milliseconds-value of the end of the Duration. |
long |
getMilliseconds()
returns the milliseconds. |
java.util.Date |
getReferenceDate()
returns the reference date. |
java.lang.String |
getSpan()
returns the string value. |
java.util.Date |
getStartDate()
returns the start date. |
java.lang.String |
getStartDateUTCString()
returns the UTC start date. |
long |
getStartMillis()
Returns the milliseconds-value of the start of the Duration. |
TimeSpan |
getTimeSpan()
returns the TimeSpan of the Duration. |
int |
hashCode()
|
Duration |
levelBoundaries(Period period)
Modifies the start/end time stamp of the Duration to match the
start/end of the given Period. |
void |
setEndDateMillis(long millis)
Sets the given value as endDate. |
void |
setMilliseconds(long ms)
sets the milliseconds for the time span. |
void |
setSpan(java.lang.String s)
sets the time span. |
TimeSpan |
subtract(TimeSpan s)
subtracts a given time span from this time span. |
java.util.Date |
subtractFrom(java.util.Date d)
returns a new Date with the time span subtracted from the Date. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Duration()
Duration starting now and lasting zero
milliseconds.
public Duration(java.lang.String ts)
Duration lasting for the given time span string and
now as the reference date.
ts - the time span as a stringpublic Duration(TimeSpan ts)
Duration lasting for the given time span.
If the time span is negative, the duration's start date is now - time span. Otherwise the start date is now.
ts - the time span
public Duration(java.util.Date d,
java.lang.String ts)
Duration lasting for the given time span and the
given reference date.
d - the reference datets - the time spanpublic Duration(java.util.Date d, TimeSpan ts)
Duration lasting for the given time span and the
given reference date.
d - the reference datets - the time span
public Duration(java.util.Date a,
java.util.Date b)
Duration with a positive TimeSpan , making
the less recent Date the reference date.
a - boundary date ab - boundary date b
public Duration(java.util.Calendar a,
java.util.Calendar b)
Duration with a positive TimeSpan , making
the less recent Calendar the reference date.
a - boundary Calendar ab - boundary Calendar b
public Duration(long a,
long b)
Duration with a positive TimeSpan , making
the less recent time-stamp the reference date.
a - boundary time-stamp ab - boundary time-stamp bpublic Duration(Duration duration)
Duration from the given Duration.
duration - the Duration| Method Detail |
|---|
public java.util.Date getStartDate()
public java.lang.String getStartDateUTCString()
public long getStartMillis()
Duration.
public java.util.Date getEndDate()
public java.lang.String getEndDateUTCString()
public long getEndMillis()
Duration.
public void setEndDateMillis(long millis)
millis - the value to set.
java.lang.IllegalArgumentException - if the record is nullpublic java.util.Date getReferenceDate()
public long getMilliseconds()
public TimeSpan getTimeSpan()
TimeSpan of the Duration.
public void setMilliseconds(long ms)
ms - the time spanpublic java.lang.String getSpan()
public void setSpan(java.lang.String s)
s - the time span stringpublic TimeSpan add(TimeSpan s)
s - the time span to add
public TimeSpan subtract(TimeSpan s)
s - the time span to add
public java.util.Date addTo(java.util.Date d)
Date with the time span added to the Date.
d - the date
public java.util.Date subtractFrom(java.util.Date d)
Date with the time span subtracted from the Date.
d - the date
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the object to check against
true, if and only if both start and end dates are equalpublic int compareTo(TimeSpan o)
compareTo in interface java.lang.Comparable<TimeSpan>o - the time span to compare with
Comparable.compareTo(java.lang.Object)public boolean contains(java.util.Date date)
date - the date
true, if and only if the given date is within the
duration. Otherwise false.public boolean contains(long time)
time - the time stamp
true, if and only if the given time stamp is within the
duration. Otherwise false.public boolean contains(Duration duration)
duration - the Duration
true, if and only if the given Duration is within
or equal the duration, false otherwisepublic Duration getDuration()
Duration with the values of the Duration.
getDuration in interface IHasDurationDuration with the values of the DurationIHasDuration.getDuration()public Duration applyOffset(java.lang.Long offset)
Duration
if the offset is not null.
offset - the offset to scroll by
Durationpublic Duration levelBoundaries(Period period)
Duration to match the
start/end of the given Period.
period - Period
Durationpublic java.lang.String toString()
toString in class java.lang.ObjectDuration
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||