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 prefix)
          Returns true if this map contains a mapping for the specified key.
 boolean containsValue(String namespaceURI)
          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.
 String get(String prefix)
          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.
 String put(String prefix, String namespaceURI)
          Associates the specified value with the specified key in this map.
 String 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, registerNatives, 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 prefix)
Returns true if this map contains a mapping for the specified key.
Parameters:
prefix - 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(String namespaceURI)
Returns true if this map contains a mapping for the specified value.
Parameters:
namespaceURI - 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 String get(String prefix)
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:
prefix - the key whose associated value is to be returned. The key should be a prefix associated with a particular namespace URI.
Returns:
the namespace URI to which this map maps the specified prefix, or null if the map contains no mapping for this key.

put

public String put(String prefix,
                  String 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 namespace URI associated with specified prefix, or null if there was no mapping for the prefix. A null return can also indicate that the Map previously associated null with the specified key.

remove

public String 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.