Class AttributesCheckVisitor

  • All Implemented Interfaces:
    IConfigurationVisitor

    public class AttributesCheckVisitor
    extends java.lang.Object
    implements IConfigurationVisitor
    A visitor for checking frozen values for all variables which correspond to a given (temporary) assignment of attribute values.
    Author:
    Holger Eichelberger
    • Field Detail

      • values

        private java.util.Map<java.lang.String,​java.util.List<Value>> values
      • isValid

        private boolean isValid
    • Constructor Detail

      • AttributesCheckVisitor

        private AttributesCheckVisitor​(ReasoningResult result,
                                       AttributeValues values)
        Creates a new visitor storing the given instances for processing.
        Parameters:
        values - the attribute values used as basis for the check (may be null)
        result - the reasoning results (may be modified as a side effect)
    • Method Detail

      • check

        public static boolean check​(Configuration configuration,
                                    ReasonerConfiguration reasonerConfiguration,
                                    ReasoningResult result)
        Checks the given configuration with respect to values and adjusts result if required.
        Parameters:
        configuration - the configuration to be checked (will not be modified)
        reasonerConfiguration - the configuration holding the attribute values (may be null)
        result - the reasoning results (may be modified as a side effect)
        Returns:
        true if the configuration is valid, false else
      • check

        public static boolean check​(Configuration configuration,
                                    AttributeValues values,
                                    ReasoningResult result)
        Checks the given configuration with respect to values and adjusts result if required.
        Parameters:
        configuration - the configuration to be checked (will not be modified)
        values - the attribute values used as basis for the check (may be null)
        result - the reasoning results (may be modified as a side effect)
        Returns:
        true if the configuration is valid, false else
      • isValid

        public boolean isValid()
        Returns whether the given configuration is valid with respect to the given set of attributes and the actual values of the attributes.
        Returns:
        true if the configuration is valid, false else
      • checkDecisionVariable

        private boolean checkDecisionVariable​(IDecisionVariable variable)
        Checks a single variable.
        Parameters:
        variable - the configuration value to be checked
        Returns:
        true if the configuration is valid, false else
      • getQualifiedName

        private static java.lang.String getQualifiedName​(IDecisionVariable variable)
        Returns the qualified name of the given decision variable.
        Parameters:
        variable - the qualified name of the given decision variable
        Returns:
        the qualified name
      • checkDecisionVariable

        private boolean checkDecisionVariable​(IDecisionVariable attribute,
                                              IAssignmentState state)
        Checks a single variable.
        Parameters:
        attribute - the variable representing the attribute
        state - the assignment state of the variable being attributed by attribute
        Returns:
        true if the configuration is valid, false else
      • createMessage

        public static Message createMessage​(java.lang.String variableName,
                                            java.lang.String attributeName,
                                            Value value,
                                            ModelElement conflictingModelElement)
        Creates the error message in case that an attribute assignment is missing.
        Parameters:
        variableName - the name of the variable causing the error
        attributeName - the name of the required attribute
        value - the value of the required attribute
        conflictingModelElement - the model element representing the conflict (may be null if irrelevant)
        Returns:
        the message instance