MulticastDemand extends NetworkElement implements IMonitorizableElement { public void decouple() { checkAttachedToNetPlanObject(); netPlan.checkIsModifiable(); if (coupledUpperLayerLinks == null) throw new Net2PlanException ("The multicast demand is not coupled"); Collection<Link> links = coupledUpperLayerLinks.values(); for (Link link : links) link.checkAttachedToNetPlanObject(this.netPlan); for (Link link : links) if (link.coupledLowerLayerMulticastDemand != this) throw new RuntimeException ("Bad"); final NetworkLayer upperLayer = links.iterator().next().layer; final NetworkLayer lowerLayer = layer; upperLayer.cache_coupledLinks.removeAll(links); layer.cache_coupledMulticastDemands.remove(this); for (Link link : links) link.coupledLowerLayerMulticastDemand = null; DemandLinkMapping coupling_thisLayerPair = netPlan.interLayerCoupling.getEdge(lowerLayer, upperLayer); coupling_thisLayerPair.remove(this); if (coupling_thisLayerPair.isEmpty()) netPlan.interLayerCoupling.removeEdge(lowerLayer , upperLayer); coupledUpperLayerLinks = null; if (ErrorHandling.isDebugEnabled()) netPlan.checkCachesConsistency(); } MulticastDemand(NetPlan netPlan , long id , int index , NetworkLayer layer , Node ingressNode , Set<Node> egressNodes , double offeredTraffic , AttributeMap attributes); void setMaximumAcceptableE2EWorstCaseLatencyInMs(double maxLatencyMs); double getMaximumAcceptableE2EWorstCaseLatencyInMs(); void setQoSType(String newQosType); String getQosType(); void setOfferedTrafficPerPeriodGrowthFactor(double growthFactor); double getOfferedTrafficPerPeriodGrowthFactor(); NetworkLayer getLayer(); double getWorseCasePropagationTimeInMs(); double getWorstCaseLengthInKm(); boolean isTraversingOversubscribedLinks(); Node getIngressNode(); SortedSet<Node> getEgressNodes(); double getOfferedTraffic(); double getCarriedTraffic(); double getBlockedTraffic(); Pair<SortedSet<MulticastTree>,Double> computeMinimumCostMulticastTrees(double [] costs); boolean isBifurcated(); boolean isBlocked(); SortedSet<MulticastTree> getMulticastTrees(); boolean isAllTreesReachingAllEgressNodes(); void couple(Set<Link> links); SortedSet<Link> coupleToNewLinksCreated(NetworkLayer newLinkLayer); SortedSet<Link> getCoupledLinks(); boolean isCoupled(); void decouple(); void remove(); void setOfferedTraffic(double offeredTraffic); String toString(); SortedMap<Link, Double> getTraversedLinksAndCarriedTraffic(final boolean normalizedToOfferedTraffic); SortedSet<Link> getLinksNoDownPropagationPotentiallyCarryingTraffic(Node egressNode); TrafficSeries getMonitoredOrForecastedOfferedTraffic(); void setMonitoredOrForecastedOfferedTraffic(TrafficSeries newTimeSeries); @Override TrafficSeries getMonitoredOrForecastedCarriedTraffic(); @Override void setMonitoredOrForecastedCarriedTraffic(TrafficSeries newTimeSeries); @Override double getCurrentTrafficToAddMonitSample(); @Override boolean isPossibleToSetCurrentTrafficAsGivenMonitSample(); @Override void setCurrentTrafficToGivenMonitSample(double traffic); @Override Optional<TrafficPredictor> getTrafficPredictor(); @Override void setTrafficPredictor(TrafficPredictor tp); @Override void removeTrafficPredictor();  }
@Test public void testDecouple() { d123.decouple(); assertTrue(!d123.isCoupled()); assertTrue(!upperMd123.isCoupled()); }