org.jcon.data
Class TranslatingMap

java.lang.Object
  extended by org.jcon.data.TranslatingMap
All Implemented Interfaces:
java.util.Map
Direct Known Subclasses:
FieldTranslator

public class TranslatingMap
extends java.lang.Object
implements java.util.Map

A dictionary that serves as a translator between a source dictionary and a client.

Version:
1.0 2/4/97
Author:
Paul Reavis

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
TranslatingMap(java.util.Map source)
           
 
Method Summary
 void clear()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
 java.util.Iterator elements()
          Returns an enumeration of the elements.
 java.util.Set entrySet()
           
 java.lang.Object get(java.lang.Object key)
          Gets the object associated with the specified key in the Map.
protected  java.util.Map getSource()
           
 boolean isEmpty()
          Returns true if the Map contains no elements.
 java.util.Iterator keys()
          Returns an enumeration of the Map's keys.
 java.util.Set keySet()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Puts the specified element into the Map, using the specified key.
 void putAll(java.util.Map map)
           
 java.lang.Object remove(java.lang.Object key)
          Removes the element corresponding to the key.
 int size()
          Returns the number of elements contained within the Map.
protected  java.lang.Object translateElement(java.lang.Object element)
           
protected  java.lang.Object translateKey(java.lang.Object key)
           
protected  java.lang.Object translateMapping(java.lang.Object key, java.lang.Object element)
           
 java.util.Collection values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

TranslatingMap

public TranslatingMap(java.util.Map source)
Method Detail

size

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

Specified by:
size in interface java.util.Map

isEmpty

public boolean isEmpty()
Returns true if the Map contains no elements.

Specified by:
isEmpty in interface java.util.Map

keys

public java.util.Iterator keys()
Returns an enumeration of the Map's keys.


elements

public java.util.Iterator elements()
Returns an enumeration of the elements. Use the Iterator methods on the returned object to fetch the elements sequentially.


get

public java.lang.Object get(java.lang.Object key)
Gets the object associated with the specified key in the Map.

Specified by:
get in interface java.util.Map
Parameters:
key - the key in the hash table
See Also:
Map.put(K, V)

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Puts the specified element into the Map, 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.

Specified by:
put in interface java.util.Map
Parameters:
key - the specified hashtable key
value - the specified element
Returns:
the old value of the key, or null if it did not have one.
Throws:
java.lang.NullPointerException - If the value of the specified element is null.
See Also:
Implementation needs work.

remove

public java.lang.Object remove(java.lang.Object key)
Removes the element corresponding to the key. Does nothing if the key is not present.

Specified by:
remove in interface java.util.Map
Parameters:
key - the key that needs to be removed
Returns:
the value of key, or null if the key was not found. Implementation needs work.

translateKey

protected java.lang.Object translateKey(java.lang.Object key)

translateElement

protected java.lang.Object translateElement(java.lang.Object element)

translateMapping

protected java.lang.Object translateMapping(java.lang.Object key,
                                            java.lang.Object element)

getSource

protected java.util.Map getSource()

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface java.util.Map

containsValue

public boolean containsValue(java.lang.Object value)
Specified by:
containsValue in interface java.util.Map

putAll

public void putAll(java.util.Map map)
Specified by:
putAll in interface java.util.Map

clear

public void clear()
Specified by:
clear in interface java.util.Map

keySet

public java.util.Set keySet()
Specified by:
keySet in interface java.util.Map

entrySet

public java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map

values

public java.util.Collection values()
Specified by:
values in interface java.util.Map