K
- the key typeV
- the value typepublic class LocalFeatureListIndex<K extends ReadWriteable,V extends LocalFeature<?,?>> extends HashMap<K,LocalFeatureList<V>> implements ReadWriteableBinary
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Field and Description |
---|---|
static byte[] |
BINARY_HEADER
The header used when writing LocalFeatureListIndex to streams and files
|
protected Class<K> |
keyClass |
protected Class<V> |
valueClass |
Constructor and Description |
---|
LocalFeatureListIndex() |
Modifier and Type | Method and Description |
---|---|
byte[] |
binaryHeader()
Header for binary input.
|
static <K extends ReadWriteable,T extends QuantisedLocalFeature<?>> |
invert(LocalFeatureListIndex<K,T> index)
Invert an index of quantised features.
|
void |
readBinary(DataInput in)
Read internal state from in.
|
void |
writeBinary(DataOutput out)
Write the content of this as binary to out.
|
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
equals, hashCode, toString
public static final byte[] BINARY_HEADER
protected Class<K extends ReadWriteable> keyClass
protected Class<V extends LocalFeature<?,?>> valueClass
public LocalFeatureListIndex()
public void readBinary(DataInput in) throws IOException
ReadableBinary
readBinary
in interface ReadableBinary
in
- source to read from.IOException
- an error reading inputpublic byte[] binaryHeader()
ReadableBinary
binaryHeader
in interface ReadableBinary
binaryHeader
in interface WriteableBinary
public void writeBinary(DataOutput out) throws IOException
WriteableBinary
writeBinary
in interface WriteableBinary
out
- sink to write toIOException
- an error writing to outpublic static <K extends ReadWriteable,T extends QuantisedLocalFeature<?>> gnu.trove.map.hash.TIntObjectHashMap<gnu.trove.map.hash.TIntObjectHashMap<List<T>>> invert(LocalFeatureListIndex<K,T> index)
Invert an index of quantised features. The inversion process swaps keys
and feature QuantisedLocalFeature.id
s around so that the inverted
index is a hash of ids to QuantisedLocalFeature
s with the
Object.hashCode()
of the key stored in the
QuantisedLocalFeature.id
field.
The original index is not affected by the inversion operation.
T
- the type of local feature.K
- the type of key.index
- the index to invert.