References to java arrays that are guaranteed to be rectangular, i.e similar to R arrays

Objects from the Class

Objects of this class should *not* be created directly. Instead, they usually come as a result of a java method call.

Slots

jsig:

JNI signature of the array type

jobj:

Internal identifier of the object

jclass:

Inherited from jobjRef, but unspecified

dimension:

dimension vector of the array

Extends

Class "jarrayRef", directly. Class "jobjRef", by class "jarrayRef", distance 2.

Methods

length

signature(x = "jrectRef"): The number of elements in the array. Note that if the array has more than one dimension, it gives the number of arrays in the first dimension, and not the total number of atomic objects in the array (like R does). This gives what would be returned by array.length in java.

str

signature(object = "jrectRef"): ...

[

signature(x = "jrectRef"): R indexing of rectangular java arrays

dim

signature(x = "jrectRef"): extracts the dimensions of the array

dim<-

signature(x = "jrectRef"): sets the dimensions of the array

unique

signature(x = "jrectRef"): unique objects in the array

duplicated

signature(x = "jrectRef"): see duplicated

anyDuplicated

signature(x = "jrectRef"): see anyDuplicated

sort

signature(x = "jrectRef"): returns a new array with elements from x in order

rev

signature(x = "jrectRef"): returns a new array with elements from x reversed

min

signature(x = "jrectRef"): the smallest object in the array (in the sense of the Comparable interface)

max

signature(x = "jrectRef"): the biggest object in the array (in the sense of the Comparable interface)

range

signature(x = "jrectRef"): the range of the array (in the sense of the Comparable interface)

Examples

v <- new( J("java.util.Vector") )
v$add( "hello" )
#> [1] TRUE
v$add( "world" )
#> [1] TRUE
v$add( new( J("java.lang.Double"), "10.2" ) )
#> [1] TRUE
array <- v$toArray()

array[ c(TRUE,FALSE,TRUE) ]
#> [1] "Java-Array-Object[Ljava/lang/Object;:[Ljava.lang.Object;@11e21d0e"
array[ 1:2 ]
#> [1] "Java-Array-Object[Ljava/lang/Object;:[Ljava.lang.Object;@1dd02175"
array[ -3 ]
#> [1] "Java-Array-Object[Ljava/lang/Object;:[Ljava.lang.Object;@31206beb"

# length
length( array )
#> [1] 3

# also works as a pseudo field as in java
array$length
#> [1] 3