seq

Section: OATH Reference Manual (3O)
Updated: 26 August 1991
Index Return to Main Contents
 

NAME

seq (seqA, seqG) - an ordered queue  

SYNOPSIS

#include <oath/seq.h>  

DESCRIPTION

The seq is an ordered collection of objs. An obj may appear in a seq any number of times; however, a seq, like all bags, may hold only certain types of objs (eg a string is a seq that only holds characters). The I'th element of a seq may be accessed via the subscript [I] operator.

The seq's ordering is directly related to the order of removal as a queue. The operations *Seq and Seq[0] return the same obj. Seq[1] will be the next obj removed, and so on. It is not defined, however, where in the ordering insertions will take place. So, Seq << Obj may place Obj at the front of Seq (lifo-behavior), at the end of Seq (fifo-behavior), or anywhere else in the Seq.

The seq has a companion class, pos, which is represents a position in the seq. A pos may be incremented, which moves it to the next position in the seq; thereby supporting iteration through the seq. In a seq containing N objs there are N+1 positions, one before each obj and one past the end.

SEQ:: [ O0 O1 O2 O3 O4 O5 O6 O7 ]


        ^    ^    ^    ^    ^    ^    ^    ^    ^


        P0   P1   P2   P3   P4   P5   P6   P7  "Past End"  

DERIVATION

seq : queue : bag : obj

seq is an abstract type.  

STATIC OPERATIONS

seqA seqA:: isa (objA)
seqA::isa(O) returns O if it is truly a seq; otherwise it returns Nil.
 

MEMBER OPERATIONS

int seqA:: isEqual (seqA)
S1.isEqual(S2) returns TRUE if the two seqs are the same type and contain the same objs (i.e. is() returns TRUE) in the same order.
objA seqA:: operator [] (int)
S[I] returns the obj indexed I in seq S. I=0 is the first obj. It is an error if there are I or fewer objs in seq S.
objA seqA:: operator [] (posA)
S[P] returns the obj at the position indicated by pos P. It is an error if P is "past the end" or does not indicate a position is seq S.
posA seqA:: makePos (int = 0, int = FALSE)
S.makePos(I) makes and returns a pos indicating the I'th position in seq S. If the second argument is non-zero, then the new pos will be const. [If I is negative, then it means "past the end".]
seqA seqA:: makeCopy (int, int, int = FALSE)
S.makeCopy(Start, Beyond) makes a seq of the same type as S that contains the objs between Start and Beyond in the same order. If the third argument is non-zero, then the new seq will be const. [If the second argument is negative, then it means "past the end".]
seqA seqA:: makeCopy (pos, pos, int = FALSE)
S.makeCopy(Start, Beyond) makes a seq of the same type as S that contains the objs between Start and Beyond in the same order. If the third argument is non-zero, then the new seq will be const. [If the second argument is Nil, then it means "past the end".]
 

INTERNAL OPERATIONS

virtual const objG* seqG:: subscript (int) const
virtual const objG* seqG:: subscript (pos) const
virtual posA seqG:: makePos (int, int)
virtual seqA seqG:: makeCopy (int, int, int)
virtual seqA seqG:: makeCopy (const posG*, const posG*, int)
 

SEE ALSO

OATH(3O), queue(3O), pos(3O)  

AUTHOR

Brian M. Kennedy (Computer Science Center, Texas Instruments Incorporated)  

BUGS


 

Index

NAME
SYNOPSIS
DESCRIPTION
DERIVATION
STATIC OPERATIONS
MEMBER OPERATIONS
INTERNAL OPERATIONS
SEE ALSO
AUTHOR
BUGS

This document was created by man2html, using the manual pages.
Time: 20:37:50 GMT, July 24, 2024