All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Acme.WildcardDictionary

java.lang.Object
   |
   +----java.util.Dictionary
           |
           +----Acme.WildcardDictionary

public class WildcardDictionary
extends Dictionary
A dictionary with wildcard lookups.

The keys in this dictionary are wildcard patterns. When you do a get(), the string you pass in is matched against all the patterns, and the first match is returned.

The wildcard matcher is fairly simple, it implements * meaning any string, ? meaning any single character, and | separating multiple patterns. All other characters must match literally.

Fetch the software.
Fetch the entire Acme package.

See Also:
match

Constructor Index

 o WildcardDictionary()
Constructor.

Method Index

 o elements()
Returns an enumeration of the elements.
 o get(Object)
Gets the object associated with the specified key in the dictionary.
 o isEmpty()
Returns true if the dictionary contains no elements.
 o keys()
Returns an enumeration of the dictionary's keys.
 o put(Object, Object)
Puts the specified element into the Dictionary, using the specified key.
 o remove(Object)
Removes the element corresponding to the key.
 o size()
Returns the number of elements contained within the dictionary.

Constructors

 o WildcardDictionary
 public WildcardDictionary()
Constructor.

Methods

 o size
 public int size()
Returns the number of elements contained within the dictionary.

Overrides:
size in class Dictionary
 o isEmpty
 public boolean isEmpty()
Returns true if the dictionary contains no elements.

Overrides:
isEmpty in class Dictionary
 o keys
 public Enumeration keys()
Returns an enumeration of the dictionary's keys.

Overrides:
keys in class Dictionary
 o elements
 public Enumeration elements()
Returns an enumeration of the elements. Use the Enumeration methods on the returned object to fetch the elements sequentially.

Overrides:
elements in class Dictionary
 o get
 public synchronized Object get(Object key)
Gets the object associated with the specified key in the dictionary. The key is assumed to be a String, which is matched against the wildcard-pattern keys in the dictionary.

Parameters:
key - the string to match
Returns:
s the element for the key, or null if there's no match
Overrides:
get in class Dictionary
See Also:
match
 o put
 public synchronized Object put(Object key,
                                Object element)
Puts the specified element into the Dictionary, using the specified key. The element may be retrieved by doing a get() with the same key. The key and the element cannot be null.

Parameters:
key - the specified wildcard-pattern key
value - the specified element
Returns:
the old value of the key, or null if it did not have one.
Throws: NullPointerException
If the value of the specified element is null.
Overrides:
put in class Dictionary
 o remove
 public synchronized Object remove(Object key)
Removes the element corresponding to the key. Does nothing if the key is not present.

Parameters:
key - the key that needs to be removed
Returns:
the value of key, or null if the key was not found.
Overrides:
remove in class Dictionary

All Packages  Class Hierarchy  This Package  Previous  Next  Index

ACME Java  ACME Labs