Import
Class BriteImport
java.lang.Object
|
+--Import.BriteImport
- public class BriteImport
- extends java.lang.Object
Functionality to import topologies that are saved in Brite format
(*.brite files) back into our data structures. An explanation of the BRITE format
can be found in documentation for the BriteExport class or in the
BRITE user manual at http://www.cs.bu.edu/brite/docs.htm.
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 id information for Nodes 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 |
BriteImport(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 |
BriteImport
public BriteImport(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.