ca.uhn.hl7v2.model.primitive
Class CommonTM

java.lang.Object
  extended by ca.uhn.hl7v2.model.primitive.CommonTM

public class CommonTM
extends java.lang.Object

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.

Author:
Neal Acharya

Constructor Summary
CommonTM()
          Constructs a TM datatype with fields initialzed to zero and the value set to null.
CommonTM(java.lang.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, -99 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.
 java.lang.String getValue()
          Returns the HL7 TM string value.
 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(java.lang.String val)
          This method takes in a string HL7 Time value and performs validations then sets the value field.
static java.lang.String toHl7TMFormat(java.util.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
 

Constructor Detail

CommonTM

public CommonTM()
Constructs a TM datatype with fields initialzed to zero and the value set to null.


CommonTM

public CommonTM(java.lang.String val)
         throws DataTypeException
Constructs a TM object with the given value. The stored value will be in the following format HH[MM[SS[.S[S[S[S]]]]]][+/-ZZZZ].

Throws:
DataTypeException
Method Detail

setValue

public void setValue(java.lang.String val)
              throws DataTypeException
This method takes in a string HL7 Time value and performs validations then sets the value field. The stored value will be in the following format HH[MM[SS[.S[S[S[S]]]]]][+/-ZZZZ]. Note: Trailing zeros supplied in the time value (HH[MM[SS[.S[S[S[S]]]]]]) and GMT offset ([+/-ZZZZ]) will be preserved. Note: If the GMT offset is not supplied then the local time zone (using standard time zone format which is not modified for daylight savings) will be stored as a default.

Throws:
DataTypeException

setHourPrecision

public void setHourPrecision(int hr)
                      throws DataTypeException
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).

Throws:
DataTypeException

setHourMinutePrecision

public void setHourMinutePrecision(int hr,
                                   int min)
                            throws DataTypeException
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).

Throws:
DataTypeException

setHourMinSecondPrecision

public void setHourMinSecondPrecision(int hr,
                                      int min,
                                      float sec)
                               throws DataTypeException
This method takes in integer values for the hour, minute, seconds, and fractional seconds (going to the tenthousandths precision). The method performs validations and then sets the value field formatted as an HL7 time value with a precision that starts from the hour and goes down to the tenthousandths of a second (HHMMSS.SSSS). Note: all of the precisions from tenths down to tenthousandths of a second are optional. If the precision goes below tenthousandths of a second then the second value will be rounded to the nearest tenthousandths of a second.

Throws:
DataTypeException

setOffset

public void setOffset(int signedOffset)
               throws DataTypeException
This method takes in the four digit (signed) GMT offset and sets the offset field

Throws:
DataTypeException

getValue

public java.lang.String getValue()
Returns the HL7 TM string value.


getHour

public int getHour()
Returns the hour as an integer.


getMinute

public int getMinute()
Returns the minute as an integer.


getSecond

public int getSecond()
Returns the second as an integer.


getFractSecond

public float getFractSecond()
Returns the fractional second value as a float.


getGMTOffset

public int getGMTOffset()
Returns the GMT offset value as an integer, -99 if not set.


toHl7TMFormat

public static java.lang.String toHl7TMFormat(java.util.GregorianCalendar cal)
                                      throws DataTypeException
Returns a string value representing the input Gregorian Calendar object in an Hl7 Time Format.

Throws:
DataTypeException


Copyright © 2001-2011 University Health Network. All Rights Reserved.