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
  • Field Details

  • 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 expression
      versionVariable - the variable representing the actual version of the project to be imported
      compoundVersionVariable - 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

      public static DecisionVariableDeclaration[] createRestrictionVars(String modelName)
      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 (see createRestrictionVars(String), the operator and the version.
      Parameters:
      var - the variable to use
      operator - the operator
      version - the version
      Returns:
      the expression
      Throws:
      ValueDoesNotMatchTypeException - in case that version is invalid
      CSTSemanticException - in case of constraint composition problems
    • emit

      public void emit(Object context)
      Specified by:
      emit in interface net.ssehub.easy.basics.modelManagement.IVersionRestriction
    • toSpecification

      public String toSpecification()
      Specified by:
      toSpecification in interface net.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:
      evaluate in interface net.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:
      copy in interface net.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:
      copy in interface net.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)
      Maps var via mapper.
      Parameters:
      mapper - the mapper
      var - the variable to be mapped
      Returns:
      the mapped variable, possibly var