Class TypeCache.Entry

java.lang.Object
net.ssehub.easy.reasoning.sseReasoner.model.TypeCache.Entry
Enclosing class:
TypeCache

public class TypeCache.Entry extends Object
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

    Fields
    Modifier and Type
    Field
    Description
     
    private Map<String,net.ssehub.easy.varModel.cst.ConstraintSyntaxTree>
     
    private net.ssehub.easy.varModel.model.AbstractVariable
     
     
    private Map<net.ssehub.easy.varModel.model.AbstractVariable,net.ssehub.easy.varModel.cst.ConstraintSyntaxTree>
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Entry(net.ssehub.easy.varModel.model.AbstractVariable var)
    Creates a type cache entry.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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.
    boolean
    containsMapping(net.ssehub.easy.varModel.model.AbstractVariable var)
    Returns whether the current context contains a mapping for var.
    net.ssehub.easy.varModel.cst.ConstraintSyntaxTree
    getLocalMapping(String name, net.ssehub.easy.varModel.model.AbstractVariable self)
    Returns the local mapping for the given variable name just from the current context.
    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 for var taking into account all current contexts of the stack starting with the current top-most one.
    boolean
    Returns whether this cache entry has a variable-accessor mapping.
    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.
     
    private boolean
    transferConstraints(TypeCache.IConstraintTarget target, net.ssehub.easy.varModel.confModel.IDecisionVariable register, net.ssehub.easy.varModel.model.AbstractVariable var)
    Transfers constraints.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • origvar

      private net.ssehub.easy.varModel.model.AbstractVariable origvar
    • constraints

      private List<TypeCache.ConstraintTemplate> constraints
    • parents

      private List<TypeCache.Entry> parents
    • varMap

      private Map<net.ssehub.easy.varModel.model.AbstractVariable,net.ssehub.easy.varModel.cst.ConstraintSyntaxTree> varMap
    • nameMap

      private Map<String,net.ssehub.easy.varModel.cst.ConstraintSyntaxTree> 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 list
      first - whether the constraint shall be added to front or back
      constraint - the constraint
      register - shall the constraint be registered in VariablesMap
    • 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:
      true for mapping, false else
    • containsMapping

      public boolean containsMapping(net.ssehub.easy.varModel.model.AbstractVariable var)
      Returns whether the current context contains a mapping for var.
      Parameters:
      var - the variable to look for
      Returns:
      true if there is a mapping, false else
    • 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 constraint
      var - 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 for var taking into account all current contexts of the stack starting with the current top-most one. If varMap is 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 for
      self - 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 variable name just from the current context. Names are registered once, to the most local (non-shadowed) variable. If varMap is 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 variable
      self - 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 entry
      target - the constraint target
      register - the variable to register against
      var - 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 target
      register - the variable to register against
      var - the replacing variable
      Returns:
      whether the transfer was done
    • toString

      public String toString()
      Overrides:
      toString in class Object