public bool CalculateSingleBatchStatistics() { bool result = false; // Calculate single batch statistics //// Get the last marked and unmarked batches and add them to the graph //int lastBatchId = 0; ProcessCapturePackets pcp = new ProcessCapturePackets(); //lastBatchId = pcp.GetLastCaptureBatchId(); CurrentCaptureFile captureFile = new CurrentCaptureFile(); CaptureFileData cfd = new CaptureFileData(); //captureFile = cfd.GetLastCaptureBatchRecord(); captureFile = cfd.GetCurrentCaptureFile(_CaptureFileName); // Set the global variable _CaptureState = captureFile.CaptureState; BindingList<BatchIntervalMarked> batchIntervals = new BindingList<BatchIntervalMarked>(); // Calculate probabilities batchIntervals = pcp.GetMarkedBatchIntervals(captureFile.CaptureBatchId); int histogramBinSize = Convert.ToInt32(_HistogramBinSize); SortedDictionary<int, decimal> probabilities = new CalculateProbability(batchIntervals).GetProbabilityByPacketRange(_TrimZeroPacketIntervals, histogramBinSize); BatchStatistics markedSingleStats = new BatchStatistics(); BatchStatistics unmarkedSingleStats = new BatchStatistics(); // Add the results to the DisplayStatistics table DisplayStatisticsData dsd = new DisplayStatisticsData(); if(captureFile.CaptureState == CaptureState.Marked) { markedSingleStats = CalculateBatchStatistics(batchIntervals, CaptureState.Marked, BatchType.Single); } else { unmarkedSingleStats = CalculateBatchStatistics(batchIntervals, CaptureState.Unmarked, BatchType.Single); } return result; }
public void SaveDisplayStatistics(BatchStatistics batchStatistics, int captureBatchId, CaptureState captureState, BatchType batchType, bool saveData) { // Save the statistics to the database for display on the Analysis tab (save to DisplayStatistics table) // Replace cumulative data with new data DisplayStatisticsData dsd = new DisplayStatisticsData(); switch (captureState) { case CaptureState.Marked: switch (batchType) { case BatchType.Single: //dsd.DeleteSingleMarkedDisplayStatitics(); dsd.InsertSingleMarkedDisplayStatitics(batchStatistics); dsd.UpdateDisplayStatsSavedFlag(captureBatchId, BatchType.Single, true); break; case BatchType.Cumulative: dsd.DeleteCumulativeMarkedDisplayStatitics(); dsd.InsertCumulativeMarkedDisplayStatitics(batchStatistics); dsd.UpdateDisplayStatsSavedFlag(captureBatchId, BatchType.Cumulative, true); break; } break; case CaptureState.Unmarked: switch (batchType) { case BatchType.Single: //dsd.DeleteSingleUnmarkedDisplayStatitics(); dsd.InsertSingleUnarkedDisplayStatitics(batchStatistics); dsd.UpdateDisplayStatsSavedFlag(captureBatchId, BatchType.Single, true); break; case BatchType.Cumulative: dsd.DeleteCumulativeUnmarkedDisplayStatitics(); dsd.InsertCumulativeUnarkedDisplayStatitics(batchStatistics); dsd.UpdateDisplayStatsSavedFlag(captureBatchId, BatchType.Cumulative, true); break; } break; } }
public void InsertHypothesisTestResults(HypothesisTest testResults) { DisplayStatisticsData dsd = new DisplayStatisticsData(); dsd.InsertHypothesisTestResults(testResults); }
public DisplayStatistic GetLastSingleUnmarkedDisplayStatistics() { DisplayStatistic statistics = new DisplayStatistic(); DisplayStatisticsData dsd = new DisplayStatisticsData(); statistics = dsd.GetLastSingleUnmarkedDisplayStatistics(); return statistics; }
public HypothesisTest GetHypothesisTestResults() { HypothesisTest ht = new HypothesisTest(); DisplayStatisticsData dsd = new DisplayStatisticsData(); ht = dsd.GetHypothesisTestResults(); if (ht != null) { return ht; } else { return new HypothesisTest(); } }
public DisplayStatistic GetCumulativeUnmarkedDisplayStatistics() { DisplayStatistic statistics = new DisplayStatistic(); DisplayStatisticsData dsd = new DisplayStatisticsData(); statistics = dsd.GetCumulativeUnmarkedDisplayStatistics(); return statistics; }
public void DeleteHypothesisTestResults() { DisplayStatisticsData dsd = new DisplayStatisticsData(); dsd.DeleteHypothesisTestResults(); }