Package ai.libs.jaicore.components.model
Class ComponentUtil
- java.lang.Object
-
- ai.libs.jaicore.components.model.ComponentUtil
-
public class ComponentUtil extends java.lang.ObjectThe 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 Concrete Methods Modifier and Type Method Description static java.util.List<ComponentInstance>categoricalParameterizationsOfComponent(Component component)static java.util.Collection<Component>getAffectedComponents(java.util.Collection<Component> components, java.lang.String requiredInterface)Returns a collection of components that is relevant to resolve all recursive dependency when the request concerns a component with the provided required interface.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.lang.StringgetComponentInstanceAsComponentNames(ComponentInstance instance)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 ComponentInstancegetDefaultParameterizationOfComponent(Component component)This procedure returns a ComponentInstance of the given Component with default parameterization.static intgetNumberOfUnparametrizedCompositions(java.util.Collection<Component> components, java.lang.String requiredInterface)static ComponentInstancegetRandomParameterizationOfComponent(Component component, java.util.Random rand)This procedure returns a valid random parameterization of a given component.static ComponentInstancegetRandomParametrization(ComponentInstance componentInstance, java.util.Random rand)static ai.libs.jaicore.basic.kvstore.KVStoregetStatsForComponents(java.util.Collection<Component> components)static booleanhasCycles(java.util.Collection<Component> components, java.lang.String requiredInterface)static booleanisDefaultConfiguration(ComponentInstance instance)static ComponentInstancemaxParameterizationOfComponent(Component component)static ComponentInstanceminParameterizationOfComponent(Component component)
-
-
-
Method Detail
-
getDefaultParameterizationOfComponent
public static ComponentInstance getDefaultParameterizationOfComponent(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.
-
getRandomParameterizationOfComponent
public static ComponentInstance getRandomParameterizationOfComponent(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.
-
minParameterizationOfComponent
public static ComponentInstance minParameterizationOfComponent(Component component)
-
maxParameterizationOfComponent
public static ComponentInstance maxParameterizationOfComponent(Component component)
-
categoricalParameterizationsOfComponent
public static java.util.List<ComponentInstance> categoricalParameterizationsOfComponent(Component component)
-
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 static 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)
-
getAffectedComponents
public static java.util.Collection<Component> getAffectedComponents(java.util.Collection<Component> components, java.lang.String requiredInterface)
Returns a collection of components that is relevant to resolve all recursive dependency when the request concerns a component with the provided required interface.- Parameters:
components- A collection of component to search for relevant components.requiredInterface- The requested required interface.- Returns:
- The collection of affected components when requesting the given required interface.
-
getComponentInstanceAsComponentNames
public static java.lang.String getComponentInstanceAsComponentNames(ComponentInstance instance)
-
-