at.dms.jperf
Class Table
java.lang.Object
|
+--at.dms.jperf.Table
- public class Table
- extends java.lang.Object
This class is the internal representation of the tables T1 and T2.
The meaning of T1 and T2 could be found in explanations of GGPerf's
algorithm.
Constructor Summary |
Table(java.lang.String tableName,
int maxWordLength,
char minCharValue,
char maxCharValue)
Creates an instance of table representing one of T1 and T2. |
Method Summary |
void |
genCode(java.io.PrintWriter out)
Outputs the contents of the table as a data structure, normally an
array. |
long |
getKeyValue(java.lang.String key)
Returns the value previously assigned to the key. |
void |
init()
Initializes the internal structures. |
long |
insertKey(java.lang.String key,
long max)
Inserts the key into the table. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Table
public Table(java.lang.String tableName,
int maxWordLength,
char minCharValue,
char maxCharValue)
- Creates an instance of table representing one of T1 and T2.
- Parameters:
tableName
- the name of the table.maxWordLength
- the maximum length of a keyword.minCharValue
- the smallest ASCII value in all keys.maxCharValue
- the largest ASCII value in all keys?
init
public void init()
- Initializes the internal structures.
insertKey
public long insertKey(java.lang.String key,
long max)
- Inserts the key into the table.
A randomly generated value is assigned to be the table value
correspondent to each character.
- Parameters:
key
- the key to insert.max
- the maximum value.- Returns:
- The sum of the values assigned to each character.
getKeyValue
public long getKeyValue(java.lang.String key)
- Returns the value previously assigned to the key.
- Parameters:
key
- The key.
genCode
public void genCode(java.io.PrintWriter out)
- Outputs the contents of the table as a data structure, normally an
array.
- Parameters:
out
- The output stream.