Class BetaMemory

  • Direct Known Subclasses:
    NotMemory

    public class BetaMemory
    extends java.lang.Object
    Memory for a beta node. It consists of: - indexed memories for each equal constraint (optional for speed) - a result memory (collection)
    • Field Detail

      • state

        protected IOAVState state
        The state.
      • xmems

        protected java.util.Map xmems
        The indexed memories (indexed constraint evaluator -> memory).
      • resultmem

        protected java.util.Set resultmem
        The result memory.
    • Constructor Detail

      • BetaMemory

        public BetaMemory​(IOAVState state)
        Create a new beta memory.
        Parameters:
        node - The beta node.
    • Method Detail

      • addResultTuple

        public boolean addResultTuple​(Tuple tuple)
        Add a tuple to the result.
        Parameters:
        tuple - The result node.
        Returns:
        True, if could be added.
      • removeResultTuple

        public boolean removeResultTuple​(Tuple tuple)
        Remove from the result.
        Parameters:
        tuple - The tuple.
        Returns:
        True, if could be removed.
      • getResultMemory

        public java.util.Collection getResultMemory()
        Get the result memory.
        Returns:
        The result memory.
      • getObjects

        public java.util.Set getObjects​(Tuple tuple,
                                        ConstraintIndexer ci)
        Get the indexed objects per tuple.
        Parameters:
        tuple - The indexed tuple.
        ci - The constraint indexer.
      • getTuples

        public java.util.Set getTuples​(java.lang.Object object,
                                       ConstraintIndexer ci)
        Get the indexed tuples per object.
        Parameters:
        object - The indexed object.
        ci - The constraint indexer.
      • addObject

        public void addObject​(java.lang.Object value,
                              java.lang.Object object,
                              ConstraintIndexer ci)
        Add an value -> object pair to the object index.
        Parameters:
        value - The value.
        object - The object.
        ci - The constraint indexer.
      • removeObject

        public void removeObject​(java.lang.Object object,
                                 ConstraintIndexer ci)
        Remove an object from the object index.
        Parameters:
        object - The object.
        ci - The constraint indexer.
      • addTuple

        public void addTuple​(java.lang.Object value,
                             Tuple tuple,
                             ConstraintIndexer ci)
        Add an value -> object pair to the tuple index.
        Parameters:
        value - The value.
        tuple - The tuple.
        ci - The constraint indexer.
      • removeTuple

        public void removeTuple​(Tuple tuple,
                                ConstraintIndexer ci)
        Remove an value -> object pair from the tuple index.
        Parameters:
        object - The object.
        ci - The constraint indexer.
      • size

        public int size()
        Get the size of the beta memory (including indexed memories).
        Returns:
        The size of the memory.
      • toString

        public java.lang.String toString()
        Get the string representation.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string representation.