Libraries
Ref_list Source Code
 previous   up   next 

Types
ref_list
Type to describe a list of reference objects.

ref_list

const type: ref_list

Type to describe a list of reference objects.


Operator Summary
ref_list
(attr ref_list) . value
Default value of ref_list (ref_list.EMPTY).
void
(inout ref_list: dest) &:= (in ref_list: extension)
Append the ref_list extension to dest.
void
(inout ref_list: dest) @:= [ (in integer: position) ] (in reference: source)
Assign reference source to the position of the dest.
boolean
(in ref_list: refList1) = (in ref_list: refList2)
Check if two ref_lists are equal.
boolean
(in ref_list: refList1) <> (in ref_list: refList2)
Check if two ref_lists are not equal.
reference
(in ref_list: aRefList) [ (in integer: index) ]
Access one element from the ref_list aRefList.
ref_list
(in ref_list: aRefList) [ (in integer: start) .. ]
Get a sublist from aRefList beginning at a start position.
ref_list
(in ref_list: aRefList) [ .. (in integer: stop) ]
Get a sublist from aRefList ending at a stop position.
ref_list
(in ref_list: aRefList) [ (in integer: start) .. (in integer: stop) ]
Get a sublist from a start position to a stop position.
ref_list
(in ref_list: refList1) & (in ref_list: refList2)
Concatenate two ref_lists.
boolean
(in reference: element) in (in ref_list: aRefList)
Membership test for a ref_list.
boolean
(in reference: element) not in (in ref_list: aRefList)
Negated membership test for a ref_list.

Function Summary
ref_list
make_list (in reference: element)
Create ref_list with the given element.
integer
pos (in ref_list: main, in reference: searched)
Search for the first occurrence of searched in main.
integer
pos (in ref_list: main, in reference: searched, in integer: start)
Search for searched in main at or after start.
integer
length (in ref_list: aRefList)
Determine the length of a ref_list.
void
for (inout reference: forVar) range (in ref_list: aRefList) do (in proc: statement) end for
For-loop where forVar loops over the elements of aRefList.
void
for (inout reference: forVar) range (in ref_list: aRefList) until (ref func boolean: condition) do (in proc: statement) end for
For-loop where forVar loops over the elements of aRefList.

Operator Detail

. value

const ref_list: (attr ref_list) . value

Default value of ref_list (ref_list.EMPTY).


&:=

const proc: (inout ref_list: dest) &:= (in ref_list: extension)

Append the ref_list extension to dest.

Raises:
MEMORY_ERROR - Not enough memory for the concatenated ref_list.

@:= [

const proc: (inout ref_list: dest) @:= [ (in integer: position) ] (in reference: source)

Assign reference source to the position of the dest.

A @:= [B] C;

is equivalent to

A := A[..pred(B)] & make_list(C) & A[succ(B)..];
Raises:
INDEX_ERROR - If position is negative or zero, or an element beyond dest would be overwritten (position > length(dest) holds).

=

const func boolean: (in ref_list: refList1) = (in ref_list: refList2)

Check if two ref_lists are equal.

Returns:
TRUE if both ref_lists are equal, FALSE otherwise.

<>

const func boolean: (in ref_list: refList1) <> (in ref_list: refList2)

Check if two ref_lists are not equal.

Returns:
FALSE if both ref_lists are equal, TRUE otherwise.

[

const func reference: (in ref_list: aRefList) [ (in integer: index) ]

Access one element from the ref_list aRefList.

Returns:
the element with the specified index from aRefList.
Raises:
INDEX_ERROR - If the index is less than 1 or greater than the length of the ref_list.

[

const func ref_list: (in ref_list: aRefList) [ (in integer: start) .. ]

Get a sublist from aRefList beginning at a start position. The first element in a ref_list has the position 1.

Returns:
the sublist beginning at the start position.
Raises:
MEMORY_ERROR - Not enough memory to represent the result.

[ ..

const func ref_list: (in ref_list: aRefList) [ .. (in integer: stop) ]

Get a sublist from aRefList ending at a stop position. The first element in a ref_list has the position 1.

Returns:
the substring ending at the stop position.
Raises:
MEMORY_ERROR - Not enough memory to represent the result.

[

const func ref_list: (in ref_list: aRefList) [ (in integer: start) .. (in integer: stop) ]

Get a sublist from a start position to a stop position. The first element in a ref_list has the position 1.

Returns:
the substring from position start to stop.
Raises:
MEMORY_ERROR - Not enough memory to represent the result.

&

const func ref_list: (in ref_list: refList1) & (in ref_list: refList2)

Concatenate two ref_lists.

Returns:
the result of the concatenation.
Raises:
MEMORY_ERROR - Not enough memory to represent the result.

in

const func boolean: (in reference: element) in (in ref_list: aRefList)

Membership test for a ref_list. Determine if aRefList contains element.

Returns:
TRUE if element is a member of aRefList, FALSE otherwise.

not in

const func boolean: (in reference: element) not in (in ref_list: aRefList)

Negated membership test for a ref_list. Determine if aRefList does not contain element.

Returns:
FALSE if element is a member of aRefList, TRUE otherwise.

Function Detail

make_list

const func ref_list: make_list (in reference: element)

Create ref_list with the given element.

Returns:
a ref_list of length 1 with the given element.
Raises:
MEMORY_ERROR - Not enough memory to represent the result.

pos

const func integer: pos (in ref_list: main, in reference: searched)

Search for the first occurrence of searched in main. The first element in a ref_list has the position 1.

Returns:
the position of searched or 0 if main does not contain searched.

pos

const func integer: pos (in ref_list: main, in reference: searched, in integer: start)

Search for searched in main at or after start. The search begins at position start and proceeds to the end. The first element in a ref_list has the position 1. The pos function is designed to allow loops like:

index := pos(aList, aReference);
while index <> 0 do
  # Do something with index
  index := pos(aList, aReference, succ(index));
end while;
Returns:
the position of searched or 0 if main does not contain searched at or after start.
Raises:
RANGE_ERROR - start <= 0 holds.

length

const func integer: length (in ref_list: aRefList)

Determine the length of a ref_list.

Returns:
the length of the ref_list.

for

const proc: for (inout reference: forVar) range (in ref_list: aRefList) do (in proc: statement) end for

For-loop where forVar loops over the elements of aRefList.


for

const proc: for (inout reference: forVar) range (in ref_list: aRefList) until (ref func boolean: condition) do (in proc: statement) end for

For-loop where forVar loops over the elements of aRefList. Additionally a condition is checked before the statements in the loop body are executed.



 previous   up   next