Class 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
    • Constructor Detail

      • DeviceWithCapabilities

        public DeviceWithCapabilities​(String name,
                                      Device.Type type)
        Create with a given name.
        Parameters:
        name - name of the device
        type - type of the device
    • Method Detail

      • getCapabilities

        public Set<Capability> getCapabilities()
        get the capabilities this device has
        Specified by:
        getCapabilities in class Device
        Returns:
        the capabilities
      • addCapability

        public void addCapability​(Capability capability)
        add a device capability If the capability has already been added does nothing.
        Specified by:
        addCapability in class Device
        Parameters:
        capability - capability to be added
      • getResourceCapabilities

        public Collection<ResourceCapability> getResourceCapabilities()
        Description copied from class: Device
        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.
        Specified by:
        getResourceCapabilities in class Device
        Returns:
        all resource capabilities of the device
      • getResourceCapability

        public ResourceCapability getResourceCapability​(Capability capability)
        Description copied from class: Device
        Get a ResourceCapability of this device for the given capability.
        Specified by:
        getResourceCapability in class Device
        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: Device
        Add a ParameterObjectValue for the device.
        Specified by:
        addParameterObject in class Device
        Parameters:
        property - The property name that connects a device capability and the value
        value - The parameter object value
        capability - capability the value is related to
      • getCapabilityParameterObjectProperties

        public Collection<String> getCapabilityParameterObjectProperties​(Capability capability)
        Description copied from class: Device
        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.
        Specified by:
        getCapabilityParameterObjectProperties in class Device
        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: Device
        Get ParameterObjectValues related to a capability via the given property. For example the capability could be Moving and property "hasLinearMovementRanges"
        Specified by:
        getParameterObjectValue in class Device
        Parameters:
        capability - a capability
        property - a property name
        Returns:
        ParameterObjectValues
      • addParameterValue

        public void addParameterValue​(Parameter param,
                                      Object value,
                                      Capability capability)
        Description copied from class: Device
        Set a value for a parameter.
        Specified by:
        addParameterValue in class Device
        Parameters:
        param - the parameter whose value is set
        value - the parameter value
        capability - the capability to which this parameter value is related to
      • getParameterValuesForCapability

        public Set<ParameterValue> getParameterValuesForCapability​(Capability capability)
        Get parameter values related to given capability for this device.
        Specified by:
        getParameterValuesForCapability in class Device
        Parameters:
        capability - Capability whose parameter values will be returned.
        Returns:
        Set of parameter values. Null if there are no parameters for the capability.