|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.rosuda.REngine.REXP org.rosuda.REngine.REXPReference
public class REXPReference
this class represents a reference (proxy) to an R object.
The reference semantics works by calling resolve()
(which in turn uses REngine.resolveReference(REXP)
on itself) whenever any methods are accessed. The implementation is not finalized yat and may change as we approach the JRI interface which is more ameanable to reference-style access. Subclasses are free to implement more efficient implementations.
Field Summary | |
---|---|
protected REngine |
eng
engine which will be used to resolve the reference |
protected java.lang.Object |
handle
an opaque (optional) handle |
protected REXP |
resolvedValue
resolved (cached) object |
Fields inherited from class org.rosuda.REngine.REXP |
---|
attr, maxDebugItems |
Constructor Summary | |
---|---|
REXPReference(REngine eng,
java.lang.Object handle)
create an external REXP reference using given engine and handle. |
Method Summary | |
---|---|
REXPList |
_attr()
this method allows a limited access to object's attributes - REXP.getAttribute(java.lang.String) should be used instead to access specific attributes!. |
double[] |
asDoubles()
returns the contents as an array of doubles (if supported by the represented object) |
RFactor |
asFactor()
returns the contents as a factor (if supported by the represented object) |
int[] |
asIntegers()
returns the contents as an array of integers (if supported by the represented object) |
RList |
asList()
returns the contents as a (named) list (if supported by the represented object) |
java.lang.String[] |
asStrings()
returns the contents as an array of Strings (if supported by the represented object) |
protected void |
finalize()
finalization that notifies the engine when a reference gets collected |
REngine |
getEngine()
|
java.lang.Object |
getHandle()
|
void |
invalidate()
invalidates any cached representation of the reference |
boolean |
isComplex()
check whether the REXP object is a complex vector |
boolean |
isEnvironment()
check whether the REXP object is an environment |
boolean |
isFactor()
check whether the REXP object is a factor |
boolean |
isInteger()
check whether the REXP object is an integer vector |
boolean |
isLanguage()
check whether the REXP object is a language object |
boolean |
isList()
check whether the REXP object is a list (either generic vector or a pairlist - i.e. |
boolean |
isLogical()
check whether the REXP object is a logical vector |
boolean |
isNull()
check whether the REXP object is NULL |
boolean |
isNumeric()
check whether the REXP object is a numeric vector |
boolean |
isRaw()
check whether the REXP object is a raw vector |
boolean |
isRecursive()
check whether the REXP object is a recursive obejct |
boolean |
isReference()
check whether the REXP object is a reference to an R object |
boolean |
isString()
check whether the REXP object is a character vector (string) |
boolean |
isSymbol()
check whether the REXP object is a symbol |
boolean |
isVector()
check whether the REXP object is a vector |
int |
length()
returns the length of a vector object. |
REXP |
resolve()
resolve the external REXP reference into an actual REXP object. |
java.lang.String |
toString()
returns a string description of the object |
Methods inherited from class org.rosuda.REngine.REXP |
---|
asBytes, asDouble, asDoubleMatrix, asInteger, asNativeJavaObject, asString, createDataFrame, createDoubleMatrix, dim, getAttribute, hasAttribute, inherits, isExpression, isNA, isPairList, toDebugString |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected REngine eng
protected java.lang.Object handle
protected REXP resolvedValue
Constructor Detail |
---|
public REXPReference(REngine eng, java.lang.Object handle)
Method Detail |
---|
public REXP resolve()
null
) will be cached for subsequent calls to resolve
until invalidate
is called.
public void invalidate()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public boolean isString()
REXP
REXP
object is a character vector (string)
isString
in class REXP
true
if the receiver is a character vector, false
otherwisepublic boolean isNumeric()
REXP
REXP
object is a numeric vector
isNumeric
in class REXP
true
if the receiver is a numeric vector, false
otherwisepublic boolean isInteger()
REXP
REXP
object is an integer vector
isInteger
in class REXP
true
if the receiver is an integer vector, false
otherwisepublic boolean isNull()
REXP
REXP
object is NULL
isNull
in class REXP
true
if the receiver is NULL, false
otherwisepublic boolean isFactor()
REXP
REXP
object is a factor
isFactor
in class REXP
true
if the receiver is a factor, false
otherwisepublic boolean isList()
REXP
REXP
object is a list (either generic vector or a pairlist - i.e. REXP.asList()
will succeed)
isList
in class REXP
true
if the receiver is a generic vector or a pair-list, false
otherwisepublic boolean isLogical()
REXP
REXP
object is a logical vector
isLogical
in class REXP
true
if the receiver is a logical vector, false
otherwisepublic boolean isEnvironment()
REXP
REXP
object is an environment
isEnvironment
in class REXP
true
if the receiver is an environment, false
otherwisepublic boolean isLanguage()
REXP
REXP
object is a language object
isLanguage
in class REXP
true
if the receiver is a language object, false
otherwisepublic boolean isSymbol()
REXP
REXP
object is a symbol
isSymbol
in class REXP
true
if the receiver is a symbol, false
otherwisepublic boolean isVector()
REXP
REXP
object is a vector
isVector
in class REXP
true
if the receiver is a vector, false
otherwisepublic boolean isRaw()
REXP
REXP
object is a raw vector
isRaw
in class REXP
true
if the receiver is a raw vector, false
otherwisepublic boolean isComplex()
REXP
REXP
object is a complex vector
isComplex
in class REXP
true
if the receiver is a complex vector, false
otherwisepublic boolean isRecursive()
REXP
REXP
object is a recursive obejct
isRecursive
in class REXP
true
if the receiver is a recursive object, false
otherwisepublic boolean isReference()
REXP
REXP
object is a reference to an R object
isReference
in class REXP
true
if the receiver is a reference, false
otherwisepublic java.lang.String[] asStrings() throws REXPMismatchException
REXP
asStrings
in class REXP
REXPMismatchException
public int[] asIntegers() throws REXPMismatchException
REXP
asIntegers
in class REXP
REXPMismatchException
public double[] asDoubles() throws REXPMismatchException
REXP
asDoubles
in class REXP
REXPMismatchException
public RList asList() throws REXPMismatchException
REXP
asList
in class REXP
REXPMismatchException
public RFactor asFactor() throws REXPMismatchException
REXP
asFactor
in class REXP
REXPMismatchException
public int length() throws REXPMismatchException
REXP
REXP.dim()
for retrieving matrix and multidimentional-array dimensions).
length
in class REXP
REXPMismatchException
- if this is not a vector objectpublic REXPList _attr()
REXP
REXP.getAttribute(java.lang.String)
should be used instead to access specific attributes!. Note that the REXP.attr
attribute should never be used directly incase the REXP implements a lazy access (e.g. via a reference)
_attr
in class REXP
null
if the object has no attributespublic java.lang.Object getHandle()
public REngine getEngine()
public java.lang.String toString()
REXP
toString
in class REXP
REXP.asString()
for accessing string REXPs)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |