Class 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 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)
      • 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)