Import
Class InetImport

java.lang.Object
  |
  +--Import.InetImport

public class InetImport
extends java.lang.Object

Functionality to import topologies that are saved in Inet format (*.inet files) into our graph data structures. We use an undirected graph to represent Inet topologies. Generally, all Import routines would be called by the Model.FileModel class. However, if you only need to import the Graph and not the Model parameters, you can simply call the parse method to obtain the Graph. The model paramters can be access by the getFormatParams method.

All NodeIDs are reinitialized to native BRITE id. A mapping between the actual IDs and the new assigned BRITE Ids are stored in a hashmap id2id with key as the actual IDs and values as the BRITE ids. You can access this mapping by the getIDMap() method.


Constructor Summary
InetImport(java.io.File inFile, int type)
          Class Constructor: Creates a constructor to import either a router-level or an AS-level topology from a specified file.
 
Method Summary
 java.lang.String getFormatParams()
          Model specific parameters if the import file format specifies it.
 java.util.HashMap getIDMap()
          When importing the graph structure in the specified topology, the actual NodeIDs are reinitialized and converted to BRITE IDs.
 Graph parse()
          File parsing is done here.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InetImport

public InetImport(java.io.File inFile,
                  int type)
Class Constructor: Creates a constructor to import either a router-level or an AS-level topology from a specified file.
Parameters:
inFile - the file to import the topology from
type - Either ModelConstants.AS_FILE or ModelConstants.RT_FILE
Method Detail

getIDMap

public java.util.HashMap getIDMap()
When importing the graph structure in the specified topology, the actual NodeIDs are reinitialized and converted to BRITE IDs. A mapping with the actual file IDs as keys and the BRITE IDs as values is maintained, which this method returns.
Returns:
HashMap the mapping

getFormatParams

public java.lang.String getFormatParams()
Model specific parameters if the import file format specifies it. If none exist, "" is returned.
Returns:
String the format specific parameters.

parse

public Graph parse()
File parsing is done here.
Returns:
Graph A BRITE graph containing the topology read in the format.