Structures
Class RouterCollection

java.lang.Object
  extended by Structures.RouterCollection

public class RouterCollection
extends java.lang.Object

Helper class to hold a collection of Router object

Author:
Ioannis Kakavas, Spyridon Dossis

Constructor Summary
RouterCollection()
           
RouterCollection(java.util.Map<java.lang.String,Router> routers)
           
 
Method Summary
 void addRouter(Router r)
          Adding a Router object in the RouterCollection
 java.util.Map<java.lang.String,java.lang.String> createHostNametoIPMap()
          Creates a Map where each of the router's IP address is mapped to its hostname It is used to create a meaningfull network diagram(graph)
 Router getRouter(int index)
          Method to return a single Router based on index
 Router getRouter(java.lang.String routerID)
          Method to return a single Router
 java.util.Collection<Router> getRoutersCollection()
          Method to return a Collection of Routers
 int getSize()
           
 void printCollection()
          Prints the collection of routers
 void saveToXML()
          Persists the collection in a XML file one for each file
 void sortCollection()
          Method for sorting the router based on the RouterComparator definition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RouterCollection

public RouterCollection()

RouterCollection

public RouterCollection(java.util.Map<java.lang.String,Router> routers)
Method Detail

sortCollection

public void sortCollection()
Method for sorting the router based on the RouterComparator definition


getRoutersCollection

public java.util.Collection<Router> getRoutersCollection()
Method to return a Collection of Routers

Returns:
A Collection of routers

getRouter

public Router getRouter(java.lang.String routerID)
Method to return a single Router

Parameters:
routerID - The wanted router's ID
Returns:
The router object

getRouter

public Router getRouter(int index)
Method to return a single Router based on index

Parameters:
index - The index of required Router
Returns:
The router object

addRouter

public void addRouter(Router r)
Adding a Router object in the RouterCollection

Parameters:
r - The Router object to be added

printCollection

public void printCollection()
Prints the collection of routers


createHostNametoIPMap

public java.util.Map<java.lang.String,java.lang.String> createHostNametoIPMap()
Creates a Map where each of the router's IP address is mapped to its hostname It is used to create a meaningfull network diagram(graph)

Returns:
Map

saveToXML

public void saveToXML()
Persists the collection in a XML file one for each file


getSize

public int getSize()