org.sixdml
Class SixdmlNamespaceMap

java.lang.Object
  |
  +--org.sixdml.SixdmlNamespaceMap
All Implemented Interfaces:
SixdmlConstants

public class SixdmlNamespaceMap
extends Object
implements SixdmlConstants

  
 SixdmlNamespaceMap.java
 A hashtable containing mappings between prefixes and namespace URIs
 for use by the SixdmlQueryService and SixdmlUpdateService classes. 
 
This class is not thread-safe. Created: Tue Feb 04 02:49:16 2002

Version:
1.0
Author:
Dare Obasanjo
See Also:
SixdmlQueryService, SixdmlUpdateService

Field Summary
private  HashMap namespaceTable
          This is the table of containing mappings of prefixes to namespace URI.
 
Fields inherited from interface org.sixdml.SixdmlConstants
SIXDML_NS, SIXDML_VERSION
 
Constructor Summary
SixdmlNamespaceMap()
          Default constructor initializes class.
 
Method Summary
 void clear()
          Removes all mappings from this map.
 boolean containsKey(String key)
          Returns true if this map contains a mapping for the specified key.
 boolean containsValue(URI value)
          Returns true if this map contains a mapping for the specified value.
 Set entrySet()
          Returns a collection view of the mappings contained in this map.
 URI get(String key)
          Returns the value to which the specified key is mapped in this identity hash map, or null if the map contains no mapping for this key.
 boolean isEmpty()
          Returns true if this map contains no key-value mappings.
 URI put(String prefix, URI namespaceURI)
          Associates the specified value with the specified key in this map.
 URI remove(String prefix)
          Removes the mapping for this key from this map if present.
 int size()
          Returns the number of key-value mappings in this map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

namespaceTable

private HashMap namespaceTable
This is the table of containing mappings of prefixes to namespace URI.

Constructor Detail

SixdmlNamespaceMap

public SixdmlNamespaceMap()
Default constructor initializes class.

Method Detail

clear

public void clear()
Removes all mappings from this map.


containsKey

public boolean containsKey(String key)
Returns true if this map contains a mapping for the specified key.

Parameters:
key - The key whose presence in this map is to be tested. The key should be a namespace prefix.
Returns:
true if this map contains a mapping for the specified key.

containsValue

public boolean containsValue(URI value)
Returns true if this map contains a mapping for the specified value.

Parameters:
value - The value whose presence in this map is to be tested. The value should be a URI.
Returns:
true if this map contains a mapping for the specified value.

isEmpty

public boolean isEmpty()
Returns true if this map contains no key-value mappings.

Returns:
true if this map contains no key-value mappings

size

public int size()
Returns the number of key-value mappings in this map.

Returns:
the number of key-value mappings in this map.

entrySet

public Set entrySet()
Returns a collection view of the mappings contained in this map. Each element in the returned collection is a Map.Entry. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa.

Returns:
collection view of the mappings contained in this map.
See Also:
Map.Entry

get

public URI get(String key)
Returns the value to which the specified key is mapped in this identity hash map, or null if the map contains no mapping for this key. A return value of null does not necessarily indicate that the map contains no mapping for the key; it is also possible that the map explicitly maps the key to null. The containsKey method may be used to distinguish these two cases.

Parameters:
key - the key whose associated value is to be returned. The key should prefix associated with a particular namespace URI.
Returns:
the value to which this map maps the specified key, or null if the map contains no mapping for this key.

put

public URI put(String prefix,
               URI namespaceURI)
Associates the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is replaced.

Parameters:
prefix - key with which the specified value is to be associated.
namespaceURI - value to be associated with the specified key.
Returns:
previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the Map previously associated null with the specified key.

remove

public URI remove(String prefix)
Removes the mapping for this key from this map if present.

Parameters:
prefix - key whose mapping is to be removed from the map.
Returns:
previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key.