verinec.netsim.util.tables
Class AddressTable

java.lang.Object
  extended by java.util.AbstractMap
      extended by verinec.netsim.util.tables.AddressTable
All Implemented Interfaces:
Map
Direct Known Subclasses:
RoutingTable

public class AddressTable
extends AbstractMap

AddressTable extends AbstractMap and has Time-Tagged Entries.

Version:
$Revision: 47 $
Author:
Dominik Jungo

Nested Class Summary
private  class AddressTable.AddressComparator
          a comparator that compares addresses
protected  class AddressTable.Entry
          a entry with an address as key, an address as associated value and an associated creation time.
private  class AddressTable.TimeComparator
          a comparator that compares the creation times of entries
 
Field Summary
private  HashSet entryset
           
 
Constructor Summary
AddressTable()
          Creates a new AddressTable
 
Method Summary
 Set entrySet()
           
 IAddress getAddress(IAddress key)
          Looks up the value(Address) associated to the key
 IAddress getReverseAddress(IAddress value)
          Looks up the key(Address) associated with the value
 Object put(Object arg0, Object arg1)
           
 Object put(Object arg0, Object arg1, double time)
          Associates the specified value with the specified key and time in this map.
 void removeOlderThan(double time)
          Removes all entries from the Set that are older that time.
 
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

entryset

private HashSet entryset
Constructor Detail

AddressTable

public AddressTable()
Creates a new AddressTable

Method Detail

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map
Specified by:
entrySet in class AbstractMap
See Also:
Map.entrySet()

getAddress

public IAddress getAddress(IAddress key)
Looks up the value(Address) associated to the key

Parameters:
key - a key
Returns:
address associated to the key

getReverseAddress

public IAddress getReverseAddress(IAddress value)
Looks up the key(Address) associated with the value

Parameters:
value - a value (Address)
Returns:
address associated to the value

put

public Object put(Object arg0,
                  Object arg1)
Specified by:
put in interface Map
Overrides:
put in class AbstractMap
See Also:
Map.put(java.lang.Object, java.lang.Object)

put

public Object put(Object arg0,
                  Object arg1,
                  double time)
Associates the specified value with the specified key and time in this map. If the map previously contained a mapping for this key, the old value is replaced.

Parameters:
arg0 - key with which the specified value is to be associated.
arg1 - value to be associated with the specified key.
time - time to be associated with the key value pair
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, if the implementation supports null values.)

removeOlderThan

public void removeOlderThan(double time)
Removes all entries from the Set that are older that time.

Parameters:
time - a time value

Copyright © 2005 Verinec, DIUF