Class TypeCache.Entry
java.lang.Object
net.ssehub.easy.reasoning.sseReasoner.model.TypeCache.Entry
- Enclosing class:
TypeCache
Implements a type cache entry. Variables in an entry are relative to
origvar, which must be substituted
finally with the actual top-level variable.- Author:
- Holger Eichelberger
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<TypeCache.ConstraintTemplate> private net.ssehub.easy.varModel.model.AbstractVariableprivate List<TypeCache.Entry> private Map<net.ssehub.easy.varModel.model.AbstractVariable, net.ssehub.easy.varModel.cst.ConstraintSyntaxTree> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateEntry(net.ssehub.easy.varModel.model.AbstractVariable var) Creates a type cache entry. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConstraint(net.ssehub.easy.reasoning.core.reasoner.ConstraintList target, boolean first, net.ssehub.easy.varModel.model.Constraint constraint, boolean register) Adds a constraint to this type cache entry.voidaddParent(TypeCache.Entry entry, TypeCache.IConstraintTarget target, net.ssehub.easy.varModel.confModel.IDecisionVariable register, net.ssehub.easy.varModel.model.AbstractVariable var) Adds a parent to this entry and causes constraint transfer.booleancontainsMapping(net.ssehub.easy.varModel.model.AbstractVariable var) Returns whether the current context contains a mapping forvar.net.ssehub.easy.varModel.cst.ConstraintSyntaxTreegetLocalMapping(String name, net.ssehub.easy.varModel.model.AbstractVariable self) Returns the local mapping for the given variablenamejust from the current context.net.ssehub.easy.varModel.cst.ConstraintSyntaxTreegetMapping(net.ssehub.easy.varModel.model.AbstractVariable var, net.ssehub.easy.varModel.model.AbstractVariable self) Returns the mapped access expression forvartaking into account all current contexts of the stack starting with the current top-most one.booleanReturns whether this cache entry has a variable-accessor mapping.private net.ssehub.easy.varModel.cst.ConstraintSyntaxTreeinstantiate(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cst, net.ssehub.easy.varModel.model.AbstractVariable var) Instantiates a the given constraint.toString()private booleantransferConstraints(TypeCache.IConstraintTarget target, net.ssehub.easy.varModel.confModel.IDecisionVariable register, net.ssehub.easy.varModel.model.AbstractVariable var) Transfers constraints.
-
Field Details
-
origvar
private net.ssehub.easy.varModel.model.AbstractVariable origvar -
constraints
-
parents
-
varMap
private Map<net.ssehub.easy.varModel.model.AbstractVariable,net.ssehub.easy.varModel.cst.ConstraintSyntaxTree> varMap -
nameMap
-
-
Constructor Details
-
Entry
private Entry(net.ssehub.easy.varModel.model.AbstractVariable var) Creates a type cache entry.- Parameters:
var- the variable the constraint are bound to
-
-
Method Details
-
addConstraint
public void addConstraint(net.ssehub.easy.reasoning.core.reasoner.ConstraintList target, boolean first, net.ssehub.easy.varModel.model.Constraint constraint, boolean register) Adds a constraint to this type cache entry.- Parameters:
target- the target listfirst- whether the constraint shall be added to front or backconstraint- the constraintregister- shall the constraint be registered inVariablesMap
-
hasMapping
public boolean hasMapping()Returns whether this cache entry has a variable-accessor mapping. Such mappings are only present if additional constraint translations for this type are needed, e.g., to cope with changing constraint variables.- Returns:
truefor mapping,falseelse
-
containsMapping
public boolean containsMapping(net.ssehub.easy.varModel.model.AbstractVariable var) Returns whether the current context contains a mapping forvar.- Parameters:
var- the variable to look for- Returns:
trueif there is a mapping,falseelse
-
instantiate
private net.ssehub.easy.varModel.cst.ConstraintSyntaxTree instantiate(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cst, net.ssehub.easy.varModel.model.AbstractVariable var) Instantiates a the given constraint.- Parameters:
cst- the constraintvar- the replacing variable- Returns:
- the instantiated constraint
-
getMapping
public net.ssehub.easy.varModel.cst.ConstraintSyntaxTree getMapping(net.ssehub.easy.varModel.model.AbstractVariable var, net.ssehub.easy.varModel.model.AbstractVariable self) Returns the mapped access expression forvartaking into account all current contexts of the stack starting with the current top-most one. IfvarMapis present, performs an on-the-fly instantiation of the mapped accessor. Intended for dynamically building up the mapping in the context stack.- Parameters:
var- the variable to return the mapping forself- the variable to instantiate the stored mapping for- Returns:
- the mapped access expression or null if there is no registered mapping
-
getLocalMapping
public net.ssehub.easy.varModel.cst.ConstraintSyntaxTree getLocalMapping(String name, net.ssehub.easy.varModel.model.AbstractVariable self) Returns the local mapping for the given variablenamejust from the current context. Names are registered once, to the most local (non-shadowed) variable. IfvarMapis present, performs an on-the-fly instantiation of the mapped accessor. Intended for dynamically building up the mapping in the context stack.- Parameters:
name- the name of the variableself- the variable to instantiate the stored mapping for- Returns:
- the mapped access expression or null if there is no registered mapping
-
addParent
public void addParent(TypeCache.Entry entry, TypeCache.IConstraintTarget target, net.ssehub.easy.varModel.confModel.IDecisionVariable register, net.ssehub.easy.varModel.model.AbstractVariable var) Adds a parent to this entry and causes constraint transfer. Shall be applied only to type-compatible types such as refined compounds or derived types.- Parameters:
entry- the entrytarget- the constraint targetregister- the variable to register againstvar- the replacing variable
-
transferConstraints
private boolean transferConstraints(TypeCache.IConstraintTarget target, net.ssehub.easy.varModel.confModel.IDecisionVariable register, net.ssehub.easy.varModel.model.AbstractVariable var) Transfers constraints.- Parameters:
target- the constraint targetregister- the variable to register againstvar- the replacing variable- Returns:
- whether the transfer was done
-
toString
-