gov.nist.nlpir.irf.util
Class StringTable

java.lang.Object
  |
  +--gov.nist.nlpir.irf.util.StringTable

public class StringTable
extends java.lang.Object

This class implements a table of unique strings read from a file in the format described below. removal.

Version:
$Revision: 1.1 $
Author:
This software was produced by NIST, an agency of the U.S. government, and by statute is not subject to copyright in the United States. Recipients of this software assume all responsibilities associated with its operation, modification and maintenance.

Field Summary
private static int EOF
          Working copy of end of file marker value
private  java.util.Hashtable table
          Table of strings - key is the string, value is always 0
 
Constructor Summary
StringTable(java.lang.String fileName)
          Creates the StringTable from a file.
 
Method Summary
 boolean containsString(java.lang.String stringToLookUp)
          Tests whether the given string is in the table or not.
 void present()
          Presents the contents of the string table.
 int size()
          Gets number of strings in string table.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

table

private java.util.Hashtable table
Table of strings - key is the string, value is always 0

EOF

private static int EOF
Working copy of end of file marker value
Constructor Detail

StringTable

public StringTable(java.lang.String fileName)
            throws java.io.IOException
Creates the StringTable from a file. The file must contain the list of terms. A term is a sequence of letters and/or digits. Terms must be separated by one or more chars which are not letters/digits. If file cannot be opened, constructor returns with empty stringtable (size() = 0)
Parameters:
filename - the name of the file used.
Throws:
java.io.IOException - if the file cannot be read
Method Detail

size

public int size()
Gets number of strings in string table.
Returns:
number of strings in string table

present

public void present()
Presents the contents of the string table.

containsString

public boolean containsString(java.lang.String stringToLookUp)
Tests whether the given string is in the table or not.
Returns:
true if the word is in the table,
false otherwise.