Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.scxml
Class SCXMLHelper

    java.lang.Object
      org.apache.commons.scxml.SCXMLHelper

public final class SCXMLHelper
extends Object

Helper class, all methods static final.

Method Summary
`static void` | `cloneDatamodel(Datamodel datamodel, Context ctx, Evaluator evaluator, org.apache.commons.logging.Log log)` Clone data model.
`static String` | `escapeXML(String str)` Escape XML strings for serialization.
`static Set` | `getAncestorClosure(Set states, Set upperBounds)` Creates a set which contains given states and all their ancestors recursively up to the upper bound.
`static TransitionTarget` | `getLCA(TransitionTarget tt1, TransitionTarget tt2)` Finds the least common ancestor of transition targets tt1 and tt2 if one exists.
`static String` | `getNodeValue(Node node)` Retrieve a DOM node value as a string depending on its type.
`static Set` | `getStatesExited(Transition t, Set currentStates)` Returns the set of all states (and parallels) which are exited if a given transition t is going to be taken.
`static boolean` | `implementationOf(Class clas, Class interfayce)` Whether the class implements the interface.
`static boolean` | `inConflict(Transition t1, Transition t2, Set currentStates)` According to the UML definition, two transitions are conflicting if the sets of states they exit overlap.
`static boolean` | `isDescendant(TransitionTarget tt, TransitionTarget ctx)` Checks whether a transition target tt (State or Parallel) is a descendant of the transition target context.
`static boolean` | `isLegalConfig(Set states, ErrorReporter errRep)` Checks whether a given set of states is a legal Harel State Table configuration (with the respect to the definition of the OR and AND states).
`static boolean` | `isStringEmpty(String attr)` Return true if the string is empty.
`static void` | `setNodeValue(Node node, String value)` Set node value, depending on its type, from a String.
`static boolean` | `subtypeOf(Class child, Class parent)` Whether the first argument is a subtype of the second.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### isStringEmpty

    public static boolean isStringEmpty(String attr)

  Return true if the string is empty.

  Parameters:
    `attr` - The String to test
  Returns:
    Is string empty

### isDescendant

    public static boolean isDescendant(TransitionTarget tt,
                                       TransitionTarget ctx)

  Checks whether a transition target tt (State or Parallel) is a descendant of the transition target context.

  Parameters:
    `tt` - TransitionTarget to check - a potential descendant
    `ctx` - TransitionTarget context - a potential ancestor
  Returns:
    true iff tt is a descendant of ctx, false otherwise

### getAncestorClosure

    public static Set getAncestorClosure(Set states,
                                         Set upperBounds)

  Creates a set which contains given states and all their ancestors recursively up to the upper bound. Null upperBound means root of the state machine.

  Parameters:
    `states` - The Set of States
    `upperBounds` - The Set of upper bound States
  Returns:
    transitive closure of a given state set

### isLegalConfig

    public static boolean isLegalConfig(Set states,
                                        ErrorReporter errRep)

  Checks whether a given set of states is a legal Harel State Table configuration (with the respect to the definition of the OR and AND states).

  Parameters:
    `states` - a set of states
    `errRep` - ErrorReporter to report detailed error info if needed
  Returns:
    true if a given state configuration is legal, false otherwise

### getLCA

    public static TransitionTarget getLCA(TransitionTarget tt1,
                                          TransitionTarget tt2)

  Finds the least common ancestor of transition targets tt1 and tt2 if one exists.

  Parameters:
    `tt1` - First TransitionTarget
    `tt2` - Second TransitionTarget
  Returns:
    closest common ancestor of tt1 and tt2 or null

### getStatesExited

    public static Set getStatesExited(Transition t,
                                      Set currentStates)

  Returns the set of all states (and parallels) which are exited if a given transition t is going to be taken. Current states are necessary to be taken into account due to orthogonal states and cross-region transitions - see UML specs for more details.

  Parameters:
    `t` - transition to be taken
    `currentStates` - the set of current states (simple states only)
  Returns:
    a set of all states (including composite) which are exited if a given transition is taken

### inConflict

    public static boolean inConflict(Transition t1,
                                     Transition t2,
                                     Set currentStates)

  According to the UML definition, two transitions are conflicting if the sets of states they exit overlap.

  Parameters:
    `t1` - a transition to check against t2
    `t2` - a transition to check against t1
    `currentStates` - the set of current states (simple states only)
  Returns:
    true if the t1 and t2 are conflicting transitions
  See Also:
    `getStatesExited(Transition, Set)`

### subtypeOf

    public static boolean subtypeOf(Class child,
                                    Class parent)

  Whether the first argument is a subtype of the second.

  Parameters:
    `child` - The candidate subtype
    `parent` - The supertype
  Returns:
    true if child is subtype of parent, otherwise false

### implementationOf

    public static boolean implementationOf(Class clas,
                                           Class interfayce)

  Whether the class implements the interface.

  Parameters:
    `clas` - The candidate class
    `interfayce` - The interface
  Returns:
    true if clas implements interfayce, otherwise false

### setNodeValue

    public static void setNodeValue(Node node,
                                    String value)

  Set node value, depending on its type, from a String.

  Parameters:
    `node` - A Node whose value is to be set
    `value` - The new value

### getNodeValue

    public static String getNodeValue(Node node)

  Retrieve a DOM node value as a string depending on its type.

  Parameters:
    `node` - A node to be retreived
  Returns:
    The value as a string

### cloneDatamodel

    public static void cloneDatamodel(Datamodel datamodel,
                                      Context ctx,
                                      Evaluator evaluator,
                                      org.apache.commons.logging.Log log)

  Clone data model.

  Parameters:
    `ctx` - The context to clone to.
    `datamodel` - The datamodel to clone.
    `evaluator` - The expression evaluator.
    `log` - The error log.

### escapeXML

    public static String escapeXML(String str)

  Escape XML strings for serialization. The basic algorithm is taken from Commons Lang (see oacl.Entities.java)

  Parameters:
    `str` - A string to be escaped
  Returns:
    The escaped string

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005-2008 The Apache Software Foundation. All Rights Reserved.