You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by at...@apache.org on 2014/03/13 23:31:34 UTC
svn commit: r1577351 - in
/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2:
SCXMLExecutor2.java semantics/SCXMLSemanticsImpl2.java
Author: ate
Date: Thu Mar 13 22:31:34 2014
New Revision: 1577351
URL: http://svn.apache.org/r1577351
Log:
SCXML-196: Redefine SCXMLSemantics to align with the Algorithm for SCXML Interpretation as described in the SCXML specification
- starting point: just checking in baseline forked versions of SCXMLExecutor and SCXMLSemanticsImpl so to be able to track changes made to the implementation
Added:
commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor2.java
- copied, changed from r1577084, commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor.java
commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl2.java
- copied, changed from r1577084, commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java
Copied: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor2.java (from r1577084, commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor.java)
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor2.java?p2=commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor2.java&p1=commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor.java&r1=1577084&r2=1577351&rev=1577351&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor2.java Thu Mar 13 22:31:34 2014
@@ -1,12 +1,11 @@
/*
- * 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
+ * Copyright 2014 Hippo B.V. (http://www.onehippo.com)
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed 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,
@@ -34,7 +33,7 @@ import org.apache.commons.scxml2.model.S
import org.apache.commons.scxml2.model.State;
import org.apache.commons.scxml2.model.Transition;
import org.apache.commons.scxml2.model.TransitionTarget;
-import org.apache.commons.scxml2.semantics.SCXMLSemanticsImpl;
+import org.apache.commons.scxml2.semantics.SCXMLSemanticsImpl2;
import org.apache.commons.scxml2.system.EventVariable;
/**
@@ -45,9 +44,9 @@ import org.apache.commons.scxml2.system.
* <p>The default implementation is
* <code>org.apache.commons.scxml2.semantics.SCXMLSemanticsImpl</code></p>
*
- * @see SCXMLSemantics
+ * @see org.apache.commons.scxml2.SCXMLSemantics
*/
-public class SCXMLExecutor implements Serializable {
+public class SCXMLExecutor2 extends SCXMLExecutor {
/**
* Serial version UID.
@@ -57,7 +56,7 @@ public class SCXMLExecutor implements Se
/**
* The Logger for the SCXMLExecutor.
*/
- private Log log = LogFactory.getLog(SCXMLExecutor.class);
+ private Log log = LogFactory.getLog(SCXMLExecutor2.class);
/**
* The stateMachine being executed.
@@ -87,7 +86,7 @@ public class SCXMLExecutor implements Se
/**
* Interpretation semantics.
*/
- private SCXMLSemantics semantics;
+ private SCXMLSemanticsImpl2 semantics;
/**
* The SCInstance.
@@ -101,7 +100,7 @@ public class SCXMLExecutor implements Se
* @param evts
* an array of external events which triggered during the last
* time quantum
- * @throws ModelException in case there is a fatal SCXML object
+ * @throws org.apache.commons.scxml2.model.ModelException in case there is a fatal SCXML object
* model problem.
*/
public synchronized void triggerEvents(final TriggerEvent[] evts)
@@ -154,7 +153,7 @@ public class SCXMLExecutor implements Se
* @param evt
* the external events which triggered during the last
* time quantum
- * @throws ModelException in case there is a fatal SCXML object
+ * @throws org.apache.commons.scxml2.model.ModelException in case there is a fatal SCXML object
* model problem.
*/
public void triggerEvent(final TriggerEvent evt)
@@ -169,15 +168,15 @@ public class SCXMLExecutor implements Se
* @param evtDisp The event dispatcher
* @param errRep The error reporter
*/
- public SCXMLExecutor(final Evaluator expEvaluator,
- final EventDispatcher evtDisp, final ErrorReporter errRep) {
+ public SCXMLExecutor2(final Evaluator expEvaluator,
+ final EventDispatcher evtDisp, final ErrorReporter errRep) {
this(expEvaluator, evtDisp, errRep, null);
}
/**
* Convenience constructor.
*/
- public SCXMLExecutor() {
+ public SCXMLExecutor2() {
this(null, null, null, null);
}
@@ -189,16 +188,16 @@ public class SCXMLExecutor implements Se
* @param errRep The error reporter
* @param semantics The SCXML semantics
*/
- public SCXMLExecutor(final Evaluator expEvaluator,
- final EventDispatcher evtDisp, final ErrorReporter errRep,
- final SCXMLSemantics semantics) {
+ public SCXMLExecutor2(final Evaluator expEvaluator,
+ final EventDispatcher evtDisp, final ErrorReporter errRep,
+ final SCXMLSemanticsImpl2 semantics) {
this.eventdispatcher = evtDisp;
this.errorReporter = errRep;
this.currentStatus = new Status();
this.stateMachine = null;
if (semantics == null) {
// Use default semantics, if none provided
- this.semantics = new SCXMLSemanticsImpl();
+ this.semantics = new SCXMLSemanticsImpl2();
} else {
this.semantics = semantics;
}
@@ -210,7 +209,7 @@ public class SCXMLExecutor implements Se
* Clear all state and begin from "initialstate" indicated
* on root SCXML element.
*
- * @throws ModelException in case there is a fatal SCXML object
+ * @throws org.apache.commons.scxml2.model.ModelException in case there is a fatal SCXML object
* model problem.
*/
public synchronized void reset() throws ModelException {
@@ -327,7 +326,7 @@ public class SCXMLExecutor implements Se
* and as a best practice, should not be altered. Also note that
* manipulation of instance data for the executor should happen through
* its root context or state contexts only, never through the direct
- * manipulation of any {@link Datamodel}s associated with this state
+ * manipulation of any {@link org.apache.commons.scxml2.model.Datamodel}s associated with this state
* machine definition.
*
* @return Returns the stateMachine.
@@ -353,7 +352,7 @@ public class SCXMLExecutor implements Se
/**
* Initiate state machine execution.
*
- * @throws ModelException in case there is a fatal SCXML object
+ * @throws org.apache.commons.scxml2.model.ModelException in case there is a fatal SCXML object
* model problem.
*/
public void go() throws ModelException {
@@ -424,9 +423,9 @@ public class SCXMLExecutor implements Se
}
/**
- * Add a listener to the {@link Observable}.
+ * Add a listener to the {@link org.apache.commons.scxml2.model.Observable}.
*
- * @param observable The {@link Observable} to attach the listener to.
+ * @param observable The {@link org.apache.commons.scxml2.model.Observable} to attach the listener to.
* @param listener The SCXMLListener.
*/
public void addListener(final Observable observable, final SCXMLListener listener) {
@@ -434,9 +433,9 @@ public class SCXMLExecutor implements Se
}
/**
- * Remove this listener from the {@link Observable}.
+ * Remove this listener from the {@link org.apache.commons.scxml2.model.Observable}.
*
- * @param observable The {@link Observable}.
+ * @param observable The {@link org.apache.commons.scxml2.model.Observable}.
* @param listener The SCXMLListener to be removed.
*/
public void removeListener(final Observable observable,
Copied: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl2.java (from r1577084, commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java)
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl2.java?p2=commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl2.java&p1=commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java&r1=1577084&r2=1577351&rev=1577351&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl2.java Thu Mar 13 22:31:34 2014
@@ -1,12 +1,11 @@
/*
- * 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
+ * Copyright 2014 Hippo B.V. (http://www.onehippo.com)
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed 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,
@@ -62,14 +61,10 @@ import org.apache.commons.scxml2.model.T
import org.apache.commons.scxml2.model.TransitionTarget;
/**
- * <p>This class encapsulates a particular SCXML semantics, that is, a
- * particular semantic interpretation of Harel Statecharts, which aligns
- * mostly with W3C SCXML July 5 public draft (that is, UML 1.5). However,
- * certain aspects are taken from STATEMATE.</p>
- *
- * <p>Specific semantics can be created by subclassing this class.</p>
+ * <p>This class will encapsulates and implement the
+ * <a href="http://www.w3.org/TR/2014/CR-scxml-20140313/#AlgorithmforSCXMLInterpretation">W3C SCXML Algorithm for SCXML Interpretation</a>
*/
-public class SCXMLSemanticsImpl implements SCXMLSemantics, Serializable {
+public class SCXMLSemanticsImpl2 implements SCXMLSemantics, Serializable {
/**
* Serial version UID.
@@ -100,12 +95,12 @@ public class SCXMLSemanticsImpl implemen
private static final String ERR_ILLEGAL_ALLOC = ".error.illegalalloc";
/**
- * Zero-length array of {@link TransitionTarget}s.
+ * Zero-length array of {@link org.apache.commons.scxml2.model.TransitionTarget}s.
*/
private static final TransitionTarget[] TT_ARR0 = new TransitionTarget[0];
/**
- * Zero-length array of {@link Transition}s.
+ * Zero-length array of {@link org.apache.commons.scxml2.model.Transition}s.
*/
private static final Transition[] TR_ARR0 = new Transition[0];
@@ -133,7 +128,7 @@ public class SCXMLSemanticsImpl implemen
* ErrorReporter callback [inout]
* @param scInstance
* The state chart instance [in]
- * @throws ModelException
+ * @throws org.apache.commons.scxml2.model.ModelException
* in case there is a fatal SCXML object model problem.
*/
public void determineInitialStates(final SCXML input, final Set<TransitionTarget> targets,
@@ -175,7 +170,7 @@ public class SCXMLSemanticsImpl implemen
* error reporter
* @param scInstance
* The state chart instance
- * @throws ModelException
+ * @throws org.apache.commons.scxml2.model.ModelException
* in case there is a fatal SCXML object model problem.
*/
public void executeActions(final Step step, final SCXML stateMachine,
@@ -342,12 +337,12 @@ public class SCXMLSemanticsImpl implemen
* @param step
* [inout]
* @param evtDispatcher
- * The {@link EventDispatcher} [in]
+ * The {@link org.apache.commons.scxml2.EventDispatcher} [in]
* @param errRep
* ErrorReporter callback [inout]
* @param scInstance
* The state chart instance [in]
- * @throws ModelException
+ * @throws org.apache.commons.scxml2.model.ModelException
* in case there is a fatal SCXML object model problem.
*/
public void filterTransitionsSet(final Step step,
@@ -531,8 +526,8 @@ public class SCXMLSemanticsImpl implemen
* ErrorReporter callback [inout]
* @param scInstance
* The state chart instance [in]
- * @throws ModelException On illegal configuration
- * @see #seedTargetSet(Set, List, ErrorReporter)
+ * @throws org.apache.commons.scxml2.model.ModelException On illegal configuration
+ * @see #seedTargetSet(java.util.Set, java.util.List, org.apache.commons.scxml2.ErrorReporter)
*/
public void determineTargetStates(final Set<TransitionTarget> states,
final ErrorReporter errRep, final SCInstance scInstance)
@@ -642,7 +637,7 @@ public class SCXMLSemanticsImpl implemen
* @param errorReporter The ErrorReporter for the current environment
* @param scInstance The state chart instance
*
- * @throws ModelException
+ * @throws org.apache.commons.scxml2.model.ModelException
* in case there is a fatal SCXML object model problem.
*/
public void followTransitions(final Step step,
@@ -716,7 +711,7 @@ public class SCXMLSemanticsImpl implemen
* ErrorReporter callback
* @param scInstance
* The state chart instance
- * @throws ModelException
+ * @throws org.apache.commons.scxml2.model.ModelException
* in case there is a fatal SCXML object model problem.
*/
public void processInvokes(final TriggerEvent[] events,