public final class Array
extends java.lang.Object
implements java.lang.Cloneable
Mutable array of frege values.
Used to realize type Prelude.Array elem s.
This is not a pure type.
Modifier and Type | Class and Description |
---|---|
static class |
Array.Int
Support for int arrays
|
Modifier and Type | Field and Description |
---|---|
private java.lang.Object[] |
j |
Constructor and Description |
---|
Array(int size) |
Array(java.lang.Object[] arr) |
Modifier and Type | Method and Description |
---|---|
static <T> T |
arrayGet(T[] arr,
int i)
Get array element.
|
static <T> int |
arrayLen(T[] arr)
Get array length.
|
static <T> void |
arraySet(T[] arr,
int i,
T v)
Update array destructively.
|
Array |
clone() |
java.lang.Object |
getAt(int i) |
int |
length() |
void |
setAt(int i,
java.lang.Object v) |
public final Array clone()
clone
in class java.lang.Object
public final int length()
public final void setAt(int i, java.lang.Object v)
public final java.lang.Object getAt(int i)
public static final <T> void arraySet(T[] arr, int i, T v)
Update array destructively. This method is not pure!
arr
- the arrayi
- index into arrv
- new value to set at index i
Changes the passed array, therefore it is not pure. Because the return type
is void
there is no way to make the frege compiler believe it is pure.
public static final <T> T arrayGet(T[] arr, int i)
Get array element.
arr
- the arrayi
- index into arrnull
public static final <T> int arrayLen(T[] arr)
Get array length.
arr
- the arrayarr.length