Class BitmapValue


  • public class BitmapValue
    extends Value
    Implements an SGr value containing a bit map value.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void absValue()
      Sets the instance's value to its absolute value, if possible.
      BitmapValue[] asArray()
      Gets the value as array.
      boolean equals​(java.lang.Object o)  
      java.util.Map<java.lang.String,​java.lang.Boolean> getBitmap()
      Gets the value as SGr bitmap.
      boolean getBoolean()
      Gets the value as boolean.
      java.time.Instant getDateTime()
      Gets the value as time stamp.
      EnumRecord getEnum()
      Gets the value as SGr enumeration record.
      float getFloat32()
      Gets the value as 32-bit floating-point.
      double getFloat64()
      Gets the value as 64-bit floating-point.
      short getInt16()
      Gets the value as 16-bit integer.
      int getInt16U()
      Gets the value as unsigned 16-bit integer.
      int getInt32()
      Gets the value as 32-bit integer.
      long getInt32U()
      Gets the value as unsigned 32-bit integer.
      long getInt64()
      Gets the value as 64-bit integer.
      java.math.BigInteger getInt64U()
      Gets the value as unsigned 64-bit integer.
      byte getInt8()
      Gets the value as 8-bit integer.
      short getInt8U()
      Gets the value as unsigned 8-bit integer.
      com.fasterxml.jackson.databind.JsonNode getJson()
      Gets the value as JSON.
      java.lang.String getString()
      Gets the value as string.
      int hashCode()  
      static BitmapValue of​(int[] registers, com.smartgridready.ns.v0.BitmapProduct bitMapping)
      Creates a new instance from Modbus registers.
      static BitmapValue of​(java.util.Map<java.lang.String,​java.lang.Boolean> bitmap)
      Creates a new instance from a map.
      void roundToInt()
      Rounds the instance's value to the nearest integer, if possible.
      int[] toModbusRegisters​(int modbusSize, com.smartgridready.ns.v0.BitmapProduct bitMapping)
      Converts to Modbus registers.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getInt8

        public byte getInt8()
        Description copied from class: Value
        Gets the value as 8-bit integer.
        Specified by:
        getInt8 in class Value
        Returns:
        a byte
      • getInt8U

        public short getInt8U()
        Description copied from class: Value
        Gets the value as unsigned 8-bit integer.
        Specified by:
        getInt8U in class Value
        Returns:
        a short
      • getInt16

        public short getInt16()
        Description copied from class: Value
        Gets the value as 16-bit integer.
        Specified by:
        getInt16 in class Value
        Returns:
        a short
      • getInt16U

        public int getInt16U()
        Description copied from class: Value
        Gets the value as unsigned 16-bit integer.
        Specified by:
        getInt16U in class Value
        Returns:
        an int
      • getInt32

        public int getInt32()
        Description copied from class: Value
        Gets the value as 32-bit integer.
        Specified by:
        getInt32 in class Value
        Returns:
        an int
      • getInt32U

        public long getInt32U()
        Description copied from class: Value
        Gets the value as unsigned 32-bit integer.
        Specified by:
        getInt32U in class Value
        Returns:
        a long
      • getInt64

        public long getInt64()
        Description copied from class: Value
        Gets the value as 64-bit integer.
        Specified by:
        getInt64 in class Value
        Returns:
        a long
      • getInt64U

        public java.math.BigInteger getInt64U()
        Description copied from class: Value
        Gets the value as unsigned 64-bit integer.
        Specified by:
        getInt64U in class Value
        Returns:
        a BigInteger
      • getFloat32

        public float getFloat32()
        Description copied from class: Value
        Gets the value as 32-bit floating-point.
        Specified by:
        getFloat32 in class Value
        Returns:
        a float
      • getFloat64

        public double getFloat64()
        Description copied from class: Value
        Gets the value as 64-bit floating-point.
        Specified by:
        getFloat64 in class Value
        Returns:
        a double
      • getString

        public java.lang.String getString()
        Description copied from class: Value
        Gets the value as string.
        Specified by:
        getString in class Value
        Returns:
        a string
      • getBoolean

        public boolean getBoolean()
        Description copied from class: Value
        Gets the value as boolean.
        Specified by:
        getBoolean in class Value
        Returns:
        a boolean
      • getEnum

        public EnumRecord getEnum()
        Description copied from class: Value
        Gets the value as SGr enumeration record.
        Specified by:
        getEnum in class Value
        Returns:
        an EnumRecord
      • getBitmap

        public java.util.Map<java.lang.String,​java.lang.Boolean> getBitmap()
        Description copied from class: Value
        Gets the value as SGr bitmap.
        Specified by:
        getBitmap in class Value
        Returns:
        a map of strings to boolean values
      • getDateTime

        public java.time.Instant getDateTime()
        Description copied from class: Value
        Gets the value as time stamp.
        Specified by:
        getDateTime in class Value
        Returns:
        an Instant
      • getJson

        public com.fasterxml.jackson.databind.JsonNode getJson()
        Description copied from class: Value
        Gets the value as JSON.
        Specified by:
        getJson in class Value
        Returns:
        a JsonNode
      • absValue

        public void absValue()
        Description copied from class: Value
        Sets the instance's value to its absolute value, if possible.
        Specified by:
        absValue in class Value
      • roundToInt

        public void roundToInt()
        Description copied from class: Value
        Rounds the instance's value to the nearest integer, if possible.
        Specified by:
        roundToInt in class Value
      • of

        public static BitmapValue of​(java.util.Map<java.lang.String,​java.lang.Boolean> bitmap)
        Creates a new instance from a map.
        Parameters:
        bitmap - a map of string to boolean
        Returns:
        a new instance of BitmapValue
      • of

        public static BitmapValue of​(int[] registers,
                                     com.smartgridready.ns.v0.BitmapProduct bitMapping)
        Creates a new instance from Modbus registers.
        Parameters:
        registers - the Modbus register values
        bitMapping - the bitmap specification
        Returns:
        a new instance of BitmapValue
      • toModbusRegisters

        public int[] toModbusRegisters​(int modbusSize,
                                       com.smartgridready.ns.v0.BitmapProduct bitMapping)
        Converts to Modbus registers.
        Parameters:
        modbusSize - the number of registers
        bitMapping - the bitmap specification
        Returns:
        an array of integers
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • asArray

        public BitmapValue[] asArray()
        Description copied from class: Value
        Gets the value as array.
        Specified by:
        asArray in class Value
        Returns:
        an array of Value
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object