Class BitmapValue
- java.lang.Object
-
- com.smartgridready.communicator.common.api.values.Value
-
- com.smartgridready.communicator.common.api.values.BitmapValue
-
public class BitmapValue extends Value
Implements an SGr value containing a bit map value.
-
-
Field Summary
-
Fields inherited from class com.smartgridready.communicator.common.api.values.Value
UNSIGNED_LONG_MASK
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabsValue()Sets the instance's value to its absolute value, if possible.BitmapValue[]asArray()Gets the value as array.booleanequals(java.lang.Object o)java.util.Map<java.lang.String,java.lang.Boolean>getBitmap()Gets the value as SGr bitmap.booleangetBoolean()Gets the value as boolean.java.time.InstantgetDateTime()Gets the value as time stamp.EnumRecordgetEnum()Gets the value as SGr enumeration record.floatgetFloat32()Gets the value as 32-bit floating-point.doublegetFloat64()Gets the value as 64-bit floating-point.shortgetInt16()Gets the value as 16-bit integer.intgetInt16U()Gets the value as unsigned 16-bit integer.intgetInt32()Gets the value as 32-bit integer.longgetInt32U()Gets the value as unsigned 32-bit integer.longgetInt64()Gets the value as 64-bit integer.java.math.BigIntegergetInt64U()Gets the value as unsigned 64-bit integer.bytegetInt8()Gets the value as 8-bit integer.shortgetInt8U()Gets the value as unsigned 8-bit integer.com.fasterxml.jackson.databind.JsonNodegetJson()Gets the value as JSON.java.lang.StringgetString()Gets the value as string.inthashCode()static BitmapValueof(int[] registers, com.smartgridready.ns.v0.BitmapProduct bitMapping)Creates a new instance from Modbus registers.static BitmapValueof(java.util.Map<java.lang.String,java.lang.Boolean> bitmap)Creates a new instance from a map.voidroundToInt()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.StringtoString()-
Methods inherited from class com.smartgridready.communicator.common.api.values.Value
enumToOrdinalValue, fromDiscreteInput, fromModbusRegister, fromString, getJson, toModbusDiscreteVal, toModbusRegister
-
-
-
-
Method Detail
-
getInt8
public byte getInt8()
Description copied from class:ValueGets the value as 8-bit integer.
-
getInt8U
public short getInt8U()
Description copied from class:ValueGets the value as unsigned 8-bit integer.
-
getInt16
public short getInt16()
Description copied from class:ValueGets the value as 16-bit integer.
-
getInt16U
public int getInt16U()
Description copied from class:ValueGets the value as unsigned 16-bit integer.
-
getInt32
public int getInt32()
Description copied from class:ValueGets the value as 32-bit integer.
-
getInt32U
public long getInt32U()
Description copied from class:ValueGets the value as unsigned 32-bit integer.
-
getInt64
public long getInt64()
Description copied from class:ValueGets the value as 64-bit integer.
-
getInt64U
public java.math.BigInteger getInt64U()
Description copied from class:ValueGets the value as unsigned 64-bit integer.
-
getFloat32
public float getFloat32()
Description copied from class:ValueGets the value as 32-bit floating-point.- Specified by:
getFloat32in classValue- Returns:
- a float
-
getFloat64
public double getFloat64()
Description copied from class:ValueGets the value as 64-bit floating-point.- Specified by:
getFloat64in classValue- Returns:
- a double
-
getString
public java.lang.String getString()
Description copied from class:ValueGets the value as string.
-
getBoolean
public boolean getBoolean()
Description copied from class:ValueGets the value as boolean.- Specified by:
getBooleanin classValue- Returns:
- a boolean
-
getEnum
public EnumRecord getEnum()
Description copied from class:ValueGets the value as SGr enumeration record.
-
getBitmap
public java.util.Map<java.lang.String,java.lang.Boolean> getBitmap()
Description copied from class:ValueGets the value as SGr bitmap.
-
getDateTime
public java.time.Instant getDateTime()
Description copied from class:ValueGets the value as time stamp.- Specified by:
getDateTimein classValue- Returns:
- an Instant
-
getJson
public com.fasterxml.jackson.databind.JsonNode getJson()
Description copied from class:ValueGets the value as JSON.
-
absValue
public void absValue()
Description copied from class:ValueSets the instance's value to its absolute value, if possible.
-
roundToInt
public void roundToInt()
Description copied from class:ValueRounds the instance's value to the nearest integer, if possible.- Specified by:
roundToIntin classValue
-
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 valuesbitMapping- 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 registersbitMapping- the bitmap specification- Returns:
- an array of integers
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
asArray
public BitmapValue[] asArray()
Description copied from class:ValueGets the value as array.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-