[rkward-cvs] SF.net SVN: rkward:[2886] trunk/rkward/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Sun Jun 20 17:51:07 UTC 2010
Revision: 2886
http://rkward.svn.sourceforge.net/rkward/?rev=2886&view=rev
Author: tfry
Date: 2010-06-20 17:51:06 +0000 (Sun, 20 Jun 2010)
Log Message:
-----------
Add initial support for GUI scripting. This will need some more refining, but all the basics appear to work.
Modified Paths:
--------------
trunk/rkward/rkward/CMakeLists.txt
trunk/rkward/rkward/plugin/rkcomponent.cpp
trunk/rkward/rkward/plugin/rkcomponent.h
trunk/rkward/rkward/plugin/rkstandardcomponent.cpp
trunk/rkward/rkward/plugin/rkstandardcomponent.h
trunk/rkward/rkward/plugins/testing/test1.js
trunk/rkward/rkward/plugins/testing/test1.xml
trunk/rkward/rkward/scriptbackends/CMakeLists.txt
Added Paths:
-----------
trunk/rkward/rkward/scriptbackends/rkcomponentscripting.cpp
trunk/rkward/rkward/scriptbackends/rkcomponentscripting.h
trunk/rkward/rkward/scriptbackends/rkcomponentscripting.js
Modified: trunk/rkward/rkward/CMakeLists.txt
===================================================================
--- trunk/rkward/rkward/CMakeLists.txt 2010-06-16 19:13:56 UTC (rev 2885)
+++ trunk/rkward/rkward/CMakeLists.txt 2010-06-20 17:51:06 UTC (rev 2886)
@@ -52,7 +52,7 @@
@ONLY)
ADD_DEPENDENCIES(rkward.bin ${RKWARD_WRAPPER_SCRIPT})
-TARGET_LINK_LIBRARIES(rkward.bin ${KDE4_KDECORE_LIBS} windows ${RKWARD_ADDLIBS} agents dialogs plugin settings dataeditor core scriptbackends rbackend misc ktexteditor ${KDE4_KHTML_LIBS} ${KDE4_KFILE_LIBS} ${KDE4_KDEUI_LIBS} ${QT_QTSCRIPT_LIBRARY})
+TARGET_LINK_LIBRARIES(rkward.bin ${KDE4_KDECORE_LIBS} windows ${RKWARD_ADDLIBS} agents dialogs plugin settings dataeditor core scriptbackends rbackend misc ktexteditor ${KDE4_KHTML_LIBS} ${KDE4_KFILE_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KROSSCORE_LIBS} ${QT_QTSCRIPT_LIBRARY})
########### install files ###############
Modified: trunk/rkward/rkward/plugin/rkcomponent.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponent.cpp 2010-06-16 19:13:56 UTC (rev 2885)
+++ trunk/rkward/rkward/plugin/rkcomponent.cpp 2010-06-20 17:51:06 UTC (rev 2886)
@@ -294,6 +294,8 @@
if (parentComponent ()) {
parentComponent ()->changed ();
}
+
+ emit (componentChanged (this));
}
void RKComponent::removeFromParent () {
Modified: trunk/rkward/rkward/plugin/rkcomponent.h
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponent.h 2010-06-16 19:13:56 UTC (rev 2885)
+++ trunk/rkward/rkward/plugin/rkcomponent.h 2010-06-20 17:51:06 UTC (rev 2886)
@@ -181,6 +181,9 @@
protected slots:
/** if a child component self-destructs, it should remove itself from its parent *before* destructing. Don't use in a regular destructor. Call only if the child dies unexpectedly */
void removeFromParent ();
+signals:
+/** emitted from changed() */
+ void componentChanged (RKComponent* component);
protected:
RKComponentPropertyBool *visibility_property;
RKComponentPropertyBool *enabledness_property;
Modified: trunk/rkward/rkward/plugin/rkstandardcomponent.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponent.cpp 2010-06-16 19:13:56 UTC (rev 2885)
+++ trunk/rkward/rkward/plugin/rkstandardcomponent.cpp 2010-06-20 17:51:06 UTC (rev 2886)
@@ -34,6 +34,7 @@
#include "../scriptbackends/phpbackend.h"
#include "../scriptbackends/qtscriptbackend.h"
#include "../scriptbackends/simplebackend.h"
+#include "../scriptbackends/rkcomponentscripting.h"
#include "../misc/xmlhelper.h"
#include "../settings/rksettingsmoduleplugins.h"
@@ -64,6 +65,7 @@
RKStandardComponent::handle = handle;
command_chain = 0;
backend = 0;
+ scripting = 0;
gui = 0;
wizard = 0;
created = false;
@@ -171,6 +173,15 @@
deleteLater ();
}
+RKComponentScriptingProxy* RKStandardComponent::scriptingProxy () {
+ RK_TRACE (PLUGIN);
+
+ if (!scripting) {
+ scripting = new RKComponentScriptingProxy (this);
+ }
+ return scripting;
+}
+
void RKStandardComponent::hide () {
RK_TRACE (PLUGIN);
@@ -640,6 +651,13 @@
} else {
xml->displayError (&e, QString ("Could not embed component '%1'. Not found").arg (component_id), DL_ERROR);
}
+ } else if (e.tagName () == "scriptable") {
+ widget = new RKComponent (component (), parent_widget);
+ QVBoxLayout *layout = new QVBoxLayout (widget);
+ layout->setContentsMargins (0, 0, 0, 0);
+ KVBox *box = new KVBox (widget);
+ layout->addWidget (box);
+ component ()->scriptingProxy ()->addScriptableWidget (id, widget);
} else {
xml->displayError (&e, QString ("Invalid tagname '%1'").arg (e.tagName ()), DL_ERROR);
}
@@ -704,6 +722,13 @@
convert->setRequireTrue (xml->getBoolAttribute (*it, "require_true", false, DL_INFO));
component ()->addChild (id, convert);
}
+
+ QDomElement e = xml->getChildElement (element, "script", DL_INFO);
+ if (!e.isNull ()) {
+ QString file = xml->getStringAttribute (e, "file", QString (), DL_INFO);
+ QString inline_command = e.text ();
+ component ()->scriptingProxy ()->initialize (file, inline_command);
+ }
}
void RKComponentBuilder::addConnection (const QString &client_id, const QString &client_property, const QString &governor_id, const QString &governor_property, bool reconcile, const QDomElement &origin) {
Modified: trunk/rkward/rkward/plugin/rkstandardcomponent.h
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponent.h 2010-06-16 19:13:56 UTC (rev 2885)
+++ trunk/rkward/rkward/plugin/rkstandardcomponent.h 2010-06-20 17:51:06 UTC (rev 2886)
@@ -23,6 +23,7 @@
#include <qdom.h>
#include <QList>
+class RKComponentScriptingProxy;
class RKStandardComponentGUI;
class RCommandChain;
class RKComponentHandle;
@@ -79,6 +80,9 @@
ComponentStatus recursiveStatus ();
RCommandChain *commandChain () const { return command_chain; };
+
+/** Return the GUI-scripting handler (creating it, if needed) */
+ RKComponentScriptingProxy* scriptingProxy ();
public slots:
/** this gets called by the script-backend, when it's done. Might enable the
submit button or destruct the plugin. */
@@ -102,6 +106,7 @@
QString filename;
bool have_help; // TODO: replace by filename, once we use the help more
ScriptBackend *backend;
+ RKComponentScriptingProxy* scripting;
RKStandardComponentGUI *gui;
RKComponentHandle *handle;
RKStandardComponentStack *wizard;
Modified: trunk/rkward/rkward/plugins/testing/test1.js
===================================================================
--- trunk/rkward/rkward/plugins/testing/test1.js 2010-06-16 19:13:56 UTC (rev 2885)
+++ trunk/rkward/rkward/plugins/testing/test1.js 2010-06-20 17:51:06 UTC (rev 2886)
@@ -1,14 +1,11 @@
function preprocess () {
printIndented ("\t\t", "This is\n\t\a\ntest");
- printIndented ("---", getValue ("embedded.code.preprocess"));
}
function calculate () {
echo ('model = glm (' + getValue ("model") + ', data=' + getValue ("model.table") + ')\n');
echo ('labels = ' + getValue ("model.labels") + '\n');
echo ('result = anova (model)\n');
-
- printIndented ("---", getValue ("embedded.code.calculate"));
}
function printout () {
Modified: trunk/rkward/rkward/plugins/testing/test1.xml
===================================================================
--- trunk/rkward/rkward/plugins/testing/test1.xml 2010-06-16 19:13:56 UTC (rev 2885)
+++ trunk/rkward/rkward/plugins/testing/test1.xml 2010-06-20 17:51:06 UTC (rev 2886)
@@ -2,9 +2,27 @@
<document>
<code file="test1.js"/>
-
- <dialog label="Testing QtScript code generation">
- <text>
+
+ <logic>
+ <script><![CDATA[
+ gui.setValue ("Select a dependent variable!", "text.text");
+
+ f = Kross.module('forms');
+ label = f.createWidget(scripty, 'QLabel', 'Label', {});
+ label.setText ('<b>This label was created by the script. Be sure to read the label above, too.</b>');
+
+ _rkward.addChangeCommand ("x.available", "updateText ()");
+ updateText = function () {
+ obj = makeRObject (gui.getValue ("x.available"));
+ text = "So, you think it's '" + obj.objectname + "'?\n";
+ text += "That has length " + obj.dimensions() + " and classes " + obj.classes() + "!";
+ gui.setValue (text, "text.text");
+ }
+ ]]></script>
+ </logic>
+
+ <dialog label="Testing Kross/QtScript code generation">
+ <text id="text">
This plugin is bogus! Do not use!
</text>
<tabbook>
@@ -18,13 +36,11 @@
<varslot type="numeric" id="y" source="vars" required="true" multi="true" label="fixed factors"/>
</column>
</row>
+ <scriptable id="scripty"/>
</tab>
<tab label="Model">
<formula id="model" fixed_factors="y" dependent="x" label="Now chose the model"/>
</tab>
- <tab>
- <embed id="embedded" component="rkward::qtscript_test2"/>
- </tab>
</tabbook>
</dialog>
Modified: trunk/rkward/rkward/scriptbackends/CMakeLists.txt
===================================================================
--- trunk/rkward/rkward/scriptbackends/CMakeLists.txt 2010-06-16 19:13:56 UTC (rev 2885)
+++ trunk/rkward/rkward/scriptbackends/CMakeLists.txt 2010-06-20 17:51:06 UTC (rev 2886)
@@ -8,6 +8,7 @@
scriptbackend.cpp
simplebackend.cpp
qtscriptbackend.cpp
+ rkcomponentscripting.cpp
)
QT4_AUTOMOC(${scriptbackends_STAT_SRCS})
@@ -17,7 +18,7 @@
########### install files ###############
-INSTALL(FILES common.php php.ini common.js DESTINATION ${DATA_INSTALL_DIR}/rkward/phpfiles )
+INSTALL(FILES common.php php.ini common.js rkcomponentscripting.js DESTINATION ${DATA_INSTALL_DIR}/rkward/phpfiles )
Added: trunk/rkward/rkward/scriptbackends/rkcomponentscripting.cpp
===================================================================
--- trunk/rkward/rkward/scriptbackends/rkcomponentscripting.cpp (rev 0)
+++ trunk/rkward/rkward/scriptbackends/rkcomponentscripting.cpp 2010-06-20 17:51:06 UTC (rev 2886)
@@ -0,0 +1,208 @@
+/***************************************************************************
+ rkcomponentscripting - description
+ -------------------
+ begin : Thu Jun 17 2010
+ copyright : (C) 2010 by Thomas Friedrichsmeier
+ email : tfry at users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "rkcomponentscripting.h"
+
+#include <klocale.h>
+
+#include "../plugin/rkcomponent.h"
+#include "../core/robjectlist.h"
+#include "../misc/rkcommonfunctions.h"
+
+#include "../debug.h"
+
+RKComponentScriptingProxy::RKComponentScriptingProxy (RKComponent *component) : QObject (component) {
+ RK_TRACE (PHP);
+
+ RK_ASSERT (component);
+ RKComponentScriptingProxy::component = component;
+
+ script = new Kross::Action (this, QString ());
+ script->setInterpreter ("qtscript");
+ script->addObject (this, "_rkward");
+}
+
+RKComponentScriptingProxy::~RKComponentScriptingProxy () {
+ RK_TRACE (PHP);
+}
+
+void RKComponentScriptingProxy::initialize (const QString& file, const QString& command) {
+ RK_TRACE (PHP);
+
+ QString _command = command;
+ if (!file.isEmpty ()) {
+ _command.prepend ("include('" + file + "');\n");
+ _scriptfile = file;
+ }
+ QDir files_path (RKCommonFunctions::getRKWardDataDir () + "phpfiles/");
+ _command.prepend ("_rkward.include('" + files_path.absoluteFilePath ("rkcomponentscripting.js") + "');\n");
+ script->setCode (_command.toUtf8 ());
+
+ script->trigger ();
+ handleScriptError ();
+}
+
+void RKComponentScriptingProxy::handleScriptError (const QString& current_file) {
+ RK_TRACE (PHP);
+
+ QString file = current_file;
+ if (file.isEmpty ()) file = _scriptfile;
+ if (script->hadError ()) {
+#warning TODO: refine error messages (file/context), and display them in a dialog
+qDebug ("line %d: %s", script->errorLineNo (), qPrintable (script->errorMessage ()));
+ }
+}
+
+void RKComponentScriptingProxy::include (const QString& filename) {
+ RK_TRACE (PHP);
+
+ QString _filename = filename;
+ if (QFileInfo (filename).isRelative ()) {
+ KUrl script_path = KUrl (QUrl::fromLocalFile (_scriptfile)).upUrl ();
+ script_path.addPath (filename);
+ _filename = script_path.toLocalFile ();
+ }
+
+ QFile file (_filename);
+ if (!file.open (QIODevice::ReadOnly | QIODevice::Text)) {
+ script->evaluate (i18n ("error ('The file \"%1\" (needed by \"%2\") could not be found. Please check your installation.');\n", _filename, _scriptfile).toUtf8 ());
+ return;
+ }
+
+ script->evaluate (file.readAll());
+ handleScriptError (_filename);
+}
+
+void RKComponentScriptingProxy::addScriptableWidget (const QString& name, QWidget *widget) {
+ RK_TRACE (PHP);
+
+ script->addObject (widget, name);
+}
+
+void RKComponentScriptingProxy::addChangeCommand (const QString& changed_id, const QString& command) {
+ RK_TRACE (PHP);
+
+ QString remainder;
+ RKComponentBase* base = component->lookupComponent (changed_id, &remainder);
+
+ if (remainder.isEmpty ()) {
+ component_commands.insert (base, command);
+ if (base->isComponent()) {
+ connect (static_cast<RKComponent*> (base), SIGNAL (componentChanged(RKComponent*)), this, SLOT (componentChanged(RKComponent*)));
+ } else {
+ connect (static_cast<RKComponentPropertyBase*> (base), SIGNAL (valueChanged(RKComponentPropertyBase*)), this, SLOT (propertyChanged(RKComponentPropertyBase*)));
+ }
+ } else {
+ script->setError (QString ("error ('No such property %1 (failed portion was %2)');\n").arg (changed_id, remainder));
+ }
+}
+
+void RKComponentScriptingProxy::componentChanged (RKComponent* changed) {
+ RK_TRACE (PHP);
+ handleChange (changed);
+}
+
+void RKComponentScriptingProxy::propertyChanged (RKComponentPropertyBase* changed) {
+ RK_TRACE (PHP);
+ handleChange (changed);
+}
+
+void RKComponentScriptingProxy::handleChange (RKComponentBase* changed) {
+ RK_TRACE (PHP);
+
+ QString command = component_commands.value (changed);
+ script->evaluate (command.toUtf8());
+}
+
+QString RKComponentScriptingProxy::getValue (const QString &id) const {
+ RK_TRACE (PHP);
+
+ return component->fetchStringValue (id);
+}
+
+void RKComponentScriptingProxy::setValue (const QString &value, const QString &id) {
+ RK_TRACE (PHP);
+
+ QString modifier;
+ RKComponentBase* resolved = component->lookupComponent (id, &modifier);
+ if (resolved && modifier.isEmpty () && resolved->isProperty ()) {
+ static_cast<RKComponentPropertyBase*> (resolved)->setValue (value);
+ } else {
+ script->setError (QString ("error ('No such property %1 (failed portion was %2)');\n").arg (id, modifier));
+ }
+}
+
+QVariantList RKComponentScriptingProxy::getObjectInfo (const QString &name) {
+ RK_TRACE (PHP);
+
+ RObject* object = RObjectList::getObjectList ()->findObject (name);
+ if (object) {
+ QVariantList ret;
+
+ QVariantList dims;
+ for (unsigned int i = 0; i < object->numDimensions (); ++i) {
+ dims.append (object->getDimension (i));
+ }
+ ret.append (QVariant (dims));
+
+ QStringList classes;
+ for (unsigned int i = 0; i < object->numClasses (); ++i) {
+ classes.append (object->getClassName (i));
+ }
+ ret.append (QVariant (classes));
+
+ ret.append (object->isType (RObject::DataFrame));
+ ret.append (object->isType (RObject::Matrix));
+ ret.append (object->isType (RObject::List));
+ ret.append (object->isType (RObject::Function));
+ ret.append (object->isType (RObject::Environment));
+
+ if (object->getDataType () == RObject::DataNumeric) ret.append ("numeric");
+ else if (object->getDataType () == RObject::DataFactor) ret.append ("factor");
+ else if (object->getDataType () == RObject::DataCharacter) ret.append ("character");
+ else if (object->getDataType () == RObject::DataLogical) ret.append ("logical");
+ else ret.append ("unknown");
+
+ return (ret);
+ }
+ return (QVariantList ());
+}
+
+QString RKComponentScriptingProxy::getObjectParent (const QString &name) {
+ RK_TRACE (PHP);
+
+ RObject* object = RObjectList::getObjectList ()->findObject (name);
+ if (object) {
+ if (object->getContainer ()) return (object->getContainer ()->getFullName ());
+ }
+ return (QString ());
+}
+
+QString RKComponentScriptingProxy::getObjectChild (const QString &name) {
+ RK_TRACE (PHP);
+ RObject* object = RObjectList::getObjectList ()->findObject (name);
+
+ if (object) {
+ if (object->isContainer ()) {
+ RObject* child = static_cast<RContainerObject*> (object)->findChildByName (name);
+ if (child) return (child->getFullName ());
+ }
+ }
+ return (QString ());
+}
+
+#include "rkcomponentscripting.moc"
Added: trunk/rkward/rkward/scriptbackends/rkcomponentscripting.h
===================================================================
--- trunk/rkward/rkward/scriptbackends/rkcomponentscripting.h (rev 0)
+++ trunk/rkward/rkward/scriptbackends/rkcomponentscripting.h 2010-06-20 17:51:06 UTC (rev 2886)
@@ -0,0 +1,69 @@
+/***************************************************************************
+ rkcomponentscripting - description
+ -------------------
+ begin : Thu Jun 17 2010
+ copyright : (C) 2010 by Thomas Friedrichsmeier
+ email : tfry at users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef RKCOMPONENTSCRIPTING_H
+#define RKCOMPONENTSCRIPTING_H
+
+#include <QObject>
+#include <QHash>
+
+#include <kross/core/action.h>
+
+class RKComponent;
+class RKComponentBase;
+class RKComponentPropertyBase;
+
+/** This class basically provides the API that is available to scripts running within rkward plugins.
+The slots are meant to be called from the script.
+
+NOTE: This contains some duplication of ScriptBackend and derived classes. Perhaps this can be merged, better.
+The key technical difference between this, and ScriptBackend, is that this operates in the main thread, while
+ScriptBackend is designed to operate in a separate thread, and may merge a bunch of changes into a single update. */
+class RKComponentScriptingProxy : public QObject {
+Q_OBJECT
+public:
+ RKComponentScriptingProxy (RKComponent *component);
+ ~RKComponentScriptingProxy ();
+
+ void initialize (const QString& file, const QString& command);
+ void addScriptableWidget (const QString& name, QWidget *widget);
+public slots:
+ void componentChanged (RKComponent* changed);
+ void propertyChanged (RKComponentPropertyBase* changed);
+
+// these are meant to be called from the script
+ void include (const QString& filename);
+ void addChangeCommand (const QString& changed_id, const QString& command);
+
+ QString getValue (const QString &id) const;
+ void setValue (const QString &value, const QString &id);
+
+ QVariantList getObjectInfo (const QString &name);
+ QString getObjectParent (const QString &name);
+ QString getObjectChild (const QString &name);
+private:
+ RKComponent* component;
+ Kross::Action* script;
+ QString _scriptfile;
+
+ void handleChange (RKComponentBase* changed);
+ QHash<RKComponentBase*, QString> component_commands;
+
+ void handleScriptError (const QString& current_file=QString ());
+};
+
+#endif
Added: trunk/rkward/rkward/scriptbackends/rkcomponentscripting.js
===================================================================
--- trunk/rkward/rkward/scriptbackends/rkcomponentscripting.js (rev 0)
+++ trunk/rkward/rkward/scriptbackends/rkcomponentscripting.js 2010-06-20 17:51:06 UTC (rev 2886)
@@ -0,0 +1,144 @@
+/***************************************************************************
+ rkcomponentscripting - description
+ -------------------
+ begin : Thu Jun 17 2010
+ copyright : (C) 2010 by Thomas Friedrichsmeier
+ email : tfry at users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// _rkward = Handler object set from RKWard
+
+function Component(id) {
+ this._id = id;
+
+ // this one is mostly for internal use
+ this.absoluteId = function (id) {
+ if (this._id == "") return (id);
+ if (id) return (this._id + "." + id);
+ return (this._id);
+ }
+
+ this.getValue = function (id) {
+ return (_rkward.getValue (this.absoluteId (id)));
+ }
+
+ this.setValue = function (value, id) {
+ return (_rkward.setValue (value, this.absoluteId (id)));
+ }
+
+ this.getChild = function (id) {
+ return (new Component (this.absoluteId (id)));
+ }
+}
+makeComponent = function (id) {
+ return (new Component (id));
+}
+gui = new Component ("");
+
+function RObject(objectname) {
+ this.objectname = objectname;
+
+ // for internal use
+ this.initialize = function () {
+ info = _rkward.getObjectInfo (this.objectname);
+
+ this._dimensions = info.shift ();
+ this._classes = info.shift ();
+ this._isDataFrame = info.shift ();
+ this._isMatrix = info.shift ();
+ this._isList = info.shift ();
+ this._isFunction = info.shift ();
+ this._isEnvironment = info.shift ();
+ this._datatype = info.shift ();
+ }
+
+ this.initialize();
+
+ this.getName = function () {
+ return (this._name);
+ }
+
+ this.exists = function () {
+ return (typeof (this._dimensions) != "undefined");
+ }
+
+ this.dimensions = function () {
+ return (this._dimensions);
+ }
+
+ this.classes = function () {
+ return (this._classes);
+ }
+
+ this.isClass = function (classname) {
+ return (this._classes.contains (classname));
+ }
+
+ this.isDataFrame = function () {
+ return (this._isDataFrame);
+ }
+
+ this.isMatrix = function () {
+ return (this._isMatrix);
+ }
+
+ this.isList = function () {
+ return (this._isList);
+ }
+
+ this.isFunction = function () {
+ return (this._isFunction);
+ }
+
+ this.isEnvironment = function () {
+ return (this._isEnvironment);
+ }
+
+ this.isDataNumeric = function () {
+ return (this._datatype == "numeric");
+ }
+
+ this.isDataFactor = function () {
+ return (this._datatype == "factor");
+ }
+
+ this.isDataCharacter = function () {
+ return (this._datatype == "character");
+ }
+
+ this.isDataLogical = function () {
+ return (this._datatype == "logical");
+ }
+
+ this.parent = function () {
+ return (new RObject (_rkward.getObjectParent (this._name)));
+ }
+
+ this.child = function (childname) {
+ return (new RObject (_rkward.getObjectChild (this._name, childname)));
+ }
+}
+makeRObject = function (objectname) {
+ return (new RObject (objectname));
+}
+
+function RObjectArray(names) {
+ this._objects = new Array ();
+
+ objs = names.split ('\n');
+ while (objs.length () > 0) {
+ this._objects.push (new RObject (objs.shift ()));
+ }
+}
+makeRObjectArray = function (objectnames) {
+ return (new RObjectArray (objectnames));
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list