# this must be run wit the ROmegahatExamples.jar
# file in the classpath (e.g.
# .JavaInit(list(classPath=system.file("org/omegahat/Jars/ROmegahatExamples.jar")))
# so as to be able to find RealVariable!
if(!is.null(.Java("__Evaluator", "expandClassName", "RealVariable"))) {
cvt <- setJavaFunctionConverter(function(jobj,className) {
.Java(jobj, "getValues")
}, function(jobj, className) {
return(className == "org.omegahat.DataStructures.Data.RealVariable")
}, "Omegahat RealVariable to numeric vector")
setJavaConvertible("RealVariable")
.JavaConstructor("RealVariable", rnorm(10))
# now unregister the converter
setJavaConvertible("RealVariable", FALSE)
removeJavaConverter(cvt$index)
}
Run the code above in your browser using DataLab