Hosted by
 |
String_Lists
 |  | package US_Lists |  |
 | Local instantiation of generic package Lists with
Unbounded_String as Content_Type. |  |
 |  | type List |  |
 | Instance of a list. There is no need to call a
constructor. Uninitialized lists behave like regular empty
ones.
This subtype renames the List type in the local package
US_Lists. |  |
List construction
 |  | procedure Push |  |
 | Insert an item at the end of the list. |  |
|
 |  | procedure Unshift |  |
 | Insert an item at the beginning of the list. |  |
|
Item indexing
 |  | function Count |  |
 | Count items in this list. This operation is not O(n) but O(1)
because the result comes straight from a counter variable. |  |
|
 |  | function Empty |  |
 | Is the list empty? Returns True if and only if there are no
items in the list. |  |
|
 |  | function Index |  |
 | Read the current iteration position as a number, starting with 1
at the first item. An index of 0 means: no current item, so
either we're not currently iterating or the iteration has
finished. |  |
|
Iterating over a list
 |  | procedure Reset |  |
 | Reset the iteration index to 0. This starts a new
iteration. There must be a call to Next before the first item
can be read from the function This. |  |
|
 |  | procedure Next |  |
 | Go to the next item. |  |
|
 |  | function Next |  |
 | Go to the next item. Return False if and only if we reached the
end of the list. |  |
|
 |  | function End_Of_List |  |
 | End of list reached? Returns True if and only if we reached the
end of the list. A call to Current would then fail because the
current item pointer is null. |  |
|
 |  | function Current |  |
 | Read the item at the current iteration pointer. |  |
|
Manipulating a list while iterating
 |  | procedure Update_Current |  |
 | Update the item at the current iteration pointer. |  |
|
 |  | procedure Remove_Current |  |
 | Remove the item at the current iteration pointer from the list. |  |
|
 |  | procedure Insert_Before_Current |  |
 | Insert an item directly before the item at the current iteration
pointer. |  |
|
 |  | procedure Insert_After_Current |  |
 | Insert an item directly after the item at the current iteration
pointer. |  |
|
|
|