Class CollectionMatchExpression
- 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.CollectionMatchExpression
-
public class CollectionMatchExpression extends AbstractRuleMatchExpression
Implements a collection match expression.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private Expressionexpressionprivate java.lang.Objectresolvedprivate TypeDescriptor<? extends Collection<? extends IArtifact>>type
-
Constructor Summary
Constructors Constructor Description CollectionMatchExpression(Expression expression)Creates a new collection 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 collection expression.TypeDescriptor<? extends Collection<? extends IArtifact>>inferType()Infers the type of this expression including the type of the contained sub-expressions.(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
-
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
-
type
private TypeDescriptor<? extends Collection<? extends IArtifact>> type
-
-
Constructor Detail
-
CollectionMatchExpression
public CollectionMatchExpression(Expression expression) throws VilException
Creates a new collection match expression.- Parameters:
expression- an expression which evaluates to a collection- Throws:
VilException- in case that the expression does not evaluate to a collection
-
-
Method Detail
-
getExpression
public Expression getExpression()
Returns the collection expression.- Returns:
- the collection expression
-
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
-
inferType
public TypeDescriptor<? extends Collection<? extends IArtifact>> inferType() throws VilException
Description copied from class:ExpressionInfers the type of this expression including the type of the contained sub-expressions.- Overrides:
inferTypein classAbstractRuleMatchExpression- Returns:
- the type of this expression
- Throws:
VilException- in case that inferring the type 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
-
determineExpected
public java.lang.Object determineExpected(AbstractRuleMatchExpression rhsExpr, java.lang.Object rhsValue)
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)
-
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
-
-