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 java.lang.Object implements VariableValueCopier.IFreezeProvider
A default freeze provider for but-expressions based on attributes of type enum.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private Attributeannotationprivate EnumLiteralliteralprivate java.lang.Stringnameprivate java.lang.Stringoperation
-
Constructor Summary
Constructors Constructor Description EnumAttributeFreezeProvider(java.lang.String name, Attribute annotation, java.lang.String operation, EnumLiteral literal)Creates a but-freeze provider for expressions of the formname|name.annotationoperationliteralEnumAttributeFreezeProvider(java.lang.String name, Attribute annotation, EnumLiteral literal)Creates a but-freeze provider for expressions of the formname|name.annotation==literal
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConstraintSyntaxTreecreateButExpression(DecisionVariableDeclaration freezeIter)Creates the freeze-but expression.private AttributefindAttribute(Project prj, java.lang.String name, java.util.Set<Project> done)Finds a declaration for the attributenameinprjor it's imports.java.lang.StringgetFreezeVariableName()The name of the freeze variable.IFreezeSelectorgetSelector()Returns a freeze selector to use.
-
-
-
Field Detail
-
name
private java.lang.String name
-
operation
private java.lang.String operation
-
annotation
private Attribute annotation
-
literal
private EnumLiteral literal
-
-
Constructor Detail
-
EnumAttributeFreezeProvider
public EnumAttributeFreezeProvider(java.lang.String name, Attribute annotation, EnumLiteral literal)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(java.lang.String name, Attribute annotation, java.lang.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 Detail
-
getFreezeVariableName
public java.lang.String getFreezeVariableName()
Description copied from interface:VariableValueCopier.IFreezeProviderThe name of the freeze variable.- Specified by:
getFreezeVariableNamein interfaceVariableValueCopier.IFreezeProvider- Returns:
- the name
-
findAttribute
private Attribute findAttribute(Project prj, java.lang.String name, java.util.Set<Project> done)
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
public IFreezeSelector 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
-
-