Class PipelineHelper

java.lang.Object
eu.qualimaster.easy.extension.internal.PipelineHelper
All Implemented Interfaces:
net.ssehub.easy.instantiation.core.model.vilTypes.IVilType

public class PipelineHelper extends Object implements net.ssehub.easy.instantiation.core.model.vilTypes.IVilType
Some pipeline helper functions mapped into rt-VIL.
Author:
Holger Eichelberger
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.ssehub.easy.varModel.confModel.IDecisionVariable
    getAvailable(net.ssehub.easy.varModel.confModel.IDecisionVariable pElt, String algorithm)
    Returns the available algorithm with given name Algorithm from pElt.
    (package private) static net.ssehub.easy.instantiation.core.model.vilTypes.configuration.DecisionVariable
    getByName(net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration configuration, String variableName)
    Finds a variable via its qualified instance name, i.e., the qualified name including nested variable names.
    static boolean
    isHardwareAlgorithm(net.ssehub.easy.varModel.confModel.IDecisionVariable var)
    Returns whether var is a hardware algorithm.
    static net.ssehub.easy.varModel.confModel.IDecisionVariable
    obtainAlgorithmByName(net.ssehub.easy.varModel.confModel.Configuration config, String name)
    Obtains an algorithm from config by its name.
    static net.ssehub.easy.varModel.confModel.IDecisionVariable
    obtainAlgorithmFromFamilyByName(net.ssehub.easy.varModel.confModel.IDecisionVariable family, String name)
    Obtains an algorithm form a family.
    static net.ssehub.easy.varModel.confModel.IDecisionVariable
    obtainAlgorithmFromFamilyByName(net.ssehub.easy.varModel.confModel.IDecisionVariable family, String slot, String name)
    Obtains an algorithm form a family.
    static net.ssehub.easy.varModel.confModel.IDecisionVariable
    obtainFamilyByName(net.ssehub.easy.varModel.confModel.IDecisionVariable pipeline, String name)
    Obtains a family of given name from pipeline.
    static net.ssehub.easy.instantiation.core.model.vilTypes.configuration.DecisionVariable
    obtainPipeline(net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration configuration, String variableName)
    Returns the pipeline related to the variable given by its instance name.
    static net.ssehub.easy.instantiation.core.model.vilTypes.configuration.DecisionVariable
    obtainPipeline(net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration configuration, String variableName, boolean strict)
    Returns the pipeline related to the variable given by its instance name.
    static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.vilTypes.configuration.DecisionVariable>
    obtainPipeline(net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration configuration, Iterator<?> clauses)
    Returns all pipelines mentioned in clauses.
    static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.vilTypes.configuration.DecisionVariable>
    obtainPipeline(net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration configuration, net.ssehub.easy.instantiation.core.model.vilTypes.Collection<?> clauses)
    Returns all pipelines mentioned in clauses.
    static net.ssehub.easy.varModel.confModel.IDecisionVariable
    obtainPipeline(net.ssehub.easy.varModel.confModel.Configuration configuration, net.ssehub.easy.varModel.confModel.IDecisionVariable element)
    Returns the pipeline decision for the given pipeline element.
    static net.ssehub.easy.varModel.confModel.IDecisionVariable
    obtainPipelineByName(net.ssehub.easy.varModel.confModel.Configuration config, String name)
    Returns a pipeline from the configuration.
    static net.ssehub.easy.varModel.confModel.IDecisionVariable
    obtainPipelineByName(net.ssehub.easy.varModel.confModel.Configuration config, String name, String varName)
    Returns a pipeline from the configuration from a given variable containing pipelines.
    static net.ssehub.easy.varModel.confModel.IDecisionVariable
    obtainPipelineElementByName(net.ssehub.easy.varModel.confModel.IDecisionVariable pipeline, net.ssehub.easy.varModel.model.datatypes.IDatatype type, String name)
    Obtains a pipeline element.
    private static net.ssehub.easy.varModel.confModel.IDecisionVariable
    searchScope(net.ssehub.easy.varModel.confModel.Configuration configuration, net.ssehub.easy.varModel.model.datatypes.IResolutionScope scope, net.ssehub.easy.varModel.model.datatypes.IDatatype type)
    Searches a given scope for a variable declaration of type and returns for the first matched decision variable the related decision.
    static void
    setActual(net.ssehub.easy.varModel.confModel.Configuration config, String pipeline, String pipelineElement, String algorithm)
    Sets the value of the actual slot in pipeline, pipelineElement to algorithm to the respective instance stored in the available slot of pipelineElement.
    static void
    setActual(net.ssehub.easy.varModel.confModel.IDecisionVariable pElt, String algorithm)
    Sets the value of the actual slot of pElt due to algorithm corresponding to the algorithm with same name in the available slot.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PipelineHelper

      public PipelineHelper()
  • Method Details

    • obtainPipeline

      public static net.ssehub.easy.instantiation.core.model.vilTypes.configuration.DecisionVariable obtainPipeline(net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration configuration, String variableName) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Returns the pipeline related to the variable given by its instance name.
      Parameters:
      configuration - the configuration as basis for the lookup
      variableName - the instance name of the variable
      Returns:
      the pipeline (may be null if not found)
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case that accessing a pipeline fails
    • obtainPipeline

      public static net.ssehub.easy.instantiation.core.model.vilTypes.configuration.DecisionVariable obtainPipeline(net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration configuration, String variableName, boolean strict) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Returns the pipeline related to the variable given by its instance name.
      Parameters:
      configuration - the configuration as basis for the lookup
      variableName - the instance name of the variable
      strict - if true return a pipeline only if variableName directly refers to it, false consider also contained variables and search also parent variables
      Returns:
      the pipeline (may be null if not found)
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case that accessing a pipeline fails
    • getByName

      static net.ssehub.easy.instantiation.core.model.vilTypes.configuration.DecisionVariable getByName(net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration configuration, String variableName)
      Finds a variable via its qualified instance name, i.e., the qualified name including nested variable names.
      Parameters:
      configuration - the configuration to search on
      variableName - the name of the variable
      Returns:
      the related decision variable (may be null if none was found)
    • obtainPipeline

      public static net.ssehub.easy.varModel.confModel.IDecisionVariable obtainPipeline(net.ssehub.easy.varModel.confModel.Configuration configuration, net.ssehub.easy.varModel.confModel.IDecisionVariable element) throws net.ssehub.easy.varModel.model.ModelQueryException
      Returns the pipeline decision for the given pipeline element.
      Parameters:
      configuration - the configuration for the lookup
      element - the pipeline element (may be null, leads to null)
      Returns:
      the pipeline, may be null if the pipeline was not found
      Throws:
      net.ssehub.easy.varModel.model.ModelQueryException - if accessing type information fails
    • searchScope

      private static net.ssehub.easy.varModel.confModel.IDecisionVariable searchScope(net.ssehub.easy.varModel.confModel.Configuration configuration, net.ssehub.easy.varModel.model.datatypes.IResolutionScope scope, net.ssehub.easy.varModel.model.datatypes.IDatatype type)
      Searches a given scope for a variable declaration of type and returns for the first matched decision variable the related decision.
      Parameters:
      configuration - the configuration to retrieve the decision from
      scope - the search scope for the declarations
      type - the type to search for
      Returns:
      the decision or null if not found
    • obtainPipeline

      public static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.vilTypes.configuration.DecisionVariable> obtainPipeline(net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration configuration, net.ssehub.easy.instantiation.core.model.vilTypes.Collection<?> clauses) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Returns all pipelines mentioned in clauses.
      Parameters:
      configuration - the configuration as basis for the lookup
      clauses - the clauses to look into
      Returns:
      the pipelines (may be empty)
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case that accessing a pipeline fails
    • obtainPipeline

      public static net.ssehub.easy.instantiation.core.model.vilTypes.Set<net.ssehub.easy.instantiation.core.model.vilTypes.configuration.DecisionVariable> obtainPipeline(net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration configuration, Iterator<?> clauses) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Returns all pipelines mentioned in clauses.
      Parameters:
      configuration - the configuration as basis for the lookup
      clauses - the clauses to look into
      Returns:
      the pipelines (may be empty)
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case that accessing a pipeline fails
    • obtainPipelineByName

      public static net.ssehub.easy.varModel.confModel.IDecisionVariable obtainPipelineByName(net.ssehub.easy.varModel.confModel.Configuration config, String name)
      Returns a pipeline from the configuration.
      Parameters:
      config - the configuration
      name - the name of the pipeline
      Returns:
      the pipeline or null if it does not exist
    • obtainPipelineByName

      public static net.ssehub.easy.varModel.confModel.IDecisionVariable obtainPipelineByName(net.ssehub.easy.varModel.confModel.Configuration config, String name, String varName)
      Returns a pipeline from the configuration from a given variable containing pipelines.
      Parameters:
      config - the configuration
      name - the name of the pipeline
      varName - the variable containing the pipelines
      Returns:
      the pipeline or null if it does not exist
    • obtainFamilyByName

      public static net.ssehub.easy.varModel.confModel.IDecisionVariable obtainFamilyByName(net.ssehub.easy.varModel.confModel.IDecisionVariable pipeline, String name)
      Obtains a family of given name from pipeline.
      Parameters:
      pipeline - the pipeline to obtain the family from (may be null)
      name - the name of the family
      Returns:
      the family if it exists, null if there is no family
    • isHardwareAlgorithm

      public static boolean isHardwareAlgorithm(net.ssehub.easy.varModel.confModel.IDecisionVariable var)
      Returns whether var is a hardware algorithm.
      Parameters:
      var - the variable to check
      Returns:
      true for hardware algorithm, false else
    • obtainAlgorithmByName

      public static net.ssehub.easy.varModel.confModel.IDecisionVariable obtainAlgorithmByName(net.ssehub.easy.varModel.confModel.Configuration config, String name)
      Obtains an algorithm from config by its name.
      Parameters:
      config - the configuration
      name - the name of the algorithm
      Returns:
      the algorithm or null if not found
    • obtainPipelineElementByName

      public static net.ssehub.easy.varModel.confModel.IDecisionVariable obtainPipelineElementByName(net.ssehub.easy.varModel.confModel.IDecisionVariable pipeline, net.ssehub.easy.varModel.model.datatypes.IDatatype type, String name)
      Obtains a pipeline element.
      Parameters:
      pipeline - the pipeline
      type - the type of the element (may be null)
      name - the name of the element
      Returns:
      the element or null if it does not exist for some reason
    • obtainAlgorithmFromFamilyByName

      public static net.ssehub.easy.varModel.confModel.IDecisionVariable obtainAlgorithmFromFamilyByName(net.ssehub.easy.varModel.confModel.IDecisionVariable family, String name)
      Obtains an algorithm form a family.
      Parameters:
      family - the family (may be null)
      name - the name of the algorithm
      Returns:
      the algorithm or null if none exists
    • obtainAlgorithmFromFamilyByName

      public static net.ssehub.easy.varModel.confModel.IDecisionVariable obtainAlgorithmFromFamilyByName(net.ssehub.easy.varModel.confModel.IDecisionVariable family, String slot, String name)
      Obtains an algorithm form a family.
      Parameters:
      family - the family (may be null)
      slot - the slot in family to use
      name - the name of the algorithm
      Returns:
      the algorithm or null if none exists
    • setActual

      public static void setActual(net.ssehub.easy.varModel.confModel.IDecisionVariable pElt, String algorithm) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Sets the value of the actual slot of pElt due to algorithm corresponding to the algorithm with same name in the available slot.
      Parameters:
      pElt - the IVML configuration variable representing the target pipeline element
      algorithm - the name of the algorithm to set as actual
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case that setting the actual value is not possible, but not if the algorithm or the pipeline element does not exist
    • getAvailable

      public static net.ssehub.easy.varModel.confModel.IDecisionVariable getAvailable(net.ssehub.easy.varModel.confModel.IDecisionVariable pElt, String algorithm) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Returns the available algorithm with given name Algorithm from pElt.
      Parameters:
      pElt - the IVML configuration variable representing the target pipeline element
      algorithm - the algorithm name
      Returns:
      the available algorithm or null if not found
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case that the available algorithm slot does not exist
    • setActual

      public static void setActual(net.ssehub.easy.varModel.confModel.Configuration config, String pipeline, String pipelineElement, String algorithm) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Sets the value of the actual slot in pipeline, pipelineElement to algorithm to the respective instance stored in the available slot of pipelineElement.
      Parameters:
      config - the configuration
      pipeline - the pipeline name
      pipelineElement - the pipeline element name
      algorithm - the algorithm name
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - if setting the actual value is not possible, but not if the algorithm or the pipeline element does not exist