Class DipDataImp

  • All Implemented Interfaces:
    DipData, java.io.Serializable
    Direct Known Subclasses:
    MockDipData

    public class DipDataImp
    extends java.lang.Object
    implements DipData, java.io.Serializable
    Interface for DIP data. DipData objects are created by DipFactoryInterfaces and returned to DipSubscriptionListeners.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      DipDataImp()
      Data object created with a default data quality of good
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(java.lang.String tag)
      Returns true if this object contains an entry with the specified tag.
      boolean extractBoolean()
      Returns the boolean stored in the default data entry.
      boolean extractBoolean​(java.lang.String tag)
      Returns the boolean stored in the specified data entry.
      boolean[] extractBooleanArray()
      Returns the boolean array stored in the default data entry.
      boolean[] extractBooleanArray​(java.lang.String tag)
      Returns the boolean array stored in the specified data entry.
      byte extractByte()
      Returns the byte stored in the default data entry.
      byte extractByte​(java.lang.String tag)
      Returns the byte stored in the specified data entry.
      byte[] extractByteArray()
      Returns the byte array stored in the default data entry.
      byte[] extractByteArray​(java.lang.String tag)
      Returns the byte array stored in the specified data entry.
      int extractDataQuality()
      Returns the data quality value of this DipData object as an int.
      DipQualityEnum extractDataQualityEnum()  
      DipTimestamp extractDipTime()
      Returns the DipTimestamp of this DipData object.
      double extractDouble()
      Returns the float array stored in the default data entry.
      double extractDouble​(java.lang.String tag)
      Returns the float array stored in the default data entry.
      double[] extractDoubleArray()
      Returns the double array stored in the default data entry.
      double[] extractDoubleArray​(java.lang.String tag)
      Returns the double array stored in the specified data entry.
      float extractFloat()
      Extracts the default value from the DipData object as a float.
      float extractFloat​(java.lang.String tag)
      Returns the float stored in the specified data entry.
      float[] extractFloatArray()
      Returns the double stored in the default data entry.
      float[] extractFloatArray​(java.lang.String tag)
      Returns the float array stored in the specified data entry.
      int extractInt()
      Returns the int stored in the default data entry.
      int extractInt​(java.lang.String tag)
      Returns the int stored in the specified data entry.
      int[] extractIntArray()
      Returns the int array stored in the default data entry.
      int[] extractIntArray​(java.lang.String tag)
      Returns the int array stored in the specified data entry.
      long extractLong()
      Returns the long stored in the default data entry.
      long extractLong​(java.lang.String tag)
      Returns the long stored in the specified data entry.
      long[] extractLongArray()
      Returns the long array stored in the default data entry.
      long[] extractLongArray​(java.lang.String tag)
      Returns the long array stored in the specified data entry.
      java.lang.String extractQualityString()
      Extracts the string that describes the reason for the quality.
      short extractShort()
      Returns the short stored in the default data entry.
      short extractShort​(java.lang.String tag)
      Returns the short stored in the specified data entry.
      short[] extractShortArray()
      Returns the short array stored in the default data entry.
      short[] extractShortArray​(java.lang.String tag)
      Returns the short array stored in the specified data entry.
      java.lang.String extractString()
      Returns the String stored in the default data entry.
      java.lang.String extractString​(java.lang.String tag)
      Returns the String stored in the specified data entry.
      java.lang.String[] extractStringArray()
      Returns the String array stored in the default data entry.
      java.lang.String[] extractStringArray​(java.lang.String tag)
      Returns the String array stored in the specified data entry.
      protected int getCByteSize()
      calc how many bytes it would take to store the data.
      java.util.Optional<java.lang.Object> getPrimitiveValueAsObject()
      Returns the primitive DipData value as a Java Object.
      java.lang.String[] getTags()
      Returns an unordered String array that contains tags of all entries.
      static int getTypeSize​(int dipType)
      returns size in bytes of DIP type in bytes If type is array it will return the size of one of its elements
      java.util.Map<java.lang.String,​java.lang.Object> getValueAsMap()
      Returns the contents of the DipData as a field name / value map.
      int getValueType()
      Returns type code for the value contained in the default entry.
      int getValueType​(java.lang.String tag)
      Returns type code for the value contained in the specified entry.
      void insert​(boolean value)
      Inserts a boolean as default value into the DipData object.
      void insert​(boolean[] value)
      Inserts a double array as default value into the DipData object.
      void insert​(byte value)
      Inserts a byte as default value into the DipData object.
      void insert​(byte[] value)
      Inserts a byte array as default value into the DipData object.
      void insert​(double value)
      Inserts a double as default value into the DipData object.
      void insert​(double[] value)
      Inserts a double array as default value into the DipData object.
      void insert​(float value)
      Inserts a float as default value into the DipData object.
      void insert​(float[] value)
      Inserts a float array as default value into the DipData object.
      void insert​(int value)
      Inserts an int as default value into the DipData object.
      void insert​(int[] value)
      Inserts an int array as default value into the DipData object.
      void insert​(long value)
      Inserts a long as default value into the DipData object.
      void insert​(long[] value)
      Inserts a long array as default value into the DipData object.
      void insert​(short value)
      Inserts a short as default value into the DipData object.
      void insert​(short[] value)
      Inserts an short array as default value into the DipData object.
      void insert​(java.lang.String value)
      Inserts a String as default value into the DipData object.
      void insert​(java.lang.String[] value)
      Inserts a String array as default value into the DipData object.
      void insert​(java.lang.String tag, boolean value)
      Inserts a named boolean entry into the DipData object.
      void insert​(java.lang.String tag, boolean[] value)
      Inserts a named boolean array entry into the DipData object.
      void insert​(java.lang.String tag, byte value)
      Inserts a named byte entry into the DipData object.
      void insert​(java.lang.String tag, byte[] value)
      Inserts a named byte array entry into the DipData object.
      void insert​(java.lang.String tag, double value)
      Inserts a named double entry into the DipData object.
      void insert​(java.lang.String tag, double[] value)
      Inserts a named double array entry into the DipData object.
      void insert​(java.lang.String tag, float value)
      Inserts a named float entry into the DipData object.
      void insert​(java.lang.String tag, float[] value)
      Inserts a named float array entry into the DipData object.
      void insert​(java.lang.String tag, int value)
      Inserts a named int entry into the DipData object.
      void insert​(java.lang.String tag, int[] value)
      Inserts a named int array entry into the DipData object.
      void insert​(java.lang.String tag, long value)
      Inserts a named long entry into the DipData object.
      void insert​(java.lang.String tag, long[] value)
      Inserts a named long array entry into the DipData object.
      void insert​(java.lang.String tag, short value)
      Inserts a named short entry into the DipData object.
      void insert​(java.lang.String tag, short[] value)
      Inserts a named short array entry into the DipData object.
      void insert​(java.lang.String tag, java.lang.String value)
      Inserts a named String entry into the DipData object.
      void insert​(java.lang.String tag, java.lang.String[] value)
      Inserts a named String array entry into the DipData object.
      boolean isEmpty()
      Returns true if this DipData contains no entries; false otherwise.
      boolean isPrimitive()
      Indicates whether the DipData package only carries a single value (as opposed to one or more fields, a.k.a.
      protected void readInFromBuffer​(java.nio.ByteBuffer dataBuffer, java.lang.String format)
      Read data into this object from a ByteBuffer.
      protected void setDataQuality​(int dataQuality)  
      protected void setDipTime​(DipTimestamp time)  
      protected void setQualityString​(java.lang.String reason)  
      int size()
      Returns the number of entries in this object.
      protected java.lang.String writeDataToBuffer​(java.nio.ByteBuffer buffer)
      Writes the usr data contained in the object to the start of the supplied Data buffer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • FIELD_NAME_WHEN_PRMITIVE

        public static final java.lang.String FIELD_NAME_WHEN_PRMITIVE
        See Also:
        Constant Field Values
    • Constructor Detail

      • DipDataImp

        public DipDataImp()
        Data object created with a default data quality of good
    • Method Detail

      • getCByteSize

        protected int getCByteSize()
        calc how many bytes it would take to store the data. Strings take size() bytes + 1
      • writeDataToBuffer

        protected java.lang.String writeDataToBuffer​(java.nio.ByteBuffer buffer)
        Writes the usr data contained in the object to the start of the supplied Data buffer. The format string has the following structure : name|type|cardinality|
        Parameters:
        buffer - - it is up to the caller to make sure this has sufficient capacity
        Returns:
        format - the format string describing how the data is packed
      • readInFromBuffer

        protected void readInFromBuffer​(java.nio.ByteBuffer dataBuffer,
                                        java.lang.String format)
                                 throws TypeMismatch
        Read data into this object from a ByteBuffer. The format string desribes the structure of the data in the buffer
        Throws:
        TypeMismatch
      • insert

        public void insert​(float value)
                    throws TypeMismatch
        Description copied from interface: DipData
        Inserts a float as default value into the DipData object. If the default value already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is complex or contains a default value which is not of the same type as value.
      • insert

        public void insert​(float[] value)
                    throws TypeMismatch
        Description copied from interface: DipData
        Inserts a float array as default value into the DipData object. If the default value already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is complex or contains a default value which is not of the same type as value.
      • insert

        public void insert​(double value)
                    throws TypeMismatch
        Inserts a double as default value into the DipData object. If the default value already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is complex or contains a default value which is not of the same type as value.
      • insert

        public void insert​(double[] value)
                    throws TypeMismatch
        Inserts a double array as default value into the DipData object. If the default value already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is complex or contains a default value which is not of the same type as value.
      • insert

        public void insert​(short value)
                    throws TypeMismatch
        Inserts a short as default value into the DipData object. If the default value already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is complex or contains a default value which is not of the same type as value.
      • insert

        public void insert​(short[] value)
                    throws TypeMismatch
        Inserts an short array as default value into the DipData object. If the default value already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is complex or contains a default value which is not of the same type as value.
      • insert

        public void insert​(int value)
                    throws TypeMismatch
        Inserts an int as default value into the DipData object. If the default value already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is complex or contains a default value which is not of the same type as value.
      • insert

        public void insert​(int[] value)
                    throws TypeMismatch
        Inserts an int array as default value into the DipData object. If the default value already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is complex or contains a default value which is not of the same type as value.
      • insert

        public void insert​(long value)
                    throws TypeMismatch
        Inserts a long as default value into the DipData object. If the default value already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is complex or contains a default value which is not of the same type as value.
      • insert

        public void insert​(long[] value)
                    throws TypeMismatch
        Inserts a long array as default value into the DipData object. If the default value already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is complex or contains a default value which is not of the same type as value.
      • insert

        public void insert​(byte value)
                    throws TypeMismatch
        Inserts a byte as default value into the DipData object. If the default value already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is complex or contains a default value which is not of the same type as value.
      • insert

        public void insert​(byte[] value)
                    throws TypeMismatch
        Inserts a byte array as default value into the DipData object. If the default value already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is complex or contains a default value which is not of the same type as value.
      • insert

        public void insert​(boolean value)
                    throws TypeMismatch
        Inserts a boolean as default value into the DipData object. If the default value already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is complex or contains a default value which is not of the same type as value.
      • insert

        public void insert​(boolean[] value)
                    throws TypeMismatch
        Inserts a double array as default value into the DipData object. If the default value already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is complex or contains a default value which is not of the same type as value.
      • insert

        public void insert​(java.lang.String value)
                    throws TypeMismatch
        Inserts a String as default value into the DipData object. If the default value already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is complex or contains a default value which is not of the same type as value.
      • insert

        public void insert​(java.lang.String[] value)
                    throws TypeMismatch
        Inserts a String array as default value into the DipData object. If the default value already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is complex or contains a default value which is not of the same type as value.
      • extractString

        public java.lang.String extractString()
                                       throws TypeMismatch
        Description copied from interface: DipData
        Returns the String stored in the default data entry.
        Specified by:
        extractString in interface DipData
        Throws:
        TypeMismatch - if 1) the object is holding complex data or 2) the value held is not of the required type.
      • extractBoolean

        public boolean extractBoolean()
                               throws TypeMismatch
        Description copied from interface: DipData
        Returns the boolean stored in the default data entry.
        Specified by:
        extractBoolean in interface DipData
        Throws:
        TypeMismatch - if 1) the object is holding complex data or 2) the value held is not of the required type.
      • extractByte

        public byte extractByte()
                         throws TypeMismatch
        Description copied from interface: DipData
        Returns the byte stored in the default data entry.
        Specified by:
        extractByte in interface DipData
        Throws:
        TypeMismatch - if 1) the object is holding complex data or 2) the value held is not of the required type.
      • extractShort

        public short extractShort()
                           throws TypeMismatch
        Description copied from interface: DipData
        Returns the short stored in the default data entry.
        Specified by:
        extractShort in interface DipData
        Throws:
        TypeMismatch - if 1) the object is holding complex data or 2) the value held is not of the required type.
      • extractInt

        public int extractInt()
                       throws TypeMismatch
        Description copied from interface: DipData
        Returns the int stored in the default data entry.
        Specified by:
        extractInt in interface DipData
        Throws:
        TypeMismatch - if 1) the object is holding complex data or 2) the value held is not of the required type.
      • extractDouble

        public double extractDouble()
                             throws TypeMismatch
        Description copied from interface: DipData
        Returns the float array stored in the default data entry.
        Specified by:
        extractDouble in interface DipData
        Throws:
        TypeMismatch - if 1) the object is holding complex data or 2) the value held is not of the required type.
      • extractLong

        public long extractLong()
                         throws TypeMismatch
        Description copied from interface: DipData
        Returns the long stored in the default data entry.
        Specified by:
        extractLong in interface DipData
        Throws:
        TypeMismatch - if 1) the object is holding complex data or 2) the value held is not of the required type.
      • extractBooleanArray

        public boolean[] extractBooleanArray()
                                      throws TypeMismatch
        Description copied from interface: DipData
        Returns the boolean array stored in the default data entry.
        Specified by:
        extractBooleanArray in interface DipData
        Throws:
        TypeMismatch - if 1) the object is holding complex data or 2) the value held is not of the required type.
      • extractByteArray

        public byte[] extractByteArray()
                                throws TypeMismatch
        Description copied from interface: DipData
        Returns the byte array stored in the default data entry.
        Specified by:
        extractByteArray in interface DipData
        Throws:
        TypeMismatch - if 1) the object is holding complex data or 2) the value held is not of the required type.
      • extractShortArray

        public short[] extractShortArray()
                                  throws TypeMismatch
        Description copied from interface: DipData
        Returns the short array stored in the default data entry.
        Specified by:
        extractShortArray in interface DipData
        Throws:
        TypeMismatch - if 1) the object is holding complex data or 2) the value held is not of the required type.
      • extractIntArray

        public int[] extractIntArray()
                              throws TypeMismatch
        Description copied from interface: DipData
        Returns the int array stored in the default data entry.
        Specified by:
        extractIntArray in interface DipData
        Throws:
        TypeMismatch - if 1) the object is holding complex data or 2) the value held is not of the required type.
      • extractFloatArray

        public float[] extractFloatArray()
                                  throws TypeMismatch
        Description copied from interface: DipData
        Returns the double stored in the default data entry.
        Specified by:
        extractFloatArray in interface DipData
        Throws:
        TypeMismatch - if 1) the object is holding complex data or 2) the value held is not of the required type.
      • extractDoubleArray

        public double[] extractDoubleArray()
                                    throws TypeMismatch
        Description copied from interface: DipData
        Returns the double array stored in the default data entry.
        Specified by:
        extractDoubleArray in interface DipData
        Throws:
        TypeMismatch - if 1) the object is holding complex data or 2) the value held is not of the required type.
      • extractLongArray

        public long[] extractLongArray()
                                throws TypeMismatch
        Description copied from interface: DipData
        Returns the long array stored in the default data entry.
        Specified by:
        extractLongArray in interface DipData
        Throws:
        TypeMismatch - if 1) the object is holding complex data or 2) the value held is not of the required type.
      • extractStringArray

        public java.lang.String[] extractStringArray()
                                              throws TypeMismatch
        Description copied from interface: DipData
        Returns the String array stored in the default data entry.
        Specified by:
        extractStringArray in interface DipData
        Throws:
        TypeMismatch - if 1) the object is holding complex data or 2) the value held is not of the required type.
      • setDataQuality

        protected void setDataQuality​(int dataQuality)
      • extractDipTime

        public DipTimestamp extractDipTime()
        Description copied from interface: DipData
        Returns the DipTimestamp of this DipData object. This should represent the time at which the value(s) contained in this object were obtained.
        Specified by:
        extractDipTime in interface DipData
      • setDipTime

        protected void setDipTime​(DipTimestamp time)
      • extractQualityString

        public java.lang.String extractQualityString()
        Extracts the string that describes the reason for the quality.
        Specified by:
        extractQualityString in interface DipData
      • setQualityString

        protected void setQualityString​(java.lang.String reason)
      • contains

        public boolean contains​(java.lang.String tag)
        Description copied from interface: DipData
        Returns true if this object contains an entry with the specified tag.
        Specified by:
        contains in interface DipData
      • extractBoolean

        public boolean extractBoolean​(java.lang.String tag)
                               throws BadParameter,
                                      TypeMismatch
        Description copied from interface: DipData
        Returns the boolean stored in the specified data entry.
        Specified by:
        extractBoolean in interface DipData
        Throws:
        BadParameter - if this DipData does not contain the specified entry
        TypeMismatch - if the entry contains something other than a boolean, or nothing.
      • extractBooleanArray

        public boolean[] extractBooleanArray​(java.lang.String tag)
                                      throws BadParameter,
                                             TypeMismatch
        Description copied from interface: DipData
        Returns the boolean array stored in the specified data entry.
        Specified by:
        extractBooleanArray in interface DipData
        Throws:
        BadParameter - if this DipData does not contain the specified entry
        TypeMismatch - if the entry contains something other than a boolean array, or nothing.
      • extractByte

        public byte extractByte​(java.lang.String tag)
                         throws BadParameter,
                                TypeMismatch
        Description copied from interface: DipData
        Returns the byte stored in the specified data entry.
        Specified by:
        extractByte in interface DipData
        Throws:
        BadParameter - if this DipData does not contain the specified entry
        TypeMismatch - if the entry contains something other than a byte, or nothing.
      • extractByteArray

        public byte[] extractByteArray​(java.lang.String tag)
                                throws BadParameter,
                                       TypeMismatch
        Description copied from interface: DipData
        Returns the byte array stored in the specified data entry.
        Specified by:
        extractByteArray in interface DipData
        Throws:
        BadParameter - if this DipData does not contain the specified entry
        TypeMismatch - if the entry contains something other than a byte array, or nothing.
      • extractDouble

        public double extractDouble​(java.lang.String tag)
                             throws BadParameter,
                                    TypeMismatch
        Description copied from interface: DipData
        Returns the float array stored in the default data entry.
        Specified by:
        extractDouble in interface DipData
        Throws:
        BadParameter - if this DipData does not contain the specified entry
        TypeMismatch - if the entry contains something other than a double array, or nothing.
      • extractDoubleArray

        public double[] extractDoubleArray​(java.lang.String tag)
                                    throws BadParameter,
                                           TypeMismatch
        Description copied from interface: DipData
        Returns the double array stored in the specified data entry.
        Specified by:
        extractDoubleArray in interface DipData
        Throws:
        BadParameter - if this DipData does not contain the specified entry
        TypeMismatch - if the entry contains something other than a double array, or nothing.
      • extractFloat

        public float extractFloat​(java.lang.String tag)
                           throws BadParameter,
                                  TypeMismatch
        Description copied from interface: DipData
        Returns the float stored in the specified data entry.
        Specified by:
        extractFloat in interface DipData
        Throws:
        BadParameter - if this DipData does not contain the specified entry
        TypeMismatch - if the entry contains something other than a float, or nothing.
      • extractFloatArray

        public float[] extractFloatArray​(java.lang.String tag)
                                  throws BadParameter,
                                         TypeMismatch
        Description copied from interface: DipData
        Returns the float array stored in the specified data entry.
        Specified by:
        extractFloatArray in interface DipData
        Throws:
        BadParameter - if this DipData does not contain the specified entry
        TypeMismatch - if the entry contains something other than a float array, or nothing.
      • extractInt

        public int extractInt​(java.lang.String tag)
                       throws BadParameter,
                              TypeMismatch
        Description copied from interface: DipData
        Returns the int stored in the specified data entry.
        Specified by:
        extractInt in interface DipData
        Throws:
        BadParameter - if this DipData does not contain the specified entry
        TypeMismatch - if the entry contains something other than a int, or nothing.
      • extractIntArray

        public int[] extractIntArray​(java.lang.String tag)
                              throws BadParameter,
                                     TypeMismatch
        Description copied from interface: DipData
        Returns the int array stored in the specified data entry.
        Specified by:
        extractIntArray in interface DipData
        Throws:
        BadParameter - if this DipData does not contain the specified entry
        TypeMismatch - if the entry contains something other than a int array, or nothing.
      • extractLong

        public long extractLong​(java.lang.String tag)
                         throws BadParameter,
                                TypeMismatch
        Description copied from interface: DipData
        Returns the long stored in the specified data entry.
        Specified by:
        extractLong in interface DipData
        Throws:
        BadParameter - if this DipData does not contain the specified entry
        TypeMismatch - if the entry contains something other than a long, or nothing.
      • extractLongArray

        public long[] extractLongArray​(java.lang.String tag)
                                throws BadParameter,
                                       TypeMismatch
        Description copied from interface: DipData
        Returns the long array stored in the specified data entry.
        Specified by:
        extractLongArray in interface DipData
        Throws:
        BadParameter - if this DipData does not contain the specified entry
        TypeMismatch - if the entry contains something other than a long array, or nothing.
      • extractShort

        public short extractShort​(java.lang.String tag)
                           throws BadParameter,
                                  TypeMismatch
        Description copied from interface: DipData
        Returns the short stored in the specified data entry.
        Specified by:
        extractShort in interface DipData
        Throws:
        BadParameter - if this DipData does not contain the specified entry
        TypeMismatch - if the entry contains something other than a short, or nothing.
      • extractShortArray

        public short[] extractShortArray​(java.lang.String tag)
                                  throws BadParameter,
                                         TypeMismatch
        Description copied from interface: DipData
        Returns the short array stored in the specified data entry.
        Specified by:
        extractShortArray in interface DipData
        Throws:
        BadParameter - if this DipData does not contain the specified entry
        TypeMismatch - if the entry contains something other than a short array, or nothing.
      • extractString

        public java.lang.String extractString​(java.lang.String tag)
                                       throws BadParameter,
                                              TypeMismatch
        Description copied from interface: DipData
        Returns the String stored in the specified data entry.
        Specified by:
        extractString in interface DipData
        Throws:
        BadParameter - if this DipData does not contain the specified entry
        TypeMismatch - if the entry contains something other than a String, or nothing.
      • extractStringArray

        public java.lang.String[] extractStringArray​(java.lang.String tag)
                                              throws BadParameter,
                                                     TypeMismatch
        Description copied from interface: DipData
        Returns the String array stored in the specified data entry.
        Specified by:
        extractStringArray in interface DipData
        Throws:
        BadParameter - if this DipData does not contain the specified entry
        TypeMismatch - if the entry contains something other than a String array, or nothing.
      • getTags

        public java.lang.String[] getTags()
        Description copied from interface: DipData
        Returns an unordered String array that contains tags of all entries. Returns a zero length array if this object is empty.
        Specified by:
        getTags in interface DipData
      • getValueType

        public int getValueType​(java.lang.String tag)
        Description copied from interface: DipData
        Returns type code for the value contained in the specified entry. The return value can be one of the TYPE_X constants defined in this interface. Will return TYPE_NULL if the tag name passed does not exist.
        Specified by:
        getValueType in interface DipData
        Parameters:
        tag - - the name of the field this method is to find the type of.
        See Also:
        DipData.getValueType()
      • getTypeSize

        public static int getTypeSize​(int dipType)
        returns size in bytes of DIP type in bytes If type is array it will return the size of one of its elements
      • insert

        public void insert​(java.lang.String tag,
                           boolean value)
                    throws TypeMismatch
        Description copied from interface: DipData
        Inserts a named boolean entry into the DipData object. If the entry already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        tag - - name of the 'field' the value belongs to.
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is simple or contains a tag already exists and its corresponding data is not of the same type as value.
      • insert

        public void insert​(java.lang.String tag,
                           boolean[] value)
                    throws TypeMismatch
        Description copied from interface: DipData
        Inserts a named boolean array entry into the DipData object. If the entry already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        tag - - name of the 'field' the value belongs to.
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is simple or contains a tag already exists and its corresponding data is not of the same type as value.
      • insert

        public void insert​(java.lang.String tag,
                           byte value)
                    throws TypeMismatch
        Description copied from interface: DipData
        Inserts a named byte entry into the DipData object. If the entry already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        tag - - name of the 'field' the value belongs to.
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is simple or contains a tag already exists and its corresponding data is not of the same type as value.
      • insert

        public void insert​(java.lang.String tag,
                           byte[] value)
                    throws TypeMismatch
        Description copied from interface: DipData
        Inserts a named byte array entry into the DipData object. If the entry already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        tag - - name of the 'field' the value belongs to.
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is simple or contains a tag already exists and its corresponding data is not of the same type as value.
      • insert

        public void insert​(java.lang.String tag,
                           double value)
                    throws TypeMismatch
        Description copied from interface: DipData
        Inserts a named double entry into the DipData object. If the entry already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        tag - - name of the 'field' the value belongs to.
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is simple or contains a tag already exists and its corresponding data is not of the same type as value.
      • insert

        public void insert​(java.lang.String tag,
                           double[] value)
                    throws TypeMismatch
        Description copied from interface: DipData
        Inserts a named double array entry into the DipData object. If the entry already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        tag - - name of the 'field' the value belongs to.
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is simple or contains a tag already exists and its corresponding data is not of the same type as value.
      • insert

        public void insert​(java.lang.String tag,
                           float value)
                    throws TypeMismatch
        Description copied from interface: DipData
        Inserts a named float entry into the DipData object. If the entry already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        tag - - name of the 'field' the value belongs to.
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is simple or contains a tag already exists and its corresponding data is not of the same type as value.
      • insert

        public void insert​(java.lang.String tag,
                           float[] value)
                    throws TypeMismatch
        Description copied from interface: DipData
        Inserts a named float array entry into the DipData object. If the entry already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        tag - - name of the 'field' the value belongs to.
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is simple or contains a tag already exists and its corresponding data is not of the same type as value.
      • insert

        public void insert​(java.lang.String tag,
                           int value)
                    throws TypeMismatch
        Description copied from interface: DipData
        Inserts a named int entry into the DipData object. If the entry already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        tag - - name of the 'field' the value belongs to.
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is simple or contains a tag already exists and its corresponding data is not of the same type as value.
      • insert

        public void insert​(java.lang.String tag,
                           int[] value)
                    throws TypeMismatch
        Description copied from interface: DipData
        Inserts a named int array entry into the DipData object. If the entry already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        tag - - name of the 'field' the value belongs to.
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is simple or contains a tag already exists and its corresponding data is not of the same type as value.
      • insert

        public void insert​(java.lang.String tag,
                           long value)
                    throws TypeMismatch
        Description copied from interface: DipData
        Inserts a named long entry into the DipData object. If the entry already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        tag - - name of the 'field' the value belongs to.
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is simple or contains a tag already exists and its corresponding data is not of the same type as value.
      • insert

        public void insert​(java.lang.String tag,
                           long[] value)
                    throws TypeMismatch
        Description copied from interface: DipData
        Inserts a named long array entry into the DipData object. If the entry already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        tag - - name of the 'field' the value belongs to.
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is simple or contains a tag already exists and its corresponding data is not of the same type as value.
      • insert

        public void insert​(java.lang.String tag,
                           short value)
                    throws TypeMismatch
        Description copied from interface: DipData
        Inserts a named short entry into the DipData object. If the entry already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        tag - - name of the 'field' the value belongs to.
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is simple or contains a tag already exists and its corresponding data is not of the same type as value.
      • insert

        public void insert​(java.lang.String tag,
                           short[] value)
                    throws TypeMismatch
        Description copied from interface: DipData
        Inserts a named short array entry into the DipData object. If the entry already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        tag - - name of the 'field' the value belongs to.
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is simple or contains a tag already exists and its corresponding data is not of the same type as value.
      • insert

        public void insert​(java.lang.String tag,
                           java.lang.String value)
                    throws TypeMismatch
        Description copied from interface: DipData
        Inserts a named String entry into the DipData object. If the entry already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        tag - - name of the 'field' the value belongs to.
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is simple or contains a tag already exists and its corresponding data is not of the same type as value.
      • insert

        public void insert​(java.lang.String tag,
                           java.lang.String[] value)
                    throws TypeMismatch
        Description copied from interface: DipData
        Inserts a named String array entry into the DipData object. If the entry already exists, it will be overwritten.
        Specified by:
        insert in interface DipData
        Parameters:
        tag - - name of the 'field' the value belongs to.
        value - - the value to be written
        Throws:
        TypeMismatch - if entry is simple or contains a tag already exists and its corresponding data is not of the same type as value.
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: DipData
        Returns true if this DipData contains no entries; false otherwise.
        Specified by:
        isEmpty in interface DipData
      • size

        public int size()
        Description copied from interface: DipData
        Returns the number of entries in this object.
        Specified by:
        size in interface DipData
      • getValueAsMap

        public java.util.Map<java.lang.String,​java.lang.Object> getValueAsMap()
                                                                             throws java.lang.Exception
        Description copied from interface: DipData
        Returns the contents of the DipData as a field name / value map.
        Specified by:
        getValueAsMap in interface DipData
        Returns:
        A map associating the field name to its value.
        Throws:
        java.lang.Exception
      • getPrimitiveValueAsObject

        public java.util.Optional<java.lang.Object> getPrimitiveValueAsObject()
        Description copied from interface: DipData
        Returns the primitive DipData value as a Java Object.
        Specified by:
        getPrimitiveValueAsObject in interface DipData
        Returns:
        the primitive value or an empty Optional if the data payload is not a carrying a single value.
      • isPrimitive

        public boolean isPrimitive()
        Description copied from interface: DipData
        Indicates whether the DipData package only carries a single value (as opposed to one or more fields, a.k.a. key/value pairs)
        Specified by:
        isPrimitive in interface DipData
        Returns:
        true if the DipData package carries a single value with a default field name.