public class SubstitutionVisitor
extends net.ssehub.easy.varModel.cst.BasicCopyVisitor
clear(). #addVariableMapping(AbstractVariable, Variable)
takes precedence over #setMappings(Map).| Modifier and Type | Field and Description |
|---|---|
private boolean |
containsSelf |
private ContextStack |
globalMapping |
private java.util.Map<net.ssehub.easy.varModel.model.AbstractVariable,net.ssehub.easy.varModel.cst.ConstraintSyntaxTree> |
mapping |
private net.ssehub.easy.varModel.model.AbstractVariable |
self |
private net.ssehub.easy.varModel.cst.ConstraintSyntaxTree |
selfEx |
| Constructor and Description |
|---|
SubstitutionVisitor()
Creates a copy visitor without mapping.
|
SubstitutionVisitor(ContextStack globalMapping)
Creates a copy visitor with explicit mapping.
|
| Modifier and Type | Method and Description |
|---|---|
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree |
accept(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cst)
Accepts this on
cst and returns BasicCopyVisitor.getResult(). |
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree |
acceptAndClear(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cst)
|
SubstitutionVisitor |
addVariableMapping(net.ssehub.easy.varModel.model.AbstractVariable orig,
net.ssehub.easy.varModel.model.AbstractVariable dest,
int derefCount)
Adds a variable mapping to be considered during copying.
|
void |
clear()
Clears this visitor for reuse.
|
SubstitutionVisitor |
clearVariableMapping()
Clears the entire variable mapping.
|
SubstitutionVisitor |
clearVariableMapping(net.ssehub.easy.varModel.model.AbstractVariable var)
Clears the mapping for a given variable.
|
boolean |
containsSelf()
Returns whether the last execution visited a self.
|
private net.ssehub.easy.varModel.cst.ConstraintSyntaxTree |
map(net.ssehub.easy.varModel.cst.Variable variable)
Maps a variable to its accessor expression.
|
void |
setMappings(ContextStack globalMapping)
Sets the mapping.
|
SubstitutionVisitor |
setSelf(net.ssehub.easy.varModel.model.AbstractVariable self)
Defines self in terms of a variable declaration.
|
SubstitutionVisitor |
setSelf(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree selfEx)
Defines self in terms of an expression.
|
void |
visitAnnotationVariable(net.ssehub.easy.varModel.cst.AttributeVariable variable) |
void |
visitComment(net.ssehub.easy.varModel.cst.Comment comment) |
void |
visitSelf(net.ssehub.easy.varModel.cst.Self self) |
void |
visitVariable(net.ssehub.easy.varModel.cst.Variable variable) |
getCopyExpressions, getCopyVariables, getLogger, getResult, inferDatatype, mapVariable, mapVariable, setCopyConstants, setCopyExpressions, setCopyVariables, setDoInferDatatype, setResult, visitBlockExpression, visitCompoundAccess, visitCompoundInitializer, visitConstantValue, visitContainerInitializer, visitContainerOperationCall, visitIfThen, visitLet, visitMultiAndExpression, visitOclFeatureCall, visitParenthesis, visitUnresolvedExpressionprivate java.util.Map<net.ssehub.easy.varModel.model.AbstractVariable,net.ssehub.easy.varModel.cst.ConstraintSyntaxTree> mapping
private ContextStack globalMapping
private net.ssehub.easy.varModel.cst.ConstraintSyntaxTree selfEx
private net.ssehub.easy.varModel.model.AbstractVariable self
private boolean containsSelf
public SubstitutionVisitor()
public SubstitutionVisitor(ContextStack globalMapping)
globalMapping - a mapping from variable declarations to new access expressions,
existing variable declarations are taken over if no mapping is given, may be null
in case of no mapping at allsetMappings(ContextStack)public void setMappings(ContextStack globalMapping)
globalMapping - a mapping from variable declarations to new access expressions,
existing variable declarations are taken over if no mapping is given, may be null
in case of no mapping at allpublic boolean containsSelf()
true for self, false elsepublic void clear()
clear in class net.ssehub.easy.varModel.cst.BasicCopyVisitorclearVariableMapping()public SubstitutionVisitor addVariableMapping(net.ssehub.easy.varModel.model.AbstractVariable orig, net.ssehub.easy.varModel.model.AbstractVariable dest, int derefCount)
#setMappings(Map).
If a variable mapping is defined by #setMappings(Map), potential transitive mappings of dest
are considered and instead of orig-dest, a mapping from orig to the
transitive value is registered.orig - the original variable to be replaced (may be null, ignored)dest - the destination variable to replace orig (may be null, ignored)derefCount - the number of refBy operations to apply to the expression refering to destpublic SubstitutionVisitor clearVariableMapping(net.ssehub.easy.varModel.model.AbstractVariable var)
var - the variable to clear the mapping for (may be null, ignored)public SubstitutionVisitor clearVariableMapping()
public SubstitutionVisitor setSelf(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree selfEx)
selfEx - the expression (may be null, ignored then).public SubstitutionVisitor setSelf(net.ssehub.easy.varModel.model.AbstractVariable self)
setSelf(ConstraintSyntaxTree) on the same expression.self - the variable (declaration) representing self (may be null, ignored then).public net.ssehub.easy.varModel.cst.ConstraintSyntaxTree accept(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cst)
cst and returns BasicCopyVisitor.getResult().cst - the constraint to visitpublic net.ssehub.easy.varModel.cst.ConstraintSyntaxTree acceptAndClear(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cst)
cst - the constraint to visitpublic void visitAnnotationVariable(net.ssehub.easy.varModel.cst.AttributeVariable variable)
visitAnnotationVariable in interface net.ssehub.easy.varModel.cst.IConstraintTreeVisitorvisitAnnotationVariable in class net.ssehub.easy.varModel.cst.BasicCopyVisitorpublic void visitVariable(net.ssehub.easy.varModel.cst.Variable variable)
visitVariable in interface net.ssehub.easy.varModel.cst.IConstraintTreeVisitorvisitVariable in class net.ssehub.easy.varModel.cst.BasicCopyVisitorprivate net.ssehub.easy.varModel.cst.ConstraintSyntaxTree map(net.ssehub.easy.varModel.cst.Variable variable)
variable - the variable to mappublic void visitComment(net.ssehub.easy.varModel.cst.Comment comment)
visitComment in interface net.ssehub.easy.varModel.cst.IConstraintTreeVisitorvisitComment in class net.ssehub.easy.varModel.cst.BasicCopyVisitorpublic void visitSelf(net.ssehub.easy.varModel.cst.Self self)
visitSelf in interface net.ssehub.easy.varModel.cst.IConstraintTreeVisitorvisitSelf in class net.ssehub.easy.varModel.cst.BasicCopyVisitorCopyright © 2009 - 2018 SSE. All Rights Reserved.