org.iitb.untwine
Class Router

java.lang.Object
  |
  +--org.iitb.untwine.Router
All Implemented Interfaces:
java.io.Serializable

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

This class is designed to store the details of a router

See Also:
Serialized Form

Constructor Summary
Router()
          Default class constructor.
Router(java.lang.String ip)
          Class copy constructor.
 
Method Summary
 java.util.Vector getInt()
          Returns the interfaces corresponding to subnets attached to router
 java.lang.String getIP()
          Returns the IP address of router
 java.util.Vector getPrevHop()
          Returns the previous hop routers to this router
 java.util.Vector getSubnet()
          Returns the subnets attached to router
 void hopAdd(java.lang.Object obj)
          Add index of previous hop router to this router in previous hop list.
 void intAddElement(java.lang.Object obj, int pos)
          Add interface passed as parameter in interface list at the position specified as second parameter.
 int subnetAddElement(java.lang.Object obj)
          Add subnet passed as parameter in subnetList and returns the index of that subnet in subnetList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Router

public Router()
Default class constructor. Initializes all vectors to null

Router

public Router(java.lang.String ip)
Class copy constructor. Constructs the object with IP address as specified in parameter and initializes vectors to null.
Parameters:
ip - IP address of router
Method Detail

getIP

public java.lang.String getIP()
Returns the IP address of router
Returns:
IP address of router as String

getSubnet

public java.util.Vector getSubnet()
Returns the subnets attached to router
Returns:
Vector of subnets attached to this router

getPrevHop

public java.util.Vector getPrevHop()
Returns the previous hop routers to this router
Returns:
Vector of routers' index in routerList which are on previous hop to this router

getInt

public java.util.Vector getInt()
Returns the interfaces corresponding to subnets attached to router
Returns:
Vector of interfaces

subnetAddElement

public int subnetAddElement(java.lang.Object obj)
Add subnet passed as parameter in subnetList and returns the index of that subnet in subnetList
Parameters:
obj - Object of class subnet
Returns:
Position of added obj in subnetList

intAddElement

public void intAddElement(java.lang.Object obj,
                          int pos)
Add interface passed as parameter in interface list at the position specified as second parameter. This corresponds to the position of subnet in the subnetList which is configured on this interface.
Parameters:
obj - Object of class subnet
pos - Position in the interface list where the interface number is to added.

hopAdd

public void hopAdd(java.lang.Object obj)
Add index of previous hop router to this router in previous hop list.
Parameters:
obj - Object of class Integer