org.activemath.omdocjdom.mbase
Class ElementFromIDTable

java.lang.Object
  extended by org.activemath.omdocjdom.mbase.ElementFromIDTable
All Implemented Interfaces:
Serializable, Map

public class ElementFromIDTable
extends Object
implements Serializable, Map

This class implements the centrals service for finding an element from a given ID. It currently uses an Hashtable but may very well skip to a less demanding organization, even one that allows reloading of documents if necessary.

Be warned that this table supposes all elements fed in should be of type OJElement and that keys should be of type ID.

Version:
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
static String CVS_ID
           
 Hashtable hashtable
           
 MBaseRef surroundingMBaseRef
           
 
Constructor Summary
ElementFromIDTable()
           
ElementFromIDTable(Hashtable hashtable)
           
ElementFromIDTable(MBaseRef surroundingMBaseRef)
           
 
Method Summary
 Object add(Object key, OJElement element)
           
 void clear()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 boolean doesIDExist(ID id)
           
 Set entrySet()
           
 boolean equals(Object ob)
           
 Object get(Object key)
           
 ID getCanonicalID(ID id)
          Uses both the local table and the surrounding MBaseRef to obtain the canonical ID.
 OJElement getOJelt(Object key)
           
 int hashCode()
           
 boolean isEmpty()
           
 Set keySet()
           
 Object put(Object key, Object element)
           
 void putAll(Map p)
           
 Object remove(Object key)
           
 int size()
           
 Collection values()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CVS_ID

public static final String CVS_ID
See Also:
Constant Field Values

hashtable

public final Hashtable hashtable

surroundingMBaseRef

public final MBaseRef surroundingMBaseRef
Constructor Detail

ElementFromIDTable

public ElementFromIDTable()

ElementFromIDTable

public ElementFromIDTable(MBaseRef surroundingMBaseRef)

ElementFromIDTable

public ElementFromIDTable(Hashtable hashtable)
Method Detail

size

public final int size()
Specified by:
size in interface Map

isEmpty

public final boolean isEmpty()
Specified by:
isEmpty in interface Map

containsKey

public final boolean containsKey(Object key)
Specified by:
containsKey in interface Map

doesIDExist

public final boolean doesIDExist(ID id)

getCanonicalID

public final ID getCanonicalID(ID id)
Uses both the local table and the surrounding MBaseRef to obtain the canonical ID.

Returns:
null if the ID is not found and/or some communication failure occured.

containsValue

public final boolean containsValue(Object value)
Specified by:
containsValue in interface Map

put

public final Object put(Object key,
                        Object element)
Specified by:
put in interface Map

add

public Object add(Object key,
                  OJElement element)

get

public Object get(Object key)
Specified by:
get in interface Map

getOJelt

public OJElement getOJelt(Object key)

remove

public Object remove(Object key)
Specified by:
remove in interface Map

putAll

public void putAll(Map p)
Specified by:
putAll in interface Map

keySet

public Set keySet()
Specified by:
keySet in interface Map

values

public Collection values()
Specified by:
values in interface Map

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map

clear

public void clear()
Specified by:
clear in interface Map

equals

public boolean equals(Object ob)
Specified by:
equals in interface Map
Overrides:
equals in class Object

hashCode

public int hashCode()
Specified by:
hashCode in interface Map
Overrides:
hashCode in class Object