edu.virginia.cs.mng.hypercast
Interface I_Node

All Known Implementing Classes:
HC_Node, DT_Node

public abstract interface I_Node
extends I_Stats

This is the interface for an overlay node. The node is responsible for organizing the overlay and providing information on how to route a message on the overlay. This interface is implemented by the class HC_Node and DT_Node.


Method Summary
 I_LogicalAddress createLogicalAddress(byte[] laddr, int offset)
          Creates a logical address object from a byte array.
 I_AddressPair[] getAllNeighbors()
          Returns the node's neighbors' physical/logical address pairs.
 I_AddressPair[] getChildren(I_LogicalAddress root)
          Returns the node's children's physical/logical address pairs, with respect to the spanning tree rooted at root.
 I_AddressPair getMyAddressPair()
          Returns this logical and physical addresses of this node.
 I_AddressPair getParent(I_LogicalAddress root)
          Returns the addresspair of the next hop for a message routed by this node towards the root.
 void joinGroup()
          Joins the overlay.
 void leaveGroup()
          Leaves the overlay.
 
Methods inherited from interface edu.virginia.cs.mng.hypercast.I_Stats
getSchema, getStats, setStats
 

Method Detail

joinGroup

public void joinGroup()
Joins the overlay. (Includes starting any adapter underneath the node.)
Throws:
java.lang.IllegalStateException - if already joined.

leaveGroup

public void leaveGroup()
Leaves the overlay. (Includes stopping any adapter underneath the node.)
Throws:
java.lang.IllegalStateException - if already left.

getParent

public I_AddressPair getParent(I_LogicalAddress root)
Returns the addresspair of the next hop for a message routed by this node towards the root. The next hop would be the node's parent in the spanning tree rooted at root.
Throws:
java.lang.IllegalStateException - if node has not joined group.

getChildren

public I_AddressPair[] getChildren(I_LogicalAddress root)
Returns the node's children's physical/logical address pairs, with respect to the spanning tree rooted at root.
Throws:
java.lang.IllegalStateException - if node has not joined group.

getAllNeighbors

public I_AddressPair[] getAllNeighbors()
Returns the node's neighbors' physical/logical address pairs.
Throws:
java.lang.IllegalStateException - if node has not joined group.

getMyAddressPair

public I_AddressPair getMyAddressPair()
Returns this logical and physical addresses of this node. This can never be null. (Neither can either the LA or PA part of it.)
Throws:
java.lang.IllegalStateException - if node has not joined group.

createLogicalAddress

public I_LogicalAddress createLogicalAddress(byte[] laddr,
                                             int offset)
Creates a logical address object from a byte array. The number of bytes read is equal to I_Node.getMyAddressPair().getLogicalAddress().getSize().
Throws:
java.lang.IllegalArgumentException - if byte[] is corrupted
ArrayIndexOutOfBoundsException - if byte[] is too small.