edu.wlu.cs.levy.RAAM
Class Vectionary

java.lang.Object
  |
  +--edu.wlu.cs.levy.RAAM.Vectionary

public class Vectionary
extends java.lang.Object

Vectionary is a class supporting a mapping from strings to vectors (double-precision arrays).

Since:
JDK1.2

Constructor Summary
Vectionary(int size)
          Creates a dictionary with vector entries of specified size.
 
Method Summary
 int count()
          Returns number of entries.
 void enter(java.lang.String s, double[] p)
          Enters a string<->vector mapping into the dictionary
 void enter(java.lang.String s, double[][] pts)
          Enters vectors->string mappings into the dictionary.
 java.lang.String lookup(double[] p)
          Returns string that keys vector.
 double[][] lookup(java.lang.String s)
          Returns vector(s) keyed by string.
 java.lang.String toString()
          Overrides Object.toString() method.
 int width()
          Returns vector size.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Vectionary

public Vectionary(int size)
Creates a dictionary with vector entries of specified size.

Parameters:
size - vector size
Method Detail

enter

public void enter(java.lang.String s,
                  double[] p)
           throws java.lang.IllegalArgumentException
Enters a string<->vector mapping into the dictionary

Parameters:
s - the string
p - the vector
Throws:
java.lang.IllegalArgumentException - if array length not equal to length specified in call to constructor

enter

public void enter(java.lang.String s,
                  double[][] pts)
Enters vectors->string mappings into the dictionary. This is useful when multiple vectors share the same string.

Parameters:
s - the string
pts - the vectors
Throws:
java.lang.IllegalArgumentException - if array length not equal to length specified in call to constructor

toString

public java.lang.String toString()
Overrides Object.toString() method.

Overrides:
toString in class java.lang.Object
Returns:
a string representing the table for this dictionary

lookup

public double[][] lookup(java.lang.String s)
                  throws java.lang.IllegalArgumentException
Returns vector(s) keyed by string.

Parameters:
s - the string
Returns:
array of vectors keyed by string
Throws:
java.lang.IllegalArgumentException - if there is no such key

lookup

public java.lang.String lookup(double[] p)
                        throws java.lang.IllegalArgumentException
Returns string that keys vector.

Parameters:
p - the vector
Returns:
string that is the key for that vector
Throws:
java.lang.IllegalArgumentException - if there is no key for that vector

width

public int width()
Returns vector size.

Returns:
vector size

count

public int count()
Returns number of entries.

Returns:
number of entries