Class RoutingTable


  • public class RoutingTable
    extends java.lang.Object
    At any time there may only ever be zero or one routing table registered in message bus for each protocol. This class contains a list of named hops and routes that may be used to substitute references to these during route resolving.
    Author:
    Simon Thoresen Hult
    • Constructor Summary

      Constructors 
      Constructor Description
      RoutingTable​(RoutingTableSpec spec)
      Creates a new routing table based on a given specification.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      HopBlueprint getHop​(java.lang.String name)
      Returns the named hop, may be null.
      RoutingTable.HopIterator getHopIterator()
      Returns an iterator for the hops of this table.
      int getNumHops()
      Returns the number of hops that are contained in this.
      int getNumRoutes()
      Returns the number of routes that are contained in this.
      Route getRoute​(java.lang.String name)
      Returns the named route, may be null.
      RoutingTable.RouteIterator getRouteIterator()
      Returns an iterator for the routes of this table.
      boolean hasHop​(java.lang.String name)
      Returns whether or not there exists a named hop in this.
      boolean hasHops()
      Returns whether or not there are any hops in this routing table.
      boolean hasRoute​(java.lang.String name)
      Returns whether or not there exists a named route in this.
      boolean hasRoutes()
      Returns whether or not there are any routes in this routing table.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • RoutingTable

        public RoutingTable​(RoutingTableSpec spec)
        Creates a new routing table based on a given specification. This also verifies the integrity of the table.
        Parameters:
        spec - The specification to use.
    • Method Detail

      • hasHops

        public boolean hasHops()
        Returns whether or not there are any hops in this routing table.
        Returns:
        True if there is at least one hop.
      • getNumHops

        public int getNumHops()
        Returns the number of hops that are contained in this.
        Returns:
        The number of hops.
      • getHopIterator

        public RoutingTable.HopIterator getHopIterator()
        Returns an iterator for the hops of this table.
        Returns:
        An iterator.
      • getRouteIterator

        public RoutingTable.RouteIterator getRouteIterator()
        Returns an iterator for the routes of this table.
        Returns:
        An iterator.
      • hasRoutes

        public boolean hasRoutes()
        Returns whether or not there are any routes in this routing table.
        Returns:
        True if there is at least one route.
      • getNumRoutes

        public int getNumRoutes()
        Returns the number of routes that are contained in this.
        Returns:
        The number of routes.
      • hasHop

        public boolean hasHop​(java.lang.String name)
        Returns whether or not there exists a named hop in this.
        Parameters:
        name - The name of the hop to look for.
        Returns:
        True if the named hop exists.
      • getHop

        public HopBlueprint getHop​(java.lang.String name)
        Returns the named hop, may be null.
        Parameters:
        name - The name of the hop to return.
        Returns:
        The hop implementation object.
      • hasRoute

        public boolean hasRoute​(java.lang.String name)
        Returns whether or not there exists a named route in this.
        Parameters:
        name - The name of the route to look for.
        Returns:
        True if the named route exists.
      • getRoute

        public Route getRoute​(java.lang.String name)
        Returns the named route, may be null.
        Parameters:
        name - The name of the route to return.
        Returns:
        The route implementation object.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object