ubc.cs.JLog.Parser
Class pTermToPacketHashtable

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable
          extended by ubc.cs.JLog.Parser.pTermToPacketHashtable
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map

public class pTermToPacketHashtable
extends java.util.Hashtable

Keeps track of jTerms and their associated pPackets. The packets contain parsing relevant information, which my be needed generate error messages if the term proves to be invalid.

Author:
Glendon Holst
See Also:
Serialized Form

Constructor Summary
pTermToPacketHashtable()
           
 
Method Summary
 ubc.cs.JLog.Parser.pPacket getPacket(jTerm t)
          Finds the packet associated with the given term key.
 ubc.cs.JLog.Parser.pToken getToken(jTerm t, ubc.cs.JLog.Parser.pPacket pp)
          Looks up packet in the hash given a term key, and returns the packets token.
 ubc.cs.JLog.Parser.pPacket putPacket(jTerm t, ubc.cs.JLog.Parser.pPacket pp)
          Associates a term with a packet.
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

pTermToPacketHashtable

public pTermToPacketHashtable()
Method Detail

getPacket

public ubc.cs.JLog.Parser.pPacket getPacket(jTerm t)
Finds the packet associated with the given term key.

Parameters:
t - The term key.
Returns:
The associated packet if there was a match.

putPacket

public ubc.cs.JLog.Parser.pPacket putPacket(jTerm t,
                                            ubc.cs.JLog.Parser.pPacket pp)
Associates a term with a packet.

Parameters:
t - The term key.
pp - The packet to associate with term t.
Returns:
Either null if the term can't have a packet, or the packet returned by the Hashtable.

getToken

public ubc.cs.JLog.Parser.pToken getToken(jTerm t,
                                          ubc.cs.JLog.Parser.pPacket pp)
Looks up packet in the hash given a term key, and returns the packets token. This just encapsulates a common use of this hashtable.

Parameters:
t - The term key.
pp - The packet associated with term t. Used if there is no packet associated in this hashtable.
Returns:
The resulting packet's token if there was a match, otherwise returning the packet pp's token.