Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/bits/queue.hfa

    ra3a76ea r9536761  
    22
    33#include "bits/collection.hfa"
     4
     5// A Queue(T) is a Collection(T) defining the ordering that nodes are returned by drop() in the same order from those
     6// added by add(). T must be a public descendant of uColable.
     7
     8// The implementation is a typical singly-linked list, except the next field of the last element points to itself
     9// instead of being null.
    410
    511forall( dtype T | { T *& Next ( T * ); } ) {
     
    108114                } // post: ! listed( n )
    109115
    110                 T & dropTail( Queue(T) & q ) with( q ) { // O(n)
     116                T & dropTail( Queue(T) & q ) with( q ) {                // O(n)
    111117                        T & n = tail( q );
    112118                        return &n ? remove( q, n ), n : *0p;
     
    155161                } // post: curr == 0p
    156162
    157                 // create an iterator active in Queue q
     163                // create an iterator active in queue q
    158164                void ?{}( QueueIter(T) & qi, Queue(T) & q ) with( qi ) {
    159165                        curr = &head( q );
     
    164170                } // post: curr = {e in q}
    165171
    166                 // make existing iterator active in Queue q
     172                // make existing iterator active in queue q
    167173                void over( QueueIter(T) & qi, Queue(T) & q ) with( qi ) {
    168174                        curr = &head( q );
    169175                } // post: curr = {e in q}
    170176
    171                 bool ?>>?( QueueIter(T) & qi, T && tp ) with( qi ) {
     177                bool ?|?( QueueIter(T) & qi, T && tp ) with( qi ) {
    172178                        if ( curr ) {
    173179                                &tp = Curr( qi );
     
    177183                        return &tp != 0p;
    178184                }
    179                 // post: elts == null & !operator>>(tp) | elts != null & *tp' in elts & elts' == elts - *tp & operator>>(tp)
     185                // post: elts == null & !operator|(tp) | elts != null & *tp' in elts & elts' == elts - *tp & operator|(tp)
    180186        } // distribution
    181187} // distribution
Note: See TracChangeset for help on using the changeset viewer.