All Packages Class Hierarchy This Package Previous Next Index
Class sdsu.test.InteractiveHashtable
java.lang.Object
|
+----java.util.Dictionary
|
+----java.util.Hashtable
|
+----sdsu.test.InteractiveHashtable
- public class InteractiveHashtable
- extends Hashtable
This hashtable acts like a
normal hashtable, except when a key or value is not found on a lookup. In this case, the hashtable
prompts the user via standard in and out for the value in question.
This class should only be used for testing programs.
This class is designed to aid in testing java programs that are run as cgi programs.
When run as a cgi program, various information is sent to the program. When the program is
tested outside the cgi environment, that data is not available.
- Author:
- Roger Whitney (whitney@cs.sdsu.edu)
-
InteractiveHashtable()
-
-
contains(Object)
- Returns true if hashtable cantains value as an element.
-
containsKey(Object)
- Returns true if the collection contains an element for the key.
-
get(Object)
- Gets the object associated with the specified key in the
hashtable.
-
keys()
- Returns an enumeration of the hashtable's keys.
-
valueFromUser(Object)
- Gets value for key from user.
InteractiveHashtable
public InteractiveHashtable()
contains
public synchronized boolean contains(Object value)
- Returns true if hashtable cantains value as an element.
If the table does not contain the value, the user is prompted for the correct
answer.
- Overrides:
- contains in class Hashtable
containsKey
public synchronized boolean containsKey(Object key)
- Returns true if the collection contains an element for the key.
If the table does not contain the value, the user is prompted for the correct
answer.
- Parameters:
- key - the key that we are looking for
- Overrides:
- containsKey in class Hashtable
get
public synchronized Object get(Object key)
- Gets the object associated with the specified key in the
hashtable. If table does not contain the key, prompt the user for
if the table should have the value.
- Parameters:
- key - the specified key
- Returns:
- s the element for the key or null if the key
is not defined in the hash table.
- Overrides:
- get in class Hashtable
- See Also:
- put
keys
public synchronized Enumeration keys()
- Returns an enumeration of the hashtable's keys.
- Overrides:
- keys in class Hashtable
- See Also:
- elements, Enumeration
valueFromUser
protected boolean valueFromUser(Object key)
- Gets value for key from user. Value and key are stored in table.
Returns true if user give value, false if no value is given
All Packages Class Hierarchy This Package Previous Next Index