public class NetPlan
extends Object
Class defining a complete network structure.
An unmodifiable version of NetPlan object can be obtained through the copy constructor. Instances work transparently as NetPlan object
unless you try to change it. Calling any method that can potentially change the network (e.g. add/set methods) throws an UnsupportedOperationException
.
Constructor and Description |
---|
NetPlan() |
NetPlan(File file)
Generate a new network structure from a given .n2p file
|
NetPlan(NetPlan aux) |
Modifier and Type | Method and Description |
---|---|
int |
addDemand(int ingressNodeId,
int egressNodeId,
double offeredTrafficInErlangs,
Map<String,String> attributes)
Adds a new traffic demand to the network.
|
void |
addDemandsFrom(NetPlan demands) |
int |
addLink(int originNodeId,
int destinationNodeId,
double linkCapacityInErlangs,
double linkLengthInKm,
Map<String,String> attributes)
Adds a new link to the network.
|
int |
addNode(double x,
double y,
String name,
Map<String,String> attributes)
Adds a new node to the network.
|
int |
addProtectionSegment(int[] sequenceOfLinks,
double reservedBandwidthInErlangs,
Map<String,String> attributes)
Adds a new protection segment to the network.
|
void |
addProtectionSegmentToRouteBackupSegmentList(int segmentId,
int routeId)
Adds a protection segment to the list of backup protection segments of a route.
|
int |
addRoute(int demandId,
double carriedTrafficInErlangs,
int[] sequenceOfLinks,
int[] backupSegmentIds,
Map<String,String> attributes)
Adds a new traffic route to the network.
|
void |
addRoutes(CandidatePathList cpl,
double[] x_p,
boolean includeUnusedRoutes)
Adds traffic routes from a candidate path list.
|
boolean |
checkProtectionSegmentMergeabilityToRoute(int routeId,
int segmentId)
Tests whether a given protection segment is applicable to a route.
|
void |
checkRouteContinuity(int[] sequenceOfLinks) |
void |
checkRouteValidityForDemand(int[] sequenceOfLinks,
int demandId) |
String[] |
checkValidity(boolean forceLinkCapacityConstraint) |
int[] |
convertBackupRoute2SequenceOfLinks(int[] sequenceOfLinksAndSegments) |
int[] |
convertSequenceOfLinks2SequenceOfNodes(int[] sequenceOfLinksAndSegments) |
NetPlan |
copy()
Returns a deep copy of the network design.
|
static NetPlan |
create()
Returns an empty network design.
|
String |
getDemandAttribute(int demandId,
String key)
Returns the value for an attribute of the given demand.
|
String[] |
getDemandAttributeVector(String key) |
double |
getDemandCarriedTrafficInErlangs(int demandId) |
double[] |
getDemandCarriedTrafficInErlangsVector() |
int |
getDemandEgressNode(int demandId)
Returns the identifier of the egress node of the demand.
|
int |
getDemandIngressNode(int demandId)
Returns the identifier of the ingress node of the demand.
|
double |
getDemandOfferedTrafficInErlangs(int demandId) |
double[] |
getDemandOfferedTrafficInErlangsVector() |
int[] |
getDemandRoutes(int demandId) |
Map<String,String> |
getDemandSpecificAttributes(int demandId) |
int[][] |
getDemandTable()
Returns the Dx2 demand table, in which each row represent the ingress and egress node of that demand.
|
String |
getLinkAttribute(int linkId,
String key) |
String[] |
getLinkAttributeVector(String key) |
double |
getLinkCapacityInErlangs(int linkId) |
double[] |
getLinkCapacityInErlangsVector() |
double |
getLinkCapacityNotReservedForProtectionInErlangs(int linkId) |
double[] |
getLinkCapacityNotReservedForProtectionInErlangsVector() |
double |
getLinkCapacityReservedForProtectionInErlangs(int linkId) |
double[] |
getLinkCapacityReservedForProtectionInErlangsVector() |
double[] |
getLinkCarriedTrafficInErlangsVector() |
int |
getLinkDestinationNode(int linkId)
Returns the identifier of the destination node of the link.
|
double |
getLinkLengthInKm(int linkId)
Returns the length of the specified link.
|
double[] |
getLinkLengthInKmVector() |
double |
getLinkMaximumUtilization() |
int |
getLinkOriginNode(int linkId)
Returns the identifier of the origin node of the link.
|
double |
getLinkPropagationDelayInSeconds(int linkId) |
double[] |
getLinkPropagationDelayInSecondsVector() |
double[] |
getLinkSpareCapacityInErlangsVector() |
Map<String,String> |
getLinkSpecificAttributes(int linkId) |
int[][] |
getLinkTable()
Returns the Ex2 link table, in which each row represent the origin and destination node of that link.
|
int[] |
getLinkTraversingProtectionSegments(int linkId) |
int[] |
getLinkTraversingRoutes(int linkId) |
double |
getLinkUtilization(int linkId) |
double[] |
getLinkUtilizationVector() |
int[] |
getMergedBackupRoute(int[] currentPath,
int segmentId) |
int[] |
getMergedRoute(int[] originalRoute,
int[] partialRoute) |
String |
getNetworkAttribute(String key) |
Map<String,String> |
getNetworkAttributes() |
String |
getNodeAttribute(int nodeId,
String key) |
String[] |
getNodeAttributeVector(String key) |
double[] |
getNodeEgressTrafficInErlangsVector() |
int[] |
getNodeIncomingDemands(int nodeId) |
int[] |
getNodeIncomingLinks(int nodeId) |
int[] |
getNodeIncomingRoutes(int nodeId) |
double[] |
getNodeIngressTrafficInErlangsVector() |
String |
getNodeName(int nodeId) |
String[] |
getNodeNameVector() |
int[] |
getNodeOutgoingDemands(int nodeId) |
int[] |
getNodeOutgoingLinks(int nodeId) |
int[] |
getNodeOutgoingRoutes(int nodeId) |
int[] |
getNodePairDemands(int ingressNode,
int egressNode)
Gets all the demands from a given ingress node to a given egress node.
|
int[] |
getNodePairLinks(int node1,
int node2) |
double |
getNodePairPhysicalDistance(int nodeId1,
int nodeId2)
Gets the physical distance between a node pair.
|
int[] |
getNodePairRoutes(int node1,
int node2) |
Map<String,String> |
getNodeSpecificAttributes(int nodeId) |
int[] |
getNodeTraversingLinks(int nodeId)
Gets all the links which has a given node as origin or destination.
|
int[] |
getNodeTraversingProtectionSegments(int nodeId) |
int[] |
getNodeTraversingRoutes(int nodeId) |
double[] |
getNodeTraversingTrafficInErlangsVector() |
double[] |
getNodeXYPosition(int nodeId) |
double[][] |
getNodeXYPositionTable()
Returns the Nx2 node position table, in which each row represent the node position in a 2D plane.
|
int |
getNumberOfDemands()
Returns the number of traffic demands defined within the network.
|
int |
getNumberOfLinks()
Returns the number of unidirectional links defined within the network.
|
int |
getNumberOfNodes()
Returns the number of nodes defined within the network.
|
int |
getNumberOfProtectionSegments()
Returns the number of protection segments defined within the network.
|
int |
getNumberOfRoutes()
Returns the number of routes for traffic demands defined within the network.
|
String |
getProtectionSegmentAttribute(int segmentId,
String key) |
String[] |
getProtectionSegmentAttributeVector(String key) |
int |
getProtectionSegmentDestinationNode(int segmentId)
Returns the identifier of the destination node of the protection segment.
|
boolean |
getProtectionSegmentIsDedicated(int segmentId) |
boolean[] |
getProtectionSegmentIsDedicatedVector() |
double |
getProtectionSegmentLengthInKm(int segmentId) |
double[] |
getProtectionSegmentLengthInKmVector() |
int |
getProtectionSegmentNumberOfHops(int segmentId) |
int[] |
getProtectionSegmentNumberOfHopsVector() |
int |
getProtectionSegmentOriginNode(int segmentId)
Returns the identifier of the origin node of the protection segment.
|
double |
getProtectionSegmentPropagationDelayInSeconds(int segmentId) |
double[] |
getProtectionSegmentPropagationDelayInSecondsVector() |
double |
getProtectionSegmentReservedBandwithInErlangs(int segmentId) |
double[] |
getProtectionSegmentReservedBandwithInErlangsVector() |
int[] |
getProtectionSegmentSequenceOfLinks(int segmentId) |
int[] |
getProtectionSegmentSequenceOfNodes(int segmentId) |
Map<String,String> |
getProtectionSegmentSpecificAttributes(int segmentId) |
List<int[]> |
getRouteAllSequenceOfLinks() |
String |
getRouteAttribute(int routeId,
String key) |
String[] |
getRouteAttributeVector(String key) |
int[] |
getRouteBackupSegmentList(int routeId) |
double |
getRouteCarriedTrafficInErlangs(int routeId) |
double[] |
getRouteCarriedTrafficInErlangsVector() |
int |
getRouteDemand(int routeId) |
int[] |
getRouteDemandVector() |
double |
getRouteLengthInKm(int routeId) |
double[] |
getRouteLengthInKmVector() |
int |
getRouteNumberOfHops(int routeId) |
int[] |
getRouteNumberOfHopsVector() |
double |
getRoutePropagationDelayInSeconds(int routeId) |
double[] |
getRoutePropagationDelayInSecondsVector() |
int[] |
getRouteSequenceOfLinks(int routeId) |
int[] |
getRouteSequenceOfNodes(int routeId) |
Map<String,String> |
getRouteSpecificAttributes(int routeId) |
double[][] |
getTrafficMatrix() |
boolean |
hasDemands()
Returns
true if the network has at least one traffic demand. |
boolean |
hasLinks()
Returns
true if the network has at least one unidirectional link. |
boolean |
hasNodes()
Returns
true if the network has at least one node. |
boolean |
hasProtectionSegments()
Returns
true if the network has at least one protection segment. |
boolean |
hasRoutes()
Returns
true if the network has at least one traffic route. |
void |
removeAllDemands()
Removes all the demands defined within the network.
|
void |
removeAllLinks()
Removes all the links defined within the network.
|
void |
removeAllNodes()
Removes all the nodes defined within the network.
|
void |
removeAllProtectionSegments()
Removes all the protection segments defined within the network.
|
void |
removeAllRoutes()
Removes all the traffic routes defined within the network.
|
void |
removeDemand(int demandId)
Removes the demand identified by the given parameter.
|
void |
removeDemandAttribute(int demandId,
String key) |
void |
removeDemands(int[] demandIds) |
void |
removeLink(int linkId)
Removes the link identified by the given parameter.
|
void |
removeLinkAttribute(int linkId,
String key) |
void |
removeLinks(int[] linkIds) |
void |
removeNetworkAttribute(String key) |
void |
removeNode(int nodeId)
Removes the node identified by the given parameter.
|
void |
removeNodeAttribute(int nodeId,
String key) |
void |
removeNodes(int[] nodeIds) |
void |
removeProtectionSegment(int segmentId)
Removes the specified protection segment from the network.
|
void |
removeProtectionSegmentAttribute(int segmentId,
String key) |
void |
removeProtectionSegmentFromRouteBackupSegmentList(int segmentId,
int routeId)
Removes a protection segment from the list of backup protection segments of a route.
|
void |
removeProtectionSegments(int[] segmentId) |
void |
removeRoute(int routeId)
Removes the traffic route identified by the given parameter.
|
void |
removeRouteAttribute(int routeId,
String key) |
void |
removeRoutes(int[] routeIds) |
void |
reset()
Resets the network.
|
void |
saveToFile(File file) |
void |
setDemandAttribute(int demandId,
String key,
String value) |
void |
setDemandAttributes(int demandId,
Map<String,String> attributes) |
void |
setDemandOfferedTrafficInErlangs(int demandId,
double offeredTrafficInErlangs) |
void |
setLinkAttribute(int linkId,
String key,
String value) |
void |
setLinkAttributes(int linkId,
Map<String,String> attributes) |
void |
setLinkCapacityInErlangs(int linkId,
double linkCapacity)
Sets the capacity of a link.
|
void |
setLinkLengthInKm(int linkId,
double linkLengthInKm)
Sets the length of a link.
|
void |
setNetworkAttribute(String key,
String value) |
void |
setNetworkAttributes(Map<String,String> attributes) |
void |
setNodeAttribute(int nodeId,
String key,
String value) |
void |
setNodeAttributes(int nodeId,
Map<String,String> attributes) |
void |
setNodeName(int nodeId,
String name)
Sets the node name.
|
void |
setNodeXYPosition(int nodeId,
double x,
double y)
Sets the node position.
|
void |
setProtectionSegmentAttribute(int segmentId,
String key,
String value) |
void |
setProtectionSegmentAttributes(int segmentId,
Map<String,String> attributes) |
void |
setProtectionSegmentReservedBandwidthInErlangs(int segmentId,
double reservedBandwidthInErlangs) |
void |
setRouteAttribute(int routeId,
String key,
String value) |
void |
setRouteAttributes(int routeId,
Map<String,String> attributes) |
void |
setRouteCarriedTrafficInErlangs(int routeId,
double carriedTrafficInErlangs) |
String |
toString() |
NetPlan |
unmodifiableView()
Returns an unmodifiable view of the network design.
|
public NetPlan()
public NetPlan(File file)
file
- javax.xml.parsers.ParserConfigurationException
Exception
public NetPlan(NetPlan aux)
aux
- public void removeNodes(int[] nodeIds)
public void removeLinks(int[] linkIds)
public void removeDemands(int[] demandIds)
public void removeRoutes(int[] routeIds)
public void removeProtectionSegments(int[] segmentId)
public int[] getNodePairRoutes(int node1, int node2)
public int[] getNodePairLinks(int node1, int node2)
public List<int[]> getRouteAllSequenceOfLinks()
public double[][] getTrafficMatrix()
public boolean[] getProtectionSegmentIsDedicatedVector()
public boolean getProtectionSegmentIsDedicated(int segmentId)
public double getLinkUtilization(int linkId)
public int[] getMergedRoute(int[] originalRoute, int[] partialRoute)
public double getLinkMaximumUtilization()
public double[] getLinkUtilizationVector()
public NetPlan unmodifiableView()
public int[] getNodePairDemands(int ingressNode, int egressNode)
ingressNode
- Ingress nodeegressNode
- Egress nodepublic double[] getLinkSpareCapacityInErlangsVector()
public double[] getLinkCarriedTrafficInErlangsVector()
public double getDemandCarriedTrafficInErlangs(int demandId)
public double[] getDemandCarriedTrafficInErlangsVector()
public double[] getNodeEgressTrafficInErlangsVector()
public double[] getNodeIngressTrafficInErlangsVector()
public double[] getNodeTraversingTrafficInErlangsVector()
public void reset()
UnsupportedOperationException
- If network design is not modifiablepublic static NetPlan create()
public void removeAllLinks()
Removes all the links defined within the network.
Important: All the traffic routes and protection segments will be also removed.
UnsupportedOperationException
- If network plan is not modifiablepublic void removeAllNodes()
Removes all the nodes defined within the network.
Important: All the links, traffic demands, traffic routes and protection segments will be also removed.
UnsupportedOperationException
- If network plan is not modifiablepublic void removeAllProtectionSegments()
Removes all the protection segments defined within the network.
Important: All the list of protection segments from traffic routes will be cleared.
UnsupportedOperationException
- If network plan is not modifiablepublic double getNodePairPhysicalDistance(int nodeId1, int nodeId2)
nodeId1
- First nodenodeId2
- Second nodepublic int[] getNodeTraversingLinks(int nodeId)
nodeId
- Node identifierpublic void addDemandsFrom(NetPlan demands)
public NetPlan copy()
public int addDemand(int ingressNodeId, int egressNodeId, double offeredTrafficInErlangs, Map<String,String> attributes)
Adds a new traffic demand to the network.
Important: Self-demands are not allowed.
ingressNodeId
- Node identifier of the ingress node. It must be in range [0, N-1], where N is the number of nodes defined in the networkegressNodeId
- Node identifier of the egress node. It must be in range [0, N-1], where N is the number of nodes defined in the networkofferedTrafficInErlangs
- Offered traffic by this demand measured in Erlangs. It must be greater or equal than zeroattributes
- Map for user-defined attributes. The key (String value) in the map will be the attribute name and the value (String value) will be whatever value is stored in that attribute. If null
, it will be assumed to be an empty HashMappublic int addLink(int originNodeId, int destinationNodeId, double linkCapacityInErlangs, double linkLengthInKm, Map<String,String> attributes) throws IllegalArgumentException, UnsupportedOperationException
Adds a new link to the network.
Important: Self-links are not allowed.
originNodeId
- Node identifier of the link origin. It must be in range [0, N-1], where N is the number of nodes defined in the networkdestinationNodeId
- Node identifier of the link destination. It must be in range [0, N-1], where N is the number of nodes defined in the networklinkCapacityInErlangs
- Link capacity measured in Erlangs. It must be greater or equal than zerolinkLengthInKm
- Link length measured in Erlangs. It must be greater or equal than zero. Physical distance between node pairs can be obtained through the getPhysicalDistanceBetweenNodePair()
methodattributes
- Map for user-defined attributes. The key (String value) in the map will be the attribute name and the value (String value) will be whatever value is stored in that attribute. If null
, it will be assumed to be an empty HashMapException
IllegalArgumentException
- If it doesn't exist either of the specified end nodes, link capacity is lower than zero, or link length is lower than zeroUnsupportedOperationException
public int addNode(double x, double y, String name, Map<String,String> attributes)
x
- Node position in x-axisy
- Node position in y-axisname
- Node name. If null
, it will be assume to be "Node " + node identifierattributes
- Map for user-defined attributes. The key (String value) in the map will be the attribute name and the value (String value) will be whatever value is stored in that attribute. If null
, it will be assumed to be an empty HashMappublic void addRoutes(CandidatePathList cpl, double[] x_p, boolean includeUnusedRoutes)
cpl
- Candidate path listx_p
- Carried traffic per route in Erlangs. It must be greater or equal than zeroincludeUnusedRoutes
- Indicate whether routes carrying no traffic will be includedpublic int addRoute(int demandId, double carriedTrafficInErlangs, int[] sequenceOfLinks, int[] backupSegmentIds, Map<String,String> attributes) throws IllegalArgumentException
demandId
- Demand identifiercarriedTrafficInErlangs
- Carried traffic by this route measured in Erlangs. It must be greater or equal than zerosequenceOfLinks
- backupSegmentIds
- attributes
- Map for user-defined attributes. The key (String value) in the map will be the attribute name and the value (String value) will be whatever value is stored in that attribute. If null
, it will be assumed to be an empty HashMapIllegalArgumentException
public double getProtectionSegmentPropagationDelayInSeconds(int segmentId)
public double[] getProtectionSegmentPropagationDelayInSecondsVector()
public double getRoutePropagationDelayInSeconds(int routeId)
public double[] getRoutePropagationDelayInSecondsVector()
public double getLinkPropagationDelayInSeconds(int linkId)
public double[] getLinkPropagationDelayInSecondsVector()
public void addProtectionSegmentToRouteBackupSegmentList(int segmentId, int routeId)
segmentId
- Segment identifierrouteId
- Route identifierpublic void setRouteCarriedTrafficInErlangs(int routeId, double carriedTrafficInErlangs)
public int addProtectionSegment(int[] sequenceOfLinks, double reservedBandwidthInErlangs, Map<String,String> attributes)
assignProtectionSegmentToRoute()
method must be used.sequenceOfLinks
- reservedBandwidthInErlangs
- attributes
- Map for user-defined attributes. The key (String value) in the map will be the attribute name and the value (String value) will be whatever value is stored in that attribute. If null
, it will be assumed to be an empty HashMappublic int[] getMergedBackupRoute(int[] currentPath, int segmentId)
currentPath
- segmentId
- public String[] checkValidity(boolean forceLinkCapacityConstraint)
public void checkRouteContinuity(int[] sequenceOfLinks)
sequenceOfLinks
- public void checkRouteValidityForDemand(int[] sequenceOfLinks, int demandId)
demandId
- sequenceOfLinks
- public String getDemandAttribute(int demandId, String key)
null
value will be returneddemandId
- Demand identifierkey
- Attribute namepublic String[] getDemandAttributeVector(String key)
public Map<String,String> getDemandSpecificAttributes(int demandId)
demandId
- public int getDemandEgressNode(int demandId)
demandId
- Demand identifierpublic int getDemandIngressNode(int demandId)
demandId
- Demand identifierpublic double getDemandOfferedTrafficInErlangs(int demandId)
public double[] getDemandOfferedTrafficInErlangsVector()
public int[][] getDemandTable()
public String getLinkAttribute(int linkId, String key)
linkId
- key
- public String[] getLinkAttributeVector(String key)
public Map<String,String> getLinkSpecificAttributes(int linkId)
linkId
- public double getLinkCapacityInErlangs(int linkId)
linkId
- public double getLinkCapacityReservedForProtectionInErlangs(int linkId)
public double[] getLinkCapacityReservedForProtectionInErlangsVector()
public double getLinkCapacityNotReservedForProtectionInErlangs(int linkId)
public double[] getLinkCapacityNotReservedForProtectionInErlangsVector()
public double[] getLinkCapacityInErlangsVector()
public int getLinkDestinationNode(int linkId)
linkId
- Link identifierpublic double getLinkLengthInKm(int linkId)
linkId
- Link identifierpublic double[] getLinkLengthInKmVector()
public int getLinkOriginNode(int linkId)
linkId
- Link identifierpublic int[][] getLinkTable()
public String getNetworkAttribute(String key)
key
- public Map<String,String> getNetworkAttributes()
public String getNodeAttribute(int nodeId, String key)
nodeId
- key
- public String[] getNodeAttributeVector(String key)
public Map<String,String> getNodeSpecificAttributes(int nodeId)
nodeId
- public int[] getNodeOutgoingRoutes(int nodeId)
public int[] getNodeIncomingRoutes(int nodeId)
public int[] getNodeIncomingDemands(int nodeId)
public int[] getNodeIncomingLinks(int nodeId)
public int[] getNodeOutgoingDemands(int nodeId)
public String getNodeName(int nodeId)
nodeId
- public String[] getNodeNameVector()
public int[] getNodeOutgoingLinks(int nodeId)
public double[] getNodeXYPosition(int nodeId)
nodeId
- public double[][] getNodeXYPositionTable()
public int getNumberOfDemands()
public int getNumberOfLinks()
public int getNumberOfNodes()
public int getNumberOfRoutes()
public int getNumberOfProtectionSegments()
public String getRouteAttribute(int routeId, String key)
routeId
- key
- public String[] getRouteAttributeVector(String key)
public Map<String,String> getRouteSpecificAttributes(int routeId)
routeId
- public int[] getRouteBackupSegmentList(int routeId)
routeId
- public int getRouteDemand(int routeId)
routeId
- public int[] getRouteDemandVector()
public int[] getDemandRoutes(int demandId)
demandId
- public double getRouteCarriedTrafficInErlangs(int routeId)
routeId
- public double getProtectionSegmentLengthInKm(int segmentId)
public double[] getProtectionSegmentLengthInKmVector()
public int getProtectionSegmentNumberOfHops(int segmentId)
public int[] getProtectionSegmentNumberOfHopsVector()
public double getRouteLengthInKm(int routeId)
public double[] getRouteLengthInKmVector()
public int getRouteNumberOfHops(int routeId)
public int[] getRouteNumberOfHopsVector()
public double[] getRouteCarriedTrafficInErlangsVector()
public int[] getRouteSequenceOfLinks(int routeId)
routeId
- public int[] getRouteSequenceOfNodes(int routeId)
routeId
- public int[] getLinkTraversingRoutes(int linkId)
linkId
- public String getProtectionSegmentAttribute(int segmentId, String key)
segmentId
- key
- public String[] getProtectionSegmentAttributeVector(String key)
public Map<String,String> getProtectionSegmentSpecificAttributes(int segmentId)
segmentId
- public int getProtectionSegmentDestinationNode(int segmentId)
segmentId
- Segment identifierpublic int getProtectionSegmentOriginNode(int segmentId)
segmentId
- Segment identifierpublic double getProtectionSegmentReservedBandwithInErlangs(int segmentId)
segmentId
- public double[] getProtectionSegmentReservedBandwithInErlangsVector()
public int[] getProtectionSegmentSequenceOfLinks(int segmentId)
segmentId
- public int[] getProtectionSegmentSequenceOfNodes(int segmentId)
segmentId
- public int[] getLinkTraversingProtectionSegments(int linkId)
linkId
- public int[] getNodeTraversingRoutes(int nodeId)
public int[] getNodeTraversingProtectionSegments(int nodeId)
public boolean hasDemands()
true
if the network has at least one traffic demand. It is equivalent to getNumberOfDemands()
> 0
.true
if there are traffic demands defined for the network, and false otherwisepublic boolean hasLinks()
true
if the network has at least one unidirectional link. It is equivalent to getNumberOfLinks()
> 0
.true
if there are links within the network, and false otherwisepublic boolean hasNodes()
true
if the network has at least one node. It is equivalent to getNumberOfNodes()
> 0
.true
if there are nodes within the network, and false otherwisepublic boolean hasRoutes()
true
if the network has at least one traffic route. It is equivalent to getNumberOfRoutes()
> 0
.true
if there are routes defined for any traffic demand in the network, and false otherwisepublic boolean hasProtectionSegments()
true
if the network has at least one protection segment. It is equivalent to getNumberOfProtectionSegments()
> 0
.true
if there are protection segments defined within the network, and false otherwisepublic boolean checkProtectionSegmentMergeabilityToRoute(int routeId, int segmentId)
segmentId
- Segment identifierrouteId
- Route identifiertrue
is segment is applicable to route, false
otherwisepublic void removeAllDemands()
Removes all the demands defined within the network.
Important: All the traffic routes will be also removed.
UnsupportedOperationException
- If network plan is not modifiablepublic void removeAllRoutes()
UnsupportedOperationException
- If network plan is not modifiablepublic void removeProtectionSegmentFromRouteBackupSegmentList(int segmentId, int routeId)
segmentId
- Segment identifierrouteId
- Route identifierpublic void removeDemand(int demandId)
Removes the demand identified by the given parameter.
Important: Any route carrying traffic from that demand will be also removed.
demandId
- Identifier of the demand to be removedUnsupportedOperationException
- If network plan is not modifiablepublic void removeDemandAttribute(int demandId, String key)
demandId
- key
- public void removeLink(int linkId)
Removes the link identified by the given parameter.
Important: Any route or protection segment traversing that link will be also removed.
linkId
- Identifier of the link to be removedUnsupportedOperationException
- If network plan is not modifiablepublic void removeLinkAttribute(int linkId, String key)
linkId
- key
- public void removeNetworkAttribute(String key)
key
- public void removeNode(int nodeId)
Removes the node identified by the given parameter.
Important: Any link or demand referring to that node will be also removed.
nodeId
- Identifier of the node to be removedUnsupportedOperationException
- If network plan is not modifiablepublic void removeNodeAttribute(int nodeId, String key)
nodeId
- key
- public void removeRoute(int routeId)
routeId
- Identifier of the route to be removedUnsupportedOperationException
- If network plan is not modifiablepublic void removeRouteAttribute(int routeId, String key)
routeId
- key
- public void removeProtectionSegment(int segmentId)
Removes the specified protection segment from the network.
Important: That segment will be removed from the list of protection segments of any associated route.
segmentId
- Identifier of the protection segment to be removedUnsupportedOperationException
- If network plan is not modifiablepublic void removeProtectionSegmentAttribute(int segmentId, String key)
segmentId
- key
- public void saveToFile(File file)
file
- public int[] convertBackupRoute2SequenceOfLinks(int[] sequenceOfLinksAndSegments)
public int[] convertSequenceOfLinks2SequenceOfNodes(int[] sequenceOfLinksAndSegments)
public void setDemandAttribute(int demandId, String key, String value)
demandId
- key
- value
- public void setDemandAttributes(int demandId, Map<String,String> attributes)
demandId
- attributes
- public void setDemandOfferedTrafficInErlangs(int demandId, double offeredTrafficInErlangs)
demandId
- offeredTrafficInErlangs
- public void setLinkAttribute(int linkId, String key, String value)
linkId
- key
- value
- public void setLinkAttributes(int linkId, Map<String,String> attributes)
linkId
- attributes
- public void setLinkCapacityInErlangs(int linkId, double linkCapacity)
linkId
- Link identifierlinkCapacityInErlangs
- Link capacity measured in Erlangs. It must be greater or equal than zeropublic void setLinkLengthInKm(int linkId, double linkLengthInKm)
linkId
- Link identifierlinkLengthInKm
- Link length measured in Erlangs. It must be greater or equal than zero. Physical distance between node pairs can be obtained through the getPhysicalDistanceBetweenNodePair()
methodUnsupportedOperationException
- If network plan is not modifiablepublic void setNetworkAttribute(String key, String value)
key
- value
- public void setNetworkAttributes(Map<String,String> attributes)
attributes
- public void setNodeAttribute(int nodeId, String key, String value)
nodeId
- key
- value
- public void setNodeAttributes(int nodeId, Map<String,String> attributes)
nodeId
- attributes
- public void setNodeName(int nodeId, String name)
nodeId
- Node identifiername
- New nameUnsupportedOperationException
- If network plan is not modifiablepublic void setNodeXYPosition(int nodeId, double x, double y)
nodeId
- Node identifierx
- Node position in x-axisy
- Node position in y-axisUnsupportedOperationException
- If network plan is not modifiablepublic void setRouteAttribute(int routeId, String key, String value)
routeId
- key
- value
- public void setRouteAttributes(int routeId, Map<String,String> attributes)
routeId
- attributes
- public void setProtectionSegmentAttribute(int segmentId, String key, String value)
segmentId
- key
- value
- public void setProtectionSegmentAttributes(int segmentId, Map<String,String> attributes)
segmentId
- attributes
- public void setProtectionSegmentReservedBandwidthInErlangs(int segmentId, double reservedBandwidthInErlangs)
public String toString()
toString
in class Object