Class RegisterBlock
-
- All Implemented Interfaces:
public final class RegisterBlockThe collection of all requested Registers that are in the same address space of a single specific device. The map from address to register in a SORTED way. This means we can iterate over the keys sequentially (yet there can be Address gaps!).
-
-
Field Summary
Fields Modifier and Type Field Description private final AddressfirstAddressprivate final Set<Address>keysprivate final Collection<RegisterValue>valuesprivate final Integersizeprivate final AddressClassaddressClass
-
Constructor Summary
Constructors Constructor Description RegisterBlock(AddressClass addressClass)
-
Method Summary
Modifier and Type Method Description final AddressgetFirstAddress()final Set<Address>getKeys()final Collection<RegisterValue>getValues()final IntegergetSize()final AddressClassgetAddressClass()The AddressClass of ALL addresses in this RegisterBlock final Unitclear()final RegisterValueget(Address address)final List<RegisterValue>get(List<Address> addresses)Get the values for the provided addresses. final Unitset(Address address, RegisterValue registerValue)final RegisterValuecomputeIfAbsent(Address requiredRegister, Function1<Address, RegisterValue> function)final Unitput(RegisterValue value)final RegisterValueput(Address key, RegisterValue value)final UnitsetValue(Address address)Set an not-yet-loaded register value IFF absent final UnitsetValue(Address address, Short value, Long timestamp)final Unitmerge(RegisterBlock registerBlock)final ShortgetValue(Address address)final List<RegisterValue>noGapsValuesList()final List<String>toHexList()Creating a list of hex values for all available values. final StringtoHexString()Creating a single string of hex values for all available values. StringtoString()Booleanequals(Object other)final RegisterBlockclone()IntegerhashCode()-
-
Constructor Detail
-
RegisterBlock
RegisterBlock(AddressClass addressClass)
-
-
Method Detail
-
getFirstAddress
final Address getFirstAddress()
-
getValues
final Collection<RegisterValue> getValues()
-
getAddressClass
final AddressClass getAddressClass()
The AddressClass of ALL addresses in this RegisterBlock
-
get
final RegisterValue get(Address address)
-
get
final List<RegisterValue> get(List<Address> addresses)
Get the values for the provided addresses.
- Parameters:
addresses- The register addresses we need the values for.- Returns:
The list of values which may be empty!
-
set
final Unit set(Address address, RegisterValue registerValue)
-
computeIfAbsent
final RegisterValue computeIfAbsent(Address requiredRegister, Function1<Address, RegisterValue> function)
-
put
final Unit put(RegisterValue value)
-
put
final RegisterValue put(Address key, RegisterValue value)
-
setValue
final Unit setValue(Address address)
Set an not-yet-loaded register value IFF absent
- Parameters:
address- The address of the new value
-
merge
final Unit merge(RegisterBlock registerBlock)
-
noGapsValuesList
final List<RegisterValue> noGapsValuesList()
-
toHexList
final List<String> toHexList()
Creating a list of hex values for all available values. Any MISSING registers will be filled with "----" So all values are 4 characters: (0-9A-F0-9A-F|----)
- Returns:
List of hex values
-
toHexString
final String toHexString()
Creating a single string of hex values for all available values. Any MISSING registers will be filled with "----". So all values are 4 characters: (0-9A-F0-9A-F|----)
- Returns:
A String of mostly 4 char hex values, sometimes "----".
-
clone
final RegisterBlock clone()
-
-
-
-