Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
 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;
     }
 }
Exemplo n.º 3
0
 public void InsertHypothesisTestResults(HypothesisTest testResults)
 {
     DisplayStatisticsData dsd = new DisplayStatisticsData();
     dsd.InsertHypothesisTestResults(testResults);
 }
Exemplo n.º 4
0
 public DisplayStatistic GetLastSingleUnmarkedDisplayStatistics()
 {
     DisplayStatistic statistics = new DisplayStatistic();
     DisplayStatisticsData dsd = new DisplayStatisticsData();
     statistics = dsd.GetLastSingleUnmarkedDisplayStatistics();
     return statistics;
 }
Exemplo n.º 5
0
 public HypothesisTest GetHypothesisTestResults()
 {
     HypothesisTest ht = new HypothesisTest();
     DisplayStatisticsData dsd = new DisplayStatisticsData();
     ht = dsd.GetHypothesisTestResults();
     if (ht != null)
     {
         return ht;
     }
     else
     {
         return new HypothesisTest();
     }
 }
Exemplo n.º 6
0
 public DisplayStatistic GetCumulativeUnmarkedDisplayStatistics()
 {
     DisplayStatistic statistics = new DisplayStatistic();
     DisplayStatisticsData dsd = new DisplayStatisticsData();
     statistics = dsd.GetCumulativeUnmarkedDisplayStatistics();
     return statistics;
 }
Exemplo n.º 7
0
 public void DeleteHypothesisTestResults()
 {
     DisplayStatisticsData dsd = new DisplayStatisticsData();
     dsd.DeleteHypothesisTestResults();
 }