java.lang.Object
de.grogra.suggest.scope.StringTable
A unique set of strings mapped to a monotonically increasing index.
These indexes often useful to bytecode interpreters that have instructions
referring to strings by unique integer. Indexing is from 0.
We can also get them back out in original order.
Yes, I know that this is similar to
String.intern()
but in this
case, I need the index out not just to make these strings unique.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
get
(int i) Get the ith string or null if out of rangeint
int
size()
String[]
toArray()
Return an array, possibly of length zero, with all strings sitting at their appropriate index within the array.toList()
Return a List, possibly of length zero, with all strings sitting at their appropriate index within the array.toString()
-
Field Details
-
table
-
index
protected int index -
strings
-
-
Constructor Details
-
StringTable
public StringTable()
-
-
Method Details
-
add
-
get
Get the ith string or null if out of range -
size
public int size() -
toArray
Return an array, possibly of length zero, with all strings sitting at their appropriate index within the array. -
toList
Return a List, possibly of length zero, with all strings sitting at their appropriate index within the array. -
getNumberOfStrings
public int getNumberOfStrings() -
toString
-