Class Device
- java.lang.Object
-
- fi.tut.mei.capabilityQueryLib.model.Device
-
- Direct Known Subclasses:
DeviceWithCapabilities
,IndividualDevice
public abstract class Device extends Object
Abstract class that represents different kinds of devices. The class offers methods shared by all devices: individual devices, blueprints and device combinations. Some methods don't have a real implementation but return null instead.- Author:
- hylli
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Device.Type
Represents different device types: individual device, blueprint or device combination
-
Constructor Summary
Constructors Constructor Description Device(String name, Device.Type type)
Create a device with the given name and type information
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
addCapability(Capability capability)
add a device capabilityabstract void
addParameterObject(String property, ParameterObjectValue value, Capability capability)
Add a ParameterObjectValue for the device.abstract void
addParameterValue(Parameter param, Object value, Capability capability)
Set a value for a parameter.abstract void
addResourceCapability(ResourceCapability capability)
Add a resource capability to this device.ParameterObjectValue
getBasicInformation()
Get basic information about this device.Blueprint
getBlueprint()
get the blueprint the device is based onabstract Set<Capability>
getCapabilities()
Get the capabilities this device hasabstract Collection<String>
getCapabilityParameterObjectProperties(Capability capability)
Get property names that connect the given capability to its ParameterObjectValues.String
getDescription()
Get a description of the device.String
getDescriptionAsPlainText()
Get description text with possible HTML tags removed.List<Device>
getDevices()
Get the devices this device consists ofString
getName()
get device nameabstract Set<ParameterObjectValue>
getParameterObjectValue(Capability capability, String property)
Get ParameterObjectValues related to a capability via the given property.abstract Collection<ParameterValue>
getParameters()
Get parameters and their values for this device.abstract Set<ParameterValue>
getParameterValuesForCapability(Capability capability)
Get parameter values related to given capability for this device.String
getRdID()
Get the resource description id of this device.String
getRdURL()
Get the resource description URL of this device.abstract Collection<ResourceCapability>
getResourceCapabilities()
Get the resource capabilities of the device.abstract ResourceCapability
getResourceCapability(Capability capability)
Get a ResourceCapability of this device for the given capability.Device.Type
getType()
Get the type of the device.void
setDescription(String description)
Set the device description.void
setRdID(String rdID)
Set the resource description id of this device.void
setRdURL(String rdURL)
Set the resource description URL of this device.String
toString()
-
-
-
Constructor Detail
-
Device
public Device(String name, Device.Type type)
Create a device with the given name and type information- Parameters:
name
- name of the devicetype
- the type of the device.
-
-
Method Detail
-
getName
public String getName()
get device name- Returns:
- the name
-
getType
public Device.Type getType()
Get the type of the device. This will correspond to the device object's class. For example object returning type BLUEPRINT is a member of class Blueprint- Returns:
- the type
-
getDescription
public String getDescription()
Get a description of the device.- Returns:
- the description
-
setDescription
public void setDescription(String description)
Set the device description.- Parameters:
description
- the description to set
-
getDescriptionAsPlainText
public String getDescriptionAsPlainText()
Get description text with possible HTML tags removed. Descriptions in the ontology may contain HTML tags which this method removes.- Returns:
- Description with HTML tags removed.
-
getRdID
public String getRdID()
Get the resource description id of this device. It is the id of this device represented in the resource description format.- Returns:
- the resource description id. Null if this device doesn't have one for example device combinations don't have one.
-
setRdID
public void setRdID(String rdID)
Set the resource description id of this device.- Parameters:
rdID
- the resource description id to set
-
getRdURL
public String getRdURL()
Get the resource description URL of this device. The URL from where you can get the representation of this device in the resource description format.- Returns:
- the resource description URL. Null if this device doesn't have one for example device combinations don't have one.
-
setRdURL
public void setRdURL(String rdURL)
Set the resource description URL of this device.- Parameters:
rdURL
- resource description URL to set
-
getBlueprint
public Blueprint getBlueprint()
get the blueprint the device is based on- Returns:
- the blueprint. Null if not applicable for the device type i.e. only individual devices have blueprints
-
getBasicInformation
public ParameterObjectValue getBasicInformation()
Get basic information about this device. This information consists of parameters that are not associated with any capability such as mass.- Returns:
- a ParameterObjectValue representing the basic information. Null if information not available.
-
getDevices
public List<Device> getDevices()
Get the devices this device consists of- Returns:
- devices this combination consists of. Null if not applicable i.e. this is not a DeviceCombination
-
getCapabilities
public abstract Set<Capability> getCapabilities()
Get the capabilities this device has- Returns:
- the capabilities
-
getResourceCapabilities
public abstract Collection<ResourceCapability> getResourceCapabilities()
Get 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.- Returns:
- all resource capabilities of the device
-
getResourceCapability
public abstract ResourceCapability getResourceCapability(Capability capability)
Get a ResourceCapability of this device for the given capability.- Parameters:
capability
- a capability- Returns:
- ResourceCapability for the capability. Null if this device doesn't have the given capability.
-
addCapability
public abstract void addCapability(Capability capability)
add a device capability- Parameters:
capability
- The capability to be added.
-
addResourceCapability
public abstract void addResourceCapability(ResourceCapability capability)
Add a resource capability to this device. This is an alternative foraddCapability(Capability)
- Parameters:
capability
- the resource capability
-
addParameterValue
public abstract void addParameterValue(Parameter param, Object value, Capability capability)
Set a value for a parameter.- Parameters:
param
- the parameter whose value is setvalue
- the parameter valuecapability
- the capability to which this parameter value is related to
-
getParameters
public abstract Collection<ParameterValue> getParameters()
Get parameters and their values for this device.- Returns:
- The parameter values.
-
getParameterValuesForCapability
public abstract Set<ParameterValue> getParameterValuesForCapability(Capability capability)
Get parameter values related to given capability for this device.- Parameters:
capability
- Capability whose parameter values will be returned.- Returns:
- Set of parameter values. Null if there are no parameters for the capability.
-
addParameterObject
public abstract void addParameterObject(String property, ParameterObjectValue value, Capability capability)
Add a ParameterObjectValue for the device.- 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 abstract Collection<String> getCapabilityParameterObjectProperties(Capability capability)
Get 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.- Parameters:
capability
- a capability- Returns:
- property names that the device has ParameterObjectValues for
-
getParameterObjectValue
public abstract Set<ParameterObjectValue> getParameterObjectValue(Capability capability, String property)
Get ParameterObjectValues related to a capability via the given property. For example the capability could be Moving and property "hasLinearMovementRanges"- Parameters:
capability
- a capabilityproperty
- a property name- Returns:
- ParameterObjectValues
-
-