Class ConfigurationContextResolver


  • class ConfigurationContextResolver
    extends java.lang.Object
    Resolves the context around changed variables, including their parent variables, their references and the variables referencing them. Create an instance, call resolve() and obtain the result from variables(), attributes() and filter().
    Author:
    Holger Eichelberger
    • Constructor Detail

      • ConfigurationContextResolver

        public ConfigurationContextResolver​(Configuration configuration,
                                            java.util.Set<AbstractIvmlVariable> changed)
        Creates a context resolver.
        Parameters:
        configuration - the configuration to resolve within
        changed - the changed variables to resolve the context for
    • Method Detail

      • resolve

        public void resolve()
        Resolve the context.
      • map

        private void map​(IDecisionVariable var,
                         boolean viaParent)
        Map the variable and its nested variables to the configuration and follows references.
        Parameters:
        var - the variable to map
        viaParent - was this called via a parent recursion?
      • mapVar

        private void mapVar​(IDecisionVariable var,
                            boolean resolve,
                            boolean viaParent)
        Map the variable (without nested) to the configuration and follows references, but only if frozen.
        Parameters:
        var - the variable to map
        resolve - consider decVar for reverse reference resolution
        viaParent - was called via parent recursion
      • createVilInstance

        private AbstractIvmlVariable createVilInstance​(IDecisionVariable decVar,
                                                       Configuration configuration)
        Obtains a mapping instance from configuration or creates a new one.
        Parameters:
        decVar - the decision variable to obtain or create
        configuration - the configuration for lookup
        Returns:
        the mapper instance
      • augment

        private void augment​(IDecisionVariable dVar,
                             boolean viaParent)
        Augments dVar and its transitive parents.
        Parameters:
        dVar - the decision variable to augment
        viaParent - was called via parent recursion
      • collectReferences

        private java.util.Map<AbstractVariable,​java.util.List<IDecisionVariable>> collectReferences()
        Collects all references in the configuration.
        Returns:
        all references in terms of a reference target - referring elements maps
      • collectReferences

        private void collectReferences​(IDecisionVariable var,
                                       java.util.Map<AbstractVariable,​java.util.List<IDecisionVariable>> references)
        Collects the references for a single variable.
        Parameters:
        var - the variable to collect the references for
        references - the references in terms of a reference target - referring elements maps (modified as a side effect)
      • collectReference

        private void collectReference​(IDecisionVariable var,
                                      Value val,
                                      java.util.Map<AbstractVariable,​java.util.List<IDecisionVariable>> references)
        Collects the references for a variable and a single value (entry in case of a collection).
        Parameters:
        var - the variable to collect the references for
        val - the value (entry)
        references - the references in terms of a reference target - referring elements maps (modified as a side effect)
      • variables

        public DecisionVariable[] variables()
        Returns the variables to be used in the configuration.
        Returns:
        the variables
      • attributes

        public Attribute[] attributes()
        Returns the attributes to be used in the configuration.
        Returns:
        the attributes
      • filter

        public IVariableFilter filter()
        Returns the filter to be used in the configuration.
        Returns:
        the filter