sg.edu.nus.peer.info
Class RoutingTableInfo

java.lang.Object
  extended by sg.edu.nus.peer.info.RoutingTableInfo
All Implemented Interfaces:
java.io.Serializable

public class RoutingTableInfo
extends java.lang.Object
implements java.io.Serializable

Implement a routing table that is composed of a set of RoutingItemInfo.

Version:
1.0 2006-2-6
Author:
Vu Quang Hieu, (Modified by) Xu Linhao
See Also:
Serialized Form

Constructor Summary
RoutingTableInfo(int tableSize)
          Construct an empty routing table with specified table size.
RoutingTableInfo(java.lang.String serializeData)
          Constructing a routing table with serialized data objects.
 
Method Summary
 java.util.Vector getNodeList()
          Deprecated. since this method is not safe. This method is replaced by getRoutingTableNode(int).
 RoutingItemInfo getRoutingTableNode(int idx)
          Get a routing item at specified position.
 int getTableSize()
          Get the size of the routing table.
 void resetRoutingTable(int tableSize)
          Deprecated. since RoutingTableInfo(int) is enough. Construct an empty routing table with specified table size.
 java.lang.String serialize()
          Get the serialized string representation of the RoutingTableInfo.
 void setRoutingTableNode(RoutingItemInfo info, int idx)
          Set a routing item into the routing table.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RoutingTableInfo

public RoutingTableInfo(int tableSize)
Construct an empty routing table with specified table size.

Parameters:
tableSize - the size of the routing table

RoutingTableInfo

public RoutingTableInfo(java.lang.String serializeData)
Constructing a routing table with serialized data objects.

Parameters:
serializeData - the serialized data objects
Method Detail

resetRoutingTable

public void resetRoutingTable(int tableSize)
Deprecated. since RoutingTableInfo(int) is enough. Construct an empty routing table with specified table size.

Parameters:
tableSize - the size of the routing table

getNodeList

public java.util.Vector getNodeList()
Deprecated. since this method is not safe. This method is replaced by getRoutingTableNode(int).

Returns:
the routing table

getTableSize

public int getTableSize()
Get the size of the routing table.

Notice that some items in the routing table may be NULL.

Returns:
the size of the routing table

getRoutingTableNode

public RoutingItemInfo getRoutingTableNode(int idx)
Get a routing item at specified position.

Parameters:
idx - the position of the routing item
Returns:
an instance of RoutingTableNodeInfo

setRoutingTableNode

public void setRoutingTableNode(RoutingItemInfo info,
                                int idx)
Set a routing item into the routing table.

Parameters:
info - the item of the routing table
idx - the position that the item will be inserted

toString

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

serialize

public java.lang.String serialize()
Get the serialized string representation of the RoutingTableInfo.

Returns:
the serialized string representation of the RoutingTableInfo