Package ai.libs.hasco.model
Class Component
- java.lang.Object
-
- ai.libs.hasco.model.Component
-
public class Component extends java.lang.Object
AComponent
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,Component
s 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.
-
-
Constructor Summary
Constructors Constructor Description Component(java.lang.String name)
Constructor creating an emptyComponent
with a specific name.Component(java.lang.String name, java.util.Collection<java.lang.String> providedInterfaces, java.util.List<java.util.Map<java.lang.String,java.lang.String>> requiredInterfaces, ai.libs.jaicore.basic.sets.PartialOrderedSet<Parameter> parameters, java.util.List<Dependency> dependencies)
Constructor for a component giving the provided and required interfaces, the collection of parameters and a list of dependencies.Component(java.lang.String name, java.util.Collection<java.lang.String> providedInterfaces, java.util.Map<java.lang.String,java.lang.String> requiredInterfaces, ai.libs.jaicore.basic.sets.PartialOrderedSet<Parameter> parameters, java.util.Collection<Dependency> dependencies)
Constructor for a component giving the provided and required interfaces, the collection of parameters and a list of dependencies.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDependency(Dependency dependency)
Adds a dependency constraint to the dependencies of this Component.void
addParameter(Parameter param)
Adds a parameter to the set of parameters iff the parameter or another parameter with the same name does not yet exist.boolean
addProvidedInterface(java.lang.String interfaceName)
Adds another provided interface to the collection of provided interfaces.void
addRequiredInterface(java.lang.String interfaceID, java.lang.String interfaceName)
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.boolean
equals(java.lang.Object obj)
java.util.Collection<Dependency>
getDependencies()
java.lang.String
getName()
ai.libs.jaicore.basic.sets.PartialOrderedSet<Parameter>
getParameters()
Parameter
getParameterWithName(java.lang.String paramName)
Returns the parameter for a given name.java.util.Collection<java.lang.String>
getProvidedInterfaces()
java.util.Map<java.lang.String,java.lang.String>
getRequiredInterfaces()
int
hashCode()
java.lang.String
toString()
-
-
-
Constructor Detail
-
Component
public Component(java.lang.String name)
Constructor creating an emptyComponent
with a specific name.- Parameters:
name
- The name of theComponent
.
-
Component
public Component(java.lang.String name, java.util.Collection<java.lang.String> providedInterfaces, java.util.Map<java.lang.String,java.lang.String> requiredInterfaces, ai.libs.jaicore.basic.sets.PartialOrderedSet<Parameter> parameters, java.util.Collection<Dependency> 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 theComponent
.providedInterfaces
- The collection of provided interfaces.requiredInterfaces
- The list of required interfaces.parameters
- Parameters of theComponent
.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<java.util.Map<java.lang.String,java.lang.String>> requiredInterfaces, ai.libs.jaicore.basic.sets.PartialOrderedSet<Parameter> parameters, java.util.List<Dependency> 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 theComponent
.providedInterfaces
- The collection of provided interfaces.requiredInterfaces
- The list of required interfaces.parameters
- Parameters of theComponent
.dependencies
- A list of dependencies to constrain the values of parameters (may be empty).
-
-
Method Detail
-
getName
public java.lang.String getName()
- Returns:
- The name of the Component.
-
getRequiredInterfaces
public java.util.Map<java.lang.String,java.lang.String> getRequiredInterfaces()
- Returns:
- The map of required interfaces.
-
getProvidedInterfaces
public java.util.Collection<java.lang.String> getProvidedInterfaces()
- Returns:
- The collection of provided interfaces.
-
getParameters
public ai.libs.jaicore.basic.sets.PartialOrderedSet<Parameter> getParameters()
- Returns:
- The set of parameters of this Component.
-
getParameterWithName
public Parameter 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.
-
getDependencies
public java.util.Collection<Dependency> getDependencies()
- Returns:
- The collection of dependencies on the parameters of this
Component
.
-
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(java.lang.String interfaceID, java.lang.String interfaceName)
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.
-
addParameter
public void addParameter(Parameter 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(Dependency 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 classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-