|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.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, 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.Objectjava.lang.Throwablepublic boolean isString()
REXPREXP object is a character vector (string)
isString in class REXPtrue if the receiver is a character vector, false otherwisepublic boolean isNumeric()
REXPREXP object is a numeric vector
isNumeric in class REXPtrue if the receiver is a numeric vector, false otherwisepublic boolean isInteger()
REXPREXP object is an integer vector
isInteger in class REXPtrue if the receiver is an integer vector, false otherwisepublic boolean isNull()
REXPREXP object is NULL
isNull in class REXPtrue if the receiver is NULL, false otherwisepublic boolean isFactor()
REXPREXP object is a factor
isFactor in class REXPtrue if the receiver is a factor, false otherwisepublic boolean isList()
REXPREXP object is a list (either generic vector or a pairlist - i.e. REXP.asList() will succeed)
isList in class REXPtrue if the receiver is a generic vector or a pair-list, false otherwisepublic boolean isLogical()
REXPREXP object is a logical vector
isLogical in class REXPtrue if the receiver is a logical vector, false otherwisepublic boolean isEnvironment()
REXPREXP object is an environment
isEnvironment in class REXPtrue if the receiver is an environment, false otherwisepublic boolean isLanguage()
REXPREXP object is a language object
isLanguage in class REXPtrue if the receiver is a language object, false otherwisepublic boolean isSymbol()
REXPREXP object is a symbol
isSymbol in class REXPtrue if the receiver is a symbol, false otherwisepublic boolean isVector()
REXPREXP object is a vector
isVector in class REXPtrue if the receiver is a vector, false otherwisepublic boolean isRaw()
REXPREXP object is a raw vector
isRaw in class REXPtrue if the receiver is a raw vector, false otherwisepublic boolean isComplex()
REXPREXP object is a complex vector
isComplex in class REXPtrue if the receiver is a complex vector, false otherwisepublic boolean isRecursive()
REXPREXP object is a recursive obejct
isRecursive in class REXPtrue if the receiver is a recursive object, false otherwisepublic boolean isReference()
REXPREXP object is a reference to an R object
isReference in class REXPtrue if the receiver is a reference, false otherwise
public java.lang.String[] asStrings()
throws REXPMismatchException
REXP
asStrings in class REXPREXPMismatchException
public int[] asIntegers()
throws REXPMismatchException
REXP
asIntegers in class REXPREXPMismatchException
public double[] asDoubles()
throws REXPMismatchException
REXP
asDoubles in class REXPREXPMismatchException
public RList asList()
throws REXPMismatchException
REXP
asList in class REXPREXPMismatchException
public RFactor asFactor()
throws REXPMismatchException
REXP
asFactor in class REXPREXPMismatchException
public int length()
throws REXPMismatchException
REXPREXP.dim() for retrieving matrix and multidimentional-array dimensions).
length in class REXPREXPMismatchException - if this is not a vector objectpublic REXPList _attr()
REXPREXP.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 REXPnull if the object has no attributespublic java.lang.Object getHandle()
public REngine getEngine()
public java.lang.String toString()
REXP
toString in class REXPREXP.asString() for accessing string REXPs)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||