MulticastTree extends NetworkElement { public void setCarriedTraffic(double newCarriedTraffic , double newOccupiedLinkCapacity) { newCarriedTraffic = NetPlan.adjustToTolerance(newCarriedTraffic); newOccupiedLinkCapacity = NetPlan.adjustToTolerance(newOccupiedLinkCapacity); checkAttachedToNetPlanObject(); netPlan.checkIsModifiable(); if ((newCarriedTraffic < 0) || (newOccupiedLinkCapacity < 0)) throw new Net2PlanException ("Carried traffics and occupied link capacities must be non-negative"); this.carriedTrafficIfNotFailing = newCarriedTraffic; this.occupiedLinkCapacityIfNotFailing = newOccupiedLinkCapacity; for (Link link : linkSet) link.updateLinkTrafficAndOccupation(); demand.carriedTraffic = 0; for (MulticastTree t : demand.cache_multicastTrees) demand.carriedTraffic += t.getCarriedTraffic(); if (demand.coupledUpperLayerLinks != null) for (Link e : demand.coupledUpperLayerLinks.values()) e.updateCapacityAndZeroCapacityLinksAndRoutesCaches(demand.carriedTraffic); if (ErrorHandling.isDebugEnabled()) netPlan.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 testSetCarriedTraffic() { assertEquals(t123.getCarriedTraffic() , 10 , 0.0); assertEquals(tStar.getCarriedTraffic() , 10 , 0.0); assertEquals(t123.getOccupiedLinkCapacity() , 15 , 0.0); assertEquals(tStar.getOccupiedLinkCapacity() , 15 , 0.0); t123.setCarriedTraffic(20 , 30); tStar.setCarriedTraffic(20 , 30); assertEquals(t123.getCarriedTraffic() , 20 , 0.0); assertEquals(tStar.getCarriedTraffic() , 20 , 0.0); assertEquals(t123.getOccupiedLinkCapacity() , 30 , 0.0); assertEquals(tStar.getOccupiedLinkCapacity() , 30 , 0.0); link23.setFailureState(false); t123.setCarriedTraffic(40 , 60); tStar.setCarriedTraffic(40 , 60); assertEquals(t123.getCarriedTraffic() , 0 , 0.0); assertEquals(tStar.getCarriedTraffic() , 40 , 0.0); assertEquals(t123.getOccupiedLinkCapacity() , 0 , 0.0); assertEquals(tStar.getOccupiedLinkCapacity() , 60 , 0.0); assertEquals(t123.getCarriedTrafficInNoFailureState() , 40 , 0.0); assertEquals(tStar.getCarriedTrafficInNoFailureState() , 40 , 0.0); assertEquals(t123.getOccupiedLinkCapacityInNoFailureState() , 60 , 0.0); assertEquals(tStar.getOccupiedLinkCapacityInNoFailureState() , 60 , 0.0); }