Class AttributesCheckVisitor
- java.lang.Object
-
- net.ssehub.easy.reasoning.core.reasoner.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 Summary
Fields Modifier and Type Field Description private booleanisValidprivate ReasoningResultresultprivate java.util.Map<java.lang.String,java.util.List<Value>>values
-
Constructor Summary
Constructors Modifier Constructor Description privateAttributesCheckVisitor(ReasoningResult result, AttributeValues values)Creates a new visitor storing the given instances for processing.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleancheck(Configuration configuration, AttributeValues values, ReasoningResult result)Checks the givenconfigurationwith respect tovaluesand adjustsresultif required.static booleancheck(Configuration configuration, ReasonerConfiguration reasonerConfiguration, ReasoningResult result)Checks the givenconfigurationwith respect tovaluesand adjustsresultif required.private booleancheckDecisionVariable(IDecisionVariable variable)Checks a single variable.private booleancheckDecisionVariable(IDecisionVariable attribute, IAssignmentState state)Checks a single variable.static MessagecreateMessage(java.lang.String variableName, java.lang.String attributeName, Value value, ModelElement conflictingModelElement)Creates the error message in case that an attribute assignment is missing.private static java.lang.StringgetQualifiedName(IDecisionVariable variable)Returns the qualified name of the given decisionvariable.booleanisValid()Returns whether the given configuration is valid with respect to the given set of attributes and the actual values of the attributes.voidvisitConfiguration(Configuration configuration)Visits a configuration.voidvisitDecisionVariable(IDecisionVariable variable)Visits a decision variable.
-
-
-
Field Detail
-
result
private ReasoningResult result
-
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 givenconfigurationwith respect tovaluesand adjustsresultif 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:
trueif the configuration is valid,falseelse
-
check
public static boolean check(Configuration configuration, AttributeValues values, ReasoningResult result)
Checks the givenconfigurationwith respect tovaluesand adjustsresultif 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:
trueif the configuration is valid,falseelse
-
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:
trueif the configuration is valid,falseelse
-
visitConfiguration
public void visitConfiguration(Configuration configuration)
Description copied from interface:IConfigurationVisitorVisits a configuration.- Specified by:
visitConfigurationin interfaceIConfigurationVisitor- Parameters:
configuration- the configuration to visit
-
visitDecisionVariable
public void visitDecisionVariable(IDecisionVariable variable)
Description copied from interface:IConfigurationVisitorVisits a decision variable.- Specified by:
visitDecisionVariablein interfaceIConfigurationVisitor- Parameters:
variable- the decision variable to visit
-
checkDecisionVariable
private boolean checkDecisionVariable(IDecisionVariable variable)
Checks a single variable.- Parameters:
variable- the configuration value to be checked- Returns:
trueif the configuration is valid,falseelse
-
getQualifiedName
private static java.lang.String getQualifiedName(IDecisionVariable variable)
Returns the qualified name of the given decisionvariable.- 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 attributestate- the assignment state of the variable being attributed byattribute- Returns:
trueif the configuration is valid,falseelse
-
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 errorattributeName- the name of the required attributevalue- the value of the required attributeconflictingModelElement- the model element representing the conflict (may be null if irrelevant)- Returns:
- the message instance
-
-