Class Component

  • All Implemented Interfaces:
    IComponent, java.io.Serializable

    public class Component
    extends java.lang.Object
    implements IComponent, java.io.Serializable
    A Component is described by - a name - a collection of provided interfaces - a list of required interfaces - a set of parameters - a list of dependencies and can be used to describe any kind of components and model complex multi-component systems. More specifically, Components are used to model the search space of HASCO. By recursively resolving required interfaces until there are no open choices left, HASCO may transform your component description automatically into an HTN planning problem to automatically optimize a component setup for a specific task.
    See Also:
    Serialized Form
    • Constructor Detail

      • Component

        public Component​(java.lang.String name)
        Constructor creating an empty Component with a specific name.
        Parameters:
        name - The name of the Component.
      • Component

        public Component​(java.lang.String name,
                         java.util.Collection<java.lang.String> providedInterfaces,
                         java.util.List<Interface> requiredInterfaces,
                         ai.libs.jaicore.basic.sets.PartialOrderedSet<IParameter> parameters,
                         java.util.Collection<IParameterDependency> dependencies)
        Constructor for a component giving the provided and required interfaces, the collection of parameters and a list of dependencies.
        Parameters:
        name - The name of the Component.
        providedInterfaces - The collection of provided interfaces.
        requiredInterfaces - The list of required interfaces.
        parameters - Parameters of the Component.
        dependencies - A list of dependencies to constrain the values of parameters (may be empty).
      • Component

        public Component​(java.lang.String name,
                         java.util.Collection<java.lang.String> providedInterfaces,
                         java.util.List<IRequiredInterfaceDefinition> requiredInterfaces,
                         ai.libs.jaicore.basic.sets.PartialOrderedSet<IParameter> parameters,
                         java.util.List<IParameterDependency> dependencies)
        Constructor for a component giving the provided and required interfaces, the collection of parameters and a list of dependencies.
        Parameters:
        name - The name of the Component.
        providedInterfaces - The collection of provided interfaces.
        requiredInterfaces - The list of required interfaces.
        parameters - Parameters of the Component.
        dependencies - A list of dependencies to constrain the values of parameters (may be empty).
    • Method Detail

      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface IComponent
        Returns:
        The name of the Component.
      • getRequiredInterfaceNames

        public java.util.List<java.lang.String> getRequiredInterfaceNames()
        Returns:
        The list of names of required interfaces.
      • getRequiredInterfaceIds

        public java.util.List<java.lang.String> getRequiredInterfaceIds()
        Returns:
        The list of ids of required interfaces.
      • getProvidedInterfaces

        public java.util.Collection<java.lang.String> getProvidedInterfaces()
        Specified by:
        getProvidedInterfaces in interface IComponent
        Returns:
        The collection of provided interfaces.
      • getParameters

        public ai.libs.jaicore.basic.sets.PartialOrderedSet<IParameter> getParameters()
        Specified by:
        getParameters in interface IComponent
        Returns:
        The set of parameters of this Component.
      • getParameterWithName

        public IParameter getParameterWithName​(java.lang.String paramName)
        Returns the parameter for a given name.
        Parameters:
        paramName - The name of the parameter to be returned.
        Returns:
        The parameter for the given name.
      • addProvidedInterface

        public boolean addProvidedInterface​(java.lang.String interfaceName)
        Adds another provided interface to the collection of provided interfaces.
        Parameters:
        interfaceName - The interface to be added to the provided interfaces.
      • addRequiredInterface

        public void addRequiredInterface​(IRequiredInterfaceDefinition ri)
        Adds a new required interface to the component
        Parameters:
        ri - The required interface definition
      • addRequiredInterface

        public void addRequiredInterface​(java.lang.String interfaceID,
                                         java.lang.String interfaceName,
                                         boolean optional,
                                         boolean uniqueComponents,
                                         boolean ordered,
                                         java.lang.Integer min,
                                         java.lang.Integer max)
        Adds an additional required interface with an ID (local identifier) and an interface name (provided interface of another Component) to the required interfaces of this Component.
        Parameters:
        interfaceID - The local identifier to reference the specific required interface.
        interfaceName - The provided interface of another component.
        uniqueComponents - Whether or not this is a set interface (every component must be attached at most once)
        min - Minimun times the interface is required?
        max - Maximum times the interface is required?
      • addRequiredInterface

        public void addRequiredInterface​(java.lang.String interfaceID,
                                         java.lang.String interfaceName)
      • addParameter

        public void addParameter​(IParameter param)
        Adds a parameter to the set of parameters iff the parameter or another parameter with the same name does not yet exist.
        Parameters:
        param - The parameter to be added.
      • addDependency

        public void addDependency​(IParameterDependency dependency)
        Adds a dependency constraint to the dependencies of this Component.
        Parameters:
        dependency - The dependency to be added.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getParameter

        public IParameter getParameter​(java.lang.String name)
        Specified by:
        getParameter in interface IComponent
        Parameters:
        name - The name of the desired parameter
        Returns:
        The parameter object