Class RuleTreeVilVisitor
- java.lang.Object
-
- net.ssehub.easy.producer.ui.productline_editor.instantiator.RuleTreeVilVisitor
-
- All Implemented Interfaces:
IVisitor,IMatchVisitor,IVisitor,IExpressionVisitor
public class RuleTreeVilVisitor extends java.lang.Object implements IVisitor, IExpressionVisitor
A visitor turning a VIL script into a tree suitable for SWT display.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Stack<TreeNode>parentsprivate java.util.List<RuleTreeNode>rootNodes
-
Constructor Summary
Constructors Constructor Description RuleTreeVilVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private TreeNodegetCurrentParent()Returns the current parent.(package private) RuleTreeNode[]getRootNodes()Returns the root nodes.java.lang.ObjectvisitAdvice(Advice advice)Visits an advice.java.lang.ObjectvisitAlternativeExpression(AlternativeExpression alt)Visits an alternative.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.ObjectvisitCompound(Compound compound)Visits a compound.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.ObjectvisitExpressionStatement(ExpressionStatement statement)Visits a statement.java.lang.ObjectvisitFieldAccessExpression(FieldAccessExpression ex)Visits a field access expression.java.lang.ObjectvisitForStatement(ForStatement stmt)Visits a for statement.java.lang.ObjectvisitInstantiateExpression(InstantiateExpression inst)Visits an instantiate expression.java.lang.ObjectvisitJoinExpression(JoinExpression ex)Visits a join expression.java.lang.ObjectvisitJoinVariableDeclaration(JoinVariableDeclaration decl)Visits a join variable declaration.java.lang.ObjectvisitLoadProperties(LoadProperties properties)Visits a load properties directive.java.lang.ObjectvisitMapExpression(MapExpression map)Visits a map 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.ObjectvisitRule(Rule rule)Visits a rule.java.lang.ObjectvisitRule(VtlRule rule)Visits a VTL mapping rule.private voidvisitRuleBlock(TreeNode node, IRuleBlock block)Visits a rule block and add the created nodes as children ofnode.java.lang.ObjectvisitRuleCallExpression(RuleCallExpression ex)Visits a rule call expression.java.lang.ObjectvisitScript(Script script)Visits a script.java.lang.ObjectvisitStrategyCallExpression(StrategyCallExpression call)Visits a strategy call node.java.lang.ObjectvisitStringExpression(StringExpression ex)Visits a string expression.java.lang.ObjectvisitStringMatchExpression(StringMatchExpression expression)Visits a string match expression.java.lang.ObjectvisitTypedef(Typedef typedef)Visits a typedef.java.lang.ObjectvisitValueAssignmentExpression(ValueAssignmentExpression ex)Visits a value assignment expression.java.lang.ObjectvisitVariableDeclaration(VariableDeclaration var)Visits a variable declaration.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.java.lang.ObjectvisitWhileStatement(WhileStatement stmt)Visits a while statement.
-
-
-
Field Detail
-
rootNodes
private java.util.List<RuleTreeNode> rootNodes
-
parents
private java.util.Stack<TreeNode> parents
-
-
Method Detail
-
getRootNodes
RuleTreeNode[] getRootNodes()
Returns the root nodes.- Returns:
- the created root nodes
-
getCurrentParent
private TreeNode getCurrentParent()
Returns the current parent.- Returns:
- the current parent
-
visitVariableDeclaration
public java.lang.Object visitVariableDeclaration(VariableDeclaration var) throws VilException
Description copied from interface:IVisitorVisits a variable declaration.- Specified by:
visitVariableDeclarationin interfaceIVisitor- Parameters:
var- the variable declaration- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitAdvice
public java.lang.Object visitAdvice(Advice advice) throws VilException
Description copied from interface:IVisitorVisits an advice.- Specified by:
visitAdvicein interfaceIVisitor- Parameters:
advice- the advice to be visited- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitExpressionStatement
public java.lang.Object visitExpressionStatement(ExpressionStatement statement) throws VilException
Description copied from interface:IVisitorVisits a statement.- Specified by:
visitExpressionStatementin interfaceIVisitor- Parameters:
statement- the statement- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitTypedef
public java.lang.Object visitTypedef(Typedef typedef) throws VilException
Description copied from interface:IVisitorVisits a typedef.- Specified by:
visitTypedefin interfaceIVisitor- Parameters:
typedef- the typedef- Returns:
- the result of visiting (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
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)
-
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)
-
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)
-
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)
-
visitScript
public java.lang.Object visitScript(Script script) throws VilException
Description copied from interface:IVisitorVisits a script.- Specified by:
visitScriptin interfaceIVisitor- Parameters:
script- the project instance- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitLoadProperties
public java.lang.Object visitLoadProperties(LoadProperties properties) throws VilException
Description copied from interface:IVisitorVisits a load properties directive.- Specified by:
visitLoadPropertiesin interfaceIVisitor- Parameters:
properties- the load properties representation- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitStrategyCallExpression
public java.lang.Object visitStrategyCallExpression(StrategyCallExpression call) throws VilException
Description copied from interface:IVisitorVisits a strategy call node.- Specified by:
visitStrategyCallExpressionin interfaceIVisitor- Parameters:
call- the node- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitRuleCallExpression
public java.lang.Object visitRuleCallExpression(RuleCallExpression ex) throws VilException
Description copied from interface:IVisitorVisits a rule call expression.- Specified by:
visitRuleCallExpressionin interfaceIVisitor- 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)
-
visitJoinExpression
public java.lang.Object visitJoinExpression(JoinExpression ex) throws VilException
Description copied from interface:IVisitorVisits a join expression.- Specified by:
visitJoinExpressionin interfaceIVisitor- Parameters:
ex- the join expression- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitJoinVariableDeclaration
public java.lang.Object visitJoinVariableDeclaration(JoinVariableDeclaration decl) throws VilException
Description copied from interface:IVisitorVisits a join variable declaration.- Specified by:
visitJoinVariableDeclarationin interfaceIVisitor- Parameters:
decl- the declaration- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitAlternativeExpression
public java.lang.Object visitAlternativeExpression(AlternativeExpression alt) throws VilException
Description copied from interface:IVisitorVisits an alternative.- Specified by:
visitAlternativeExpressionin interfaceIVisitor- Parameters:
alt- the alternative- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitRule
public java.lang.Object visitRule(VtlRule rule) throws VilException
Description copied from interface:IVisitorVisits a VTL mapping rule.- Specified by:
visitRulein interfaceIVisitor- Parameters:
rule- the rule- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitRule
public java.lang.Object visitRule(Rule rule) throws VilException
Description copied from interface:IVisitorVisits a rule.- Specified by:
visitRulein interfaceIVisitor- Parameters:
rule- the rule- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitRuleBlock
private void visitRuleBlock(TreeNode node, IRuleBlock block)
Visits a rule block and add the created nodes as children ofnode.- Parameters:
node- the node to be modifiedblock- the block to be visited
-
visitMapExpression
public java.lang.Object visitMapExpression(MapExpression map) throws VilException
Description copied from interface:IVisitorVisits a map expression.- Specified by:
visitMapExpressionin interfaceIVisitor- Parameters:
map- the expression to be visited- Returns:
- the result of visiting the given expression (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitWhileStatement
public java.lang.Object visitWhileStatement(WhileStatement stmt) throws VilException
Description copied from interface:IVisitorVisits a while statement.- Specified by:
visitWhileStatementin interfaceIVisitor- Parameters:
stmt- the statement to be visited- Returns:
- the result of visiting the given expression (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitForStatement
public java.lang.Object visitForStatement(ForStatement stmt) throws VilException
Description copied from interface:IVisitorVisits a for statement.- Specified by:
visitForStatementin interfaceIVisitor- Parameters:
stmt- the statement to be visited- Returns:
- the result of visiting the given expression (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitInstantiateExpression
public java.lang.Object visitInstantiateExpression(InstantiateExpression inst) throws VilException
Description copied from interface:IVisitorVisits an instantiate expression.- Specified by:
visitInstantiateExpressionin interfaceIVisitor- Parameters:
inst- the instantiation expression- Returns:
- the result of visiting the given expression (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)
-
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)
-
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)
-
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)
-
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)
-
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)
-
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)
-
visitCompound
public java.lang.Object visitCompound(Compound compound) throws VilException
Description copied from interface:IVisitorVisits a compound.- Specified by:
visitCompoundin interfaceIVisitor- Parameters:
compound- the compound- Returns:
- the result of visiting (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
-