Class InstrumentKeyToIntegerHashMap

  • All Implemented Interfaces:
    deltix.util.memory.MemorySizeEstimator, java.io.Serializable, java.lang.Cloneable

    public class InstrumentKeyToIntegerHashMap
    extends deltix.util.collections.VLinkHashMapBase
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int indexMask  
      protected deltix.qsrv.hf.pub.ConstantInstrumentKey[] keys  
      • Fields inherited from class deltix.util.collections.VLinkHashMapBase

        count, freeHead, hashCodeComputer, hashIndex, MIN_CAPACITY, next, NULL, prev
      • Fields inherited from interface deltix.util.memory.MemorySizeEstimator

        ARRAY_OVERHEAD, OBJECT_OVERHEAD, SIZE_OF_BOOLEAN, SIZE_OF_BYTE, SIZE_OF_CHAR, SIZE_OF_DOUBLE, SIZE_OF_FLOAT, SIZE_OF_INT, SIZE_OF_LONG, SIZE_OF_POINTER, SIZE_OF_SHORT
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void allocTable​(int cap)  
      void clear()  
      boolean containsKey​(deltix.qsrv.hf.pub.ConstantInstrumentKey key)
      Quick test for the presence of the specified key.
      boolean containsValue​(int value)
      Linearly searches for the specified value.
      deltix.util.collections.generated.IntegerEnumeration elements()  
      boolean equals​(java.lang.Object o)  
      protected int find​(int hidx, deltix.qsrv.hf.pub.ConstantInstrumentKey key)  
      protected int find​(int hidx, deltix.qsrv.hf.pub.InstrumentType keyType, java.lang.CharSequence keySymbol)  
      protected int find​(deltix.qsrv.hf.pub.ConstantInstrumentKey key)  
      protected int find​(deltix.qsrv.hf.pub.InstrumentType type, java.lang.CharSequence symbol)  
      protected void free​(int idx)  
      int get​(deltix.qsrv.hf.pub.ConstantInstrumentKey key, int notFoundValue)  
      int get​(deltix.qsrv.hf.pub.InstrumentType type, java.lang.CharSequence symbol, int notFoundValue)  
      deltix.qsrv.hf.pub.ConstantInstrumentKey[] getInverseMapSnapshot()
      Returns array that contains keys of this map as values with array indexes matching this map keys.
      deltix.qsrv.hf.pub.ConstantInstrumentKey getKeyObject​(deltix.qsrv.hf.pub.InstrumentType type, java.lang.CharSequence symbol)  
      long getSizeInMemory()  
      int hashCode()  
      protected int hashIndex​(deltix.qsrv.hf.pub.ConstantInstrumentKey key)  
      protected int hashIndex​(deltix.qsrv.hf.pub.InstrumentType type, java.lang.CharSequence symbol)  
      boolean isEmpty()  
      protected boolean keyEquals​(deltix.qsrv.hf.pub.ConstantInstrumentKey a, deltix.qsrv.hf.pub.ConstantInstrumentKey b)  
      protected boolean keyEquals​(deltix.qsrv.hf.pub.ConstantInstrumentKey a, deltix.qsrv.hf.pub.InstrumentType bType, java.lang.CharSequence bSymbol)  
      java.util.Iterator<deltix.qsrv.hf.pub.ConstantInstrumentKey> keyIterator()  
      deltix.util.collections.ElementsEnumeration<deltix.qsrv.hf.pub.ConstantInstrumentKey> keys()  
      deltix.qsrv.hf.pub.ConstantInstrumentKey[] keysToArray​(deltix.qsrv.hf.pub.ConstantInstrumentKey[] ret)  
      boolean put​(deltix.qsrv.hf.pub.ConstantInstrumentKey key, int value)
      Put new element into the map
      int putAndGet​(deltix.qsrv.hf.pub.ConstantInstrumentKey key, int value, int notFoundValue)
      Replace a value and return the old one.
      int putAndGetIfEmpty​(deltix.qsrv.hf.pub.ConstantInstrumentKey key, int value)
      Put new value into the map only if there is no previously stored value under the same key.
      boolean putIfEmpty​(deltix.qsrv.hf.pub.ConstantInstrumentKey key, int value)
      Put new value into the map only if there is no previously stored value under the same key.
      protected void putKey​(int idx, deltix.qsrv.hf.pub.ConstantInstrumentKey key)  
      boolean remove​(deltix.qsrv.hf.pub.ConstantInstrumentKey key)  
      int remove​(deltix.qsrv.hf.pub.ConstantInstrumentKey key, int notFoundValue)
      Remove a value, if existed.
      protected void resizeTable​(int newSize)  
      int[] valuesToArray​(int[] ret)  
      • Methods inherited from class deltix.util.collections.VLinkHashMapBase

        allocEntry, getCapacity, getShrinkFactor, isEmpty, isFilled, setShrinkFactor, size
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • keys

        protected deltix.qsrv.hf.pub.ConstantInstrumentKey[] keys
      • indexMask

        protected int indexMask
    • Constructor Detail

      • InstrumentKeyToIntegerHashMap

        public InstrumentKeyToIntegerHashMap()
      • InstrumentKeyToIntegerHashMap

        public InstrumentKeyToIntegerHashMap​(int cap)
    • Method Detail

      • allocTable

        protected void allocTable​(int cap)
      • getSizeInMemory

        public long getSizeInMemory()
        Specified by:
        getSizeInMemory in interface deltix.util.memory.MemorySizeEstimator
      • resizeTable

        protected void resizeTable​(int newSize)
      • get

        public int get​(deltix.qsrv.hf.pub.InstrumentType type,
                       java.lang.CharSequence symbol,
                       int notFoundValue)
      • getKeyObject

        @Nullable
        public deltix.qsrv.hf.pub.ConstantInstrumentKey getKeyObject​(deltix.qsrv.hf.pub.InstrumentType type,
                                                                     java.lang.CharSequence symbol)
        Returns:
        key object instance if key present in the map
      • get

        public int get​(deltix.qsrv.hf.pub.ConstantInstrumentKey key,
                       int notFoundValue)
      • remove

        public int remove​(deltix.qsrv.hf.pub.ConstantInstrumentKey key,
                          int notFoundValue)
        Remove a value, if existed.
        Parameters:
        key - The key
        notFoundValue - This will be returned if the key was not associated with a value.
        Returns:
        The old value associated with the key, or notFoundValue.
      • put

        public boolean put​(deltix.qsrv.hf.pub.ConstantInstrumentKey key,
                           int value)
        Put new element into the map
        Parameters:
        key - The key
        value - The value
        Returns:
        true if the element is new, false if the key was found.
      • putAndGet

        public int putAndGet​(deltix.qsrv.hf.pub.ConstantInstrumentKey key,
                             int value,
                             int notFoundValue)
        Replace a value and return the old one.
        Parameters:
        key - The key
        value - The new value to put in table
        notFoundValue - This will be returned if the key was not associated with a value.
        Returns:
        The old value associated with the key, or notFoundValue.
      • putAndGetIfEmpty

        public int putAndGetIfEmpty​(deltix.qsrv.hf.pub.ConstantInstrumentKey key,
                                    int value)
        Put new value into the map only if there is no previously stored value under the same key.
        Parameters:
        key - The key
        value - The new value to put in table (but only if the key is not occupied)
        Returns:
        Value that remains in the map.
      • putIfEmpty

        public boolean putIfEmpty​(deltix.qsrv.hf.pub.ConstantInstrumentKey key,
                                  int value)
        Put new value into the map only if there is no previously stored value under the same key.
        Parameters:
        key - The key
        value - The new value to put in table (but only if the key is not occupied)
        Returns:
        True if this map has changed as the result of this call.
      • containsValue

        public final boolean containsValue​(int value)
        Linearly searches for the specified value.
        Parameters:
        value - The value to search.
        Returns:
        Whether the specified value is found.
      • valuesToArray

        public final int[] valuesToArray​(int[] ret)
      • getInverseMapSnapshot

        @Nonnull
        public deltix.qsrv.hf.pub.ConstantInstrumentKey[] getInverseMapSnapshot()
        Returns array that contains keys of this map as values with array indexes matching this map keys. So map [(key1 - 1), (key2 - 2), (key3 - 0)] will be returned as [key3, key1, key2] Values for entries in current map must be distinct and in range 0..size-1. Otherwise Illegal state exception will be thrown.
      • elements

        public deltix.util.collections.generated.IntegerEnumeration elements()
      • equals

        public final boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • putKey

        protected void putKey​(int idx,
                              deltix.qsrv.hf.pub.ConstantInstrumentKey key)
      • keyEquals

        protected final boolean keyEquals​(deltix.qsrv.hf.pub.ConstantInstrumentKey a,
                                          deltix.qsrv.hf.pub.InstrumentType bType,
                                          java.lang.CharSequence bSymbol)
      • keyEquals

        protected final boolean keyEquals​(deltix.qsrv.hf.pub.ConstantInstrumentKey a,
                                          deltix.qsrv.hf.pub.ConstantInstrumentKey b)
      • clear

        public void clear()
        Overrides:
        clear in class deltix.util.collections.VLinkHashMapBase
      • free

        protected void free​(int idx)
        Overrides:
        free in class deltix.util.collections.VLinkHashMapBase
      • keyIterator

        public java.util.Iterator<deltix.qsrv.hf.pub.ConstantInstrumentKey> keyIterator()
      • hashIndex

        protected final int hashIndex​(deltix.qsrv.hf.pub.InstrumentType type,
                                      java.lang.CharSequence symbol)
      • hashIndex

        protected final int hashIndex​(deltix.qsrv.hf.pub.ConstantInstrumentKey key)
      • remove

        public boolean remove​(deltix.qsrv.hf.pub.ConstantInstrumentKey key)
      • find

        protected int find​(deltix.qsrv.hf.pub.InstrumentType type,
                           java.lang.CharSequence symbol)
      • find

        protected int find​(deltix.qsrv.hf.pub.ConstantInstrumentKey key)
      • find

        protected int find​(int hidx,
                           deltix.qsrv.hf.pub.ConstantInstrumentKey key)
      • find

        protected int find​(int hidx,
                           deltix.qsrv.hf.pub.InstrumentType keyType,
                           java.lang.CharSequence keySymbol)
      • containsKey

        public boolean containsKey​(deltix.qsrv.hf.pub.ConstantInstrumentKey key)
        Quick test for the presence of the specified key.
        Parameters:
        key - The key to search.
      • isEmpty

        public final boolean isEmpty()
      • keys

        public deltix.util.collections.ElementsEnumeration<deltix.qsrv.hf.pub.ConstantInstrumentKey> keys()
      • keysToArray

        public final deltix.qsrv.hf.pub.ConstantInstrumentKey[] keysToArray​(deltix.qsrv.hf.pub.ConstantInstrumentKey[] ret)