SleelaDoc API
HTML documentation for the SLeeLa standard library (/lib)
Home › Packages › array

Package array

This package contains 5 source unit(s) defining 5 class(es) / struct(s). Each unit below lists its fields (the values it stores) and methods (the actions it performs), with a plain explanation of each.

SLArray2D #sleela 3.1 (lib/array/SLArray2D.sleela)

SLArray2D class

Helpers over int[][] and double[][] (SLEELA.syntax section 46): creation of rectangular grids, row and column counts, copy, fill, transpose, sum and text. Requires #sleela 3.1 in the using program (it uses a.length and new T[a][b]).

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
rowsstatic int rows(int[][] a)No description in source.
colsstatic int cols(int[][] a, int r)Length of row r (rows of a jagged array may differ).
isRectangularstatic boolean isRectangular(int[][] a)True when every row has the length of row 0.
fillstatic void fill(int[][] a, int v)No description in source.
sumOfstatic int sumOf(int[][] a)No description in source.
toTextstatic String toText(int[][] a)Text like [[1, 2], [3, 4]].

SLDoubleArray #sleela 3.0 (lib/array/SLDoubleArray.sleela)

SLDoubleArray class

Helpers over double[] (SLEELA.syntax section 46): copy, fill, sum, minimum, maximum, search, equality and reverse. Version neutral (uses arrayLength).

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
copyOfstatic double[] copyOf(double[] a, int n)No description in source.
fillstatic void fill(double[] a, double v)No description in source.
sumOfstatic double sumOf(double[] a)No description in source.
minOfstatic double minOf(double[] a)No description in source.
maxOfstatic double maxOf(double[] a)No description in source.
indexOfstatic int indexOf(double[] a, double v)No description in source.
isEqualstatic boolean isEqual(double[] a, double[] b)No description in source.
reversestatic void reverse(double[] a)No description in source.

SLIntArray #sleela 3.0 (lib/array/SLIntArray.sleela)

SLIntArray class

Helpers over int[] (SLEELA.syntax section 46): copy, range copy, concat, fill, equality, search, sum, minimum, maximum, swap, reverse, heapsort, binary search and text. Version neutral: it uses arrayLength, so it runs under any syntax that has arrays.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
checkIndexstatic void checkIndex(int index, int length)Throws when index is outside 0..length-1.
copyOfstatic int[] copyOf(int[] a, int n)No description in source.
copyOfRangestatic int[] copyOfRange(int[] a, int from, int to)The elements from (inclusive) to to (exclusive).
concatstatic int[] concat(int[] a, int[] b)No description in source.
fillstatic void fill(int[] a, int v)No description in source.
fillRangestatic void fillRange(int[] a, int from, int to, int v)No description in source.
isEqualstatic boolean isEqual(int[] a, int[] b)Same length and the same elements; two null arrays are equal.
indexOfstatic int indexOf(int[] a, int v)No description in source.
lastIndexOfstatic int lastIndexOf(int[] a, int v)No description in source.
containsstatic boolean contains(int[] a, int v)No description in source.
sumOfstatic int sumOf(int[] a)No description in source.
minOfstatic int minOf(int[] a)No description in source.
maxOfstatic int maxOf(int[] a)No description in source.
swapstatic void swap(int[] a, int i, int j)No description in source.
reversestatic void reverse(int[] a)No description in source.
sortstatic void sort(int[] a)In-place ascending sort (heapsort: O(n log n), no recursion, not stable).
siftDownstatic void siftDown(int[] a, int root, int n)No description in source.
binarySearchstatic int binarySearch(int[] a, int key)Index of key in an ascending array, or -(insertion point)-1 when absent.
toTextstatic String toText(int[] a)Text like [1, 2, 3]; null prints as null.

SLPackage #sleela 3.0 (lib/array/SLPackage.sleela)

SLPackage class

Defines the SLeeLa standard-library package for arrays (syntax 3.1, section 46).

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
packageNameString packageNameNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
configurevoid configure(String name)No description in source.
nameString name()No description in source.
availableboolean available()No description in source.

SLRefArray #sleela 3.0 (lib/array/SLRefArray.sleela)

SLRefArray class

Helpers over reference arrays Any[] (SLEELA.syntax section 46): emptiness, length, index check, copy, fill and identity. Version neutral (uses arrayLength).

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
isEmptystatic boolean isEmpty(Any[] a)True when the value is an array handle with no elements.
lengthOfstatic int lengthOf(Any[] a)Number of elements; the same as arrayLength, for code that prefers a method name.
checkIndexstatic void checkIndex(int index, int length)No description in source.
copyOfstatic Any[] copyOf(Any[] a, int n)A new array of n elements holding the leading elements of a; extra elements are null.
fillstatic void fill(Any[] a, Any v)No description in source.
samestatic boolean same(Any[] a, Any[] b)Reference identity of the arrays (the same array object), as == on arrays.