Class AbstractTxnMap<K,​V>

  • All Implemented Interfaces:
    java.util.Map<K,​V>, TxnMap<K,​V>
    Direct Known Subclasses:
    NaiveTxnHashMap

    public abstract class AbstractTxnMap<K,​V>
    extends java.lang.Object
    implements TxnMap<K,​V>
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractTxnMap​(Stm stm)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()  
      boolean containsKey​(java.lang.Object key)  
      boolean containsValue​(java.lang.Object value)  
      TxnSet<java.util.Map.Entry<K,​V>> entrySet()
      Returns a TxnSet view of the mappings contained in this map.
      V get​(java.lang.Object key)  
      Stm getStm()
      Returns the Stm that manages this TxnMap.
      boolean isEmpty()  
      boolean isEmpty​(Txn tx)
      Returns true if this map contains no key-value mappings.
      TxnSet<K> keySet()
      Returns a TxnSet view of the keys contained in this map.
      V put​(K key, V value)  
      void putAll​(java.util.Map<? extends K,​? extends V> m)  
      void putAll​(Txn tx, java.util.Map<? extends K,​? extends V> m)
      Copies all of the mappings from the specified map to this map (optional operation).
      V remove​(java.lang.Object key)  
      int size()  
      java.lang.String toString()  
      TxnCollection<V> values()
      Returns a TxnCollection view of the values contained in this map.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
    • Field Detail

      • stm

        protected final Stm stm
      • defaultRefFactory

        protected final TxnRefFactory defaultRefFactory
    • Constructor Detail

      • AbstractTxnMap

        public AbstractTxnMap​(Stm stm)
    • Method Detail

      • getStm

        public final Stm getStm()
        Description copied from interface: TxnMap
        Returns the Stm that manages this TxnMap.
        Specified by:
        getStm in interface TxnMap<K,​V>
        Returns:
        the Stm that manages this map.
      • size

        public int size()
        Specified by:
        size in interface java.util.Map<K,​V>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Map<K,​V>
      • isEmpty

        public boolean isEmpty​(Txn tx)
        Description copied from interface: TxnMap
        Returns true if this map contains no key-value mappings.
        Specified by:
        isEmpty in interface TxnMap<K,​V>
        Returns:
        true if this map contains no key-value mappings
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Map<K,​V>
      • get

        public V get​(java.lang.Object key)
        Specified by:
        get in interface java.util.Map<K,​V>
      • put

        public V put​(K key,
                     V value)
        Specified by:
        put in interface java.util.Map<K,​V>
      • remove

        public V remove​(java.lang.Object key)
        Specified by:
        remove in interface java.util.Map<K,​V>
      • keySet

        public TxnSet<K> keySet()
        Description copied from interface: TxnMap
        Returns a TxnSet view of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.
        Specified by:
        keySet in interface java.util.Map<K,​V>
        Specified by:
        keySet in interface TxnMap<K,​V>
        Returns:
        a set view of the keys contained in this map
      • containsKey

        public boolean containsKey​(java.lang.Object key)
        Specified by:
        containsKey in interface java.util.Map<K,​V>
      • containsValue

        public boolean containsValue​(java.lang.Object value)
        Specified by:
        containsValue in interface java.util.Map<K,​V>
      • putAll

        public void putAll​(java.util.Map<? extends K,​? extends V> m)
        Specified by:
        putAll in interface java.util.Map<K,​V>
      • putAll

        public void putAll​(Txn tx,
                           java.util.Map<? extends K,​? extends V> m)
        Description copied from interface: TxnMap
        Copies all of the mappings from the specified map to this map (optional operation). The effect of this call is equivalent to that of calling put(k, v) on this map once for each mapping from key k to value v in the specified map. The behavior of this operation is undefined if the specified map is modified while the operation is in progress.
        Specified by:
        putAll in interface TxnMap<K,​V>
        m - mappings to be stored in this map
      • values

        public TxnCollection<V> values()
        Description copied from interface: TxnMap
        Returns a TxnCollection view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. If the map is modified while an iteration over the collection is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The collection supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Collection.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.
        Specified by:
        values in interface java.util.Map<K,​V>
        Specified by:
        values in interface TxnMap<K,​V>
        Returns:
        a collection view of the values contained in this map
      • entrySet

        public TxnSet<java.util.Map.Entry<K,​V>> entrySet()
        Description copied from interface: TxnMap
        Returns a TxnSet view of the mappings contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation, or through the setValue operation on a map entry returned by the iterator) the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.
        Specified by:
        entrySet in interface java.util.Map<K,​V>
        Specified by:
        entrySet in interface TxnMap<K,​V>
        Returns:
        a set view of the mappings contained in this map
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object