You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ra...@apache.org on 2006/01/09 01:20:56 UTC
svn commit: r367140 -
/jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/Builtin.java
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