Class MatchResolver
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.buildlangModel.ruleMatch.MatchResolver
-
- All Implemented Interfaces:
IMatchVisitor,IExpressionVisitor
public class MatchResolver extends java.lang.Object implements IExpressionVisitor, IMatchVisitor
This class resolves match expressions if necessary.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private IRuntimeEnvironmentenvironmentprivate IExpressionVisitorevaluatorprivate IExpressionParser<Resolver>expressionParser
-
Constructor Summary
Constructors Constructor Description MatchResolver(IRuntimeEnvironment environment, IExpressionParser<Resolver> expressionParser, IExpressionVisitor evaluator)Creates a match resolver.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.Stringresolve(java.lang.String string)Resolves the given string.java.lang.ObjectvisitArtifactMatchExpression(ArtifactMatchExpression expression)Visits an artifact match expression.java.lang.ObjectvisitBooleanMatchExpression(BooleanMatchExpression expression)Visits a boolean match expression.java.lang.ObjectvisitCallExpression(CallExpression call)Visits a call node.java.lang.ObjectvisitCollectionMatchExpression(CollectionMatchExpression expression)Visits a collection match expression.java.lang.ObjectvisitCompositeExpression(CompositeExpression ex)Visits a composite expression.java.lang.ObjectvisitCompoundMatchExpression(CompoundMatchExpression expression)Visits a compound match expression.java.lang.ObjectvisitConstantExpression(ConstantExpression cst)Visits a constant node.java.lang.ObjectvisitContainerInitializerExpression(ContainerInitializerExpression ex)Visits a container initializer expression.java.lang.ObjectvisitExpression(Expression ex)Visits an unspecified expression (in case of specialized nodes).java.lang.ObjectvisitExpressionEvaluator(ExpressionEvaluator ex)Visits an expression evaluator.java.lang.ObjectvisitFieldAccessExpression(FieldAccessExpression ex)Visits a field access expression.java.lang.ObjectvisitMultiAndExpression(MultiAndExpression ex)Visits a multi-and expression.java.lang.ObjectvisitParenthesisExpression(ParenthesisExpression par)Visits a parenthesis node.java.lang.ObjectvisitPathMatchExpression(PathMatchExpression expression)Visits a path match expression.java.lang.ObjectvisitResolvableOperationCallExpression(ResolvableOperationCallExpression ex)Visits resolvable operation call expression (function pointer call).java.lang.ObjectvisitResolvableOperationExpression(ResolvableOperationExpression ex)Visits resolvable operation expression (function pointer resolution).java.lang.ObjectvisitStringExpression(StringExpression ex)Visits a string expression.java.lang.ObjectvisitStringMatchExpression(StringMatchExpression expression)Visits a string match expression.java.lang.ObjectvisitValueAssignmentExpression(ValueAssignmentExpression ex)Visits a value assignment expression.java.lang.ObjectvisitVariableExpression(VariableExpression cst)Visits a constant node.java.lang.ObjectvisitVarModelIdentifierExpression(VarModelIdentifierExpression identifier)Visits a variability model identifier.java.lang.ObjectvisitVilTypeExpression(VilTypeExpression typeExpression)Visits a VIL type expression.
-
-
-
Field Detail
-
environment
private IRuntimeEnvironment environment
-
expressionParser
private IExpressionParser<Resolver> expressionParser
-
evaluator
private IExpressionVisitor evaluator
-
-
Constructor Detail
-
MatchResolver
public MatchResolver(IRuntimeEnvironment environment, IExpressionParser<Resolver> expressionParser, IExpressionVisitor evaluator)
Creates a match resolver.- Parameters:
environment- the actual runtime environmentexpressionParser- the actual expression parserevaluator- the actual evaluator
-
-
Method Detail
-
resolve
private java.lang.String resolve(java.lang.String string) throws VilExceptionResolves the given string.- Parameters:
string- the string to be resolved- Returns:
- the resolved string
- Throws:
VilException- in case that resolution fails
-
visitPathMatchExpression
public java.lang.Object visitPathMatchExpression(PathMatchExpression expression) throws VilException
Description copied from interface:IMatchVisitorVisits a path match expression.- Specified by:
visitPathMatchExpressionin interfaceIMatchVisitor- Parameters:
expression- the expression- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitStringMatchExpression
public java.lang.Object visitStringMatchExpression(StringMatchExpression expression) throws VilException
Description copied from interface:IMatchVisitorVisits a string match expression.- Specified by:
visitStringMatchExpressionin interfaceIMatchVisitor- Parameters:
expression- the expression- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitBooleanMatchExpression
public java.lang.Object visitBooleanMatchExpression(BooleanMatchExpression expression) throws VilException
Description copied from interface:IMatchVisitorVisits a boolean match expression.- Specified by:
visitBooleanMatchExpressionin interfaceIMatchVisitor- Parameters:
expression- the expression- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitArtifactMatchExpression
public java.lang.Object visitArtifactMatchExpression(ArtifactMatchExpression expression) throws VilException
Description copied from interface:IMatchVisitorVisits an artifact match expression.- Specified by:
visitArtifactMatchExpressionin interfaceIMatchVisitor- Parameters:
expression- the expression- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitCollectionMatchExpression
public java.lang.Object visitCollectionMatchExpression(CollectionMatchExpression expression) throws VilException
Description copied from interface:IMatchVisitorVisits a collection match expression.- Specified by:
visitCollectionMatchExpressionin interfaceIMatchVisitor- Parameters:
expression- the expression- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitParenthesisExpression
public java.lang.Object visitParenthesisExpression(ParenthesisExpression par) throws VilException
Description copied from interface:IExpressionVisitorVisits a parenthesis node.- Specified by:
visitParenthesisExpressionin interfaceIExpressionVisitor- Parameters:
par- the node- Returns:
- the result of visiting this expression (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitCallExpression
public java.lang.Object visitCallExpression(CallExpression call) throws VilException
Description copied from interface:IExpressionVisitorVisits a call node.- Specified by:
visitCallExpressionin interfaceIExpressionVisitor- Parameters:
call- the node- Returns:
- the result of visiting this expression (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitMultiAndExpression
public java.lang.Object visitMultiAndExpression(MultiAndExpression ex) throws VilException
Description copied from interface:IExpressionVisitorVisits a multi-and expression.- Specified by:
visitMultiAndExpressionin interfaceIExpressionVisitor- Parameters:
ex- the expression- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitConstantExpression
public java.lang.Object visitConstantExpression(ConstantExpression cst) throws VilException
Description copied from interface:IExpressionVisitorVisits a constant node.- Specified by:
visitConstantExpressionin interfaceIExpressionVisitor- Parameters:
cst- the node- Returns:
- the result of visiting this expression (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitStringExpression
public java.lang.Object visitStringExpression(StringExpression ex) throws VilException
Description copied from interface:IExpressionVisitorVisits a string expression.- Specified by:
visitStringExpressionin interfaceIExpressionVisitor- Parameters:
ex- the expression- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitVarModelIdentifierExpression
public java.lang.Object visitVarModelIdentifierExpression(VarModelIdentifierExpression identifier) throws VilException
Description copied from interface:IExpressionVisitorVisits a variability model identifier.- Specified by:
visitVarModelIdentifierExpressionin interfaceIExpressionVisitor- Parameters:
identifier- the identifier- Returns:
- the result of visiting this expression (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitVilTypeExpression
public java.lang.Object visitVilTypeExpression(VilTypeExpression typeExpression) throws VilException
Description copied from interface:IExpressionVisitorVisits a VIL type expression.- Specified by:
visitVilTypeExpressionin interfaceIExpressionVisitor- Parameters:
typeExpression- the expression- Returns:
- the result of visiting this expression (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitVariableExpression
public java.lang.Object visitVariableExpression(VariableExpression cst) throws VilException
Description copied from interface:IExpressionVisitorVisits a constant node.- Specified by:
visitVariableExpressionin interfaceIExpressionVisitor- Parameters:
cst- the node- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitFieldAccessExpression
public java.lang.Object visitFieldAccessExpression(FieldAccessExpression ex) throws VilException
Description copied from interface:IExpressionVisitorVisits a field access expression.- Specified by:
visitFieldAccessExpressionin interfaceIExpressionVisitor- Parameters:
ex- the expression- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitExpression
public java.lang.Object visitExpression(Expression ex) throws VilException
Description copied from interface:IExpressionVisitorVisits an unspecified expression (in case of specialized nodes).- Specified by:
visitExpressionin interfaceIExpressionVisitor- Parameters:
ex- the node- Returns:
- the result of visiting this expression (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitValueAssignmentExpression
public java.lang.Object visitValueAssignmentExpression(ValueAssignmentExpression ex) throws VilException
Description copied from interface:IExpressionVisitorVisits a value assignment expression.- Specified by:
visitValueAssignmentExpressionin interfaceIExpressionVisitor- Parameters:
ex- the expression- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitExpressionEvaluator
public java.lang.Object visitExpressionEvaluator(ExpressionEvaluator ex) throws VilException
Description copied from interface:IExpressionVisitorVisits an expression evaluator.- Specified by:
visitExpressionEvaluatorin interfaceIExpressionVisitor- Parameters:
ex- the evaluator- Returns:
- the result of visiting this expression (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitContainerInitializerExpression
public java.lang.Object visitContainerInitializerExpression(ContainerInitializerExpression ex) throws VilException
Description copied from interface:IExpressionVisitorVisits a container initializer expression.- Specified by:
visitContainerInitializerExpressionin interfaceIExpressionVisitor- Parameters:
ex- the expression- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitCompoundMatchExpression
public java.lang.Object visitCompoundMatchExpression(CompoundMatchExpression expression) throws VilException
Description copied from interface:IMatchVisitorVisits a compound match expression.- Specified by:
visitCompoundMatchExpressionin interfaceIMatchVisitor- Parameters:
expression- the expression- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitCompositeExpression
public java.lang.Object visitCompositeExpression(CompositeExpression ex) throws VilException
Description copied from interface:IExpressionVisitorVisits a composite expression.- Specified by:
visitCompositeExpressionin interfaceIExpressionVisitor- Parameters:
ex- the expression- Returns:
- the result of visiting the given statement
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitResolvableOperationExpression
public java.lang.Object visitResolvableOperationExpression(ResolvableOperationExpression ex) throws VilException
Description copied from interface:IExpressionVisitorVisits resolvable operation expression (function pointer resolution).- Specified by:
visitResolvableOperationExpressionin interfaceIExpressionVisitor- Parameters:
ex- the expression- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitResolvableOperationCallExpression
public java.lang.Object visitResolvableOperationCallExpression(ResolvableOperationCallExpression ex) throws VilException
Description copied from interface:IExpressionVisitorVisits resolvable operation call expression (function pointer call).- Specified by:
visitResolvableOperationCallExpressionin interfaceIExpressionVisitor- Parameters:
ex- the expression- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
-