Package io.patriot_framework.hub
Class DeviceRegistry
- java.lang.Object
-
- io.patriot_framework.hub.DeviceRegistry
-
public class DeviceRegistry extends Object
Implements registry of devices deployed within simulated environment Currently can only hold access to the plain references of generators but in the future will be used as accessor to all deployed devices within simulated environment
-
-
Constructor Summary
Constructors Constructor Description DeviceRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<Unit>
getAllDevices()
Get stream of all devicesUnit
getDevice(UUID id)
Searches for device in registryCollection<Unit>
getDevicesByLabel(String label)
Returns stream of devices with specified labelboolean
putDevice(Unit device)
registers device to registryboolean
removeDevice(UUID id)
Removes device from registry
-
-
-
Method Detail
-
putDevice
public boolean putDevice(Unit device)
registers device to registry- Parameters:
device
- device to be stored- Returns:
- true if device is not already in registry, false otherwise
-
removeDevice
public boolean removeDevice(UUID id)
Removes device from registry- Parameters:
id
- uuid of device to be deleted- Returns:
- true when device was deleted, false otherwise
-
getDevice
public Unit getDevice(UUID id)
Searches for device in registry- Parameters:
id
- uuid of device in registry- Returns:
- Unit object if it is found, null otherwise
-
getAllDevices
public Collection<Unit> getAllDevices()
Get stream of all devices- Returns:
- all devices in stream
-
getDevicesByLabel
public Collection<Unit> getDevicesByLabel(String label)
Returns stream of devices with specified label- Parameters:
label
- searched label- Returns:
- Units with concrete label
-
-