opendap.util
Class SortedTable

java.lang.Object
  extended by java.util.Dictionary
      extended by opendap.util.SortedTable
All Implemented Interfaces:
java.io.Serializable

public final class SortedTable
extends java.util.Dictionary
implements java.io.Serializable

SortedTable looks exactly like Hashtable but preserves the insertion order of elements. While this results in slower performance, it ensures that the DAS will always be printed in the same order in which it was read.

See Also:
Serialized Form

Constructor Summary
SortedTable()
           
 
Method Summary
 java.lang.Object elementAt(int index)
          Returns the element at the specified index.
 java.util.Enumeration elements()
          Returns an enumeration of the values in this table.
 java.lang.Object get(java.lang.Object key)
          Returns the value to which the key is mapped in this table.
 java.util.Vector getElementVector()
          Returns a Vector containing the elements in the SortedTable.
 java.lang.Object getKey(int index)
          Returns the key at the specified index.
 boolean isEmpty()
          Tests if this table is empty.
 java.util.Enumeration keys()
          Returns an enumeration of the keys in this table.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Maps the specified key to the specified value in this table.
 java.lang.Object remove(java.lang.Object key)
          Removes the key (and its corresponding value) from this table.
 int size()
          Returns the number of keys in this table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SortedTable

public SortedTable()
Method Detail

size

public int size()
Returns the number of keys in this table.

Specified by:
size in class java.util.Dictionary

isEmpty

public boolean isEmpty()
Tests if this table is empty.

Specified by:
isEmpty in class java.util.Dictionary

keys

public java.util.Enumeration keys()
Returns an enumeration of the keys in this table.

Specified by:
keys in class java.util.Dictionary

elements

public java.util.Enumeration elements()
Returns an enumeration of the values in this table.

Specified by:
elements in class java.util.Dictionary

get

public java.lang.Object get(java.lang.Object key)
Returns the value to which the key is mapped in this table.

Specified by:
get in class java.util.Dictionary
Parameters:
key - a key in this table.
Returns:
the value to which the key is mapped, or null if the key is not mapped to any value in the table.

getKey

public java.lang.Object getKey(int index)
Returns the key at the specified index.

Parameters:
index - the index to return
Returns:
the key at the specified index.

elementAt

public java.lang.Object elementAt(int index)
Returns the element at the specified index.

Parameters:
index - the index to return
Returns:
the element at the specified index.

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
                     throws java.lang.NullPointerException
Maps the specified key to the specified value in this table.

Specified by:
put in class java.util.Dictionary
Parameters:
key - the key
value - the value
Returns:
the previous value to which the key is mapped, or null if the key did not have a previous mapping.
Throws:
java.lang.NullPointerException - if the key or value is null.

remove

public java.lang.Object remove(java.lang.Object key)
Removes the key (and its corresponding value) from this table. If the key is not in the table, do nothing.

Specified by:
remove in class java.util.Dictionary
Parameters:
key - the key to remove.
Returns:
the value to which the key had been mapped, or null if the key did not have a mapping.

getElementVector

public java.util.Vector getElementVector()
Returns a Vector containing the elements in the SortedTable. This is used for more efficient implementation of opendap.dap.Util.uniqueNames() by opendap.dap.DDS.checkSemantics()

Returns:
A Vector containing the elements in this SortedTable.