public class TimeValue
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
private java.util.Calendar |
calendar
Date/Time storage/manipulation back-end
|
private static java.lang.ThreadLocal<java.text.SimpleDateFormat> |
format
Format used for
TimeValue <-> String
conversion. |
| Constructor and Description |
|---|
TimeValue(java.util.Date other)
Constructs an instance of the
TimeValue from the
Date instance. |
TimeValue(int hours,
int minutes)
Constructs an instance of the TimeValue from hours and minutes.
|
TimeValue(int hours,
int minutes,
int seconds)
Constructs an instance with all fields (hours, minutes, and seconds)
defined.
|
TimeValue(TimeValue other)
Constructs an instance of the
TimeValue from the other
instance. |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(java.util.Date other)
Compares this instance with instance of
Date for
ordering. |
int |
compareTo(java.lang.Object other)
Compare this instance with other object.
|
int |
compareTo(TimeValue other)
Compares two instances for ordering.
|
private void |
enforceDate(java.util.Date input)
This method performs all necessary steps to enforce TimeValue instance
to contain only time, without date part.
|
boolean |
equals(java.lang.Object o)
Compares two objects for equality.
|
java.util.Date |
getDate()
Return current time as instance of the
Date. |
int |
hashCode()
Return a hash code for the instance.
|
void |
setDate(java.util.Date date)
Set current value using instance of
Date as a source. |
java.lang.String |
toString()
Convert
TimeValue instance into String. |
static TimeValue |
valueOf(java.lang.String str)
Parse
String like HH:MM:SS and create an instance of
TimeValue. |
private static final java.lang.ThreadLocal<java.text.SimpleDateFormat> format
TimeValue <-> String
conversion.private java.util.Calendar calendar
public TimeValue(java.util.Date other)
TimeValue from the
Date instance.other - An instance which is used as a source of data.public TimeValue(int hours,
int minutes)
hours - Hours filed for the new instance.minutes - Minutes value for the new instance.public TimeValue(int hours,
int minutes,
int seconds)
hours - Hours value for the new instance.minutes - Minutes value for the new instance.seconds - Seconds value for the new instance.public TimeValue(TimeValue other)
TimeValue from the other
instance.other - An instance which is used as a source of data.public static TimeValue valueOf(java.lang.String str)
String like HH:MM:SS and create an instance of
TimeValue.str - Source string.TimeValue instance or null if
source string does not contain properly formatted time.public int compareTo(java.util.Date other)
Date for
ordering. Note that argument must have date part reset to 0
because it is involved into comparison.other - The instance of Date to be compared.0 if times are equal; a value less than
0 if this instance time is before time of the
passed parameter; a value greater than 0 if this
instance time is after time of the parameter.public int compareTo(java.lang.Object other)
compareTo in interface java.lang.Comparableother - The instance of Date to be compared.0 if times are equal; a value less than
0 if this instance time is before time of the
passed parameter; a value greater than 0 if this
instance time is after time of the parameter.java.lang.ClassCastException - if argument is not instance of Date or
TimeValue.public int compareTo(TimeValue other)
other - The instance to be compared.0 if instances are equal; a value less than
0 if this instance time is before time of the
instance passed as a parameter; a value greater than
0 if this instance time is after time of the
instance passed as a parameter.public boolean equals(java.lang.Object o)
Calendar.equals()
or Date.equals() if possible. Otherwise return
false.equals in class java.lang.Objecto - Object to compare with.true if instances are equal and
false otherwise.public java.util.Date getDate()
Date.java.util.Date.public int hashCode()
Date.hashCode()
for real computation.hashCode in class java.lang.Objectpublic void setDate(java.util.Date date)
Date as a source.date - Source instance of Date to get values from.public java.lang.String toString()
TimeValue instance into String.toString in class java.lang.Objectprivate void enforceDate(java.util.Date input)
input - Date instance to set information from.