/// <summary>
        /// Calculates the status code for the slice 
        /// </summary>
        protected StatusCode GetTimeBasedStatusCode(List<SubRegion> regions, StatusCode statusCode)
        {
            // check for empty set.
            if (regions == null || regions.Count == 0)
            {
                return StatusCodes.BadNoData;
            }

            // compute the total good/bad/uncertain.
            double badDuration = 0;
            double goodDuration = 0;
            double totalDuration = 0;

            foreach (SubRegion region in regions)
            {
                totalDuration += region.Duration;

                if (StatusCode.IsBad(region.StatusCode))
                {
                    badDuration += region.Duration;
                    continue;
                }

                if (StatusCode.IsGood(region.StatusCode))
                {
                    goodDuration += region.Duration;
                }
            }

            // default to good.
            statusCode = statusCode.SetCodeBits(StatusCodes.Good);

            // uncertain if the good duration is less than the configured threshold.
            if ((goodDuration/totalDuration)*100 < Configuration.PercentDataGood)
            {
                statusCode = statusCode.SetCodeBits(StatusCodes.UncertainDataSubNormal);
            }

            // bad if the bad duration is greater than or equal to the configured threshold.
            if ((badDuration/totalDuration)*100 >= Configuration.PercentDataBad)
            {
                statusCode = StatusCodes.Bad;
            }

            // always calculated.
            return statusCode;
        }
        /// <summary>
        /// Calculates the value based status code for the slice 
        /// </summary>
        protected StatusCode GetValueBasedStatusCode(TimeSlice slice, List<DataValue> values, StatusCode statusCode)
        {
            // compute the total good/bad/uncertain.
            double badCount = 0;
            double goodCount = 0;
            double totalCount = 0;

            for (int ii = 0; ii < values.Count; ii++)
            {
                totalCount++;

                if (StatusCode.IsBad(values[ii].StatusCode))
                {
                    badCount++;
                    continue;
                }

                if (StatusCode.IsGood(values[ii].StatusCode))
                {
                    goodCount++;
                }
            }

            // default to good.
            statusCode = statusCode.SetCodeBits(StatusCodes.Good);

            // uncertain if the good duration is less than the configured threshold.
            if ((goodCount / totalCount) * 100 < Configuration.PercentDataGood)
            {
                statusCode = statusCode.SetCodeBits(StatusCodes.UncertainDataSubNormal);
            }

            // bad if the bad duration is greater than or equal to the configured threshold.
            if ((badCount / totalCount) * 100 >= Configuration.PercentDataBad)
            {
                statusCode = StatusCodes.Bad;
            }

            return statusCode;
        }