public class BiHashtable
extends java.lang.Object
Constructor and Description |
---|
BiHashtable(int nbStrings)
Initialises the bi-directional hashtable with the vocabulary size
|
BiHashtable(java.util.List<java.lang.String> vocab)
Initialises the bi-directional hashtable translator with the vocabulary
list
|
Modifier and Type | Method and Description |
---|---|
java.lang.Character |
addString(java.lang.String str) |
void |
associate(java.lang.String str,
java.lang.Character c) |
java.lang.Character |
getChar(java.lang.String str)
Get the character associated to the string
|
java.lang.String |
getString(java.lang.Character c)
Returns the string associated to the character
|
java.lang.String |
toString()
Get the string representation of the word-to-character equivalences
contained in the translator
|
public BiHashtable(int nbStrings)
nbStrings
- number of strings in the vocabularypublic BiHashtable(java.util.List<java.lang.String> vocab) throws xmlVocabularySizeTooBig
vocab
- List of words to be translated. The corresponding letters will
start with ascii 'a'.xmlVocabularySizeTooBig
- if no more association can be addedpublic java.lang.Character getChar(java.lang.String str) throws java.lang.NullPointerException
str
- stringjava.lang.NullPointerException
- if the element is nullpublic java.lang.String getString(java.lang.Character c) throws java.lang.NullPointerException
c
- character for which the string is neededjava.lang.NullPointerException
- if the element is nullpublic void associate(java.lang.String str, java.lang.Character c) throws java.lang.NullPointerException
str
- string to be associatedc
- character to be associatedjava.lang.NullPointerException
- if the string or the character is nullpublic java.lang.Character addString(java.lang.String str) throws java.lang.NullPointerException, xmlVocabularySizeTooBig
elem
- element to be associatedc
- character to be associatedjava.lang.NullPointerException
- if the element or the character is nullxmlVocabularySizeTooBig
- if no more association can be addedpublic java.lang.String toString()
toString
in class java.lang.Object
java.lang.NullPointerException
- if the element or the character is null