public final class OCamlArray<T extends OCamlValue> extends OCamlValue implements java.lang.Iterable<T>
OCamlArray
class is the wrapper class for OCaml values of
type 'a array
.WRAPPER
Modifier and Type | Method and Description |
---|---|
static <T extends OCamlValue> |
create(int sz,
T v)
Constructs a new
'a array value, and wraps it. |
static <T extends OCamlValue> |
create(Wrapper<T> w,
T[] v)
Constructs a new
'a array value, and wraps it. |
boolean |
equals(java.lang.Object obj) |
T |
get(int idx)
Returns the value at the specified index.
|
Wrapper<? extends OCamlArray<T>> |
getWrapper()
Returns the wrapper used to wrap
Value elements into
instances of the current class. |
Wrapper<? extends OCamlValue> |
getWrapper(int idx)
Returns the wrapper used to wrap
Value elements into
instances of the embedded type at given index. |
int |
hashCode() |
java.util.Iterator<T> |
iterator() |
long |
length()
Returns the array length.
|
void |
set(int idx,
T v)
Changes the value at the specified index.
|
java.lang.String |
toString() |
static <T extends OCamlValue> |
wrap(Wrapper<T> w,
org.ocamljava.runtime.values.Value v)
Wraps the passed value.
|
static <T extends OCamlValue> |
wrapper(Wrapper<T> w)
Returns a wrapper for
OCamlArray values. |
value, wrap, wrapper
public Wrapper<? extends OCamlArray<T>> getWrapper()
Value
elements into
instances of the current class.getWrapper
in class OCamlValue
Value
elements into
instances of the current classpublic Wrapper<? extends OCamlValue> getWrapper(int idx)
Value
elements into
instances of the embedded type at given index.getWrapper
in class OCamlValue
idx
- index of embedded typeValue
elements into
instances of the embedded type at given index.public T get(int idx)
idx
- index of valuepublic void set(int idx, T v)
idx
- index of value to modifyv
- new valuepublic long length()
public java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T extends OCamlValue>
public int hashCode()
hashCode
in class OCamlValue
public boolean equals(java.lang.Object obj)
equals
in class OCamlValue
public java.lang.String toString()
toString
in class OCamlValue
public static <T extends OCamlValue> OCamlArray<T> create(int sz, T v)
'a array
value, and wraps it.sz
- array size - should not be negativev
- initial value for each array element - should not be null
OCamlArray
instance wrapping the passed valuepublic static <T extends OCamlValue> OCamlArray<T> create(Wrapper<T> w, T[] v)
'a array
value, and wraps it. w
- wrapper for elements - should not be null
v
- array to wrap - should not be null
OCamlArray
instance wrapping the passed valuepublic static <T extends OCamlValue> OCamlArray<T> wrap(Wrapper<T> w, org.ocamljava.runtime.values.Value v)
w
- wrapper for elements - should not be null
v
- value to wrap - should not be null
OCamlArray
instance wrapping the passed valuepublic static <T extends OCamlValue> Wrapper<? extends OCamlArray<T>> wrapper(Wrapper<T> w)
OCamlArray
values.w
- wrapper for elements - should not be null
OCamlArray
values