public void execute() { Random rng = new Random(); NetPlan netPlan = callback.getDesign(); if (netPlan.hasMulticastDemands(getTableNetworkLayer())) { int result = JOptionPane.showConfirmDialog(null, "Remove all existing multicast demands before?", "", JOptionPane.YES_NO_CANCEL_OPTION); if (result == JOptionPane.CANCEL_OPTION || result == JOptionPane.CLOSED_OPTION) return; if (result == JOptionPane.YES_OPTION) netPlan.removeAllMulticastDemands(); } if (netPlan.getNumberOfNodes() < 2) throw new Net2PlanException("At least two nodes are needed"); for (Node ingressNode : netPlan.getNodes()) { Set<Node> egressNodes = new HashSet<Node>(); for (Node n : netPlan.getNodes()) if ((n != ingressNode) && rng.nextBoolean()) egressNodes.add(n); if (egressNodes.isEmpty()) egressNodes.add(netPlan.getNode(ingressNode.getIndex() == 0 ? 1 : 0)); netPlan.addMulticastDemand(ingressNode, egressNodes, 0, null); } }
public void execute() { NetPlan netPlan = callback.getDesign(); if (netPlan.hasMulticastDemands(getTableNetworkLayer())) { int result = JOptionPane.showConfirmDialog(null, "Remove all existing multicast demands before?", "", JOptionPane.YES_NO_CANCEL_OPTION); if (result == JOptionPane.CANCEL_OPTION || result == JOptionPane.CLOSED_OPTION) return; else if (result == JOptionPane.YES_OPTION) netPlan.removeAllMulticastDemands(); } if (netPlan.getNumberOfNodes() < 2) throw new Net2PlanException("At least two nodes are needed"); for (Node ingressNode : netPlan.getNodes()) { Set<Node> egressNodes = new HashSet<Node>(netPlan.getNodes()); egressNodes.remove(ingressNode); netPlan.addMulticastDemand(ingressNode, egressNodes, 0, null); } } }
/** * <p>Removes all the network layers (everything but the nodes and the SRGs). Removes all the links, demands and multicast demands of the defualt layer, it does not remove it </p> */ public void removeAllNetworkLayers() { final boolean previousErrorHandling = ErrorHandling.DEBUG; ErrorHandling.DEBUG = false; checkIsModifiable(); for (NetworkLayer layer : new ArrayList<NetworkLayer>(layers)) { if (layer != defaultLayer) { removeNetworkLayer(layer); continue; } removeAllLinks(layer); removeAllDemands(layer); removeAllMulticastDemands(layer); } ErrorHandling.DEBUG = previousErrorHandling; if (ErrorHandling.isDebugEnabled()) this.checkCachesConsistency(); }
netPlan.removeAllMulticastDemands(layer); for (MulticastDemand demand : demands.getMulticastDemands())
netPlan.removeAllMulticastDemands(wdmLayer);
netPlan.removeAllMulticastDemands(wdmLayer);
netPlan.addDemand(netPlan.getNode(demand.getIngressNode().getIndex()), netPlan.getNode(demand.getEgressNode().getIndex()), demand.getOfferedTraffic(), demand.getRoutingType() , demand.getAttributes()); netPlan.removeAllMulticastDemands(); for (MulticastDemand demand : demands.getMulticastDemands())