Class VariableValueCopier.EnumAttributeFreezeProvider
java.lang.Object
net.ssehub.easy.varModel.cstEvaluation.VariableValueCopier.EnumAttributeFreezeProvider
- All Implemented Interfaces:
VariableValueCopier.IFreezeProvider
- Enclosing class:
VariableValueCopier
public static class VariableValueCopier.EnumAttributeFreezeProvider
extends Object
implements VariableValueCopier.IFreezeProvider
A default freeze provider for but-expressions based on attributes of type enum.
- Author:
- Holger Eichelberger
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Attributeprivate EnumLiteralprivate Stringprivate String -
Constructor Summary
ConstructorsConstructorDescriptionEnumAttributeFreezeProvider(String name, Attribute annotation, String operation, EnumLiteral literal) Creates a but-freeze provider for expressions of the formname|name.annotationoperationliteralEnumAttributeFreezeProvider(String name, Attribute annotation, EnumLiteral literal) Creates a but-freeze provider for expressions of the formname|name.annotation==literal -
Method Summary
Modifier and TypeMethodDescriptioncreateButExpression(DecisionVariableDeclaration freezeIter) Creates the freeze-but expression.private AttributefindAttribute(Project prj, String name, Set<Project> done) Finds a declaration for the attributenameinprjor it's imports.The name of the freeze variable.Returns a freeze selector to use.
-
Field Details
-
name
-
operation
-
annotation
-
literal
-
-
Constructor Details
-
EnumAttributeFreezeProvider
Creates a but-freeze provider for expressions of the formname|name.annotation==literal- Parameters:
name- the name of the freeze variableannotation- the annotation onname(providing annotation name and type)literal- the literal to test for
-
EnumAttributeFreezeProvider
public EnumAttributeFreezeProvider(String name, Attribute annotation, String operation, EnumLiteral literal) Creates a but-freeze provider for expressions of the formname|name.annotationoperationliteral- Parameters:
name- the name of the freeze variableannotation- the annotation onname(providing annotation name and type)operation- the operation to be appliedliteral- the literal to test for
-
-
Method Details
-
getFreezeVariableName
Description copied from interface:VariableValueCopier.IFreezeProviderThe name of the freeze variable.- Specified by:
getFreezeVariableNamein interfaceVariableValueCopier.IFreezeProvider- Returns:
- the name
-
findAttribute
Finds a declaration for the attributenameinprjor it's imports.- Parameters:
prj- the project to search forname- the name of the attributedone- the already processed projects (cycle detection)- Returns:
- the found attribute (may be null)
-
createButExpression
public ConstraintSyntaxTree createButExpression(DecisionVariableDeclaration freezeIter) throws CSTSemanticException, ValueDoesNotMatchTypeException Description copied from interface:VariableValueCopier.IFreezeProviderCreates the freeze-but expression.- Specified by:
createButExpressionin interfaceVariableValueCopier.IFreezeProvider- Parameters:
freezeIter- the freeze iterator variable (of typeFreezeVariableType)- Returns:
- the but-expression
- Throws:
CSTSemanticException- in case that the but-expression was not constructed correctlyValueDoesNotMatchTypeException- in case that creating values fails
-
getSelector
Description copied from interface:VariableValueCopier.IFreezeProviderReturns a freeze selector to use.- Specified by:
getSelectorin interfaceVariableValueCopier.IFreezeProvider- Returns:
- the selector or null for none, i.e., create an internal freeze-block based on the information in this provider
-