bamboo.router
Class LocationCache

java.lang.Object
  extended by bamboo.router.LocationCache

public class LocationCache
extends Object

A Chord-like location cache; for use in performance evaluations.

Version:
$Id: LocationCache.java,v 1.9 2003/10/05 23:26:52 srhea Exp $
Author:
Sean C. Rhea

Nested Class Summary
protected static class LocationCache.MyIterator
           
protected static class LocationCache.Node
           
 
Field Summary
protected  SortedMap cache
           
protected  int capacity
           
protected  LocationCache.Node first
           
protected  LocationCache.Node last
           
protected  BigInteger MODULUS
           
 
Constructor Summary
LocationCache(int cap, BigInteger mod)
           
 
Method Summary
 void add_node(NeighborInfo ni)
           
protected  void BUG(String msg)
           
protected  BigInteger calc_dist(BigInteger a, BigInteger b)
           
 NeighborInfo closest_node(BigInteger guid)
           
 Iterator iterator()
          Returns an iterator which walks through the set of nodes in the cache, starting with the most recently added.
protected  void rem_n(LocationCache.Node n)
           
 boolean remove_node(NeighborInfo ni)
           
 int size()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MODULUS

protected BigInteger MODULUS

capacity

protected int capacity

cache

protected SortedMap cache

first

protected LocationCache.Node first

last

protected LocationCache.Node last
Constructor Detail

LocationCache

public LocationCache(int cap,
                     BigInteger mod)
Method Detail

size

public int size()

iterator

public Iterator iterator()
Returns an iterator which walks through the set of nodes in the cache, starting with the most recently added.


add_node

public void add_node(NeighborInfo ni)

remove_node

public boolean remove_node(NeighborInfo ni)

toString

public String toString()
Overrides:
toString in class Object

closest_node

public NeighborInfo closest_node(BigInteger guid)

calc_dist

protected BigInteger calc_dist(BigInteger a,
                               BigInteger b)

rem_n

protected void rem_n(LocationCache.Node n)

BUG

protected void BUG(String msg)