summaryrefslogtreecommitdiffstats
path: root/contrib/java
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-08-13 12:24:51 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-08-13 12:24:51 (GMT)
commitd35b69b97dead2e50dda697f0fb0d5e574bbf205 (patch)
tree6eac5b09bdc23b3aeb478779a7a25f5caf0f3568 /contrib/java
parent459f406eb2a36d393bd3a2b6aa3d63d86eb99c07 (diff)
downloaduscxml-d35b69b97dead2e50dda697f0fb0d5e574bbf205.zip
uscxml-d35b69b97dead2e50dda697f0fb0d5e574bbf205.tar.gz
uscxml-d35b69b97dead2e50dda697f0fb0d5e574bbf205.tar.bz2
Renamed event.type to eventType to avoid clash with send.type and invoker.type
Diffstat (limited to 'contrib/java')
-rw-r--r--contrib/java/src/org/uscxml/tests/TestDataModel.java83
1 files changed, 66 insertions, 17 deletions
diff --git a/contrib/java/src/org/uscxml/tests/TestDataModel.java b/contrib/java/src/org/uscxml/tests/TestDataModel.java
index c9d8ae0..e3c8d7a 100644
--- a/contrib/java/src/org/uscxml/tests/TestDataModel.java
+++ b/contrib/java/src/org/uscxml/tests/TestDataModel.java
@@ -16,11 +16,20 @@ public class TestDataModel extends JavaDataModel {
@Override
public JavaDataModel create(Interpreter interpreter) {
- return new JavaDataModel();
+ /**
+ * An SCXML interpreter wants an instance of this datamodel
+ */
+ System.out.println("create");
+ return new TestDataModel();
}
@Override
public StringSet getNames() {
+ /**
+ * Register with the following names for the datamodel attribute
+ * at the scxml element.
+ */
+ System.out.println("getNames");
StringSet ss = new StringSet();
ss.insert("java");
return ss;
@@ -28,67 +37,107 @@ public class TestDataModel extends JavaDataModel {
@Override
public boolean validate(String location, String schema) {
+ /**
+ * Validate the datamodel. This make more sense for XML datamodels
+ * and is pretty much unused but required as per draft.
+ */
+ System.out.println("validate " + location + " " + schema);
return true;
}
@Override
public void setEvent(Event event) {
- /* make sure the fields of event are available as _event to conform
- * with the SCXML draft
+ /**
+ * Make the event available as the variable _event
+ * in the datamodel.
*/
+ System.out.println("setEvent " + event);
}
@Override
public Data getStringAsData(String content) {
+ /**
+ * Evaluate the string as a value expression and
+ * transform it into a JSON-like Data structure
+ */
+ System.out.println("getStringAsData " + content);
Data data = new Data();
return data;
}
@Override
public long getLength(String expr) {
+ /**
+ * Return the length of the expression if it were an
+ * array, used by foreach element.
+ */
+ System.out.println("getLength " + expr);
return 0;
}
@Override
public void setForeach(String item, String array, String index, long iteration) {
+ /**
+ * Prepare an iteration of the foreach element, by setting the variable in index
+ * to the curent iteration and setting the variable in item to the current item
+ * from array.
+ */
+ System.out.println("setForeach " + item + " " + index + " " + iteration);
}
@Override
- public void eval(SWIGTYPE_p_Arabica__DOM__ElementT_std__string_t scriptElem, String expr) {
+ public void eval(String scriptElem, String expr) {
+ /**
+ * Evaluate the given expression in the datamodel.
+ * This is used foremost with script elements.
+ */
+ System.out.println("eval " + scriptElem + " " + expr);
}
@Override
public String evalAsString(String expr) {
+ /**
+ * Evaluate the expression as a string e.g. for the log element.
+ */
+ System.out.println("evalAsString " + expr);
return "";
}
@Override
public boolean evalAsBool(String expr) {
+ /**
+ * Evaluate the expression as a boolean for cond attributes in
+ * if and transition elements.
+ */
+ System.out.println("evalAsBool " + expr);
return true;
}
@Override
public boolean isDeclared(String expr) {
+ /**
+ * The interpreter is supposed to raise an error if we assign
+ * to an undeclared variable. This method is used to check whether
+ * a location from assign is declared.
+ */
+ System.out.println("isDeclared " + expr);
return true;
}
@Override
- public void assign(SWIGTYPE_p_Arabica__DOM__ElementT_std__string_t assignElem, SWIGTYPE_p_Arabica__DOM__DocumentT_std__string_t doc, String content) {
- }
-
- @Override
- public void assign(String location, Data data) {
- super.assign(location, data);
- }
-
- @Override
- public void init(SWIGTYPE_p_Arabica__DOM__ElementT_std__string_t dataElem, SWIGTYPE_p_Arabica__DOM__DocumentT_std__string_t doc, String content) {
- super.init(dataElem, doc, content);
+ public void init(String dataElem, String location, String content) {
+ /**
+ * Called when we pass data elements.
+ */
+ System.out.println("init " + dataElem + " " + location + " " + content);
}
@Override
- public void init(String location, Data data) {
- super.init(location, data);
+ public void assign(String assignElem, String location, String content) {
+ /**
+ * Called when we evaluate assign elements
+ */
+ System.out.println("assign " + assignElem + " " + location + " " + content);
}
/**