cdac.medinfo.sdk.hl7282.baselibs

## Class PrimitiveDataType

- java.lang.Object
- - cdac.medinfo.sdk.hl7282.baselibs.PrimitiveDataType

- All Implemented Interfaces:
    IDataType
  Direct Known Subclasses:
    DT, DTM, FT, GTS, ID, IS, NM, SI, SNM, ST, TM, TX, UN

      public abstract class PrimitiveDataType
      extends java.lang.Object
      implements IDataType

  The Base Data Type class which is Responsible for the Validation, setting the values and Read and Write of all the Primitive DataTypes which extends from this class.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PrimitiveDataType(IDataTypeKey objIDataTypeKey)` constructor for the Class PrimitiveDataType
    `PrimitiveDataType(IDataTypeKey objIDataTypeKey, int iMinLength, int iMaxLength, java.lang.String strCLength)` Constructor for PrimitiveDataType which takes two arguments and sets the value in the respective member variable.
    `PrimitiveDataType(IDataTypeKey objIDataTypeKey, int iMinLength, int iMaxLength, java.lang.String strCLength, int iTableNo)` Constructor for PrimitiveDataType which takes three arguments and sets the value in the respective member variable.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `copy(IDataType objDataType, IDelimiter objDelimiter)` This will create replicate of existing Data Type.
    `IDataTypeKey` | `getDataTypeName()` This method returns the name of Data Type.
    `java.lang.String` | `getICLength()` Function returns the cLength in the member variable iConformanceLength.
    `int` | `getIMaxLength()` Function returns the maxLength in the member variable iMaxLength.
    `int` | `getIMinLength()` Function returns the minLength in the member variable iMinLength.
    `int` | `getLength()` This will return the length of DataType.
    `java.lang.Object` | `getValue()` Function returns the value in the member variable strValue.
    `boolean` | `isPrimitive()` This method returns the state for Data Type whether it is primitive Data Type or composite DataType.
    `int` | `read(java.lang.String strAttributeData, IDelimiter objIDelimiter)` Method reads the data from the String.
    `void` | `setICLength(java.lang.String cLength)` Function sets the cLength in the member variable iCVariable.
    `void` | `setIMaxLength(int maxLength)` Function sets the maxLength in the member variable iMaxVariable.
    `void` | `setIMinLength(int minLength)` Function sets the minLength in the member variable iMinVariable.
    `void` | `setValue(java.lang.Object objValue)` Function sets the value in the member variable strValue after validations.
    `java.lang.String` | `toString()` This method returns a string consisting name of the Item.
    `boolean` | `validate()` This validate function validates the data value object with the regular expression and check for maximum length.
    `int` | `write(IHL7Stream objIHL7Stream, IDelimiter objIDelimiter)` Method writes the data to the Stream.

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

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### PrimitiveDataType

          public PrimitiveDataType(IDataTypeKey objIDataTypeKey)

      constructor for the Class PrimitiveDataType

    - #### PrimitiveDataType

          public PrimitiveDataType(IDataTypeKey objIDataTypeKey,
                           int iMinLength,
                           int iMaxLength,
                           java.lang.String strCLength)

      Constructor for PrimitiveDataType which takes two arguments and sets the value in the respective member variable.
      Parameters:
        `objIDataTypeKey` - object of IDataTypeKey.
        `iMinLength` - The Minimum length the DataType can have.
        `iMaxLength` - The Maximum length the DataType can have.
        `iCLength` - The Conformance length the DataType can have.

    - #### PrimitiveDataType

          public PrimitiveDataType(IDataTypeKey objIDataTypeKey,
                           int iMinLength,
                           int iMaxLength,
                           java.lang.String strCLength,
                           int iTableNo)

      Constructor for PrimitiveDataType which takes three arguments and sets the value in the respective member variable.
      Parameters:
        `objIDataTypeKey` - object of IDataTypeKey.
        `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.

  - ### Method Detail

    - #### getDataTypeName

          public IDataTypeKey getDataTypeName()

      This method returns the name of Data Type.
      Specified by:
        `getDataTypeName` in interface `IDataType`
      Returns:
        IDataTypeKey - Name of the Data Type.

    - #### getIMaxLength

          public int getIMaxLength()

      Function returns the maxLength in the member variable iMaxLength.
      Returns:
        int - the Maximum length.

    - #### setIMaxLength

          public void setIMaxLength(int maxLength)

      Function sets the maxLength in the member variable iMaxVariable.
      Parameters:
        `maxLength` - - the Maximum length.

    - #### getIMinLength

          public int getIMinLength()

      Function returns the minLength in the member variable iMinLength.
      Returns:
        int - the Minimum length.

    - #### setIMinLength

          public void setIMinLength(int minLength)

      Function sets the minLength in the member variable iMinVariable.
      Parameters:
        `maxLength` - - the Minimum length.

    - #### getICLength

          public java.lang.String getICLength()

      Function returns the cLength in the member variable iConformanceLength.
      Returns:
        String - the Conformance length.

    - #### setICLength

          public void setICLength(java.lang.String cLength)

      Function sets the cLength in the member variable iCVariable.
      Parameters:
        `cLength` - - the Confromance length.

    - #### getValue

          public java.lang.Object getValue()

      Function returns the value in the member variable strValue.
      Specified by:
        `getValue` in interface `IDataType`
      Returns:
        String - string actual value.

    - #### setValue

          public void setValue(java.lang.Object objValue)
                        throws InvalidDataTypeException

      Function sets the value in the member variable strValue after validations.
      Specified by:
        `setValue` in interface `IDataType`
      Parameters:
        `objValue` - - the Object value as String.
      Throws:
        `InvalidDataTypeException`

    - #### write

          public int write(IHL7Stream objIHL7Stream,
                  IDelimiter objIDelimiter)
                    throws java.io.IOException

      Method writes the data to the Stream.
      Specified by:
        `write` in interface `IDataType`
      Parameters:
        `objIHL7Stream` - Object of HL7Stream
        `objIDelimiter` - Object of class Delimiter
      Returns:
        the integer value depending on the result.
      Throws:
        `java.io.IOException` - - if IO exception fails.

    - #### validate

          public boolean validate()
                           throws InvalidDataTypeException

      This validate function validates the data value object with the regular expression and check for maximum length.
      Specified by:
        `validate` in interface `IDataType`
      Parameters:
        `strValue` - - the string value.
      Returns:
        int - function status [Success/Failure].
      Throws:
        `InvalidDataTypeException` - - if Data Type Validation fails

    - #### read

          public int read(java.lang.String strAttributeData,
                 IDelimiter objIDelimiter)
                   throws java.io.IOException

      Method reads the data from the String.
      Specified by:
        `read` in interface `IDataType`
      Parameters:
        `strAttributeData` - String of HL7Stream.
        `objIDelimiter` - Object of class Delimiter.
      Returns:
        integer - Number of bytes read. - Fail if data read is not valid.
      Throws:
        `java.io.IOException` - - if IO exception fails.

    - #### copy

          public void copy(IDataType objDataType,
                  IDelimiter objDelimiter)
                    throws java.io.IOException

      This will create replicate of existing Data Type.
      Parameters:
        `objDataType` - object of Data Type.
        `objDelimiter` - object of Delimiter.
      Throws:
        `java.io.IOException` - - if IO operation fails.

    - #### getLength

          public int getLength()

      This will return the length of DataType.
      Specified by:
        `getLength` in interface `IDataType`
      Returns:
        int length of String.

    - #### isPrimitive

          public boolean isPrimitive()

      This method returns the state for Data Type whether it is primitive Data Type or composite DataType.
      Specified by:
        `isPrimitive` in interface `IDataType`
      Returns:
        false for all Composite DataType.

    - #### toString

          public java.lang.String toString()

      This method returns a string consisting name of the Item.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        String - name of the Item.