Esempio n. 1
0
        /// <summary>
        /// Creates a new iterator instance.
        /// </summary>
        /// <param name="sequence">An existing sequence instance.</param>
        /// <exception cref="System.ArgumentNullException">if sequence is null.</exception>
        public QuotesSingleIterator(QuotesSingleSequence sequence)
        {
            if (sequence == null)
            {
                throw new ArgumentNullException(nameof(sequence), "Sequence parameter can not be null.");
            }

            this.Sequence = sequence;

            if (sequence.StartTime <= sequence.EndTime)
            {
                this.from      = sequence.StartTime.Normalize();
                this.to        = sequence.EndTime.Normalize();
                this.direction = TimeDirection.Forward;
            }
            else
            {
                this.from      = sequence.EndTime.Normalize();
                this.to        = sequence.StartTime.Normalize();
                this.direction = TimeDirection.Backward;
            }

            this.fromEx = this.from.RoundDownMilliseconds();
            this.toEx   = this.to.RoundUpMilliseconds();

            if (this.direction == TimeDirection.Forward)
            {
                this.Current = this.ConstructForward();
            }
            else
            {
                this.Current = this.ConstructBackward();
            }

            this.Continue = this.Current != null;
        }
Esempio n. 2
0
 public QuotesSingleEnumerator(QuotesSingleSequence sequence)
 {
     this.sequence = sequence;
 }