|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cc.mallet.grmm.types.BidirectionalIntObjectMap
public class BidirectionalIntObjectMap
A mapping between integers and objects where the mapping in each direction is efficient. Integers are assigned consecutively, starting at zero, as objects are added to map. Objects can not be deleted from the map and thus the integers are never reused.
This class is exactly like Alphabet in MALLET, except that it does not do the Serialization magic to ensure that two alphabets that are desrialized from the same file are ==. This avoids memory leaks, because MALLET Alphabets are retained in memory forever.
Constructor Summary | |
---|---|
BidirectionalIntObjectMap()
|
|
BidirectionalIntObjectMap(BidirectionalIntObjectMap other)
|
|
BidirectionalIntObjectMap(int capacity)
|
Method Summary | |
---|---|
boolean |
contains(java.lang.Object entry)
|
void |
dump()
|
void |
dump(java.io.PrintStream out)
|
void |
dump(java.io.PrintWriter out)
|
boolean |
growthStopped()
|
java.util.Iterator |
iterator()
|
int |
lookupIndex(java.lang.Object entry)
|
int |
lookupIndex(java.lang.Object entry,
boolean addIfNotPresent)
Return -1 if entry isn't present. |
int[] |
lookupIndices(java.lang.Object[] objects,
boolean addIfNotPresent)
|
java.lang.Object |
lookupObject(int index)
|
java.lang.Object[] |
lookupObjects(int[] indices)
|
java.lang.Object[] |
lookupObjects(int[] indices,
java.lang.Object[] buf)
Returns an array of the objects corresponding to |
int |
size()
|
void |
startGrowth()
|
void |
stopGrowth()
|
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] in)
Returns an array containing all the entries in the Alphabet. |
java.lang.String |
toString()
Return String representation of all Alphabet entries, each separated by a newline. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BidirectionalIntObjectMap(int capacity)
public BidirectionalIntObjectMap()
public BidirectionalIntObjectMap(BidirectionalIntObjectMap other)
Method Detail |
---|
public int lookupIndex(java.lang.Object entry, boolean addIfNotPresent)
public int lookupIndex(java.lang.Object entry)
public java.lang.Object lookupObject(int index)
public java.lang.Object[] toArray()
public java.lang.Object[] toArray(java.lang.Object[] in)
public java.util.Iterator iterator()
public java.lang.Object[] lookupObjects(int[] indices)
public java.lang.Object[] lookupObjects(int[] indices, java.lang.Object[] buf)
indices
- An array of indices to look upbuf
- An array to store the returned objects in.
public int[] lookupIndices(java.lang.Object[] objects, boolean addIfNotPresent)
public boolean contains(java.lang.Object entry)
public int size()
public void stopGrowth()
public void startGrowth()
public boolean growthStopped()
public java.lang.String toString()
toString
in class java.lang.Object
public void dump()
public void dump(java.io.PrintStream out)
public void dump(java.io.PrintWriter out)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |