|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectthings.data.language.WordDictionary
public class WordDictionary
Create a word dictionary. Regardless of what you load, there will always be at least one word per word size in characters from 1 character to the max size characters.
THIS PACKAGE WAS ABANDONED IN FAVOR OF ANOTHER PROJECT
Version History
EPG - Initial -10 MAY 06
Field Summary | |
---|---|
static int[] |
defaultFrequencyChart
The default size frequency chart for random selection. |
static int[] |
firstnameFrequencyChart
The first name size frequency chart for random selection. |
static int[] |
lastnameFrequencyChart
The last name size frequency chart for random selection. |
static int |
MAXSIZE
Maximum supported word size. |
Constructor Summary | |
---|---|
WordDictionary(java.io.InputStream wordSource)
A ready to do stream from which WS delimited words can be found. |
Method Summary | |
---|---|
java.lang.String |
get()
Get a word of random size. |
java.lang.String |
get(int size)
Get a word of specified size. |
java.lang.String |
getMax(int max)
Get a word of random size up to the specified maximum. |
java.lang.String |
getMax(int max,
int[] chart)
Get a word of random size up to the specified maximum. |
void |
refreshMemory()
Refresh what we've remembered. |
void |
setFrequencyChart(int[] chart)
Set the frequency chart. |
java.lang.String |
translate(java.lang.String word)
Translate a word. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAXSIZE
public static int[] defaultFrequencyChart
public static int[] firstnameFrequencyChart
public static int[] lastnameFrequencyChart
Constructor Detail |
---|
public WordDictionary(java.io.InputStream wordSource) throws java.lang.Throwable
wordSource
- a stream to the word source.
java.lang.Throwable
- for any failure.Method Detail |
---|
public void refreshMemory()
public java.lang.String get() throws java.lang.Throwable
java.lang.Throwable
public java.lang.String getMax(int max) throws java.lang.Throwable
max
- max size.
java.lang.Throwable
public java.lang.String getMax(int max, int[] chart) throws java.lang.Throwable
max
- max possible size.chart
- use this frequency chart instead of the configured.
java.lang.Throwable
public java.lang.String get(int size) throws java.lang.Throwable
size
- if less than one, it'll return an empty string. If there is no words of the specified size, it returns an empty string.
java.lang.Throwable
public java.lang.String translate(java.lang.String word) throws java.lang.Throwable
translate
in interface Translator
word
- The word to translate.
java.lang.Throwable
public void setFrequencyChart(int[] chart) throws java.lang.Throwable
chart
- It must be exactly 100 entries. The size will be chosen randomly from one of the hundred.
java.lang.Throwable
- if null or not 100 entries.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |