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 class
InstrumentKeyToIntegerHashMap.ElementEnumeration
-
Constructor Summary
Constructors Constructor Description InstrumentKeyToIntegerHashMap()
InstrumentKeyToIntegerHashMap(int cap)
-
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 mapint
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)
-
-
-
Method Detail
-
allocTable
protected void allocTable(int cap)
-
getSizeInMemory
public long getSizeInMemory()
- Specified by:
getSizeInMemory
in 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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in 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:
clear
in classdeltix.util.collections.VLinkHashMapBase
-
free
protected void free(int idx)
- Overrides:
free
in 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)
-
-