Package deltix.qsrv.hf.blocks
Class InstrumentKeyToIntegerHashMap
- java.lang.Object
-
- deltix.util.collections.VLinkHashMapBase
-
- deltix.qsrv.hf.blocks.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classInstrumentKeyToIntegerHashMap.ElementEnumeration
-
Constructor Summary
Constructors Constructor Description InstrumentKeyToIntegerHashMap()InstrumentKeyToIntegerHashMap(int cap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidallocTable(int cap)voidclear()booleancontainsKey(deltix.qsrv.hf.pub.ConstantInstrumentKey key)Quick test for the presence of the specified key.booleancontainsValue(int value)Linearly searches for the specified value.deltix.util.collections.generated.IntegerEnumerationelements()booleanequals(java.lang.Object o)protected intfind(int hidx, deltix.qsrv.hf.pub.ConstantInstrumentKey key)protected intfind(int hidx, deltix.qsrv.hf.pub.InstrumentType keyType, java.lang.CharSequence keySymbol)protected intfind(deltix.qsrv.hf.pub.ConstantInstrumentKey key)protected intfind(deltix.qsrv.hf.pub.InstrumentType type, java.lang.CharSequence symbol)protected voidfree(int idx)intget(deltix.qsrv.hf.pub.ConstantInstrumentKey key, int notFoundValue)intget(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.ConstantInstrumentKeygetKeyObject(deltix.qsrv.hf.pub.InstrumentType type, java.lang.CharSequence symbol)longgetSizeInMemory()inthashCode()protected inthashIndex(deltix.qsrv.hf.pub.ConstantInstrumentKey key)protected inthashIndex(deltix.qsrv.hf.pub.InstrumentType type, java.lang.CharSequence symbol)booleanisEmpty()protected booleankeyEquals(deltix.qsrv.hf.pub.ConstantInstrumentKey a, deltix.qsrv.hf.pub.ConstantInstrumentKey b)protected booleankeyEquals(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)booleanput(deltix.qsrv.hf.pub.ConstantInstrumentKey key, int value)Put new element into the mapintputAndGet(deltix.qsrv.hf.pub.ConstantInstrumentKey key, int value, int notFoundValue)Replace a value and return the old one.intputAndGetIfEmpty(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.booleanputIfEmpty(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 voidputKey(int idx, deltix.qsrv.hf.pub.ConstantInstrumentKey key)booleanremove(deltix.qsrv.hf.pub.ConstantInstrumentKey key)intremove(deltix.qsrv.hf.pub.ConstantInstrumentKey key, int notFoundValue)Remove a value, if existed.protected voidresizeTable(int newSize)int[]valuesToArray(int[] ret)
-
-
-
Method Detail
-
allocTable
protected void allocTable(int cap)
-
getSizeInMemory
public long getSizeInMemory()
- Specified by:
getSizeInMemoryin interfacedeltix.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 keynotFoundValue- 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 keyvalue- 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 keyvalue- The new value to put in tablenotFoundValue- 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 keyvalue- 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 keyvalue- 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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.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:
clearin classdeltix.util.collections.VLinkHashMapBase
-
free
protected void free(int idx)
- Overrides:
freein classdeltix.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)
-
-