org.af.jhlir.call
Interface RVectorFactor<WRAPPED_TYPE,ARR_TYPE,EL_TYPE>

Type Parameters:
WRAPPED_TYPE - underlying type of the used back-end, see RObj
ARR_TYPE - used Java array to store the data.
EL_TYPE - boxed type of an element of ARR_TYPE. Extends Object. Example: For RInteger ARR_TYPE equals int[] and
All Superinterfaces:
RObj<WRAPPED_TYPE>
All Known Subinterfaces:
RChar<WRAPPED_TYPE>, RFactor<WRAPPED_TYPE>, RInteger<WRAPPED_TYPE>, RLogical<WRAPPED_TYPE>, RNumeric<WRAPPED_TYPE>, RNumericRef<WRAPPED_REF,RESOLVED_TYPE>, RVector<WRAPPED_TYPE,ARR_TYPE,EL_TYPE>

public interface RVectorFactor<WRAPPED_TYPE,ARR_TYPE,EL_TYPE>
extends RObj<WRAPPED_TYPE>

Common interface for Vectors and Factors. Extends RObj.


Method Summary
 EL_TYPE get(int i)
          Returns the element at the specified position in this vector/factor.
 ARR_TYPE getData()
          Returns an array containing all of the elements in this vector/factor in proper sequence
 List<EL_TYPE> getDataAsList()
          Returns a list containing all of the elements in this vector/factor in proper sequence
 EL_TYPE[] getDataAsObjArr()
          Returns an array containing all of the elements in this vector/factor in proper sequence.
 int getLength()
          Returns the number of elements in this vector/factor.
 String getName(int i)
          Returns the name at the specified position of this vector/factor.
 String[] getNames()
          If no name is set null is returned.
 List<String> getNamesAsList()
          If no name is set null is returned.
 boolean isNA(int i)
          Returns true if the specified element is NA.
 
Methods inherited from interface org.af.jhlir.call.RObj
asRChar, asRDataFrame, asREnvironment, asRFactor, asRInteger, asRList, asRLogical, asRMatrixDouble, asRNumeric, asS3Obj, getWrapped
 

Method Detail

getLength

int getLength()
Returns the number of elements in this vector/factor.

Returns:
the number of elements in this vector/factor

getData

ARR_TYPE getData()
Returns an array containing all of the elements in this vector/factor in proper sequence

Returns:
an array containing all of the elements in this vector/factor in proper sequence

getDataAsObjArr

EL_TYPE[] getDataAsObjArr()
Returns an array containing all of the elements in this vector/factor in proper sequence. If getData() returns an array of primitives, this methods converts to an array of Java Objects. Note that this takes linear time for long arrays.

Returns:
an array containing all of the elements in this vector/factor in proper sequence

getDataAsList

List<EL_TYPE> getDataAsList()
Returns a list containing all of the elements in this vector/factor in proper sequence

Returns:
a list containing all of the elements in this vector/factor in proper sequence

get

EL_TYPE get(int i)
Returns the element at the specified position in this vector/factor.

Parameters:
i - index of the element to return
Returns:
the element at the specified position in this vector/factor
Throws:
IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= getLength())

getName

String getName(int i)
Returns the name at the specified position of this vector/factor. If the name is not set RCallServices.NA_CHAR is returned.

Parameters:
i - index of the position
Returns:
the name of the specified position of this vector/factor

getNames

String[] getNames()
If no name is set null is returned. Otherwise returns a String Array of length equal to getLength() that contains the names of the positions in this vector/factor. If a name is not set RCallServices.NA_CHAR is used.

Returns:
the names of this vector/factor

getNamesAsList

List<String> getNamesAsList()
If no name is set null is returned. Returns a List of Strings of size equal to getLength() that contains the names of the positions in this vector/factor. If a name is not set RCallServices.NA_CHAR is used.

Returns:
the names of this vector/factor

isNA

boolean isNA(int i)
Returns true if the specified element is NA.

Parameters:
i - index of the element to test for NA
Returns:
true if the specified element is NA