commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@apache.org
Subject svn commit: r367140 - /jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/Builtin.java
Date Mon, 09 Jan 2006 00:20:56 GMT
Author: rahul
Date: Sun Jan  8 16:20:53 2006
New Revision: 367140

URL: http://svn.apache.org/viewcvs?rev=367140&view=rev
Log:
Factor out built-in SCXML functions, such as the In() predicate.

Added:
    jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/Builtin.java
  (with props)

Added: jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/Builtin.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/Builtin.java?rev=367140&view=auto
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/Builtin.java
(added)
+++ jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/Builtin.java
Sun Jan  8 16:20:53 2006
@@ -0,0 +1,58 @@
+/*
+ *
+ *   Copyright 2006 The Apache Software Foundation.
+ *
+ *  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,
+ *  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.
+ *
+ */
+package org.apache.commons.scxml;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.commons.scxml.model.TransitionTarget;
+
+/**
+ * Implementations of builtin functions defined by the SCXML
+ * specification.
+ *
+ * The current version of the specification defines one builtin
+ * predicate In()
+ */
+public class Builtin {
+
+    /**
+     * Implements the In() predicate for SCXML documents. The method
+     * name chosen is different since "in" is a reserved token
+     * in some expression languages.
+     *
+     * Does this state belong to the given Set of States.
+     * Simple ID based comparator, assumes IDs are unique.
+     *
+     * @param allStates The Set of State objects to look in
+     * @param state The State ID to compare with
+     * @return Whether this State belongs to this Set
+     */
+    public static boolean isMember(final Set allStates,
+            final String state) {
+        for (Iterator i = allStates.iterator(); i.hasNext();) {
+            TransitionTarget tt = (TransitionTarget) i.next();
+            if (state.equals(tt.getId())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+}
+

Propchange: jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/Builtin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/Builtin.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message