Package array
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]).
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
rows | static int rows(int[][] a) | No description in source. |
cols | static int cols(int[][] a, int r) | Length of row r (rows of a jagged array may differ). |
isRectangular | static boolean isRectangular(int[][] a) | True when every row has the length of row 0. |
fill | static void fill(int[][] a, int v) | No description in source. |
sumOf | static int sumOf(int[][] a) | No description in source. |
toText | static 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).
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
copyOf | static double[] copyOf(double[] a, int n) | No description in source. |
fill | static void fill(double[] a, double v) | No description in source. |
sumOf | static double sumOf(double[] a) | No description in source. |
minOf | static double minOf(double[] a) | No description in source. |
maxOf | static double maxOf(double[] a) | No description in source. |
indexOf | static int indexOf(double[] a, double v) | No description in source. |
isEqual | static boolean isEqual(double[] a, double[] b) | No description in source. |
reverse | static 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.
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
checkIndex | static void checkIndex(int index, int length) | Throws when index is outside 0..length-1. |
copyOf | static int[] copyOf(int[] a, int n) | No description in source. |
copyOfRange | static int[] copyOfRange(int[] a, int from, int to) | The elements from (inclusive) to to (exclusive). |
concat | static int[] concat(int[] a, int[] b) | No description in source. |
fill | static void fill(int[] a, int v) | No description in source. |
fillRange | static void fillRange(int[] a, int from, int to, int v) | No description in source. |
isEqual | static boolean isEqual(int[] a, int[] b) | Same length and the same elements; two null arrays are equal. |
indexOf | static int indexOf(int[] a, int v) | No description in source. |
lastIndexOf | static int lastIndexOf(int[] a, int v) | No description in source. |
contains | static boolean contains(int[] a, int v) | No description in source. |
sumOf | static int sumOf(int[] a) | No description in source. |
minOf | static int minOf(int[] a) | No description in source. |
maxOf | static int maxOf(int[] a) | No description in source. |
swap | static void swap(int[] a, int i, int j) | No description in source. |
reverse | static void reverse(int[] a) | No description in source. |
sort | static void sort(int[] a) | In-place ascending sort (heapsort: O(n log n), no recursion, not stable). |
siftDown | static void siftDown(int[] a, int root, int n) | No description in source. |
binarySearch | static int binarySearch(int[] a, int key) | Index of key in an ascending array, or -(insertion point)-1 when absent. |
toText | static 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).
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
packageName | String packageName | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
configure | void configure(String name) | No description in source. |
name | String name() | No description in source. |
available | boolean 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).
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
isEmpty | static boolean isEmpty(Any[] a) | True when the value is an array handle with no elements. |
lengthOf | static int lengthOf(Any[] a) | Number of elements; the same as arrayLength, for code that prefers a method name. |
checkIndex | static void checkIndex(int index, int length) | No description in source. |
copyOf | static Any[] copyOf(Any[] a, int n) | A new array of n elements holding the leading elements of a; extra elements are null. |
fill | static void fill(Any[] a, Any v) | No description in source. |
same | static boolean same(Any[] a, Any[] b) | Reference identity of the arrays (the same array object), as == on arrays. |