bamboo.router
Class RoutingTable
java.lang.Object
bamboo.router.RoutingTable
public class RoutingTable
- extends Object
Abstracts the routing table for use by the Router.
- Version:
- $Id: RoutingTable.java,v 1.27 2004/02/13 04:28:01 srhea Exp $
- Author:
- Sean C. Rhea
|
Method Summary |
NeighborInfo |
add(NeighborInfo ni,
double rtt_ms,
boolean pns,
long now_ms)
If the node is of no use as a neighbor, it is not added and null is
returned; if it replaces an existing neighbor who is in turn removed,
that neighbor is returned; if it is added, but does not replace any
existing neighbor, then my_neigbor_info is returned. |
LinkedList |
as_list()
|
protected int |
calc_first_diff(int[] other)
|
boolean |
contains(NeighborInfo ni)
|
BigInteger |
digits_to_guid(int[] digits)
|
boolean |
fills_hole(NeighborInfo ni)
|
void |
force_add(NeighborInfo ni,
double rtt_ms)
|
int[] |
guid_to_digits(BigInteger guid)
|
int |
highest_level()
|
int |
matching_digits(BigInteger guid)
|
NeighborInfo |
next_hop(BigInteger guid,
Set ignore)
|
RoutingTable.RoutingEntry |
primary_re(int digit,
int value)
|
NeighborInfo |
primary(int digit,
int value)
Returns the primary neighbor for this entry, or null if there is a
hole. |
NeighborInfo |
random_neighbor(int digit,
Random rand)
|
int |
remove(NeighborInfo ni)
Returns the level of the routing table from which the node was
removed, or -1 if the node was not in the routing table. |
int |
size()
|
String |
toString()
|
MODULUS
protected BigInteger MODULUS
GUID_DIGITS
protected int GUID_DIGITS
DIGIT_VALUES
protected int DIGIT_VALUES
BITS_PER_DIGIT
protected int BITS_PER_DIGIT
SCALE
protected double SCALE
table
protected RoutingTable.RoutingEntry[][] table
my_neighbor_info
protected NeighborInfo my_neighbor_info
my_routing_entry
protected RoutingTable.RoutingEntry my_routing_entry
my_digits
protected int[] my_digits
size
protected int size
highest_level
protected int highest_level
GRAPHVIZ
protected boolean GRAPHVIZ
RoutingTable
public RoutingTable(NeighborInfo ni,
double scale,
BigInteger mod,
int guid_digits,
int digit_values)
highest_level
public int highest_level()
size
public int size()
digits_to_guid
public BigInteger digits_to_guid(int[] digits)
guid_to_digits
public int[] guid_to_digits(BigInteger guid)
calc_first_diff
protected int calc_first_diff(int[] other)
primary
public NeighborInfo primary(int digit,
int value)
- Returns the primary neighbor for this entry, or null if there is a
hole.
primary_re
public RoutingTable.RoutingEntry primary_re(int digit,
int value)
random_neighbor
public NeighborInfo random_neighbor(int digit,
Random rand)
matching_digits
public int matching_digits(BigInteger guid)
contains
public boolean contains(NeighborInfo ni)
add
public NeighborInfo add(NeighborInfo ni,
double rtt_ms,
boolean pns,
long now_ms)
- If the node is of no use as a neighbor, it is not added and null is
returned; if it replaces an existing neighbor who is in turn removed,
that neighbor is returned; if it is added, but does not replace any
existing neighbor, then my_neigbor_info is returned.
force_add
public void force_add(NeighborInfo ni,
double rtt_ms)
fills_hole
public boolean fills_hole(NeighborInfo ni)
remove
public int remove(NeighborInfo ni)
- Returns the level of the routing table from which the node was
removed, or -1 if the node was not in the routing table.
next_hop
public NeighborInfo next_hop(BigInteger guid,
Set ignore)
as_list
public LinkedList as_list()
toString
public String toString()
- Overrides:
toString in class Object