Class BooleanMatchExpression
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.expressions.Expression
-
- net.ssehub.easy.instantiation.core.model.buildlangModel.ruleMatch.AbstractRuleMatchExpression
-
- net.ssehub.easy.instantiation.core.model.buildlangModel.ruleMatch.BooleanMatchExpression
-
public class BooleanMatchExpression extends AbstractRuleMatchExpression
Implements a Boolean match expression, i.e., a traditional pre- or postcondition.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private Expressionexpressionprivate java.lang.Objectresolved
-
Constructor Summary
Constructors Constructor Description BooleanMatchExpression(Expression expression)Creates a new Boolean match expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Objectaccept(IMatchVisitor visitor)Accepts the given visitor for visiting.booleancontributesTo(AbstractRuleMatchExpression expression)Returns whether this rule match expression may contribute to the fulfillment ofexpression.java.lang.ObjectdetermineExpected(AbstractRuleMatchExpression rhsExpr, java.lang.Object rhsValue)Determines the expected value on the left side (represented by this object) based on the actual value for the corresponding right side.Collection<?>evaluate(IExpressionVisitor evaluator)Evaluates this expression.TypeDescriptor<?>getEntryType()Returns the entry type over which this match expression will be able to iterate.ExpressiongetExpression()Returns the actual Boolean expression.(package private) voidresolve(java.lang.Object resolved)Resolves the expression.-
Methods inherited from class net.ssehub.easy.instantiation.core.model.buildlangModel.ruleMatch.AbstractRuleMatchExpression
accept, ensureType, inferType
-
Methods inherited from class net.ssehub.easy.instantiation.core.model.expressions.Expression
replaceEmptyLine
-
-
-
-
Field Detail
-
expression
private Expression expression
-
resolved
private transient java.lang.Object resolved
-
-
Constructor Detail
-
BooleanMatchExpression
public BooleanMatchExpression(Expression expression) throws VilException
Creates a new Boolean match expression.- Parameters:
expression- an expression which evaluates to a Boolean- Throws:
VilException- in case that the expression does not evaluate to a Boolean
-
-
Method Detail
-
getEntryType
public TypeDescriptor<?> getEntryType()
Description copied from class:AbstractRuleMatchExpressionReturns the entry type over which this match expression will be able to iterate.- Specified by:
getEntryTypein classAbstractRuleMatchExpression- Returns:
- the entry type
-
getExpression
public Expression getExpression()
Returns the actual Boolean expression.- Returns:
- the actual expression
-
determineExpected
public java.lang.Object determineExpected(AbstractRuleMatchExpression rhsExpr, java.lang.Object rhsValue) throws VilException
Description copied from class:AbstractRuleMatchExpressionDetermines the expected value on the left side (represented by this object) based on the actual value for the corresponding right side.- Specified by:
determineExpectedin classAbstractRuleMatchExpression- Parameters:
rhsExpr- the (resolved) RHS expressionrhsValue- the RHS value- Returns:
- the expected LHS value (null denotes no expectation)
- Throws:
VilException- in case that determining the expected object fails
-
accept
protected java.lang.Object accept(IMatchVisitor visitor) throws VilException
Description copied from class:AbstractRuleMatchExpressionAccepts the given visitor for visiting.- Specified by:
acceptin classAbstractRuleMatchExpression- Parameters:
visitor- the match visitor used for visiting- Returns:
- the result of visiting (may be null)
- Throws:
VilException- in case of visiting / evaluation errors
-
contributesTo
public boolean contributesTo(AbstractRuleMatchExpression expression)
Description copied from class:AbstractRuleMatchExpressionReturns whether this rule match expression may contribute to the fulfillment ofexpression.- Specified by:
contributesToin classAbstractRuleMatchExpression- Parameters:
expression- the expression to be considered (typically a RHS expression, while this is a LHS expression)- Returns:
trueif this rule may contribute,falseelse
-
evaluate
public Collection<?> evaluate(IExpressionVisitor evaluator) throws VilException
Description copied from class:AbstractRuleMatchExpressionEvaluates this expression. Some subtypes may define some kind of value resolution, e.g., for match expressions. This must be called before!- Specified by:
evaluatein classAbstractRuleMatchExpression- Parameters:
evaluator- the expression evaluator (in case that an actual expression must be evaluated as part of this evaluation).- Returns:
- the evaluation result
- Throws:
VilException- in case that evaluation fails
-
resolve
void resolve(java.lang.Object resolved)
Resolves the expression.- Parameters:
resolved- the resolved object
-
-