Example #1
0
        private void CalculateSingleHistogramProbability(BindingList<BatchIntervalMarked> batchIntervalsCollection, BatchType batchType, CurrentCaptureFile captureFile)
        {
            BindingList<BatchIntervalMarked> batchIntervals = new BindingList<BatchIntervalMarked>();
            batchIntervals = batchIntervalsCollection;

            SortedDictionary<int, decimal> histogramProbabilities = new SortedDictionary<int, decimal>();

            int histogramBinSize = AnalysisConfiguration.HistogramBinSize;
            histogramProbabilities = new CalculateProbability(batchIntervals).GetProbabilityByPacketRange(_TrimZeroPacketIntervals, histogramBinSize);

            // Convert histogram probabilities to Histogram type collection
            BindingList<SingleHistogram> singleHistogramProbabilityData = new BindingList<SingleHistogram>();
            foreach (KeyValuePair<int, decimal> data in histogramProbabilities)
            {
                SingleHistogram h = new SingleHistogram();
                h.CaptureBatchId = captureFile.CaptureBatchId;
                h.Interval = data.Key;
                h.Probability = data.Value;
                h.BatchType = Convert.ToInt32(batchType);
                h.CaptureState = Convert.ToInt32(captureFile.CaptureState);
                singleHistogramProbabilityData.Add(h);
            }

            // Save histogram data
            SingleHistogramData shd = new SingleHistogramData(singleHistogramProbabilityData);
            shd.InsertSingleHistogramData();
        }
 public BindingList<SingleHistogram> GetSingleHistogramProbabilityData(int captureBatchId)
 {
     BindingList<SingleHistogram> probabilities = new BindingList<SingleHistogram>();
     SingleHistogramData shd = new SingleHistogramData();
     probabilities = shd.GetSingleHistogramData(captureBatchId);
     return probabilities;
 }