Package net.ssehub.easy.varModel.model
Class ExpressionVersionRestriction
java.lang.Object
net.ssehub.easy.varModel.model.ExpressionVersionRestriction
- All Implemented Interfaces:
net.ssehub.easy.basics.modelManagement.IVersionRestriction
public class ExpressionVersionRestriction
extends Object
implements net.ssehub.easy.basics.modelManagement.IVersionRestriction
A version expression based on IVML constraints.
- Author:
- Holger Eichelberger
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.ssehub.easy.basics.modelManagement.IVersionRestriction
net.ssehub.easy.basics.modelManagement.IVersionRestriction.IVariableMapper -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DecisionVariableDeclarationprivate ConstraintSyntaxTreeprivate DecisionVariableDeclaration -
Constructor Summary
ConstructorsConstructorDescriptionExpressionVersionRestriction(ConstraintSyntaxTree expr, DecisionVariableDeclaration versionVariable, DecisionVariableDeclaration compoundVersionVariable) Creates a new expression version restriction. -
Method Summary
Modifier and TypeMethodDescriptionnet.ssehub.easy.basics.modelManagement.IVersionRestrictioncopy(net.ssehub.easy.basics.modelManagement.IModel model) net.ssehub.easy.basics.modelManagement.IVersionRestrictioncopy(net.ssehub.easy.basics.modelManagement.IVersionRestriction.IVariableMapper mapper) static DecisionVariableDeclaration[]createRestrictionVars(String modelName) Creates the restriction variables for IVML models.static ConstraintSyntaxTreecreateSingleRestriction(DecisionVariableDeclaration var, String operator, net.ssehub.easy.basics.modelManagement.Version version) Creates a typical single restriction from the given variable (seecreateRestrictionVars(String), the operator and the version.voidbooleanevaluate(net.ssehub.easy.basics.modelManagement.IRestrictionEvaluationContext context, net.ssehub.easy.basics.modelManagement.Version version) private DecisionVariableDeclarationmap(net.ssehub.easy.basics.modelManagement.IVersionRestriction.IVariableMapper mapper, DecisionVariableDeclaration var) Mapsvarviamapper.
-
Field Details
-
expr
-
versionVariable
-
compoundVersionVariable
-
-
Constructor Details
-
ExpressionVersionRestriction
public ExpressionVersionRestriction(ConstraintSyntaxTree expr, DecisionVariableDeclaration versionVariable, DecisionVariableDeclaration compoundVersionVariable) throws net.ssehub.easy.basics.modelManagement.RestrictionEvaluationException Creates a new expression version restriction.- Parameters:
expr- the version restriction expressionversionVariable- the variable representing the actual version of the project to be importedcompoundVersionVariable- the version variable in terms of the (legacy) compound version- Throws:
net.ssehub.easy.basics.modelManagement.RestrictionEvaluationException- in case of type compliance problems
-
-
Method Details
-
createRestrictionVars
Creates the restriction variables for IVML models.- Parameters:
modelName- the name of the model- Returns:
- the restriction variables (1: the pseudo-compound variable, 0: the plain variable)
-
createSingleRestriction
public static ConstraintSyntaxTree createSingleRestriction(DecisionVariableDeclaration var, String operator, net.ssehub.easy.basics.modelManagement.Version version) throws ValueDoesNotMatchTypeException, CSTSemanticException Creates a typical single restriction from the given variable (seecreateRestrictionVars(String), the operator and the version.- Parameters:
var- the variable to useoperator- the operatorversion- the version- Returns:
- the expression
- Throws:
ValueDoesNotMatchTypeException- in case thatversionis invalidCSTSemanticException- in case of constraint composition problems
-
emit
- Specified by:
emitin interfacenet.ssehub.easy.basics.modelManagement.IVersionRestriction
-
toSpecification
- Specified by:
toSpecificationin interfacenet.ssehub.easy.basics.modelManagement.IVersionRestriction
-
evaluate
public boolean evaluate(net.ssehub.easy.basics.modelManagement.IRestrictionEvaluationContext context, net.ssehub.easy.basics.modelManagement.Version version) throws net.ssehub.easy.basics.modelManagement.RestrictionEvaluationException - Specified by:
evaluatein interfacenet.ssehub.easy.basics.modelManagement.IVersionRestriction- Throws:
net.ssehub.easy.basics.modelManagement.RestrictionEvaluationException
-
copy
public net.ssehub.easy.basics.modelManagement.IVersionRestriction copy(net.ssehub.easy.basics.modelManagement.IModel model) throws net.ssehub.easy.basics.modelManagement.RestrictionEvaluationException - Specified by:
copyin interfacenet.ssehub.easy.basics.modelManagement.IVersionRestriction- Throws:
net.ssehub.easy.basics.modelManagement.RestrictionEvaluationException
-
copy
public net.ssehub.easy.basics.modelManagement.IVersionRestriction copy(net.ssehub.easy.basics.modelManagement.IVersionRestriction.IVariableMapper mapper) throws net.ssehub.easy.basics.modelManagement.RestrictionEvaluationException - Specified by:
copyin interfacenet.ssehub.easy.basics.modelManagement.IVersionRestriction- Throws:
net.ssehub.easy.basics.modelManagement.RestrictionEvaluationException
-
map
private DecisionVariableDeclaration map(net.ssehub.easy.basics.modelManagement.IVersionRestriction.IVariableMapper mapper, DecisionVariableDeclaration var) Mapsvarviamapper.- Parameters:
mapper- the mappervar- the variable to be mapped- Returns:
- the mapped variable, possibly
var
-