Class DeviceWithCapabilities
- java.lang.Object
-
- fi.tut.mei.capabilityQueryLib.model.Device
-
- fi.tut.mei.capabilityQueryLib.model.DeviceWithCapabilities
-
- Direct Known Subclasses:
Blueprint,DeviceCombination
public abstract class DeviceWithCapabilities extends Device
Abstract class that represents a device that directly knows its capabilities i.e. device combination and blueprint. Compared to these an individual device gets its capabilities from its blueprint.- Author:
- hylli
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class fi.tut.mei.capabilityQueryLib.model.Device
Device.Type
-
-
Constructor Summary
Constructors Constructor Description DeviceWithCapabilities(String name, Device.Type type)Create with a given name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCapability(Capability capability)add a device capability If the capability has already been added does nothing.voidaddParameterObject(String property, ParameterObjectValue value, Capability capability)Add a ParameterObjectValue for the device.voidaddParameterValue(Parameter param, Object value, Capability capability)Set a value for a parameter.voidaddResourceCapability(ResourceCapability capability)Add a resource capability to this device.Set<Capability>getCapabilities()get the capabilities this device hasCollection<String>getCapabilityParameterObjectProperties(Capability capability)Get property names that connect the given capability to its ParameterObjectValues.Set<ParameterObjectValue>getParameterObjectValue(Capability capability, String property)Get ParameterObjectValues related to a capability via the given property.Collection<ParameterValue>getParameters()Get parameters and their values for this device.Set<ParameterValue>getParameterValuesForCapability(Capability capability)Get parameter values related to given capability for this device.Collection<ResourceCapability>getResourceCapabilities()Get the resource capabilities of the device.ResourceCapabilitygetResourceCapability(Capability capability)Get a ResourceCapability of this device for the given capability.-
Methods inherited from class fi.tut.mei.capabilityQueryLib.model.Device
getBasicInformation, getBlueprint, getDescription, getDescriptionAsPlainText, getDevices, getName, getRdID, getRdURL, getType, setDescription, setRdID, setRdURL, toString
-
-
-
-
Constructor Detail
-
DeviceWithCapabilities
public DeviceWithCapabilities(String name, Device.Type type)
Create with a given name.- Parameters:
name- name of the devicetype- type of the device
-
-
Method Detail
-
getCapabilities
public Set<Capability> getCapabilities()
get the capabilities this device has- Specified by:
getCapabilitiesin classDevice- Returns:
- the capabilities
-
addCapability
public void addCapability(Capability capability)
add a device capability If the capability has already been added does nothing.- Specified by:
addCapabilityin classDevice- Parameters:
capability- capability to be added
-
addResourceCapability
public void addResourceCapability(ResourceCapability capability)
Description copied from class:DeviceAdd a resource capability to this device. This is an alternative forDevice.addCapability(Capability)- Specified by:
addResourceCapabilityin classDevice- Parameters:
capability- the resource capability
-
getResourceCapabilities
public Collection<ResourceCapability> getResourceCapabilities()
Description copied from class:DeviceGet the resource capabilities of the device. A resource capability contains parameter values for a device capability. The Device class also contains methods for working with the parameters. So you can work with capability parameters through them or directly with the resource capability.- Specified by:
getResourceCapabilitiesin classDevice- Returns:
- all resource capabilities of the device
-
getResourceCapability
public ResourceCapability getResourceCapability(Capability capability)
Description copied from class:DeviceGet a ResourceCapability of this device for the given capability.- Specified by:
getResourceCapabilityin classDevice- Parameters:
capability- a capability- Returns:
- ResourceCapability for the capability. Null if this device doesn't have the given capability.
-
addParameterObject
public void addParameterObject(String property, ParameterObjectValue value, Capability capability)
Description copied from class:DeviceAdd a ParameterObjectValue for the device.- Specified by:
addParameterObjectin classDevice- Parameters:
property- The property name that connects a device capability and the valuevalue- The parameter object valuecapability- capability the value is related to
-
getCapabilityParameterObjectProperties
public Collection<String> getCapabilityParameterObjectProperties(Capability capability)
Description copied from class:DeviceGet property names that connect the given capability to its ParameterObjectValues. Note this is not necessariliy the same as capability.getParameterObjectProperties since the device might not have ParameterObjectValues for all of the properties.- Specified by:
getCapabilityParameterObjectPropertiesin classDevice- Parameters:
capability- a capability- Returns:
- property names that the device has ParameterObjectValues for
-
getParameterObjectValue
public Set<ParameterObjectValue> getParameterObjectValue(Capability capability, String property)
Description copied from class:DeviceGet ParameterObjectValues related to a capability via the given property. For example the capability could be Moving and property "hasLinearMovementRanges"- Specified by:
getParameterObjectValuein classDevice- Parameters:
capability- a capabilityproperty- a property name- Returns:
- ParameterObjectValues
-
addParameterValue
public void addParameterValue(Parameter param, Object value, Capability capability)
Description copied from class:DeviceSet a value for a parameter.- Specified by:
addParameterValuein classDevice- Parameters:
param- the parameter whose value is setvalue- the parameter valuecapability- the capability to which this parameter value is related to
-
getParameters
public Collection<ParameterValue> getParameters()
Get parameters and their values for this device.- Specified by:
getParametersin classDevice- Returns:
- The parameter values.
-
getParameterValuesForCapability
public Set<ParameterValue> getParameterValuesForCapability(Capability capability)
Get parameter values related to given capability for this device.- Specified by:
getParameterValuesForCapabilityin classDevice- Parameters:
capability- Capability whose parameter values will be returned.- Returns:
- Set of parameter values. Null if there are no parameters for the capability.
-
-