Implements standard IEnumerator behavior over an ISeq.
Equivalent to Java verion: SeqIterator
Inheritance: IEnumerator
Exemple #1
0
 /// <summary>
 /// Construct a <see cref="MapEnumerator">MapEnumerator</see> from a persistent map.
 /// </summary>
 /// <param name="map">The map to iterate over.</param>
 public MapEnumerator(IPersistentMap map)
 {
     _seqEnum = new SeqEnumerator(map.seq());
 }
 /// <summary>
 /// Construct a <see cref="MapEnumerator">MapEnumerator</see> from a persistent map.
 /// </summary>
 /// <param name="map">The map to iterate over.</param>
 public MapEnumerator(IPersistentMap map)
 {
     _seqEnum = new SeqEnumerator(map.seq());
 }
Exemple #3
0
        public void SeqIteratorResetAtEndWorks()
        {
            Cons c = new Cons(1, new Cons(2, null));
            SeqEnumerator s = new SeqEnumerator(c);

            s.MoveNext();
            s.MoveNext();
            s.MoveNext();
            s.Reset();

            Expect(s.MoveNext());
            Expect(s.Current, EqualTo(1));
            Expect(s.MoveNext());
            Expect(s.Current, EqualTo(2));
            Expect(s.Current, EqualTo(2));
            Expect(s.MoveNext(), False);
        }
Exemple #4
0
 public void SeqIteratorMovedToEmptyHasNoCurrent()
 {
     Cons c = new Cons(1, new Cons(2, null));
     SeqEnumerator s = new SeqEnumerator(c);
     
     s.MoveNext();
     s.MoveNext();
     s.MoveNext();
     
     // Have to assign to access
     object o = s.Current;
 }
Exemple #5
0
        public void SeqIteratorOnEmptyHasNoCurrent()
        {
            SeqEnumerator s = new SeqEnumerator(null);
            
            // Have to assign to access
            object o = s.Current;

        }
Exemple #6
0
        public void SeqIteratorOnEmptySeqGoesNowhere()
        {
            SeqEnumerator s = new SeqEnumerator(null);

            Expect(s.MoveNext(), False);
        }
Exemple #7
0
 public void SeqIteratorOnEmptyHasNoCurrent()
 {
     SeqEnumerator s = new SeqEnumerator(null);
     object o = s.Current;
 }