diff options
author | Stefan Radomski <github@mintwerk.de> | 2016-11-28 17:03:31 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2016-11-28 17:03:31 (GMT) |
commit | a6313d4ab2005196f376870c9ca945c691948416 (patch) | |
tree | 5345422d235e7c511885601854b6a2923db09e2e /contrib/java/generated/org/uscxml | |
parent | fcfc842a1ccee7a6b2579889f3236d50849c0679 (diff) | |
download | uscxml-a6313d4ab2005196f376870c9ca945c691948416.zip uscxml-a6313d4ab2005196f376870c9ca945c691948416.tar.gz uscxml-a6313d4ab2005196f376870c9ca945c691948416.tar.bz2 |
Refactored Java into bindings and generated
Diffstat (limited to 'contrib/java/generated/org/uscxml')
17 files changed, 669 insertions, 0 deletions
diff --git a/contrib/java/generated/org/uscxml/Data.java b/contrib/java/generated/org/uscxml/Data.java new file mode 100644 index 0000000..c3dfe7d --- /dev/null +++ b/contrib/java/generated/org/uscxml/Data.java @@ -0,0 +1,59 @@ +package org.uscxml; + +import java.lang.reflect.Field; + +import org.uscxml.Data.Type; + +public class Data { + + public static enum Type { + VERBATIM, + INTERPRETED + } + + public DataList getArray() { + // TODO Auto-generated method stub + return null; + } + + public void setAtom(String string) { + // TODO Auto-generated method stub + + } + + public void setType(Type interpreted) { + // TODO Auto-generated method stub + + } + + public DataMap getCompound() { + // TODO Auto-generated method stub + return null; + } + + public void set(String name, Data jexlObjectAsData) { + // TODO Auto-generated method stub + + } + + public String getAtom() { + // TODO Auto-generated method stub + return null; + } + + public Type getType() { + // TODO Auto-generated method stub + return null; + } + + public int size() { + // TODO Auto-generated method stub + return 0; + } + + public StringVector getCompoundKeys() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/contrib/java/generated/org/uscxml/DataList.java b/contrib/java/generated/org/uscxml/DataList.java new file mode 100644 index 0000000..f98d5f6 --- /dev/null +++ b/contrib/java/generated/org/uscxml/DataList.java @@ -0,0 +1,20 @@ +package org.uscxml; + +public class DataList { + + public void add(Data jexlObjectAsData) { + // TODO Auto-generated method stub + + } + + public int size() { + // TODO Auto-generated method stub + return 0; + } + + public Data get(int i) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/contrib/java/generated/org/uscxml/DataMap.java b/contrib/java/generated/org/uscxml/DataMap.java new file mode 100644 index 0000000..ceed1ce --- /dev/null +++ b/contrib/java/generated/org/uscxml/DataMap.java @@ -0,0 +1,20 @@ +package org.uscxml; + +public class DataMap { + + public int size() { + // TODO Auto-generated method stub + return 0; + } + + public Data get(String object) { + // TODO Auto-generated method stub + return null; + } + + public void set(String name, Data jexlObjectAsData) { + // TODO Auto-generated method stub + + } + +} diff --git a/contrib/java/generated/org/uscxml/DataModel.java b/contrib/java/generated/org/uscxml/DataModel.java new file mode 100644 index 0000000..8e12d19 --- /dev/null +++ b/contrib/java/generated/org/uscxml/DataModel.java @@ -0,0 +1,77 @@ +package org.uscxml; + +import org.uscxml.dm.jexl.Event; + +public class DataModel { + + public long getLength(String expr) { + // TODO Auto-generated method stub + return 0; + } + + public void setEvent(Event event) { + // TODO Auto-generated method stub + + } + + public void addExtension(DataModelExtension ext) { + // TODO Auto-generated method stub + + } + + public StringList getNames() { + // TODO Auto-generated method stub + return null; + } + + public DataModel create() { + // TODO Auto-generated method stub + return null; + } + + public boolean isValidSyntax(String expr) { + // TODO Auto-generated method stub + return false; + } + + public void setEvent(org.uscxml.Event event) { + // TODO Auto-generated method stub + + } + + public Data getAsData(String content) { + // TODO Auto-generated method stub + return null; + } + + public Data evalAsData(String content) { + // TODO Auto-generated method stub + return null; + } + + public boolean evalAsBool(String expr) { + // TODO Auto-generated method stub + return false; + } + + public void setForeach(String item, String array, String index, long iteration) { + // TODO Auto-generated method stub + + } + + public void assign(String location, Data data) { + // TODO Auto-generated method stub + + } + + public void init(String location, Data data) { + // TODO Auto-generated method stub + + } + + public boolean isDeclared(String expr) { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/contrib/java/generated/org/uscxml/DataModelExtension.java b/contrib/java/generated/org/uscxml/DataModelExtension.java new file mode 100644 index 0000000..fbb38f9 --- /dev/null +++ b/contrib/java/generated/org/uscxml/DataModelExtension.java @@ -0,0 +1,5 @@ +package org.uscxml; + +public class DataModelExtension { + +} diff --git a/contrib/java/generated/org/uscxml/ErrorEvent.java b/contrib/java/generated/org/uscxml/ErrorEvent.java new file mode 100644 index 0000000..699ddad --- /dev/null +++ b/contrib/java/generated/org/uscxml/ErrorEvent.java @@ -0,0 +1,9 @@ +package org.uscxml; + +public class ErrorEvent extends Event { + + public ErrorEvent(String string) { + // TODO Auto-generated constructor stub + } + +} diff --git a/contrib/java/generated/org/uscxml/Event.java b/contrib/java/generated/org/uscxml/Event.java new file mode 100644 index 0000000..9469b5f --- /dev/null +++ b/contrib/java/generated/org/uscxml/Event.java @@ -0,0 +1,5 @@ +package org.uscxml; + +public class Event extends java.lang.RuntimeException { + +} diff --git a/contrib/java/generated/org/uscxml/InterpreterException.java b/contrib/java/generated/org/uscxml/InterpreterException.java new file mode 100644 index 0000000..b2baa99 --- /dev/null +++ b/contrib/java/generated/org/uscxml/InterpreterException.java @@ -0,0 +1,11 @@ +package org.uscxml; + +public class InterpreterException extends Exception { + private static final long serialVersionUID = -3534919496547591015L; + + public InterpreterException(String name, String msg) { + super(msg); + } + + public String name; +} diff --git a/contrib/java/generated/org/uscxml/InterpreterMonitor.java b/contrib/java/generated/org/uscxml/InterpreterMonitor.java new file mode 100644 index 0000000..f67039f --- /dev/null +++ b/contrib/java/generated/org/uscxml/InterpreterMonitor.java @@ -0,0 +1,65 @@ +package org.uscxml; + +public class InterpreterMonitor { + + public void beforeExitingState(String stateId, String xpath, String stateXML) { + // TODO Auto-generated method stub + + } + + public void afterExitingState(String stateId, String xpath, String stateXML) { + // TODO Auto-generated method stub + + } + + public void beforeExecutingContent(String tagName, String xpath, String contentXML) { + // TODO Auto-generated method stub + + } + + public void afterExecutingContent(String tagName, String xpath, String contentXML) { + // TODO Auto-generated method stub + + } + + public void beforeUninvoking(String xpath, String invokeid, String invokerXML) { + // TODO Auto-generated method stub + + } + + public void afterUninvoking(String xpath, String invokeid, String invokerXML) { + // TODO Auto-generated method stub + + } + + public void beforeTakingTransition(String xpath, String source, StringList targets, String transitionXML) { + // TODO Auto-generated method stub + + } + + public void afterTakingTransition(String xpath, String source, StringList targets, String transitionXML) { + // TODO Auto-generated method stub + + } + + public void beforeEnteringState(String stateId, String xpath, String stateXML) { + // TODO Auto-generated method stub + + } + + public void afterEnteringState(String stateId, String xpath, String stateXML) { + // TODO Auto-generated method stub + + } + + public void beforeInvoking(String xpath, String invokeid, String invokerXML) { + // TODO Auto-generated method stub + + } + + public void afterInvoking(String xpath, String invokeid, String invokerXML) { + // TODO Auto-generated method stub + + } + +} diff --git a/contrib/java/generated/org/uscxml/StateChart.java b/contrib/java/generated/org/uscxml/StateChart.java new file mode 100644 index 0000000..6b620ab --- /dev/null +++ b/contrib/java/generated/org/uscxml/StateChart.java @@ -0,0 +1,222 @@ +package org.uscxml; + +import java.util.BitSet; +import java.util.Deque; +import java.util.List; +import java.util.Map; + +/** Base class for generated StateCharts */ + +public abstract class StateChart { + + public enum InterpreterState { + USCXML_FINISHED, + USCXML_UNDEF, + USCXML_IDLE, + USCXML_INITIALIZED, + USCXML_INSTANTIATED, + USCXML_MICROSTEPPED, + USCXML_MACROSTEPPED, + USCXML_CANCELLED + } + + public enum StateType { + USCXML_STATE_ATOMIC, + USCXML_STATE_PARALLEL, + USCXML_STATE_COMPOUND, + USCXML_STATE_FINAL, + USCXML_STATE_HISTORY_DEEP, + USCXML_STATE_HISTORY_SHALLOW, + USCXML_STATE_INITIAL, + USCXML_STATE_HAS_HISTORY + } + + public enum TransitionType { + USCXML_TRANS_SPONTANEOUS, + USCXML_TRANS_TARGETLESS, + USCXML_TRANS_INTERNAL, + USCXML_TRANS_HISTORY, + USCXML_TRANS_INITIAL + } + + public abstract class State { + String name; + int parent; + BitSet children; + BitSet completion; + BitSet ancestors; + Data data; + StateType type; + + public abstract void onEntry() throws InterpreterException; + public abstract void onExit() throws InterpreterException; + public abstract void invoke(Invoke invoker, boolean invoke) throws InterpreterException; + } + + public abstract class Transition { + int source; + BitSet target; + String event; + String condition; + TransitionType type; + BitSet conflicts; + BitSet exitSet; + + public abstract boolean isEnabled(); + public abstract boolean isMatched(); + public abstract void onTransition(); + } + + public class Data { + String id; + String src; + String expr; + String content; + } + + public class Assign { + String location; + String expr; + String content; + } + + public class Foreach { + String array; + String item; + String index; + } + + public class Param { + String name; + String expr; + String location; + } + + public class DoneData { + int source; + String content; + String contentExpr; + List<Param> params; + } + + public abstract class Invoke { + StateChart machine; + String type; + String typeExpr; + String src; + String srcExpr; + String id; + String idlocation; + String sourceName; + String namelist; + boolean autoForward; + String content; + String contentExpr; + List<Param> params; + + public abstract void finalize(); + } + + public class Send { + String event; + String eventExpr; + String target; + String targetExpr; + String type; + String typeExpr; + String id; + String idlocation; + String delay; + String delayExpr; + String namelist; + String content; + String contentExpr; + List<Param> params; + } + + public List<Transition> transitions; + public List<State> states; + + public Deque<Object> externalQueue; + public Deque<Object> internalQueue; + + protected InterpreterState state = InterpreterState.USCXML_UNDEF; + protected Object event; + + protected BitSet flags; + protected BitSet config; + protected BitSet history; + protected BitSet invocations; + protected BitSet initializedData; + + protected Map<String, Integer> stateNamesToIndex; + + public InterpreterState step() throws org.uscxml.InterpreterException { + return step(0); + } + + public InterpreterState step(long blockMs) throws org.uscxml.InterpreterException { + /** Here you would implement microstep(T) as in the book chapter */ + + + /** Just to silence the compiler warning */ + if (true) throw new InterpreterException("", ""); + return state; + } + + public void cancel() { + state = InterpreterState.USCXML_CANCELLED; + } + + public void reset() { + history.clear(); + config.clear(); + flags.clear(); + // @TODO: uninvoke any invokers + invocations.clear(); + } + + public InterpreterState getState() { return state; } + + public boolean isInState(String stateId) { + if (!stateNamesToIndex.containsKey(stateId)) + return false; + return config.get((int) stateNamesToIndex.get(stateId)); + } + + public void receive(Object event) { + externalQueue.addLast(event); + } + + protected Object dequeueInternal() { + try { + return internalQueue.removeLast(); + } catch(Exception e) { + return null; + } + } + + protected Object dequeueExternal() { + try { + return externalQueue.removeLast(); + } catch(Exception e) { + return null; + } + } + + public abstract boolean isTrue(String expression); + public abstract void raiseDoneEvent(State state, DoneData doneData); + + public abstract void execContentLog(String label, String expression); + public abstract void execContentRaise(String event); + public abstract void execContentSend(Send send); + public abstract void execContentForeachInit(Foreach foreach); + public abstract void execContentForeachNext(Foreach foreach); + public abstract void execContentForeachDone(Foreach foreach); + public abstract void execContentAssign(Assign assign); + public abstract void execContentInit(Data data); + public abstract void execContentCancel(String sendId, String sendIdExpr); + public abstract void execContentScript(String src, String content); + public abstract void execContentFinalize(Invoke invoker, Object event); + +}
\ No newline at end of file diff --git a/contrib/java/generated/org/uscxml/StateChartJava5Impl.java b/contrib/java/generated/org/uscxml/StateChartJava5Impl.java new file mode 100644 index 0000000..381a214 --- /dev/null +++ b/contrib/java/generated/org/uscxml/StateChartJava5Impl.java @@ -0,0 +1,89 @@ +package org.uscxml; + +/** + * @author sradomski + * + * This is the base class inheriting the abstract StateChart class + * It is supposed to realize the callbacks with the language features + * found in Java5 only. + */ + +public class StateChartJava5Impl extends StateChart { + + @Override + public boolean isTrue(String expression) { + // TODO Auto-generated method stub + return false; + } + + @Override + public void raiseDoneEvent(State state, DoneData doneData) { + // TODO Auto-generated method stub + } + + @Override + public void execContentLog(String label, String expression) { + // TODO Auto-generated method stub + } + + @Override + public void execContentRaise(String event) { + // TODO Auto-generated method stub + + } + + @Override + public void execContentSend(Send send) { + // TODO Auto-generated method stub + + } + + @Override + public void execContentForeachInit(Foreach foreach) { + // TODO Auto-generated method stub + + } + + @Override + public void execContentForeachNext(Foreach foreach) { + // TODO Auto-generated method stub + + } + + @Override + public void execContentForeachDone(Foreach foreach) { + // TODO Auto-generated method stub + + } + + @Override + public void execContentAssign(Assign assign) { + // TODO Auto-generated method stub + + } + + @Override + public void execContentInit(Data data) { + // TODO Auto-generated method stub + + } + + @Override + public void execContentCancel(String sendId, String sendIdExpr) { + // TODO Auto-generated method stub + + } + + @Override + public void execContentScript(String src, String content) { + // TODO Auto-generated method stub + + } + + @Override + public void execContentFinalize(Invoke invoker, Object event) { + // TODO Auto-generated method stub + + } + +} diff --git a/contrib/java/generated/org/uscxml/StringList.java b/contrib/java/generated/org/uscxml/StringList.java new file mode 100644 index 0000000..6b37b36 --- /dev/null +++ b/contrib/java/generated/org/uscxml/StringList.java @@ -0,0 +1,10 @@ +package org.uscxml; + +public class StringList { + + public void add(String string) { + // TODO Auto-generated method stub + + } + +} diff --git a/contrib/java/generated/org/uscxml/StringVector.java b/contrib/java/generated/org/uscxml/StringVector.java new file mode 100644 index 0000000..d760a37 --- /dev/null +++ b/contrib/java/generated/org/uscxml/StringVector.java @@ -0,0 +1,15 @@ +package org.uscxml; + +public class StringVector { + + public int size() { + // TODO Auto-generated method stub + return 0; + } + + public String get(int i) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/contrib/java/generated/org/uscxml/dm/jexl/DataModelExtension.java b/contrib/java/generated/org/uscxml/dm/jexl/DataModelExtension.java new file mode 100644 index 0000000..0f70395 --- /dev/null +++ b/contrib/java/generated/org/uscxml/dm/jexl/DataModelExtension.java @@ -0,0 +1,5 @@ +package org.uscxml.dm.jexl; + +public class DataModelExtension { + +} diff --git a/contrib/java/generated/org/uscxml/dm/jexl/Event.java b/contrib/java/generated/org/uscxml/dm/jexl/Event.java new file mode 100644 index 0000000..aa1eaae --- /dev/null +++ b/contrib/java/generated/org/uscxml/dm/jexl/Event.java @@ -0,0 +1,5 @@ +package org.uscxml.dm.jexl; + +public class Event { + +} diff --git a/contrib/java/generated/org/uscxml/examples/hello-world.xml b/contrib/java/generated/org/uscxml/examples/hello-world.xml new file mode 100644 index 0000000..3ac168c --- /dev/null +++ b/contrib/java/generated/org/uscxml/examples/hello-world.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" ?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with this + work for additional information regarding copyright ownership. The ASF + licenses this file to You under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + or agreed to in writing, software distributed under the License is + distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the specific language + governing permissions and limitations under the License. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" + initial="hello"> + + <final id="hello"> + <onentry> + <log expr="'Hello, World!'" /> + </onentry> + </final> + +</scxml>
\ No newline at end of file diff --git a/contrib/java/generated/org/uscxml/tests/gen/TestStateChart.java b/contrib/java/generated/org/uscxml/tests/gen/TestStateChart.java new file mode 100644 index 0000000..d459c7e --- /dev/null +++ b/contrib/java/generated/org/uscxml/tests/gen/TestStateChart.java @@ -0,0 +1,27 @@ +package org.uscxml.tests.gen; + +import org.uscxml.InterpreterException; +import org.uscxml.StateChart; +import org.uscxml.gen.TestStateChartBase; + +public class TestStateChart extends TestStateChartBase { + + public static void main(String[] args) { + System.out.println("Testing " + args[0]); + + TestStateChart machine = new TestStateChart(); + try { + while(machine.step() != StateChart.InterpreterState.USCXML_FINISHED) { + // here we could inspect the state chart after a step + } + // when we arrive here, the state chart is finished + assert(machine.isInState("pass")); + System.out.println("PASSED"); + System.exit(0); // EXIT_SUCCESS + } catch (InterpreterException e) { + System.out.println("FAILED"); + System.exit(-1); // EXIT_FAILURE + } + } + +} |