Class VariableLookUpTable

    • Field Detail

      • initialized

        private boolean initialized
      • constraintReusers

        private java.util.Map<AbstractVariable,​java.util.Set<ContainableModelElement>> constraintReusers
        List model elements, reusing a constraint variable (declaration). A tuple in form of (Constraint Variable declaration, Set of reusing elements). For instance: Constraint cVar = ...; def Boolean func(Integer intVar) = cVar && ...;
      • definedDeclarations

        private java.util.Set<AbstractVariable> definedDeclarations
        List model elements, calling a constraint variable (declaration). A tuple in form of (Calling element Set of called constraint variables). Inverse to constraintReusers For instance: Constraint cVar = func(aVariable); def Boolean func(Integer intVar) = intVar > 10;
        See Also:
        constraintReusers
    • Constructor Detail

      • VariableLookUpTable

        VariableLookUpTable()
        Single constructor for this class.
    • Method Detail

      • init

        void init​(Configuration config)
        Creates the internal look up tables and should be called if it is the first time used. Multiple calls will ignored.
        Parameters:
        config - The used configuration.
      • init

        private void init​(IDecisionVariable variable)
        Recursive part of init(Configuration). Will add the variable as well as all nested variables and annotations. Adapt this method if further tables are needed.
        Parameters:
        variable - A IDecisionVariable of the configuration.
      • getInstancesForDeclaration

        java.util.Set<IDecisionVariable> getInstancesForDeclaration​(AbstractVariable declaration)
        Returns the set of instances of the given AbstractVariable declaration.
        Parameters:
        declaration - The declaration for which the instances shall be returned. If the declaration is nested inside a compound which was multiple times instantiated, this single declaration could return multiple IDecisionVariables.
        Returns:
        The instances for the given declaration or null if no instances exist.
      • declarationKnown

        boolean declarationKnown​(AbstractVariable declaration)
        Checks whether the declaration is known or whether the declaration is a local declaration used as an iterator of a constraint. Needs that this VariableLookUpTable was already initialized with a Configuration.
        Parameters:
        declaration - The declaration to check.
        Returns:
        true if the declaration is used for a IDecisionVariable of the configuration or if this table was not initialized with a Configuration, false otherwise.
      • putConstraintOccurrence

        void putConstraintOccurrence​(AbstractVariable constraintDecl,
                                     ContainableModelElement referringElement)
        Stores that the given constraint declaration was used inside the referring element.
        Parameters:
        constraintDecl - A constraint declaration used inside the second parameter.
        referringElement - An element which may use a constraint declaration as part of its own definition, e.g., another constraint declaration, a Constraint or a OperationDefinition.