Package org.basex.util.hash
Class TokenIntMap
- java.lang.Object
-
- org.basex.util.hash.ASet
-
- org.basex.util.hash.TokenSet
-
- org.basex.util.hash.TokenIntMap
-
-
Constructor Summary
Constructors Constructor Description TokenIntMap()
Constructor.TokenIntMap(DataInput in)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
get(byte[] key)
Returns the value for the specified key.void
put(byte[] key, int value)
Indexes the specified key and stores the associated value.void
read(DataInput in)
Reads the data structure from the specified input.protected void
rehash(int newSize)
Rehashes all entries.int
remove(byte[] key)
Removes the entry with the specified key.String
toString()
void
write(DataOutput out)
Writes the data structure to the specified output.-
Methods inherited from class org.basex.util.hash.TokenSet
add, add, clear, contains, hash, id, iterator, key, put
-
Methods inherited from class org.basex.util.hash.ASet
capacity, checkCapacity, checkCapacity, isEmpty, size, toString, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
TokenIntMap
public TokenIntMap()
Constructor.
-
TokenIntMap
public TokenIntMap(DataInput in) throws IOException
Constructor.- Parameters:
in
- input stream- Throws:
IOException
- I/O exception
-
-
Method Detail
-
read
public void read(DataInput in) throws IOException
Description copied from class:TokenSet
Reads the data structure from the specified input.- Overrides:
read
in classTokenSet
- Parameters:
in
- input stream- Throws:
IOException
- I/O exception
-
write
public void write(DataOutput out) throws IOException
Description copied from class:TokenSet
Writes the data structure to the specified output.- Overrides:
write
in classTokenSet
- Parameters:
out
- output stream- Throws:
IOException
- I/O exception
-
put
public void put(byte[] key, int value)
Indexes the specified key and stores the associated value. If the key already exists, the value is updated.- Parameters:
key
- keyvalue
- value
-
get
public int get(byte[] key)
Returns the value for the specified key.- Parameters:
key
- key to be looked up- Returns:
- value, or
-1
if the key was not found
-
remove
public int remove(byte[] key)
Description copied from class:TokenSet
Removes the entry with the specified key. The deletion of keys will lead to empty entries. IfASet.size
is called after deletions, the original number of entries will be returned.
-
rehash
protected void rehash(int newSize)
Description copied from class:ASet
Rehashes all entries.
-
-