public class CommonTM extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static int |
GMT_OFFSET_NOT_SET_VALUE
Value returned by
getGMTOffset() if no offset is set |
Constructor and Description |
---|
CommonTM()
Constructs a TM datatype with fields initialzed to zero and the value set to
null.
|
CommonTM(String val)
Constructs a TM object with the given value.
|
Modifier and Type | Method and Description |
---|---|
float |
getFractSecond()
Returns the fractional second value as a float.
|
int |
getGMTOffset()
Returns the GMT offset value as an integer,
GMT_OFFSET_NOT_SET_VALUE if not set. |
int |
getHour()
Returns the hour as an integer.
|
int |
getMinute()
Returns the minute as an integer.
|
int |
getSecond()
Returns the second as an integer.
|
String |
getValue()
Returns the HL7 TM string value.
|
Calendar |
getValueAsCalendar()
Return the value as a calendar object.
|
Date |
getValueAsDate()
Return the value as a date object
|
void |
setHourMinSecondPrecision(int hr,
int min,
float sec)
This method takes in integer values for the hour, minute, seconds, and fractional seconds
(going to the tenthousandths precision).
|
void |
setHourMinutePrecision(int hr,
int min)
This method takes in integer values for the hour and minute and performs validations,
it then sets the value field formatted as an HL7 time value
with hour&minute precision (HHMM).
|
void |
setHourPrecision(int hr)
This method takes in an integer value for the hour and performs validations,
it then sets the value field formatted as an HL7 time
value with hour precision (HH).
|
void |
setOffset(int signedOffset)
This method takes in the four digit (signed) GMT offset and sets the offset
field
|
void |
setValue(Calendar theCalendar)
Convenience setter which sets the value using a
Calendar object. |
void |
setValue(Date theDate)
Convenience setter which sets the value using a
Calendar object. |
void |
setValue(String val)
This method takes in a string HL7 Time value and performs validations
then sets the value field.
|
void |
setValueToMinute(Calendar theCalendar)
Convenience setter which sets the value using a
Calendar object. |
void |
setValueToMinute(Date theDate)
Convenience setter which sets the value using a
Date object. |
void |
setValueToSecond(Calendar theCalendar)
Convenience setter which sets the value using a
Calendar object. |
void |
setValueToSecond(Date theDate)
Convenience setter which sets the value using a
Date object. |
static String |
toHl7TMFormat(GregorianCalendar cal)
Returns a string value representing the input Gregorian Calendar object in
an Hl7 Time Format.
|
public static final int GMT_OFFSET_NOT_SET_VALUE
getGMTOffset()
if no offset is setpublic CommonTM()
public CommonTM(String val) throws DataTypeException
DataTypeException
public void setValue(String val) throws DataTypeException
null
clears any existing value.DataTypeException
public void setHourPrecision(int hr) throws DataTypeException
DataTypeException
public void setHourMinutePrecision(int hr, int min) throws DataTypeException
DataTypeException
public void setHourMinSecondPrecision(int hr, int min, float sec) throws DataTypeException
DataTypeException
public void setOffset(int signedOffset) throws DataTypeException
DataTypeException
public void setValueToMinute(Calendar theCalendar) throws DataTypeException
Calendar
object. Passing in null
clears any existing value.
Note: Sets fields using precision up to the minutetheCalendar
- The calendar object from which to retrieve valuesDataTypeException
public void setValueToMinute(Date theDate) throws DataTypeException
Date
object. Passing in null
clears any existing value.
Note: Sets fields using precision up to the minute
Note: Date is timezone-agnostic, representing always GMT timetheDate
- The date object from which to retrieve valuesDataTypeException
public void setValueToSecond(Calendar theCalendar) throws DataTypeException
Calendar
object. Passing in null
clears any existing value.
Note: Sets fields using precision up to the secondtheCalendar
- The calendar object from which to retrieve valuesDataTypeException
public void setValue(Calendar theCalendar) throws DataTypeException
Calendar
object. Passing in null
clears any existing value.
Note: Sets fields using precision up to the millisecond, including timezone offsettheCalendar
- The calendar object from which to retrieve valuesDataTypeException
public void setValue(Date theDate) throws DataTypeException
Calendar
object. Passing in null
clears any existing value.
Note: Sets fields using precision up to the millisecond, and sets the timezone offset to
the current system offset
Note: Date is timezone-agnostic, representing always GMT timetheDate
- The calendar object from which to retrieve valuesDataTypeException
public void setValueToSecond(Date theDate) throws DataTypeException
Date
object. Passing in null
clears any existing value.
Note: Sets fields using precision up to the second
Note: Date is timezone-agnostic, representing always GMT timetheDate
- The date object from which to retrieve valuesDataTypeException
public Calendar getValueAsCalendar()
Return the value as a calendar object.
Note that only the time component of the return value is set to the value from this object. Returned value will have today's datepublic Date getValueAsDate()
Return the value as a date object
Note that only the time component of the return value is set to the value from this object. Returned value will have today's date Note: Date is timezone-agnostic, representing always GMT timepublic int getHour()
public int getMinute()
public int getSecond()
public float getFractSecond()
public int getGMTOffset()
GMT_OFFSET_NOT_SET_VALUE
if not set.public static String toHl7TMFormat(GregorianCalendar cal) throws DataTypeException
DataTypeException
Copyright © 2001–2017 University Health Network. All rights reserved.