Package ai.libs.hasco.model
Class ComponentUtil
- java.lang.Object
-
- ai.libs.hasco.model.ComponentUtil
-
public class ComponentUtil extends java.lang.Object
The ComponentUtil class can be used to deal with Components in a convenient way. For instance, for a given component (type) it can be used to return a parameterized ComponentInstance.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ComponentInstance
defaultParameterizationOfComponent(Component component)
This procedure returns a ComponentInstance of the given Component with default parameterization.static java.util.Collection<ComponentInstance>
getAllAlgorithmSelectionInstances(Component rootComponent, java.util.Collection<Component> components)
Enumerates all possible component instances for a specific root component and a collection of components for resolving required interfaces.static java.util.Collection<ComponentInstance>
getAllAlgorithmSelectionInstances(java.lang.String requiredInterface, java.util.Collection<Component> components)
Enumerates all possible component instances for a specific root component and a collection of components for resolving required interfaces.static java.util.Collection<Component>
getComponentsProvidingInterface(java.util.Collection<Component> components, java.lang.String providedInterface)
Searches and returns all components within a collection of components that provide a specific interface.static int
getNumberOfUnparametrizedCompositions(java.util.Collection<Component> components, java.lang.String requiredInterface)
ComponentInstance
getRandomParametrization(ComponentInstance componentInstance, java.util.Random rand)
static ai.libs.jaicore.basic.kvstore.KVStore
getStatsForComponents(java.util.Collection<Component> components)
static boolean
hasCycles(java.util.Collection<Component> components, java.lang.String requiredInterface)
static boolean
isDefaultConfiguration(ComponentInstance instance)
static ComponentInstance
randomParameterizationOfComponent(Component component, java.util.Random rand)
This procedure returns a valid random parameterization of a given component.
-
-
-
Method Detail
-
defaultParameterizationOfComponent
public static ComponentInstance defaultParameterizationOfComponent(Component component)
This procedure returns a ComponentInstance of the given Component with default parameterization. Note that required interfaces are not resolved.- Parameters:
component
- The component for which a random parameterization is to be returned.- Returns:
- An instantiation of the component with default parameterization.
-
randomParameterizationOfComponent
public static ComponentInstance randomParameterizationOfComponent(Component component, java.util.Random rand)
This procedure returns a valid random parameterization of a given component. Random decisions are made with the help of the given Random object. Note that required interfaces are not resolved.- Parameters:
component
- The component for which a random parameterization is to be returned.rand
- The Random instance for making the random decisions.- Returns:
- An instantiation of the component with valid random parameterization.
-
getComponentsProvidingInterface
public static java.util.Collection<Component> getComponentsProvidingInterface(java.util.Collection<Component> components, java.lang.String providedInterface)
Searches and returns all components within a collection of components that provide a specific interface.- Parameters:
components
- The collection of components to search in.providedInterface
- The interface of interest.- Returns:
- A sub-collection of components all of which provide the requested providedInterface.
-
getAllAlgorithmSelectionInstances
public static java.util.Collection<ComponentInstance> getAllAlgorithmSelectionInstances(Component rootComponent, java.util.Collection<Component> components)
Enumerates all possible component instances for a specific root component and a collection of components for resolving required interfaces. Hyperparameters are set to the default value.- Parameters:
rootComponent
- The component to be considered the root.components
- The collection fo components that is used for resolving required interfaces recursively.- Returns:
- A collection of component instances of the given root component with all possible algorithm choices.
-
getAllAlgorithmSelectionInstances
public static java.util.Collection<ComponentInstance> getAllAlgorithmSelectionInstances(java.lang.String requiredInterface, java.util.Collection<Component> components)
Enumerates all possible component instances for a specific root component and a collection of components for resolving required interfaces. Hyperparameters are set to the default value.- Parameters:
requiredInterface
- The interface required to be provided by the root components.components
- The collection fo components that is used for resolving required interfaces recursively.- Returns:
- A collection of component instances of the given root component with all possible algorithm choices.
-
getNumberOfUnparametrizedCompositions
public static int getNumberOfUnparametrizedCompositions(java.util.Collection<Component> components, java.lang.String requiredInterface)
-
getRandomParametrization
public ComponentInstance getRandomParametrization(ComponentInstance componentInstance, java.util.Random rand)
-
hasCycles
public static boolean hasCycles(java.util.Collection<Component> components, java.lang.String requiredInterface)
-
isDefaultConfiguration
public static boolean isDefaultConfiguration(ComponentInstance instance)
-
getStatsForComponents
public static ai.libs.jaicore.basic.kvstore.KVStore getStatsForComponents(java.util.Collection<Component> components)
-
-