cdac.medinfo.sdk.hl7282.baselibs

## Class CP

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

- All Implemented Interfaces:
    IDataType

      public class CP
      extends CompositeDataType

  CP - Composite Price

  This data type is often used to define a repeating field within a given segment.

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

  1. Price (MO)Required
  2. Price Type (ID)Optional
  3. From Value (NM)Optional
  4. To Value (NM)Optional
  5. Range Units (CWE)Conditional
  6. Range Type (ID)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
    `CP()` Default Constructor for CP
    `CP(int iComponentType, IDataTypeMap objIDataTypeMap)` Constructor for CP class which takes two arguments and sets the value in the respective member variable.
    `CP(int iComponentType, int iMinLength, int iMaxLength, java.lang.String strCLength, IDataTypeMap objIDataTypeMap)` Constructor for CP class which takes five arguments and sets the value in the respective member variable.
    `CP(int iComponentType, int iMinLength, int iMaxLength, java.lang.String strCLength, int ITableNo, IDataTypeMap objIDataTypeMap)` Constructor for CP class which takes six arguments and sets the value in the respective member variable.
    `CP(int iMinLength, int iMaxLength, java.lang.String strCLength, int iComponentType)` Constructor for CP class which takes four arguments and sets the value in the respective member variable.
    `CP(int iMinLength, int iMaxLength, java.lang.String strCLength, int iTableNo, int iComponentType)` Constructor for CP 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` | `getFromValue()` Returns From Value
    `MO` | `getPrice()` Returns Price
    `ID` | `getPriceType()` Returns Price Type
    `ID` | `getRangeType()` Returns Range Type
    `CWE` | `getRangeUnits()` Returns Range Units
    `NM` | `getToValue()` Returns To Value
    `void` | `setFromValue(NM objNM)` Sets the From Value.
    `void` | `setFromValue(java.lang.String strFromValue)` Sets the From Value.
    `void` | `setPrice(MO objPrice)` Sets the Price
    `void` | `setPriceType(ID objID)` Sets the Price Type.
    `void` | `setPriceType(java.lang.String strPriceType)` Sets the Price Type.
    `void` | `setRangeType(ID objID)` Sets the Range Type.
    `void` | `setRangeType(java.lang.String strRangeType)` Sets the Range Type.
    `void` | `setRangeUnits(CWE objRangeUnits)` Sets the Range Units.
    `void` | `setToValue(NM objNM)` Sets the To Value.
    `void` | `setToValue(java.lang.String strToValue)` Sets the To Value.
    `boolean` | `validate()` The Method validates the Input value,and if validated properly then returns true.

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

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

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

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

- - ### Constructor Detail

    - #### CP

          public CP()

      Default Constructor for CP

    - #### CP

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

      Constructor for CP class which takes four arguments and sets the value in the respective member variable.
      Parameters:
        `iMinLength` - The Minimum length the DataType can have.
        `iMaxLength` - The Maximum length the DataType can have.
        `iCLength` - The Conformance 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.

    - #### CP

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

      Constructor for CP class which takes five arguments and sets the value in the respective member variable.
      Parameters:
        `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.
        `iComponentType` - The Type of the component i.e Component or a subcomponent.
      Throws:
        `InvalidComponentTypeException` - - if Component Type is not specified or valid.

    - #### CP

          public CP(int iComponentType,
            IDataTypeMap objIDataTypeMap)

      Constructor for CP 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.

    - #### CP

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

      Constructor for CP 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.

    - #### CP

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

      Constructor for CP 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

    - #### setPrice

          public void setPrice(MO objPrice)

      Sets the Price
      Parameters:
        `objPrice` - Specifies an amount of money and the denomination in which it is expressed.

    - #### setPriceType

          public void setPriceType(java.lang.String strPriceType)

      Sets the Price Type.
      Parameters:
        `strPriceType` - Specifies a coded value, data type ID.[Refer to HL7 Table 0205] Suggested Values AP,DC,IC,PF,TF,TP,UP.

    - #### setPriceType

          public void setPriceType(ID objID)

      Sets the Price Type.
      Parameters:
        `objID` - Specifies a coded value, data type ID.[Refer to HL7 Table 0205] Suggested Values AP,DC,IC,PF,TF,TP,UP.

    - #### setFromValue

          public void setFromValue(java.lang.String strFromValue)

      Sets the From Value.
      Parameters:
        `strFromValue` - Spefies the "range" alongwith strToValue.

    - #### setFromValue

          public void setFromValue(NM objNM)

      Sets the From Value.
      Parameters:
        `objNM` - Spefies the "range" alongwith strToValue.

    - #### setToValue

          public void setToValue(java.lang.String strToValue)

      Sets the To Value.
      Parameters:
        `strToValue` - Spefies the "range" alongwith strFromValue.

    - #### setToValue

          public void setToValue(NM objNM)

      Sets the To Value.
      Parameters:
        `objNM` - Spefies the "range" alongwith strFromValue.

    - #### setRangeUnits

          public void setRangeUnits(CWE objRangeUnits)

      Sets the Range Units.
      Parameters:
        `objRangeUnits` - Specifies This describes the units associated with the range, e.g., seconds, minutes

    - #### setRangeType

          public void setRangeType(java.lang.String strRangeType)

      Sets the Range Type.
      Parameters:
        `strRangeType` - Refer to HL7 Table 0298 - CP range type for valid values.(P,F)

    - #### setRangeType

          public void setRangeType(ID objID)

      Sets the Range Type.
      Parameters:
        `objID` - Refer to HL7 Table 0298 - CP range type for valid values.(P,F)

    - #### getPrice

          public MO getPrice()

      Returns Price
      Returns:
        MO - data type.

    - #### getPriceType

          public ID getPriceType()

      Returns Price Type
      Returns:
        ID - data type.

    - #### getFromValue

          public NM getFromValue()

      Returns From Value
      Returns:
        NM - data type.

    - #### getToValue

          public NM getToValue()

      Returns To Value
      Returns:
        NM - data type.

    - #### getRangeUnits

          public CWE getRangeUnits()

      Returns Range Units
      Returns:
        CWE - data type.

    - #### getRangeType

          public ID getRangeType()

      Returns Range Type
      Returns:
        ID - data type.

    - #### validate

          public boolean validate()
                           throws InvalidDataTypeException

      The Method validates the Input value,and if validated properly then returns true. Here the validetion is based on the compulsory fields for the Datatype.
      Specified by:
        `validate` in interface `IDataType`
      Overrides:
        `validate` in class `CompositeDataType`
      Returns:
        boolean - true or false.
      Throws:
        `InvalidDataTypeException` - - if Invalid values is entered or Mandatory field is missing.

    - #### 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.