ants.jxtagnutant
Class Keywords

java.lang.Object
  |
  +--ants.jxtagnutant.Keywords

public class Keywords
extends Object

Provides a holder for keywords, read from an ASCII file with a set of keywords on each line.

Version:
$Revision: 1.2 $
Author:
Hein Meling

Constructor Summary
Keywords(String kwFile)
          Loads the specified keyword file, entirely.
Keywords(String kwFile, int lines, double mean)
          Loads the specified keyword file, limited by the number of keyword lines to load into the keyword list.
 
Method Summary
 String getKeyword(int index)
          Returns the keyword stored in the given position.
 String getLogRndKeyword()
          Returns a random (exponentional distribution) keyword from the keywordList.
 String getRndKeyword()
          Returns a random (uniformly distributed) keyword from the keywordList.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Keywords

public Keywords(String kwFile)
         throws FileNotFoundException
Loads the specified keyword file, entirely.

Parameters:
kwFile - the filename of the keyword file.

Keywords

public Keywords(String kwFile,
                int lines,
                double mean)
         throws FileNotFoundException
Loads the specified keyword file, limited by the number of keyword lines to load into the keyword list.

Parameters:
kwFile - the filename of the keyword file.
lines - the number of lines to load; used to limit the number of keyword lines to load into the keywordList.
Method Detail

getKeyword

public String getKeyword(int index)
Returns the keyword stored in the given position. If the given index position is outside the table range, it will wrap to a legal position using modulo table size.

Parameters:
index - position into the keywordList.
Returns:
a String containing a set of keywords associated with the given index position in the keywordList.

getRndKeyword

public String getRndKeyword()
Returns a random (uniformly distributed) keyword from the keywordList.

Returns:
a String containing a set of keywords.

getLogRndKeyword

public String getLogRndKeyword()
Returns a random (exponentional distribution) keyword from the keywordList.

Returns:
a String containing a set of keywords.