|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.uhn.hl7v2.model.primitive.CommonTM
public class CommonTM
This class contains functionality used by the TM class in the version 2.3.0, 2.3.1, and 2.4 packages Note: The class description below has been excerpted from the Hl7 2.4 documentation. Sectional references made below also refer to the same documentation. Format: HH[MM[SS[.S[S[S[S]]]]]][+/-ZZZZ] In prior versions of HL7, this data type was always specified to be in the format HHMM[SS[.SSSS]][+/-ZZZZ] using a 24 hour clock notation. In the current and future versions, the precision of a time may be expressed by limiting the number of digits used with the format specification as shown above. By site-specific agreement, HHMM[SS[.SSSS]][+/-ZZZZ] may be used where backward compatibility must be maintained. Thus, HH is used to specify a precision of "hour," HHMM is used to specify a precision of "minute," HHMMSS is used to specify a precision of seconds, and HHMMSS.SSSS is used to specify a precision of ten-thousandths of a second. In each of these cases, the time zone is an optional component. The fractional seconds could be sent by a transmitter who requires greater precision than whole seconds. Fractional representations of minutes, hours or other higher-order units of time are not permitted. Note: The time zone [+/-ZZZZ], when used, is restricted to legally-defined time zones and is represented in HHMM format. The time zone of the sender may be sent optionally as an offset from the coordinated universal time (previously known as Greenwich Mean Time). Where the time zone is not present in a particular TM field but is included as part of the date/time field in the MSH segment, the MSH value will be used as the default time zone. Otherwise, the time is understood to refer to the local time of the sender. Midnight is represented as 0000. Examples:|235959+1100| 1 second before midnight in a time zone eleven hours ahead of Universal Coordinated Time (i.e., east of Greenwich). |0800| Eight AM, local time of the sender. |093544.2312| 44.2312 seconds after Nine thirty-five AM, local time of sender. |13| 1pm (with a precision of hours), local time of sender.
| Field Summary | |
|---|---|
static int |
GMT_OFFSET_NOT_SET_VALUE
Value returned by getGMTOffset() if no offset is set |
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int GMT_OFFSET_NOT_SET_VALUE
getGMTOffset() if no offset is set
| Constructor Detail |
|---|
public CommonTM()
public CommonTM(String val)
throws DataTypeException
DataTypeException| Method Detail |
|---|
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
DataTypeExceptionpublic String getValue()
public void setValueToMinute(Calendar theCalendar)
throws DataTypeException
Calendar object. Passing in null clears any existing value.
Note: Sets fields using precision up to the minute
theCalendar - The calendar object from which to retrieve values
DataTypeException
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 time
theCalendar - The calendar object from which to retrieve values
DataTypeException
public void setValueToSecond(Calendar theCalendar)
throws DataTypeException
Calendar object. Passing in null clears any existing value.
Note: Sets fields using precision up to the second
theCalendar - The calendar object from which to retrieve values
DataTypeException
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 offset
theCalendar - The calendar object from which to retrieve values
DataTypeException
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 time
theDate - The calendar object from which to retrieve values
DataTypeException
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 time
theCalendar - The calendar object from which to retrieve values
DataTypeExceptionpublic 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 date
public 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 time
public 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
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||