module JavaDoubleArray: sig .. end
Support for double[]
type.
type e = java_double
The type of array elements.
type 'a t = 'a java_double_array
The type of arrays.
Usual operations
val make : java_int -> e java_double_array
make len
creates and returns an array of len
elements.
All elements are set to zero.
Raises Java_exception
if len
is negative
val init : java_int ->
(java_int -> e) -> e java_double_array
init len f
creates and returns an array of len
elements.
The element at index i
is initialized with value f i
.
Raises Java_exception
if len
is negative
val length : e java_double_array -> java_int
length a
returns the length of a
.
Raises Java_exception
if a
is null
val get : e java_double_array -> java_int -> e
get a i
returns the element at index i
in a
.
Raises Java_exception
if a
is null
, or i
is out of bounds
val set : e java_double_array -> java_int -> e -> unit
set a i x
changes the element at index i
in a
to x
.
Raises Java_exception
if a
is null
, or i
is out of bounds
val append : e java_double_array ->
e java_double_array -> e java_double_array
append a1 a2
returns the concatenation of a1
and a2
.
Raises Java_exception
if either a1
or a2
is null
val concat : e java_double_array list ->
e java_double_array
concat l
returns the concatenation of arrays in l
.
Raises Java_exception
if any of the arrays in l
is null
val sub : e java_double_array ->
java_int -> java_int -> e java_double_array
sub a ofs len
returns an array of len
elements, copying elements
from a
starting at offset ofs
.
Raises Java_exception
if a
is null
val copy : e java_double_array -> e java_double_array
copy a
returns a copy of a
.
Raises Java_exception
if a
is null
val fill : e java_double_array ->
java_int -> java_int -> e -> unit
fill a ofs len x
sets len
elements of a
to x
, starting at
offset ofs
.
Raises Java_exception
if a
is null
val blit : e java_double_array ->
java_int ->
e java_double_array -> java_int -> java_int -> unit
blit src srcofs dst dstofs len
copies len
elements from src
at
offset srcofs
to dst
at offset dstofs
.
Raises Java_exception
if either src
or ofs
is null
val to_list : e java_double_array -> e list
to_list a
returns the elements of a
as a list.
Raises Java_exception
if a
is null
val of_list : e list -> e java_double_array
of_list l
returns the elements of l
as an array.
Raises Invalid_argument
if l
has more elements than can be
represented by an java_int
value
val iter : (e -> unit) -> e java_double_array -> unit
iter f a
applies f
to each element of a
.
Raises Java_exception
if a
is null
val map : (e -> e) ->
e java_double_array -> e java_double_array
map f a
returns an array with elements f a_0, f a_1, ...
where
a_i
is the element of a
at index i
.
Raises Java_exception
if a
is null
val iteri : (java_int -> e -> unit) ->
e java_double_array -> unit
iter f a
applies f
to each element of a
(also passing element index).
Raises Java_exception
if a
is null
val mapi : (java_int -> e -> e) ->
e java_double_array -> e java_double_array
map f a
returns an array with elements f 0 a_0, f 1 a_1, ...
where
a_i
is the element of a
at index i
.
Raises Java_exception
if a
is null
val fold_left : ('a -> e -> 'a) ->
'a -> e java_double_array -> 'a
fold_left f z a
returns f (... (f (f z a_0) a_1))
where a_i
is
the element of a
at index i
.
Raises Java_exception
if a
is null
val fold_right : (e -> 'a -> 'a) ->
e java_double_array -> 'a -> 'a
fold_right f a z
returns f a_0 (f a_1 (f ... z))
where a_i
is
the element of a
at index i
.
Raises Java_exception
if a
is null
Conversion from/to OCaml arrays
val of_ocaml : e array -> e java_double_array
of_ocaml a
returns a Java array equivalent to a
.
Raises Invalid_argument
if a
has more elements than can be
represented by an java_int
value
val to_ocaml : e java_double_array -> e array
to_ocaml a
returns an OCaml array equivalent to a
.
Raises Java_exception
if a
is null
Java operations
val equals : e java_double_array ->
e java_double_array -> bool
equals a1 a2
tests whether
a1
and
a2
are equal; see
equals(...).
val hash_code : e java_double_array -> java_int
val null : e java_double_array
The null
value.
val is_null : e java_double_array -> bool
is_null x
returns true
iff x
is equal to null
.
val is_not_null : e java_double_array -> bool
is_not_null x
returns false
iff x
is equal to null
.
val wrap : e java_double_array ->
e java_double_array option
wrap x
wraps the array
x
into an option type:
Some x
if x
is not null
;
None
if x
is null
.
val unwrap : e java_double_array option ->
e java_double_array
unwrap x
unwraps the option
x
into a bare reference:
Some x
is mapped to x
;
None
is mapped to null
.