public class Topology extends PropertyContainer implements Cloneable
Constructor and Description |
---|
Topology()
Constructor
|
Topology(boolean directed)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addEdge(String u,
String v)
Add an edge to the topology.
|
void |
addEdge(String u,
String v,
Edge edge)
Add an edge to the topology.
|
void |
addNode(String v,
Node node)
Add a node to the topology
|
Topology |
clone()
Return a copy of this object
|
Set<Pair<String,String>> |
getAllEdges()
Return a set containing all the edge endpoints pair.
|
Set<String> |
getAllNodes()
Return a set containing all the node IDs.
|
String |
getBufferUnit()
Return the unit of buffer size
|
String |
getCapacityUnit()
Return the unit of link capacity
|
String |
getDelayUnit()
Return the unit of link delay
|
String |
getDistanceUnit()
Return the unit of geographical distance (used for link lengths)
|
Edge |
getEdge(Pair<String,String> endpoints)
Return a specific edge in the topology
|
Edge |
getEdge(String u,
String v)
Return a specific edge in the topology
|
Node |
getNode(String v)
Return a specific node of the topology
|
boolean |
isDirected()
Return the type of edges
|
void |
makeDirected()
Makes this topology directed.
|
int |
numberOfEdges()
Return the number of edges in the topology
|
int |
numberOfNodes()
Return the number of nodes in the topology
|
Edge |
removeEdge(String u,
String v)
Remove an edge from the topology
|
Node |
removeNode(String v)
Remove a node to the topology.
|
void |
setBufferUnit(String bufferUnit)
Set the unit of buffer size
|
void |
setCapacityUnit(String capacityUnit)
Set the unit of link capacity
|
void |
setDelayUnit(String delayUnit)
Set the unit of link delay
|
void |
setDistanceUnit(String distanceUnit)
Set the unit of geographical distance (used for nodes coordinates and
link lengths)
|
getAllProperties, getProperty, hasProperty, removeProperty, setProperty
public Topology()
public Topology(boolean directed)
directed
- true
if edges are directed,
false
otherwisepublic boolean isDirected()
true
if edges are directed, false
public void makeDirected()
public String getCapacityUnit()
public void setCapacityUnit(String capacityUnit)
capacityUnit
- the capacity unit to setpublic String getDelayUnit()
public void setDelayUnit(String delayUnit)
delayUnit
- the delay unit to setpublic String getDistanceUnit()
public void setDistanceUnit(String distanceUnit)
distanceUnit
- the distance unit to setpublic String getBufferUnit()
public void setBufferUnit(String bufferUnit)
bufferUnit
- the buffer unit to setpublic void addNode(String v, Node node)
v
- The ID of the nodenode
- The Node objectpublic Node removeNode(String v)
v
- The ID of the node to removeNode
object removed if it was present in the
topology. Otherwise, null
is returnedpublic Node getNode(String v)
v
- The ID of the nodenull
is returnedpublic Set<String> getAllNodes()
getNode(String v)
getNode(String)
public int numberOfNodes()
public void addEdge(String u, String v)
u
- The start nodev
- The end nodepublic void addEdge(String u, String v, Edge edge)
u
- The start nodev
- The end nodeedge
- The edge objectpublic Edge removeEdge(String u, String v)
u
- The start nodev
- The end nodenull
is returned.public Edge getEdge(String u, String v)
u
- The edge start nodev
- The edge end nodenull
is
returnedpublic Edge getEdge(Pair<String,String> endpoints)
endpoints
- a pair containing edge endpointsnull
is
returnedpublic Set<Pair<String,String>> getAllEdges()
getEdge(String v, String u)
getEdge(String, String)
public int numberOfEdges()
public Topology clone()
clone
in class PropertyContainer