cdac.medinfo.sdk.hl7282.baselibs

## Class CQ

- java.lang.Object
- - cdac.medinfo.sdk.hl7282.baselibs.CompositeDataType
  - - cdac.medinfo.sdk.hl7282.baselibs.CQ

- All Implemented Interfaces:
    IDataType

      public class CQ
      extends CompositeDataType

  CQ - Composite Quantity with Units

  This is composite quantity with units. Examples: |123.7^kg| kilograms is an ISO unit |150^lb&&ANSI+| weight in pounds is a customary US unit defined within ANSI+. Note:Refer HL7 Document(2.A.11)CQ cannot be legally expressed when embedded within another data type. Its use is constrained to a segment field.

  Represents an HL7 CQ data type. This data type has the following attributes:

  1. Quantity (NM)Optional
  2. Units (CWE)Optional

  This class provides accessors & mutators for the elements mentioned above. This class override the equal method, to check whether some other object is "equal to" this one.

  User can also create Data Type through `DataElementFactory`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CQ()` Default Constructor for CQ
    `CQ(int iComponentType, IDataTypeMap objIDataTypeMap)` Constructor for CQ class which takes two arguments and sets the value in the respective member variable.
    `CQ(int iComponentType, int iMinLength, int iMaxLength, java.lang.String strCLength, IDataTypeMap objIDataTypeMap)` Constructor for CQ class which takes five arguments and sets the value in the respective member variable.
    `CQ(int iComponentType, int iMinLength, int iMaxLength, java.lang.String strCLength, int ITableNo, IDataTypeMap objIDataTypeMap)` Constructor for CQ class which takes six arguments and sets the value in the respective member variable.
    `CQ(int iMinLength, int iMaxLength, java.lang.String strCLength, int iComponentType)` Constructor for CQ class which takes four arguments and sets the value in the respective member variable.
    `CQ(int iMinLength, int iMaxLength, java.lang.String strCLength, int iTableNo, int iComponentType)` Constructor for CQ class which takes five arguments and sets the value in the respective member variable.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object objObject)` This method checks the equality of Object.
    `NM` | `getQuantity()` Returns Quantity
    `CWE` | `getUnits()` Returns Units
    `void` | `setQuantity(NM objQuantity)` Sets the Quantity.
    `void` | `setQuantity(java.lang.String strQuantity)` Sets the Quantity.
    `void` | `setUnits(CWE objUnits)` Sets the Units.
    `void` | `setUnits(java.lang.String strUnits)` Sets the Units.

    - ### Methods inherited from class cdac.medinfo.sdk.hl7282.baselibs.CompositeDataType

      `copy, dumpDataType, getAttributes, getDataTypeName, getLength, getValue, isPrimitive, read, setValue, validate, write, writeToXML`

    - ### Methods inherited from class java.lang.Object

      `getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CQ

          public CQ()

      Default Constructor for CQ

    - #### CQ

          public CQ(int iMinLength,
            int iMaxLength,
            java.lang.String strCLength,
            int iComponentType)
             throws InvalidComponentTypeException

      Constructor for CQ class which takes four arguments and sets the value in the respective member variable.
      Parameters:
        `iMaxLength` - - The Maximum length the DataType can have.
        `iComponentType` - - The Type of the component i.e Component or a subcomponent.
      Throws:
        `InvalidComponentTypeException` - - if Component Type is not specified or valid.

    - #### CQ

          public CQ(int iMinLength,
            int iMaxLength,
            java.lang.String strCLength,
            int iTableNo,
            int iComponentType)
             throws InvalidComponentTypeException

      Constructor for CQ class which takes five arguments and sets the value in the respective member variable.
      Parameters:
        `iMaxLength` - - The Maximum length the DataType can have.
        `iTableNo` - - The Table number to which the value for the component is specified.
        `iComponentType` - - The Type of the component i.e Component or a subcomponent.
      Throws:
        `InvalidComponentTypeException` - - if Component Type is not specified or valid.

    - #### CQ

          public CQ(int iComponentType,
            IDataTypeMap objIDataTypeMap)

      Constructor for CQ class which takes two arguments and sets the value in the respective member variable.
      Parameters:
        `objIDataTypeMap` - object of Data Type Map.
        `iComponentType` - The Type of the component i.e Component or a subcomponent.
      Throws:
        `InvalidComponentTypeException` - - if Component Type is not specified or valid.

    - #### CQ

          public CQ(int iComponentType,
            int iMinLength,
            int iMaxLength,
            java.lang.String strCLength,
            IDataTypeMap objIDataTypeMap)

      Constructor for CQ class which takes five arguments and sets the value in the respective member variable.
      Parameters:
        `objIDataTypeMap` - object of Data Type Map.
        `iComponentType` - The Type of the component i.e Component or a subcomponent.
        `iMinLength` - The Minimum length the DataType can have.
        `iMaxLength` - The Maximum length the DataType can have.
        `iCLength` - The Conformance length the DataType can have.
      Throws:
        `InvalidComponentTypeException` - - if Component Type is not specified or valid.

    - #### CQ

          public CQ(int iComponentType,
            int iMinLength,
            int iMaxLength,
            java.lang.String strCLength,
            int ITableNo,
            IDataTypeMap objIDataTypeMap)

      Constructor for CQ class which takes six arguments and sets the value in the respective member variable.
      Parameters:
        `objIDataTypeMap` - object of Data Type Map.
        `iComponentType` - The Type of the component i.e Component or a subcomponent.
        `iMinLength` - The Minimum length the DataType can have.
        `iMaxLength` - The Maximum length the DataType can have.
        `iCLength` - The Conformance length the DataType can have.
        `iTableNo` - The Table number to which the value for the component is specified.
      Throws:
        `InvalidComponentTypeException` - - if Component Type is not specified or valid.

  - ### Method Detail

    - #### setQuantity

          public void setQuantity(java.lang.String strQuantity)

      Sets the Quantity.
      Parameters:
        `strQuantity` - specifies the Quantity.

    - #### setQuantity

          public void setQuantity(NM objQuantity)

      Sets the Quantity.
      Parameters:
        `objQuantity` - specifies the Quantity.

    - #### setUnits

          public void setUnits(java.lang.String strUnits)

      Sets the Units.
      Parameters:
        `strUnits` - specifies the Units.

    - #### setUnits

          public void setUnits(CWE objUnits)

      Sets the Units.
      Parameters:
        `objUnits` - specifies the Units.

    - #### getQuantity

          public NM getQuantity()

      Returns Quantity
      Returns:
        NM

    - #### getUnits

          public CWE getUnits()

      Returns Units
      Returns:
        CE

    - #### equals

          public boolean equals(java.lang.Object objObject)

      This method checks the equality of Object.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `objObject` - object of Object class.
      Returns:
        boolean - shows success or failure of the comparison.