|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbcds.phison.io.DemandTypesReader
public class DemandTypesReader
Demand types file (.dtypes) reader.
A demand types file specifies certain properties that are common to groups of connections, for example, in what proportion each group contributes to the total traffic (to be used by traffic generators), or which routing algorithm should be used with each one (to be used by simulators).
One (ficticious) example of a .dtypes file is:
d1 proportion=20,ra=mincost,costtype=unavail_and_edge_bc,w_alpha=0.3 d2 proportion=80,ra=minhop,costtype=hop
The format is line-oriented. Each line has the following format:
id tagwhere
Values can be quoted to include space and other delimiters, such as comma and the equal sign.
Actually, the "value" part is optional, so that
something like ra=mira,use_infinite_capacity,costtype=distance
is valid.
getTypes()
.
Nested Class Summary | |
---|---|
class |
DemandTypesReader.DemandType
DemandType associates a collection of key-value pairs to a demand id. |
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_TYPE
A default demand type. |
Constructor Summary | |
---|---|
DemandTypesReader()
Creates a new instance and automatically inserts a "default" type whose id is "*", with an empty tag. |
|
DemandTypesReader(java.lang.String fname)
Creates a new instance just like DemandTypesReader(java.lang.String) ,
and prepares for reading from the file fname . |
Method Summary | |
---|---|
void |
addDefaultType()
Inserts the "default" demand type. |
java.util.Map<java.lang.String,DemandTypesReader.DemandType> |
getTypes()
Returns a reference to the demand types map. |
void |
read()
Reads the whole file and populates the internal map. |
void |
setInputStream(java.io.Reader ips)
Changes the input stream to ips . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_TYPE
DemandTypesReader()
.
Constructor Detail |
---|
public DemandTypesReader()
public DemandTypesReader(java.lang.String fname)
DemandTypesReader(java.lang.String)
,
and prepares for reading from the file fname
.
AnyException
- wrapping an IOException if any IO error
occurs while instantiating the DataFileReader
object.Method Detail |
---|
public void setInputStream(java.io.Reader ips)
ips
. The interal
DataFileReader
object created in the constructor is replace with a new
one pointing to ips
.
AnyException
- wrapping an IOException if any IO error
occurs while instantiating the DataFileReader
object.public java.util.Map<java.lang.String,DemandTypesReader.DemandType> getTypes()
public void read()
The current demand types are removed prior to the read.
BadFormatException
- if there is a syntax error or
if the demand ids are duplicated.
AnyException
- wrapping an IOException if
any error is encountered while reading.public void addDefaultType()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |