/** * <p>Sets nodes and links associated to the SRG as down (in case they are not yet). The network state is updated with the affected routes, * segments, trees and hop-by-hop routing associated to the new nodes/links down </p> */ public void setAsDown () { checkAttachedToNetPlanObject(); netPlan.setLinksAndNodesFailureState (null , getLinksAllLayers() , null , getNodes ()); }
/** * <p>Sets nodes and links associated to the SRG as up (in case they are not yet). The network state is updated with the affected routes, * segments, trees and hop-by-hop routing associated to the new nodes/links down </p> */ public void setAsUp () { checkAttachedToNetPlanObject(); netPlan.setLinksAndNodesFailureState (getLinksAllLayers() , null , getNodes (), null); }
/** * <p>Adds a node to the SRG. If the node is already part of the SRG, no action is taken</p> * @param node Node to add */ public void addNode(Node node) { if (isDynamicSrg()) throw new Net2PlanException ("Cannot modify dynamic SRGs"); checkAttachedToNetPlanObject(); netPlan.checkIsModifiable(); node.checkAttachedToNetPlanObject(this.netPlan); if (this.nodesIfNonDynamic.contains(node)) return; node.cache_nodeNonDynamicSRGs.add(this); this.nodesIfNonDynamic.add(node); if (ErrorHandling.isDebugEnabled()) netPlan.checkCachesConsistency(); }
/** * <p>Removes a link from the set of links of the SRG. If the link is not in the SRG, no action is taken</p> * @param e Link to be removed */ public void removeLink (Link e) { if (isDynamicSrg()) throw new Net2PlanException ("Cannot modify dynamic SRGs"); checkAttachedToNetPlanObject(); netPlan.checkIsModifiable(); e.cache_nonDynamicSrgs.remove (this); linksIfNonDynamic.remove (e); if (ErrorHandling.isDebugEnabled()) netPlan.checkCachesConsistency(); }
/** * <p>Removes a node from the set of nodes of the SRG. If the node is not in the SRG, no action is taken</p> * @param n Node to be removed */ public void removeNode (Node n) { if (isDynamicSrg()) throw new Net2PlanException ("Cannot modify dynamic SRGs"); checkAttachedToNetPlanObject(); netPlan.checkIsModifiable(); n.cache_nodeNonDynamicSRGs.remove (this); nodesIfNonDynamic.remove (n); if (ErrorHandling.isDebugEnabled()) netPlan.checkCachesConsistency(); }
/** * <p>Adds a link to the SRG. If the link is already part of the srg, no action is taken.</p> * @param link Link to add */ public void addLink(Link link) { if (isDynamicSrg()) throw new Net2PlanException ("Cannot modify dynamic SRGs"); checkAttachedToNetPlanObject(); netPlan.checkIsModifiable(); link.checkAttachedToNetPlanObject(this.netPlan); if (this.linksIfNonDynamic.contains(link)) return; link.cache_nonDynamicSrgs.add(this); this.linksIfNonDynamic.add(link); if (ErrorHandling.isDebugEnabled()) netPlan.checkCachesConsistency(); }
/** * <p>Removes this SRG.</p> */ public void remove() { checkAttachedToNetPlanObject(); netPlan.checkIsModifiable(); if (!isDynamicSrg()) { for (Node node : nodesIfNonDynamic) node.cache_nodeNonDynamicSRGs.remove (this); for (Link link : linksIfNonDynamic) link.cache_nonDynamicSrgs.remove (this); } else { dynamicSrgImplementation.remove(); // release memory } for (String tag : tags) netPlan.cache_taggedElements.get(tag).remove(this); netPlan.cache_id2srgMap.remove (id); NetPlan.removeNetworkElementAndShiftIndexes(netPlan.srgs , index); if (isDynamicSrg()) netPlan.cache_dynamicSrgs.remove(this); final NetPlan npOld = this.netPlan; removeId(); if (ErrorHandling.isDebugEnabled()) npOld.checkCachesConsistency(); }