|
Media Authoring with Java API |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objecttv.amwa.maj.embeddable.TimeStruct
public final class TimeStruct
Implementation of the time component of date and time values specified according to Coordinated Universal Time (UTC), including hour, minute, second and 1/100th of a second. The time structure is itself a component of a timestamp.
This implementation is backed by a Calendar.
DateStruct,
TimeStamp,
TypeDefinitionRecord.TimeStruct,
Serialized Form| Constructor Summary | |
|---|---|
TimeStruct()
Create a new time structure set to the current time. |
|
TimeStruct(byte hour,
byte minute,
byte second)
Create a time value from its hour, minute and second component parts. |
|
TimeStruct(byte hour,
byte minute,
byte second,
byte fraction)
Create a time value from all of its component parts. |
|
TimeStruct(Calendar timeItem)
Create a new time structure from the given calendar value. |
|
| Method Summary | |
|---|---|
static TimeStruct |
castFromInterface(TimeStruct alien)
Cast a value the implements the TimeStruct interface
to concrete value of this implementation. |
TimeStruct |
clone()
Creates a cloned deep copy of this embeddable value. |
boolean |
equals(Object o)
Tests to see if the value of two time structures are equal. |
byte |
getFraction()
Returns the fractions of a second component of the time value. |
byte |
getHour()
Returns the hours component of the time value. |
byte |
getMinute()
Returns the minutes component of the time value. |
byte |
getSecond()
Returns the seconds component of the time value. |
Calendar |
getTimeValue()
Returns a copy of the calendar value used to represent the time value. |
int |
hashCode()
Returns a hash code value for this embeddable object. |
static TimeStruct |
parseTimeStruct(String time)
Creates a new time value from a UTC-style string. |
void |
setFraction(byte fraction)
Sets the fractions of a second component of the time value, in the range 0 to 99. |
void |
setHour(byte hour)
Sets the hours component of the time value, in the range 0 to 23. |
void |
setMinute(byte minute)
Sets the minutes component of the time value, in the range 0 to 59. |
void |
setPropertiesFromInterface(TimeStruct castFrom)
Set the properties of this value from those available in the given value, which is specified by the time structure interface. |
void |
setSecond(byte second)
Sets the second component of the time value, normally in the range 0 to 59. |
void |
setTime(byte hour,
byte minute,
byte second)
Set the values of the time structure using an hour, minute and second values provided. |
void |
setTime(byte hour,
byte minute,
byte second,
byte fraction)
Sets all the values of the time structure using the hour, minute, second and fraction of a second values provided. |
void |
setTimeValue(Calendar timeItem)
Sets the value of the time structure from the given calendar value. |
String |
toString()
Creates a UTC-style string representation of the time structure's value, including the timezone offset. |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TimeStruct(byte hour,
byte minute,
byte second,
byte fraction)
throws IllegalArgumentException
Create a time value from all of its component parts.
hour - Hour component of the time value, in the inclusive range 0 to 23.minute - Minute component of the time value, in the inclusive range 0 to 59.second - Second component of the time value, normally in the inclusive range 0 to 59.fraction - 1/100th of a second component of the time value, in the inclusive range
0 to 99.
IllegalArgumentException - One or more of the parameters is out of range.
public TimeStruct(byte hour,
byte minute,
byte second)
throws IllegalArgumentException
Create a time value from its hour, minute and second component parts. The fraction of a second is set to 0.
hour - Hour component of the time value, in the inclusive range 0 to 23.minute - Minute component of the time value, in the inclusive range 0 to 59.second - Second component of the time value, normally in the inclusive range 0 to 59.
IllegalArgumentException - One or more of the parameters is out of range.
public TimeStruct(Calendar timeItem)
throws NullPointerException,
IllegalArgumentException
Create a new time structure from the given calendar value.
timeItem - Calendar item to use to create a new time structure.
NullPointerException - Argument is null.
IllegalArgumentException - The given calendar value contains out-of-range
values.public TimeStruct()
Create a new time structure set to the current time.
| Method Detail |
|---|
public static final TimeStruct castFromInterface(TimeStruct alien)
throws NullPointerException
Cast a value the implements the TimeStruct interface
to concrete value of this implementation.
alien - Value to cast to a concrete instance.
NullPointerException - The alien value argument is null.setPropertiesFromInterface(tv.amwa.maj.record.TimeStruct)
public final void setPropertiesFromInterface(TimeStruct castFrom)
throws NullPointerException
Set the properties of this value from those available in the given value, which is specified by the time structure interface.
castFrom - Value to extract properties from.
NullPointerException - The given value to use to set this value is null.castFromInterface(tv.amwa.maj.record.TimeStruct)public final byte getFraction()
TimeStructReturns the fractions of a second component of the time value.
getFraction in interface TimeStruct
public final void setFraction(byte fraction)
throws IllegalArgumentException
TimeStructSets the fractions of a second component of the time value, in the range 0 to 99.
setFraction in interface TimeStructfraction - Fractions of a second component of the time value.
IllegalArgumentException - The fractions of a second value is outside the acceptable
range.public final byte getHour()
TimeStructReturns the hours component of the time value.
getHour in interface TimeStruct
public final void setHour(byte hour)
throws IllegalArgumentException
TimeStructSets the hours component of the time value, in the range 0 to 23.
setHour in interface TimeStructhour - Hours component of the time value.
IllegalArgumentException - The hours value is outside the acceptable range.public final byte getMinute()
TimeStructReturns the minutes component of the time value.
getMinute in interface TimeStruct
public final void setMinute(byte minute)
throws IllegalArgumentException
TimeStructSets the minutes component of the time value, in the range 0 to 59.
setMinute in interface TimeStructminute - Minutes component of the time value.
IllegalArgumentException - The minute value is outside the acceptable range.public final byte getSecond()
TimeStructReturns the seconds component of the time value. Note that advanced implementations may allow for very occasional leap second values of 60 or 61.
getSecond in interface TimeStruct
public final void setSecond(byte second)
throws IllegalArgumentException
TimeStructSets the second component of the time value, normally in the range 0 to 59. Note that advanced implementations may allow for very occasional leap second values of 60 or 61.
setSecond in interface TimeStructsecond - Seconds component of the time value.
IllegalArgumentException - The second value is outside the acceptable range.
public final void setTime(byte hour,
byte minute,
byte second)
throws IllegalArgumentException
TimeStructSet the values of the time structure using an hour, minute and second values provided. The fraction of the second represented is set to be 0.
setTime in interface TimeStructhour - Hours component of the time value, represented in 24-hour clock format.minute - Minutes component of the time value.second - Seconds component of the time value.
IllegalArgumentException - One or more of the values is outside the acceptable
range for a time value.
public final void setTime(byte hour,
byte minute,
byte second,
byte fraction)
throws IllegalArgumentException
TimeStructSets all the values of the time structure using the hour, minute, second and fraction of a second values provided.
setTime in interface TimeStructhour - Hours component of the time value, represented in 24-hour clock format.minute - Minutes component of the time value.second - Seconds component of the time value.fraction - Fractions of a second component of the time value.
IllegalArgumentException - One or more of the values is outside the acceptable
range for a time value.
public final void setTimeValue(Calendar timeItem)
throws NullPointerException,
IllegalArgumentException
Sets the value of the time structure from the given calendar value.
timeItem - Calendar value to set for this time structure.
NullPointerException - Argument is null.
IllegalArgumentException - The given calendar value contains one or more fields
that are out of range.public final Calendar getTimeValue()
Returns a copy of the calendar value used to represent the time value.
public final String toString()
Creates a UTC-style string representation of the time structure's value, including the
timezone offset. The format used is "HH:mm:ss.SSSZ", where:
toString in interface MAJCommontoString in class ObjectObject.toString(),
SimpleDateFormatpublic final boolean equals(Object o)
Tests to see if the value of two time structures are equal. Two time values are equal if and only each of their hour, minute, second and fraction of a second values are equal respectively.
equals in interface MAJCommonequals in class Objecto - Object to test for equality with.
Object.equals(java.lang.Object)public final int hashCode()
MAJCommonReturns a hash code value for this embeddable object.
hashCode in interface MAJCommonhashCode in class ObjectObject.hashCode()public final TimeStruct clone()
MAJCommonCreates a cloned deep copy of this embeddable value. The clone will be initialized to have the same value as this value but exists independently from then on. Changes to this value will not effect the clone and changes to the clone will not effect this. MAJ API clones are true deep clones with no shared references to areas of memory within the original.
This method does not throw a CloneNotSupportedException as all
embeddable values must implement the Cloneable interface.
clone in interface MAJCommonclone in class ObjectObject.clone()
public static final TimeStruct parseTimeStruct(String time)
throws ParseException,
NullPointerException
Creates a new time value from a UTC-style string. The expected format of the
string is "HH:mm:ss.SSSZ", where:
Note that if a timezone value different from UTC ("+0000"), the time value will be converted to its UTC equivalent.
time - UTC-style string time value.
ParseException - The given value could not be converted into a time structure value.
NullPointerException - Argument is null.
|
Media Authoring with Java API |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||