All Packages  This Package  Class Hierarchy  Class Search  Index

Class edu.utah.janos.route.RouteTable
java.lang.Object
   |
   +----edu.utah.janos.route.RouteTable

  Summary

public class  RouteTable
     extends java.lang.Object
{
          // Fields 2
     private final Hashtable neighbors;
     private final Hashtable routes;

          // Constructors 1
     public RouteTable();

          // Methods 9
     private static RouteEntry castToRouteEntry(Object);

     public Enumeration getNeighbors();
     public RouteEntry getRoute(int);
     public RouteEntry getRoute(Integer);
     public Enumeration getRoutes();
     public int neighborCount();
     void package_addRoute(RouteEntry);
     void package_removeRoute(RouteEntry);
     public int routeCount();

          // Inner Classes 1
     private class RouteTable.RouteTableInfo
}

Routing table. Maps 32-bit integer "active addresses" to RouteEntries. A RouteEntry contains the core Address object which, in turn, contains the "real" address of the target node. RouteEntry can be subclassed to add more information to the table.

XXX most the hashtable used in this class is indexed by 'ints'. But, that requires allocating (and dropping) a lot of "Integer" objects. Could be optimized by moving to a more pure hashtable (or putting the Integer in the RouteTable. Also, would benefit from parameterized tables.

By design, this class defines a read-only RouteTable for users in other packages. Access to WriteableRouteTable is required to make updates to the RouteTable.

Note that the read-only-ness of this class depends on the immutablity of base RouteEntries.

Author:
Janos Ministry of Development

See Also: WriteableRouteTable


  Cross Reference

Extended By:
WriteableRouteTable

Returned By:
WriteableRouteTable.getRouteTable()





  Fields

· routes

Summary  |  Top
   private final Hashtable routes

The table of all known routes.


· neighbors

Summary  |  Top
   private final Hashtable neighbors

The table of immediate neighbors.


  Constructors

· RouteTable

Summary  |  Top

   public RouteTable() 

Construct a table for routes. The initial table is empty. Routes can be added through addRoute() or ...

XXX take a size hint for the hashtable.



  Methods

· getRoutes

Summary  |  Top
   public Enumeration getRoutes() 


· getNeighbors

Summary  |  Top
   public Enumeration getNeighbors() 


· routeCount

Summary  |  Top
   public int routeCount() 


· neighborCount

Summary  |  Top
   public int neighborCount() 


· castToRouteEntry

Summary  |  Top
   private static RouteEntry castToRouteEntry(Object o) 

A convenience function for casting objects returned from the routes hashtable.

XXX Using parameterized Hashtables would eliminate this, methinks. XXX can't this assert() that all o's are instances of RouteEntry or null?



· getRoute

Summary  |  Top
   public RouteEntry getRoute(int activeDest) 

Retrive the current route to get to the given active address.



· getRoute

Summary  |  Top
   public RouteEntry getRoute(Integer activeDest) 


· package_removeRoute

Summary  |  Top
   void package_removeRoute(RouteEntry r) 

Remove a route from the table.

External access through WriteableRouteTable



· package_addRoute

Summary  |  Top
   void package_addRoute(RouteEntry route) 

Add a route to the table.

External access through WriteableRouteTable



All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7