/** * <p>Adds multiple multicast trees from a Candidate Tree list.</p> * * @param cpl {@code SortedMap} where the keys are multicast demands and the values lists of link sets * @see com.net2plan.interfaces.networkDesign.MulticastDemand * @see com.net2plan.interfaces.networkDesign.Link */ public void addMulticastTreesFromCandidateTreeList(SortedMap<MulticastDemand, List<SortedSet<Link>>> cpl) { checkIsModifiable(); List<MulticastTree> trees = new LinkedList<MulticastTree>(); try { for (Entry<MulticastDemand, List<SortedSet<Link>>> entry : cpl.entrySet()) for (SortedSet<Link> linkSet : entry.getValue()) trees.add(addMulticastTree(entry.getKey(), 0, 0, linkSet, null)); } catch (Exception e) { for (MulticastTree t : trees) t.remove(); throw e; } if (ErrorHandling.isDebugEnabled()) this.checkCachesConsistency(); }
/** * <p>Removes all the multicast trees defined in the given layer. If no layer is provided, default layer is assumed.</p> * * @param optionalLayerParameter Network layer (optional) */ public void removeAllMulticastTrees(NetworkLayer... optionalLayerParameter) { checkIsModifiable(); NetworkLayer layer = checkInThisNetPlanOptionalLayerParameter(optionalLayerParameter); for (MulticastTree t : new ArrayList<MulticastTree>(layer.multicastTrees)) t.remove(); if (ErrorHandling.isDebugEnabled()) this.checkCachesConsistency(); }
/** * <p>Removes this multicast demand, and any associated multicast trees. If the demand is coupled, it is first decoupled. </p> */ public void remove() { checkAttachedToNetPlanObject(); netPlan.checkIsModifiable(); if (this.coupledUpperLayerLinks != null) this.decouple (); for (MulticastTree tree : new TreeSet<MulticastTree> (cache_multicastTrees)) tree.remove(); netPlan.cache_id2MulticastDemandMap.remove(id); NetPlan.removeNetworkElementAndShiftIndexes (layer.multicastDemands , index); ingressNode.cache_nodeOutgoingMulticastDemands.remove (this); for (Node egressNode : egressNodes) egressNode.cache_nodeIncomingMulticastDemands.remove (this); for (String tag : tags) netPlan.cache_taggedElements.get(tag).remove(this); final Pair<SortedSet<Demand>,SortedSet<MulticastDemand>> qosInfo = layer.cache_qosTypes2DemandMap.get(qosType); assert qosInfo != null; final boolean removed = qosInfo.getSecond().remove(this); assert removed; if (qosInfo.getFirst().isEmpty() && qosInfo.getSecond().isEmpty()) layer.cache_qosTypes2DemandMap.remove(qosType); final NetPlan npOld = this.netPlan; removeId(); if (ErrorHandling.isDebugEnabled()) npOld.checkCachesConsistency(); }
/** * <p>Removes all the multicast trees carrying no traffic and occupying no link capacity (even in the no failure state) defined in the given layer. If no layer is provided, default layer is used.</p> * * @param toleranceTrafficAndCapacityValueToConsiderUnusedTree Tolerance capacity to consider a link unsused * @param optionalLayerParameter Network layer (optional) */ public void removeAllMulticastTreesUnused(double toleranceTrafficAndCapacityValueToConsiderUnusedTree, NetworkLayer... optionalLayerParameter) { checkIsModifiable(); NetworkLayer layer = checkInThisNetPlanOptionalLayerParameter(optionalLayerParameter); for (MulticastTree t : new ArrayList<MulticastTree>(layer.multicastTrees)) if ((t.carriedTrafficIfNotFailing < toleranceTrafficAndCapacityValueToConsiderUnusedTree) && (t.occupiedLinkCapacityIfNotFailing < toleranceTrafficAndCapacityValueToConsiderUnusedTree)) t.remove(); if (ErrorHandling.isDebugEnabled()) this.checkCachesConsistency(); }
for (MulticastTree tree : new LinkedList<MulticastTree> (cache_traversingTrees)) tree.remove ();
/** * <p>Removes a node, and any associated link, demand, route or forwarding rule.</p> */ public void remove () { checkAttachedToNetPlanObject(); netPlan.checkIsModifiable(); for (Resource resource : new LinkedList<Resource> (cache_nodeResources)) resource.remove(); for (MulticastTree tree : new LinkedList<MulticastTree> (cache_nodeAssociatedulticastTrees)) tree.remove (); for (Route route : new LinkedList<Route> (cache_nodeAssociatedRoutes)) route.remove (); for (SharedRiskGroup srg : new LinkedList<SharedRiskGroup> (cache_nodeNonDynamicSRGs)) srg.remove (); for (Link link : new LinkedList<Link> (cache_nodeIncomingLinks)) link.remove (); for (Link link : new LinkedList<Link> (cache_nodeOutgoingLinks)) link.remove (); for (Demand demand : new LinkedList<Demand> (cache_nodeIncomingDemands)) demand.remove (); for (Demand demand : new LinkedList<Demand> (cache_nodeOutgoingDemands)) demand.remove (); for (MulticastDemand demand : new LinkedList<MulticastDemand> (cache_nodeIncomingMulticastDemands)) demand.remove (); for (MulticastDemand demand : new LinkedList<MulticastDemand> (cache_nodeOutgoingMulticastDemands)) demand.remove (); netPlan.cache_id2NodeMap.remove (id); for (String tag : tags) netPlan.cache_taggedElements.get(tag).remove(this); NetPlan.removeNetworkElementAndShiftIndexes(netPlan.nodes , this.index); final NetPlan npOld = this.netPlan; removeId(); if (ErrorHandling.isDebugEnabled()) npOld.checkCachesConsistency(); }
public List<AjtRcMenu> getNonBasicRightClickMenusInfo() { final NetPlan np = callback.getDesign(); final List<AjtRcMenu> res = new ArrayList<> (); res.add(new AjtRcMenu("Add multicast tree", e->createMulticastTreeGUI(callback), (a,b)->true, null)); res.add(new AjtRcMenu("Remove selected trees", e->getSelectedElements().forEach(dd->((MulticastTree)dd).remove()) , (a,b)->b>0, null)); res.add(new AjtRcMenu("Add one tree per demand, minimizing end-to-end average number of traversed links", e->new MulticastTreeMinE2E(true, false) , (a,b)->true, null)); res.add(new AjtRcMenu("Add one tree per demand, minimizing end-to-end average traversed length in km", e->new MulticastTreeMinE2E(false, false) , (a,b)->true, null)); res.add(new AjtRcMenu("Add one tree per demand, minimizing number of links in the tree (uses default ILP solver)", e->new MulticastTreeMinE2E(true, true) , (a,b)->true, null)); res.add(new AjtRcMenu("Add one tree per demand, minimizing number of km of the links in the tree (uses default ILP solver)", e->new MulticastTreeMinE2E(false, true) , (a,b)->true, null)); return res; }
/** * <p>Removes a layer, and any associated link, demand, route, or forwarding rule. If this layer is the default, the new default layer is the one with index 0 (the smallest identifier) </p> * * @param optionalLayerParameter Network layer (optional) */ public void removeNetworkLayer(NetworkLayer... optionalLayerParameter) { checkIsModifiable(); final NetworkLayer layer = checkInThisNetPlanOptionalLayerParameter(optionalLayerParameter); checkAttachedToNetPlanObject(); netPlan.checkIsModifiable(); if (netPlan.layers.size() == 1) throw new Net2PlanException("At least one layer must exist"); for (Route route : new LinkedList<Route>(layer.routes)) route.remove(); for (MulticastTree tree : new LinkedList<MulticastTree>(layer.multicastTrees)) tree.remove(); for (Link link : new LinkedList<Link>(layer.links)) link.remove(); for (Demand demand : new LinkedList<Demand>(layer.demands)) demand.remove(); for (MulticastDemand demand : new LinkedList<MulticastDemand>(layer.multicastDemands)) demand.remove(); for (Node node : nodes) node.removeUrlNodeIcon(layer); for (String tag : layer.tags) this.cache_taggedElements.get(tag).remove(layer); netPlan.interLayerCoupling.removeVertex(layer); netPlan.cache_id2LayerMap.remove(layer.id); NetPlan.removeNetworkElementAndShiftIndexes(netPlan.layers, layer.index); if (netPlan.defaultLayer.equals(layer)) netPlan.defaultLayer = netPlan.layers.get(0); layer.removeId(); if (ErrorHandling.isDebugEnabled()) netPlan.checkCachesConsistency(); }
case LINK: ((Link)e).remove(); break; case MULTICAST_DEMAND: ((MulticastDemand)e).remove(); break; case MULTICAST_TREE: ((MulticastTree)e).remove(); break; case NODE: ((Node)e).remove(); break; case RESOURCE: ((Resource)e).remove(); break;