things.data.language
Class LanguageGenerator_Basic

java.lang.Object
  extended by things.data.language.LanguageGenerator_Basic
All Implemented Interfaces:
LanguageGenerator

public class LanguageGenerator_Basic
extends java.lang.Object
implements LanguageGenerator

Basic implementation of the language interface.

THIS PACKAGE WAS ABANDONED IN FAVOR OF ANOTHER PROJECT

Version:
1.0

Version History

EPG - Initial - 10 MAY 06
 
Author:
Erich P. Gatejen

Field Summary
static java.lang.String LINE_WRAP
           
static java.lang.String SENTENCE_SEPERATOR
           
 
Constructor Summary
LanguageGenerator_Basic()
           
 
Method Summary
 void initialize(WordDictionary dictionary)
          Initialize it with a dictionary.
 void page(AText target, int size, int wrap, java.lang.String wrapPrepend)
          Get a page of paragraphs.
 java.lang.String page(int size, int wrap, java.lang.String wrapPrepend)
          Get a page of paragraphs.
 void paragraph(AText target, int size, int wrap, java.lang.String wrapPrepend)
          Get a paragraph of specified size.
 java.lang.String paragraph(int size, int wrap, java.lang.String wrapPrepend)
          Get a paragraph of specified size.
 void sentence(AText target, int size, int wrap, java.lang.String wrapPrepend)
          Get a sentence of specified size.
 java.lang.String sentence(int size, int wrap, java.lang.String wrapPrepend)
          Get a sentence of specified size.
 java.lang.String word()
          Get a word of random size.
 java.lang.String word(int size)
          Get a word of specified size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LINE_WRAP

public static final java.lang.String LINE_WRAP
See Also:
Constant Field Values

SENTENCE_SEPERATOR

public static final java.lang.String SENTENCE_SEPERATOR
See Also:
Constant Field Values
Constructor Detail

LanguageGenerator_Basic

public LanguageGenerator_Basic()
Method Detail

initialize

public void initialize(WordDictionary dictionary)
                throws java.lang.Throwable
Initialize it with a dictionary.

Specified by:
initialize in interface LanguageGenerator
Parameters:
dictionary -
Throws:
java.lang.Throwable

word

public java.lang.String word()
                      throws java.lang.Throwable
Get a word of random size.

Specified by:
word in interface LanguageGenerator
Returns:
the word.
Throws:
java.lang.Throwable

word

public java.lang.String word(int size)
                      throws java.lang.Throwable
Get a word of specified size

Specified by:
word in interface LanguageGenerator
Parameters:
size - In character count(not byte count). It must be more than 0.
Returns:
the word.
Throws:
java.lang.Throwable

sentence

public java.lang.String sentence(int size,
                                 int wrap,
                                 java.lang.String wrapPrepend)
                          throws java.lang.Throwable
Get a sentence of specified size. It will have language appropriate punctuation and whitespace, which is included in the size count.

Specified by:
sentence in interface LanguageGenerator
Parameters:
size - In character count(not byte count), including whitespace. It must be more than 2.
wrap - Line wrap size. It must be more than 3.
wrapPrepend - if not null, prepend this after each line wrap.
Returns:
the completed sentence
Throws:
java.lang.Throwable

sentence

public void sentence(AText target,
                     int size,
                     int wrap,
                     java.lang.String wrapPrepend)
              throws java.lang.Throwable
Get a sentence of specified size. It will have language appropriate punctuation and whitespace, which is included in the size count.

Specified by:
sentence in interface LanguageGenerator
Parameters:
target - The sentence will be added to this.
size - In character count(not byte count), including whitespace. It must be more than 2.
wrap - Line wrap size. It must be more than 3.
wrapPrepend - if not null, prepend this after each line wrap.
Throws:
java.lang.Throwable

paragraph

public java.lang.String paragraph(int size,
                                  int wrap,
                                  java.lang.String wrapPrepend)
                           throws java.lang.Throwable
Get a paragraph of specified size. It will have language appropriate punctuation and whitespace, which is included in the size count.

Specified by:
paragraph in interface LanguageGenerator
Parameters:
size - In character count(not byte count). It must be more than PARAGRAPH_MIN_SIZE.
wrap - Line wrap size. It must be more than 3.
wrapPrepend - if not null, prepend this after each line wrap.
Returns:
the completed paragraph.
Throws:
java.lang.Throwable

paragraph

public void paragraph(AText target,
                      int size,
                      int wrap,
                      java.lang.String wrapPrepend)
               throws java.lang.Throwable
Get a paragraph of specified size. It will have language appropriate punctuation and whitespace, which is included in the size count.

Specified by:
paragraph in interface LanguageGenerator
Parameters:
size - In character count(not byte count). It must be more than PARAGRAPH_MIN_SIZE.
target - The sentence will be added to this.
wrap - Line wrap size. It must be more than 3.
wrapPrepend - if not null, prepend this after each line wrap.
Throws:
java.lang.Throwable

page

public java.lang.String page(int size,
                             int wrap,
                             java.lang.String wrapPrepend)
                      throws java.lang.Throwable
Get a page of paragraphs. It will have language appropriate punctuation and whitespace, which is included in the size count. Single or double CRLF will be put between paragraphs, but not at the end!

Specified by:
page in interface LanguageGenerator
Parameters:
size - In character count(not byte count). It must be more than PARAGRAPH_MIN_SIZE.
wrap - Line wrap size. It must be more than 3.
wrapPrepend - if not null, prepend this after each line wrap.
Returns:
the completed paragraph.
Throws:
java.lang.Throwable

page

public void page(AText target,
                 int size,
                 int wrap,
                 java.lang.String wrapPrepend)
          throws java.lang.Throwable
Get a page of paragraphs. It will have language appropriate punctuation and whitespace, which is included in the size count. Single or double CRLF will be put between paragraphs, but not at the end!

Specified by:
page in interface LanguageGenerator
Parameters:
size - In character count(not byte count). It must be more than PARAGRAPH_MIN_SIZE.
target - The sentence will be added to this.
wrap - Line wrap size. It must be more than 3.
wrapPrepend - if not null, prepend this after each line wrap.
Throws:
java.lang.Throwable


Things.