Import
Class GTImport
java.lang.Object
|
+--Import.GTImport
- public class GTImport
- extends java.lang.Object
Functionality to import topologies that are saved in the GT-ITM
(*.gtitm files) ALT format into our graph data structure. We use
a undirected graph to represent GTITM topologies. (GTITM
topologies are undirected in the sense that they have double
directed edges between each pair or neighboring nodes). This
class does not know how to transit-stub topologies. To import
transit-stub topologies, use the GTTSImport class instead.
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 |
GTImport(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 |
GTImport
public GTImport(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 fromtype
- Either ModelConstants.AS_FILE or ModelConstants.RT_FILE
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.