fr.dyade.aaa.agent
Class ServersHT

java.lang.Object
  extended by fr.dyade.aaa.agent.ServersHT

public class ServersHT
extends java.lang.Object

This class implements a ServerDesc hashtable, which uses sid as keys.


Constructor Summary
ServersHT()
          Constructs a new, empty hashtable with the default initial capacity and load factor.
 
Method Summary
 void clear()
          Clears this hashtable so that it contains no descriptors.
 java.util.Enumeration elements()
          Returns an enumeration of the server descriptors in this hashtable.
 ServerDesc get(short sid)
          Returns the descriptor of the corresponding server.
 java.util.Enumeration keys()
          Returns an enumeration of the keys (server id.) in this hashtable.
 ServerDesc put(ServerDesc desc)
          Maps the specified desc in this hashtable.
protected  void rehash()
          Increases the capacity of and internally reorganizes this hashtable, in order to accommodate and access its entries more efficiently.
 ServerDesc remove(short sid)
          Removes the descriptor from this hashtable.
 int size()
          Returns the number of entries in this hashtable.
 java.lang.String toString()
          Returns a string representation of this Hashtable object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServersHT

public ServersHT()
Constructs a new, empty hashtable with the default initial capacity and load factor.

Method Detail

size

public int size()
Returns the number of entries in this hashtable.

Returns:
the number of entries in this hashtable.

keys

public java.util.Enumeration keys()
Returns an enumeration of the keys (server id.) in this hashtable.

Returns:
an enumeration of the keys in this hashtable.
See Also:
Enumeration

elements

public java.util.Enumeration elements()
Returns an enumeration of the server descriptors in this hashtable. Use the Enumeration methods on the returned object to fetch the elements sequentially.

Returns:
an enumeration of the values in this hashtable.
See Also:
Enumeration

get

public ServerDesc get(short sid)
Returns the descriptor of the corresponding server.

Parameters:
sid - The server unique identification.
Returns:
the descriptor of the corresponding server.

rehash

protected void rehash()
Increases the capacity of and internally reorganizes this hashtable, in order to accommodate and access its entries more efficiently. This method is called automatically when the number of keys in the hashtable exceeds this hashtable's capacity and load factor.


put

public ServerDesc put(ServerDesc desc)
Maps the specified desc in this hashtable. The descriptor can be retrieved by calling the get method with a key that is equal to the server id.

Parameters:
desc - the descriptor.
Returns:
the previous value of the descriptor, or null if it did not have one.
Throws:
java.lang.NullPointerException - if the descriptor is null.

remove

public ServerDesc remove(short sid)
Removes the descriptor from this hashtable. This method does nothing if the key is not in the hashtable.

Parameters:
sid - the id of server that needs to be removed.
Returns:
the descriptor of the server or null if it is not defined.

clear

public void clear()
Clears this hashtable so that it contains no descriptors.


toString

public java.lang.String toString()
Returns a string representation of this Hashtable object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this hashtable.


Copyright © 2011 ScalAgent D.T.. All Rights Reserved.