private void Initialize(ulong start, ulong stop, ulong mainInterval, ulong subInterval, ulong tolerance)
            {
                if (start > stop)
                {
                    throw new ArgumentOutOfRangeException("start", "start must be before stop");
                }
                if (mainInterval < subInterval)
                {
                    throw new ArgumentOutOfRangeException("mainInterval", "must be larger than the subinterval");
                }
                if (tolerance >= subInterval)
                {
                    throw new ArgumentOutOfRangeException("tolerance", "must be smaller than the subinterval");
                }

                m_start = start;
                m_stop  = stop;

                StartOfRange.SetMin();
                StartOfRange.Timestamp = m_start;
                EndOfRange.SetMax();
                EndOfRange.Timestamp = m_stop;

                m_current      = start;
                m_mainInterval = mainInterval;
                m_subInterval  = subInterval;
                m_subIntervalPerMainInterval = (uint)Math.Round(mainInterval / (double)subInterval);
                m_tolerance = tolerance;
                m_count     = 0;
            }
Beispiel #2
0
 /// <summary>
 /// Resets the iterative nature of the filter.
 /// </summary>
 /// <remarks>
 /// Since a time filter is a set of date ranges, this will reset the frame so a
 /// call to <see cref="NextWindow"/> will return the first window of the sequence.
 /// </remarks>
 public override void Reset()
 {
     m_isEndReached = false;
     StartOfRange.SetMin();
     StartOfRange.Timestamp = m_start;
     EndOfRange.SetMax();
     EndOfRange.Timestamp = m_stop;
 }
Beispiel #3
0
 /// <summary>
 /// Creates a filter from the boundary
 /// </summary>
 /// <param name="firstTime">the start of the only window.</param>
 /// <param name="lastTime">the stop of the only window.</param>
 public FixedRange(ulong firstTime, ulong lastTime)
     : this()
 {
     m_start = firstTime;
     m_stop  = lastTime;
     StartOfRange.SetMin();
     StartOfRange.Timestamp = m_start;
     EndOfRange.SetMax();
     EndOfRange.Timestamp = m_stop;
 }
Beispiel #4
0
 /// <summary>
 /// Creates a filter by reading from the stream.
 /// </summary>
 /// <param name="stream">the stream to read from</param>
 public FixedRange(BinaryStreamBase stream)
     : this()
 {
     m_start = stream.ReadUInt64();
     m_stop  = stream.ReadUInt64();
     StartOfRange.SetMin();
     StartOfRange.Timestamp = m_start;
     EndOfRange.SetMax();
     EndOfRange.Timestamp = m_stop;
 }
 public override bool NextWindow()
 {
     if (m_isEndReached)
     {
         return(false);
     }
     StartOfRange.SetMin();
     EndOfRange.SetMax();
     m_isEndReached = true;
     return(true);
 }
 public override void Reset()
 {
     m_isEndReached = false;
     StartOfRange.SetMin();
     EndOfRange.SetMax();
 }