private void FinishBaseClusterCt() { Iterator<Entry<Long, TrafficCluster>> ClusterIterator = BaseClusters.entrySet().iterator(); TrafficCluster TempCluster; while (ClusterIterator.hasNext()) { Map.Entry<Long, TrafficCluster> Cluster = (Map.Entry<Long, TrafficCluster>) ClusterIterator.next(); TempCluster = Cluster.getValue(); TempCluster.AdjustBaseClusterCount(); if ((this.TotalPacketCount > 0) && (this.TotalByteCount > 0)) { TempCluster.CalculateContribution(this.TotalPacketCount, this.TotalByteCount); } } }
private void UpdateClusterStat() { TrafficCluster VolatileCluster; long TempTotalPacketCount = 0; double TempTotalByteCount = 0.0; for (StatResult result : this.ClusterStats) { VolatileCluster = UniqueClusters.get(result.ClusterID); if (VolatileCluster != null) { TempTotalPacketCount += result.PacketCount; TempTotalByteCount += result.ByteCount; VolatileCluster.UpdateCount(result.PacketCount, result.ByteCount); InitBaseClusterCt(VolatileCluster.ParentClusterIDs, result.PacketCount, result.ByteCount); } else { System.out.println("SOMETHING WENT WRONG"); break; } } this.ClusterStats.clear(); this.TotalPacketCount = TempTotalPacketCount; this.TotalByteCount = TempTotalByteCount; this.FinishBaseClusterCt(); // doing a second loop to update the contribution of each cluster relative the so far total // counts // Will see if we can skip this second loop if ((this.TotalPacketCount > 0) && (this.TotalByteCount > 0)) { Iterator<Entry<Long, TrafficCluster>> ClusterIterator = UniqueClusters.entrySet().iterator(); TrafficCluster TempCluster; while (ClusterIterator.hasNext()) { Map.Entry<Long, TrafficCluster> Cluster = (Map.Entry<Long, TrafficCluster>) ClusterIterator.next(); TempCluster = Cluster.getValue(); TempCluster.CalculateContribution(this.TotalPacketCount, this.TotalByteCount); if (TempCluster.IsBaseType == true) { this.CopyFromCluster(TempCluster); } } } }