|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.uima.internal.util.TimeSpan
public class TimeSpan
Encode a span of time. The main purpose of this class is to provide a printing utility for time spans. E.g., 1081 ms should be printed as 1.081 s, 108101 ms should be printed as 1 min 48.101 s, etc.
Note that the largest value you can represent with this class is 9223372036854775807 (Long.MAX_VALUE),
or equivalently, 292471208 yrs 247 days 7 hrs 12 min 55.807 sec. Overflow is not handled
gracefully by this class.
Also note that for the purposes of this class, a year has 365 days. I.e., a year corresponds to
365 * 24 * 60 * 60 * 1000 ms.
| Constructor Summary | |
|---|---|
TimeSpan()
Create an uninstantiated TimeSpan. |
|
TimeSpan(long milliseconds)
Create a TimeSpan from a ms interval. |
|
| Method Summary | |
|---|---|
int |
getDays()
Get the day fraction of this object. |
long |
getFullMilliseconds()
Get the length of the TimeSpan as milliseconds. |
int |
getHours()
Get the hour fraction of this object. |
int |
getMilliseconds()
Get the millisecond fraction of this object. |
int |
getMinutes()
Get the minute fraction of this object. |
int |
getSeconds()
Get the second fraction of this object. |
int |
getYears()
Get the year fraction of this object. |
boolean |
isInstantiated()
|
boolean |
setDays(int days)
Set the day fraction of this TimeSpan. |
boolean |
setFullMilliseconds(long milliseconds)
Set the full TimeSpan in terms of milliseconds. |
boolean |
setHours(int hours)
Set the hour fraction of this TimeSpan. |
boolean |
setMilliseconds(int milliseconds)
Set the millisecond fraction of this TimeSpan. |
boolean |
setMinutes(int minutes)
Set the minute fraction of this TimeSpan. |
boolean |
setSeconds(int seconds)
Set the second fraction of this TimeSpan. |
boolean |
setYears(int years)
Set the year fraction of this TimeSpan. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TimeSpan()
TimeSpan.
public TimeSpan(long milliseconds)
TimeSpan from a ms interval.
milliseconds - The interval in ms. If milliseconds
< 0, an uninstantiated
TimeSpan is created.| Method Detail |
|---|
public boolean isInstantiated()
true, if the object has been instantiated with a legal interval;
false, else.public boolean setYears(int years)
TimeSpan.
years - The number of years.
false, if years < 0; true, else.public boolean setDays(int days)
TimeSpan.
days - The number of days.
false, if days < 0; true, else.public boolean setHours(int hours)
TimeSpan.
hours - The number of hours.
false, if hours < 0; true, else.public boolean setMinutes(int minutes)
TimeSpan.
minutes - The number of minutes.
false, if minutes < 0; true, else.public boolean setSeconds(int seconds)
TimeSpan.
seconds - The number of seconds.
false, if seconds < 0; true, else.public boolean setMilliseconds(int milliseconds)
TimeSpan.
milliseconds - The number of milliseconds.
false, if milliseconds < 0; true,
else.public boolean setFullMilliseconds(long milliseconds)
TimeSpan in terms of milliseconds.
milliseconds - The number of milliseconds.
false, if milliseconds < 0; true,
else.public long getFullMilliseconds()
TimeSpan as milliseconds.
-1, else (e.g., when the
TimeSpan is not instantiated).public int getYears()
-1, if this object is not instantiated; the year fraction, else.public int getDays()
-1, if this object is not instantiated; the day fraction, else.public int getHours()
-1, if this object is not instantiated; the hour fraction, else.public int getMinutes()
-1, if this object is not instantiated; the minute fraction, else.public int getSeconds()
-1, if this object is not instantiated; the second fraction, else.public int getMilliseconds()
-1, if this object is not instantiated; the millisecond fraction, else.public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||