MulticastTree extends NetworkElement { public void remove () { checkAttachedToNetPlanObject(); netPlan.checkIsModifiable(); setCarriedTraffic(0, 0); netPlan.cache_id2MulticastTreeMap.remove(id); NetPlan.removeNetworkElementAndShiftIndexes(layer.multicastTrees , index); for (Link link : linkSet) link.cache_traversingTrees.remove(this); for (Node node : cache_traversedNodes) node.cache_nodeAssociatedulticastTrees.remove(this); demand.cache_multicastTrees.remove(this); layer.cache_multicastTreesDown.remove(this); layer.cache_multicastTreesTravLinkZeroCap.remove(this); for (String tag : tags) netPlan.cache_taggedElements.get(tag).remove(this); final NetPlan npOld = this.netPlan; removeId(); if (ErrorHandling.isDebugEnabled()) npOld.checkCachesConsistency(); } MulticastTree(NetPlan netPlan , long id , int index,  MulticastDemand demand , Set<Link> links , AttributeMap attributes); Set<Link> getInitialLinkSet(); void revertToInitialSetOfLinks(); boolean isUpTheInitialLinkSet(); NetworkLayer getLayer(); Set<SharedRiskGroup> getSRGs(); MulticastDemand getMulticastDemand(); Node getIngressNode(); Set<Node> getEgressNodesReached(); boolean isReachedEgressNode(Node n); boolean isReachinAllDemandEgressNodes(); List<Link> getSeqLinksToEgressNode(Node egressNode); void setLinks(Set<Link> newLinkSet); Set<Link> getLinkSet(); boolean isDown(); boolean isTraversingZeroCapLinks(); Set<Node> getNodeSet(); Link getIngressLinkOfNode(Node n); Set<Link> getOutputLinkOfNode(Node n); double getTreeTotalLengthInKm(); double getTreeMaximumPathLengthInKm(); double getTreeAveragePathLengthInKm(); double getTreeMaximumPropagationDelayInMs(); double getTreeAveragePropagationDelayInMs(); int getTreeMaximumPathLengthInHops(); double getTreeAveragePathLengthInHops(); int getTreeNumberOfLinks(); double getCarriedTraffic(); double getOccupiedLinkCapacity(); double getCarriedTrafficInNoFailureState(); double getOccupiedLinkCapacityInNoFailureState(); void setCarriedTraffic(double newCarriedTraffic , double newOccupiedLinkCapacity); void remove(); @Override String toString();  }
@Test public void testRemove() { t123.remove(); assertEquals(d123.getCarriedTraffic() , 10 , 0.0); assertEquals(d123.getMulticastTrees() , Collections.singleton(tStar)); tStar.remove(); assertEquals(d123.getCarriedTraffic() , 0 , 0.0); assertEquals(d123.getMulticastTrees() , Collections.emptySet()); }