Package ai.libs.jaicore.components.model
Class ComponentInstance
- java.lang.Object
-
- ai.libs.jaicore.components.model.ComponentInstance
-
- All Implemented Interfaces:
java.io.Serializable
public class ComponentInstance extends java.lang.Object implements java.io.SerializableFor a givenComponent, aComponent Instancedefines all parameter values and the required interfaces (recursively) and thus provides a grounding of the respectiveComponent.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ComponentInstance(ComponentInstance other)ComponentInstance(Component component, java.util.Map<java.lang.String,java.lang.String> parameterValues, java.util.Map<java.lang.String,ComponentInstance> satisfactionOfRequiredInterfaces)Constructor for creating aComponentInstancefor a particularComponent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendAnnotation(java.lang.String key, java.lang.String annotation)booleanequals(java.lang.Object obj)java.lang.StringgetAnnotation(java.lang.String key)Retrieve an annotation by its key.ComponentgetComponent()java.util.Collection<Component>getContainedComponents()java.lang.StringgetNestedComponentDescription()java.util.Collection<Parameter>getParametersThatHaveBeenSetExplicitly()java.util.Collection<Parameter>getParametersThatHaveNotBeenSetExplicitly()java.lang.StringgetParameterValue(Parameter param)java.lang.StringgetParameterValue(java.lang.String paramName)java.util.Map<java.lang.String,java.lang.String>getParameterValues()java.lang.StringgetPrettyPrint()Returns the description of aComponentInstanceas a pretty print with indentation.java.util.Map<java.lang.String,ComponentInstance>getSatisfactionOfRequiredInterfaces()inthashCode()booleanisDefaultParametrized()booleanmatchesPathRestriction(java.util.List<ai.libs.jaicore.basic.sets.Pair<java.lang.String,java.lang.String>> path)This method checks, whether a path of refinements conforms the constraints for parameter refinements.booleanmatchesPathRestrictions(java.util.Collection<java.util.List<ai.libs.jaicore.basic.sets.Pair<java.lang.String,java.lang.String>>> paths)This method checks, whether a given list of paths of refinements conforms the constraints for parameter refinements.voidputAnnotation(java.lang.String key, java.lang.String annotation)Add an annotation to this component instance.java.lang.StringtoComponentNameString()java.lang.StringtoString()
-
-
-
Constructor Detail
-
ComponentInstance
public ComponentInstance(ComponentInstance other)
-
ComponentInstance
public ComponentInstance(Component component, java.util.Map<java.lang.String,java.lang.String> parameterValues, java.util.Map<java.lang.String,ComponentInstance> satisfactionOfRequiredInterfaces)
Constructor for creating aComponentInstancefor a particularComponent.- Parameters:
component- The component that is grounded.parameterValues- A map containing the parameter values of this grounding.satisfactionOfRequiredInterfaces- The refinement of the required interfaces.
-
-
Method Detail
-
getComponent
public Component getComponent()
- Returns:
- The
Componentto thisComponentInstance.
-
getParameterValues
public java.util.Map<java.lang.String,java.lang.String> getParameterValues()
- Returns:
- The parameters and how their values were set.
-
getParametersThatHaveBeenSetExplicitly
public java.util.Collection<Parameter> getParametersThatHaveBeenSetExplicitly()
- Returns:
- The set of parameters of which the values have been set explicitly.
-
getParametersThatHaveNotBeenSetExplicitly
public java.util.Collection<Parameter> getParametersThatHaveNotBeenSetExplicitly()
- Returns:
- The set of parameters of which the values have not been set explicitly.
-
getParameterValue
public java.lang.String getParameterValue(Parameter param)
- Parameters:
param- The parameter for which the value shall be returned.- Returns:
- The value of the parameter.
-
getParameterValue
public java.lang.String getParameterValue(java.lang.String paramName)
- Parameters:
paramName- The name of the parameter for which the value is requested.- Returns:
- The value of the parameter with the given name.
-
getSatisfactionOfRequiredInterfaces
public java.util.Map<java.lang.String,ComponentInstance> getSatisfactionOfRequiredInterfaces()
- Returns:
- This method returns a mapping of interface IDs to component instances.
-
getContainedComponents
public java.util.Collection<Component> getContainedComponents()
- Returns:
- A collection of all components contained (recursively) in this
ComponentInstance.
-
matchesPathRestrictions
public boolean matchesPathRestrictions(java.util.Collection<java.util.List<ai.libs.jaicore.basic.sets.Pair<java.lang.String,java.lang.String>>> paths)
This method checks, whether a given list of paths of refinements conforms the constraints for parameter refinements.- Parameters:
paths- A list of paths of refinements to be checked.- Returns:
- Returns true if everything is alright and false if there is an issue with the given paths.
-
matchesPathRestriction
public boolean matchesPathRestriction(java.util.List<ai.libs.jaicore.basic.sets.Pair<java.lang.String,java.lang.String>> path)
This method checks, whether a path of refinements conforms the constraints for parameter refinements.- Parameters:
path- A path of refinements to be checked.- Returns:
- Returns true if everything is alright and false if there is an issue with the given path.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toComponentNameString
public java.lang.String toComponentNameString()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getPrettyPrint
public java.lang.String getPrettyPrint() throws java.io.IOExceptionReturns the description of aComponentInstanceas a pretty print with indentation.- Returns:
- A string representing this object in JSON format.
- Throws:
java.io.IOException- An IOException is thrown if the object cannot be serialized to a String.
-
getNestedComponentDescription
public java.lang.String getNestedComponentDescription()
-
putAnnotation
public void putAnnotation(java.lang.String key, java.lang.String annotation)Add an annotation to this component instance.- Parameters:
key- The key of how to address this annotation.annotation- The annotation value.
-
getAnnotation
public java.lang.String getAnnotation(java.lang.String key)
Retrieve an annotation by its key.- Parameters:
key- The key for which to retrieve the annotation.- Returns:
- The annotation value.
-
appendAnnotation
public void appendAnnotation(java.lang.String key, java.lang.String annotation)
-
isDefaultParametrized
public boolean isDefaultParametrized()
-
-