# Section 8.5.4.1.1:
$LISTS

###### abstract class $LISTS{ETP} < $ARR{ETP}

This abstraction models a modifiable list which is not extensible. The list has keys which, because of its parentage, are cardinal numbers.

create : SAME ; -- This version of creation produces a default list which is empty.
create( size : CARD ) : SAME ; -- This feature creates a new list with at least the given size, all of -- the elements of which are empty.
equals( other : $RO_ARR{ETP} ) : BOOL ; -- This routine returns true if and only if all elements of self are -- equal to all elements of other when taken in the same order. count( val : ETP ) : CARD ; -- This feature returns the number of elements in the list which have -- the given value.
insert_after( index : CARD, val : ETP ) : SAME ; -- This inserts val immediately after the given index position in a copy -- of self. The indices of all subsequent elements will have increased by -- one. The resulting list is returned. insert_before( index : CARD, val : ETP ) : SAME ; -- This inserts the value val in the position immediately before the -- given index in a copy of self. The indices of all subsequent elements -- will be increased by one. The resultant list is returned. insert_all_before( index : CARD, val : $CONTAINER{ETP} ) : SAME ; -- This inserts all of the items in val in order at the position before -- the given index in a copy of self. All subsequent elements will have -- their index increased by the number of elements in val. The resultant -- list is returned. insert_all_after( index : CARD, val : $CONTAINER{ETP} ) : SAME ; -- This inserts all of the items in val in order at the position after -- the given index in a copy of self. All subsequent elements will have -- their index increased by the number of elements in val. The resultant -- list is returned.

| Language Index |  | Library Index |  | Container Index

Comments or enquiries should be made to Keith Hopper. Page last modified: Tuesday, 28 November 2000. |