public TimeSeriesPoint this[int i, int j]
 {
     get
     {
         var rval = new TimeSeriesPoint(Times[i], Values[i, j]);
         return(rval);
     }
 }
        /// <summary>
        /// Returns a list of qualities, each quality indicating whether it's set or not in the time series point.
        /// </summary>
        /// <param name="tsp"></param>
        /// <returns></returns>
        public static List <Quality> QualityStats(TimeSeriesPoint tsp, bool GetActiveQualities = true, bool GetInActiveQualities = true)
        {
            var l = new List <Quality>();

            foreach (var item in Enum.GetValues(typeof(BaseQualityFlags)))
            {
                if (GetActiveQualities && IsQualitySet(tsp, (BaseQualityFlags)item))
                {
                    l.Add(new Quality((BaseQualityFlags)item, true));
                }
                else if (GetInActiveQualities && !IsQualitySet(tsp, (BaseQualityFlags)item))
                {
                    l.Add(new Quality((BaseQualityFlags)item));
                }
            }
            foreach (var item in Enum.GetValues(typeof(PreviousModifierFlags)))
            {
                if (GetActiveQualities && IsQualitySet(tsp, (PreviousModifierFlags)item))
                {
                    l.Add(new Quality((PreviousModifierFlags)item, true));
                }
                else if (GetInActiveQualities && !IsQualitySet(tsp, (PreviousModifierFlags)item))
                {
                    l.Add(new Quality((PreviousModifierFlags)item));
                }
            }
            foreach (var item in Enum.GetValues(typeof(ReplacementMethodFlags)))
            {
                if (GetActiveQualities && IsQualitySet(tsp, (ReplacementMethodFlags)item))
                {
                    l.Add(new Quality((ReplacementMethodFlags)item, true));
                }
                else if (GetInActiveQualities && !IsQualitySet(tsp, (ReplacementMethodFlags)item))
                {
                    l.Add(new Quality((ReplacementMethodFlags)item));
                }
            }
            foreach (var item in Enum.GetValues(typeof(TestFailedFlags)))
            {
                if (GetActiveQualities && IsQualitySet(tsp, (TestFailedFlags)item))
                {
                    l.Add(new Quality((TestFailedFlags)item, true));
                }
                else if (GetInActiveQualities && !IsQualitySet(tsp, (TestFailedFlags)item))
                {
                    l.Add(new Quality((TestFailedFlags)item));
                }
            }
            return(l);
        }
 public static bool IsQualitySet(TimeSeriesPoint tsp, TestFailedFlags flag)
 {
     return((tsp.IntQuality & (int)flag) == (int)flag);
 }
        public static bool IsQualitySet(TimeSeriesPoint tsp, ReplacementMethodFlags flag)
        {
            int rmq = (tsp.IntQuality >> 11) & 0b1111;

            return(rmq == (int)flag);
        }
        public static bool IsQualitySet(TimeSeriesPoint tsp, PreviousModifierFlags flag)
        {
            int pmq = (tsp.IntQuality >> 8) & 0b111;

            return(pmq == (int)flag);
        }