Libraries
Base idx array Source Code
 previous   up   next 

Abstract data types
type
array [ (in integer: minIdx) .. ] (in type: baseType)
Abstract data type, describing arrays with a fixed minimum integer index.

array [

const func type: array [ (in integer: minIdx) .. ] (in type: baseType)

Abstract data type, describing arrays with a fixed minimum integer index. A base array type defines the minimum allowed index. All arrays declared with this type have the same minimum index. All abstract base array types are incompatible to each other. A type declaration is needed to use the same fixed size array type at several places. E.g.:

 const type: nameList is array [1 .. ] string;

afterwards nameList can be used in declarations. E.g.:

 var nameList: aNameList is nameList.value;
Parameters:
minIdx - Minimum index of the array type.
baseType - Type of the array elements.

Operator Summary
void
(inout arrayType: arr) &:= (in arrayType: extension)
Append the array extension to the array arr.
void
(inout arrayType: arr) &:= (in baseType: element)
Append the given element to the array arr.
arrayType
(in arrayType: arr1) & (in arrayType: arr2)
Concatenate two arrays.
baseType
(in arrayType: arr) [ (in integer: index) ]
Access one element from the array arr.
arrayType
(in arrayType: arr) [ (in integer: start) .. ]
Get a sub array beginning at the position start.
arrayType
(in arrayType: arr) [ .. (in integer: stop) ]
Get a sub array ending at the position stop.
arrayType
(in arrayType: arr) [ (in integer: start) .. (in integer: stop) ]
Get a sub array from the position start to the position stop.
arrayType
(in arrayType: arr) [ (in integer: start) len (in integer: length) ]
Get a sub array from the position start with maximum length len.

Function Summary
void
insert (inout arrayType: arr, in integer: index, in baseType: element)
Insert element at index into arr.
void
insert (inout arrayType: arr, in integer: index, in arrayType: elements)
Insert elements at index into arr.
baseType
remove (inout arrayType: arr, in integer: index)
Remove the element with index from arr.
arrayType
remove (inout arrayType: arr, in integer: index, in integer: length)
Remove the sub-array with index and length from arr.
integer
length (in arrayType: arr)
Determine the length of the array arr.
integer
minIdx (attr arrayType)
Minimum index of all arrays declared with arrayType.
integer
minIdx (in arrayType: arr)
Minimum index of array arr.
integer
maxIdx (in arrayType: arr)
Maximum index of array arr.
void
for (inout baseType: forVar) range (in arrayType: arr) do (in proc: statements) end for
For-loop where forVar loops over the elements of the array arr.
void
for key (inout integer: keyVar) range (in arrayType: arr) do (in proc: statements) end for
For-loop where keyVar loops over the indices of the array arr.
void
for (inout baseType: forVar) key (inout integer: keyVar) range (in arrayType: arr) do (in proc: statements) end for
For-loop where forVar and keyVar loop over the array arr.
void
for (inout baseType: forVar) range (in arrayType: arr) until (ref func boolean: condition) do (in proc: statements) end for
For-loop where forVar loops over the elements of the array arr.
void
for key (inout integer: keyVar) range (in arrayType: arr) until (ref func boolean: condition) do (in proc: statements) end for
For-loop where keyVar loops over the indices of the array arr.
void
for (inout baseType: forVar) key (inout integer: keyVar) range (in arrayType: arr) until (ref func boolean: condition) do (in proc: statements) end for
For-loop where forVar and keyVar loop over the array arr.
baseType
rand (in arrayType: arr)
Select a random element from arr.

Operator Detail

&:=

const proc: (inout arrayType: arr) &:= (in arrayType: extension)

Append the array extension to the array arr.

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

&:=

const proc: (inout arrayType: arr) &:= (in baseType: element)

Append the given element to the array arr.

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

&

const func arrayType: (in arrayType: arr1) & (in arrayType: arr2)

Concatenate two arrays.

Returns:
the result of the concatenation.

[

const func baseType: (in arrayType: arr) [ (in integer: index) ]

Access one element from the array arr.

Returns:
the element with the specified index from arr.
Raises:
INDEX_ERROR - If index is less than minIdx(arr) or greater than maxIdx(arr)

[

const func arrayType: (in arrayType: arr) [ (in integer: start) .. ]

Get a sub array beginning at the position start.

Returns:
the sub array beginning at the start position.
Raises:
INDEX_ERROR - The start position is less than minIdx(arr).
MEMORY_ERROR - Not enough memory to represent the result.

[ ..

const func arrayType: (in arrayType: arr) [ .. (in integer: stop) ]

Get a sub array ending at the position stop.

Returns:
the sub array ending at the stop position.
Raises:
INDEX_ERROR - The stop position is less than pred(minIdx(arr)).
MEMORY_ERROR - Not enough memory to represent the result.

[

const func arrayType: (in arrayType: arr) [ (in integer: start) .. (in integer: stop) ]

Get a sub array from the position start to the position stop.

Returns:
the sub array from position start to stop.
Raises:
INDEX_ERROR - The start position is less than minIdx(arr1), or the stop position is less than pred(start).
MEMORY_ERROR - Not enough memory to represent the result.

[

const func arrayType: (in arrayType: arr) [ (in integer: start) len (in integer: length) ]

Get a sub array from the position start with maximum length len.

Returns:
the sub array from position start with maximum length len.
Raises:
INDEX_ERROR - The start position is less than minIdx(arr), or the length is negative.
MEMORY_ERROR - Not enough memory to represent the result.

Function Detail

insert

const proc: insert (inout arrayType: arr, in integer: index, in baseType: element)

Insert element at index into arr. Elements are moved backward to create space for the element to be inserted. This function is tuned for performance and the movement works without copying elements.

Raises:
INDEX_ERROR - If index is less than minIdx(arr) or greater than succ(maxIdx(arr))

insert

const proc: insert (inout arrayType: arr, in integer: index, in arrayType: elements)

Insert elements at index into arr. Elements are moved backward to create space for the elements to be inserted. This function is tuned for performance and the movement works without copying elements.

Raises:
INDEX_ERROR - If index is less than minIdx(arr) or greater than succ(maxIdx(arr))

remove

const func baseType: remove (inout arrayType: arr, in integer: index)

Remove the element with index from arr. The elements after the removed element are moved forward. This function is tuned for performance and the movement works without copying elements.

Returns:
the removed element.
Raises:
INDEX_ERROR - If index is less than minIdx(arr) or greater than maxIdx(arr)

remove

const func arrayType: remove (inout arrayType: arr, in integer: index, in integer: length)

Remove the sub-array with index and length from arr. The elements after the removed sub-array are moved forward. This function is tuned for performance and the movement works without copying elements.

Returns:
the removed sub-array.
Raises:
INDEX_ERROR - If index is less than minIdx(arr) or greater than maxIdx(arr)

length

const func integer: length (in arrayType: arr)

Determine the length of the array arr.

Returns:
the length of the array.

minIdx

const integer: minIdx (attr arrayType)

Minimum index of all arrays declared with arrayType. All arrays declared with arrayType have this minimum index.

Returns:
the length of the array.

minIdx

const integer: minIdx (in arrayType: arr)

Minimum index of array arr. The minimum index of a fixed size array does not depend on the value.

Returns:
the minimum index of the array.

maxIdx

const func integer: maxIdx (in arrayType: arr)

Maximum index of array arr.

Returns:
the maximum index of the array.

for

const proc: for (inout baseType: forVar) range (in arrayType: arr) do (in proc: statements) end for

For-loop where forVar loops over the elements of the array arr.


for key

const proc: for key (inout integer: keyVar) range (in arrayType: arr) do (in proc: statements) end for

For-loop where keyVar loops over the indices of the array arr.


for

const proc: for (inout baseType: forVar) key (inout integer: keyVar) range (in arrayType: arr) do (in proc: statements) end for

For-loop where forVar and keyVar loop over the array arr. The variable forVar loops over the elements of arr and keyVar loops over the indices of arr.


for

const proc: for (inout baseType: forVar) range (in arrayType: arr) until (ref func boolean: condition) do (in proc: statements) end for

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


for key

const proc: for key (inout integer: keyVar) range (in arrayType: arr) until (ref func boolean: condition) do (in proc: statements) end for

For-loop where keyVar loops over the indices of the array arr. Additionally a condition is checked before the statements in the loop body are executed.


for

const proc: for (inout baseType: forVar) key (inout integer: keyVar) range (in arrayType: arr) until (ref func boolean: condition) do (in proc: statements) end for

For-loop where forVar and keyVar loop over the array arr. The variable forVar loops over the elements of arr and keyVar loops over the indices of arr. Additionally a condition is checked before the statements in the loop body are executed.


rand

const func baseType: rand (in arrayType: arr)

Select a random element from arr. The pseudo-random indices of the elements are uniform distributed.

Returns:
a random element from arr.
Raises:
RANGE_ERROR - If arr is empty.


 previous   up   next