## org.opencyc.uml.statemachine
Class StateMachineFactory

    java.lang.Object
      |
      +--org.opencyc.uml.statemachine.StateMachineFactory

public class StateMachineFactory
extends java.lang.Object

StateVertex from the UML State_Machines package.

Author:
  Stephen L. Reed

  Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

  the license

  www.opencyc.org

  OpenCyc at SourceForge

  THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Field Summary
`protected org.opencyc.uml.core.Namespace` `namespace` the namespace for this state machine and its components
`protected StateMachine` `stateMachine` the state machine being assembled

Constructor Summary
`StateMachineFactory()` Constructs a new StateMachineFactory object.

Method Summary
`InputPin` `addInputPinToProcedure(java.lang.String name, java.lang.String commentString, org.opencyc.uml.core.Procedure procedure, java.lang.Class type)` Adds an input pin (variable) to the given procedure.
`OutputPin` `addOutputPinToProcedure(java.lang.String name, java.lang.String commentString, org.opencyc.uml.core.Procedure procedure, java.lang.Class type)` Adds an output pin (variable) to the given procedure.
`org.opencyc.uml.core.Parameter` `addParameterToEvent(java.lang.String name, java.lang.String commentString, Event event, java.lang.Class type)` Adds a parameter to the given event.
`void` `destroyComment(org.opencyc.uml.core.Comment comment)` Destroys the given comment by unlinking it from its associations.
`void` `destroyEvent(Event event)` Destroys the given event, its parameters and its comment by unlinking them from their associations.
`void` `destroyParameter(org.opencyc.uml.core.Parameter parameter)` Destroys the given parameter by unlinking it from its associations.
`CallEvent` `makeCallEvent(java.lang.String name, java.lang.String commentString, java.lang.String specification)` Makes a new CallEvent object.
`ChangeEvent` `makeChangeEvent(java.lang.String name, java.lang.String commentString, java.lang.String language, java.lang.String body)` Makes a new ChangeEvent object.
`CompletionEvent` `makeCompletionEvent(java.lang.String name, java.lang.String commentString, State state)` Makes a new CompletionEvent object.
`CompositeState` `makeCompositeState(java.lang.String name, java.lang.String commentString, CompositeState container, org.opencyc.uml.core.Procedure entry, org.opencyc.uml.core.Procedure exit, org.opencyc.uml.core.Procedure doActivity, boolean isConcurrent)` Makes a new composite state object.
`Event` `makeEvent(java.lang.String name, java.lang.String commentString)` Makes a new Event object.
`FinalState` `makeFinalState(java.lang.String name, java.lang.String commentString, CompositeState container, org.opencyc.uml.core.Procedure entry, org.opencyc.uml.core.Procedure exit, org.opencyc.uml.core.Procedure doActivity)` Makes a new final state object.
`org.opencyc.uml.core.Procedure` `makeProcedure(java.lang.String name, java.lang.String commentString, java.lang.String language, java.lang.String body, boolean isList)` Makes a new procedure object.
`PseudoState` `makePseudoState(java.lang.String name, java.lang.String commentString, CompositeState container, int kind)` Makes a new pseudo state object.
`SignalEvent` `makeSignalEvent(java.lang.String name, java.lang.String commentString, Signal signal)` Makes a new SignalEvent object.
`SimpleState` `makeSimpleState(java.lang.String name, java.lang.String commentString, CompositeState container, org.opencyc.uml.core.Procedure entry, org.opencyc.uml.core.Procedure exit, org.opencyc.uml.core.Procedure doActivity)` Makes a new simple state object.
`StateMachine` `makeStateMachine(java.lang.String namespaceName, java.lang.String name, java.lang.String commentString, java.lang.Object context)` Makes a new state machine object.
`StateVertex` `makeStateVertex(java.lang.String name, java.lang.String commentString, CompositeState container)` Makes a new state vertex object.
`TimeEvent` `makeTimeEvent(java.lang.String name, java.lang.String commentString, java.lang.String language, java.lang.String body)` Makes a new TimeEvent object.
`Transition` `makeTransition(java.lang.String name, java.lang.String commentString, java.lang.String guardExpressionLanguage, java.lang.String guardExpressionBody, org.opencyc.uml.core.Procedure effect, Event trigger, StateVertex source, StateVertex target)` Makes a new transition object.
`void` `setNamespace(org.opencyc.uml.core.Namespace namespace)` Sets the namespace for this state machine factory in the case where the state machine already exists.
`protected void` `setNamespaceNameComment(org.opencyc.uml.core.ModelElement modelElement, java.lang.String name, java.lang.String commentString)` Sets the namespace, name and comment string for the new model element.
`void` `setStateMachine(StateMachine stateMachine)` Sets the state machine for this state machine factory in the case where the state machine already exists.

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

Field Detail

### namespace

    protected org.opencyc.uml.core.Namespace namespace

  the namespace for this state machine and its components

### stateMachine

    protected StateMachine stateMachine

  the state machine being assembled

Constructor Detail

### StateMachineFactory

    public StateMachineFactory()

  Constructs a new StateMachineFactory object.

Method Detail

### makeStateMachine

    public StateMachine makeStateMachine(java.lang.String namespaceName,
                                         java.lang.String name,
                                         java.lang.String commentString,
                                         java.lang.Object context)

  Makes a new state machine object. All further objects defined for this state machine will linked to the given namespace.
  Parameters:
    `namespaceName` - the state machine namespace name
    `name` - the identifier for the state machine within its containing namespace
    `commentString` - the comment for this state machine
    `context` - the context Classifier of this state machine, which contains the variables that distinguish the state, and the operations which can be performed during state transitions.
  Returns:
    the new state machine object

### makeProcedure

    public org.opencyc.uml.core.Procedure makeProcedure(java.lang.String name,
                                                        java.lang.String commentString,
                                                        java.lang.String language,
                                                        java.lang.String body,
                                                        boolean isList)

  Makes a new procedure object.
  Parameters:
    `name` - the identifier for the procedure within its containing namespace
    `commentString` - the comment for this procedure
    `language` - the name of the language in which the body attribute is written
    `body` - the text of the procedure written in the given language
    `isList` - true when the arguments to the procedure are passed as attributes of a single object, or false when passed separately
    `expression` - the text of the procedure written in the given language
    `method` - a method which is performed by the procedure
  Returns:
    the new procedure object

### addInputPinToProcedure

    public InputPin addInputPinToProcedure(java.lang.String name,
                                           java.lang.String commentString,
                                           org.opencyc.uml.core.Procedure procedure,
                                           java.lang.Class type)

  Adds an input pin (variable) to the given procedure.
  Parameters:
    `name` - the name of the input pin (variable)
    `commentString` - the comment for this input pin
    `procedure` - the given procedure to which the input pin is to be added
    `type` - the Class of the input pin (variable)
  Returns:
    the added input pin for the given procedure

### addOutputPinToProcedure

    public OutputPin addOutputPinToProcedure(java.lang.String name,
                                             java.lang.String commentString,
                                             org.opencyc.uml.core.Procedure procedure,
                                             java.lang.Class type)

  Adds an output pin (variable) to the given procedure.
  Parameters:
    `name` - the name of the output pin (variable)
    `commentString` - the comment for this output pin
    `procedure` - the given procedure to which the output pin is to be added
    `type` - the Class of the output pin (variable)
  Returns:
    the added output pin for the given procedure

### makeEvent

    public Event makeEvent(java.lang.String name,
                           java.lang.String commentString)

  Makes a new Event object.
  Parameters:
    `name` - the identifier for the event within its containing namespace
    `commentString` - the comment for this event
  Returns:
    the new event object

### makeCallEvent

    public CallEvent makeCallEvent(java.lang.String name,
                                   java.lang.String commentString,
                                   java.lang.String specification)

  Makes a new CallEvent object.
  Parameters:
    `name` - the identifier for the call event within its containing namespace
    `commentString` - the comment for this call event
    `specification` - the specification of the operation called by this event
  Returns:
    the new call event object

### makeChangeEvent

    public ChangeEvent makeChangeEvent(java.lang.String name,
                                       java.lang.String commentString,
                                       java.lang.String language,
                                       java.lang.String body)

  Makes a new ChangeEvent object.
  Parameters:
    `name` - the identifier for the change event within its containing namespace
    `commentString` - the comment for this change event
    `language` - the language of the boolean change expression
    `body` - the body of the boolean change expression
  Returns:
    the new change event object

### makeCompletionEvent

    public CompletionEvent makeCompletionEvent(java.lang.String name,
                                               java.lang.String commentString,
                                               State state)

  Makes a new CompletionEvent object.
  Parameters:
    `name` - the identifier for the completion event within its containing namespace
    `commentString` - the comment for this completion event
    `state` - the state issuing this completion expression
  Returns:
    the new completion event object

### makeSignalEvent

    public SignalEvent makeSignalEvent(java.lang.String name,
                                       java.lang.String commentString,
                                       Signal signal)

  Makes a new SignalEvent object.
  Parameters:
    `name` - the identifier for the signal event within its containing namespace
    `commentString` - the comment for this signal event
    `signal` - the signal causing this event
  Returns:
    the new signal event object

### makeTimeEvent

    public TimeEvent makeTimeEvent(java.lang.String name,
                                   java.lang.String commentString,
                                   java.lang.String language,
                                   java.lang.String body)

  Makes a new TimeEvent object.
  Parameters:
    `name` - the identifier for the change event within its containing namespace
    `commentString` - the comment for this change event
    `language` - the language of the boolean change expression
    `body` - the body of the boolean change expression
  Returns:
    the new change event object

### addParameterToEvent

    public org.opencyc.uml.core.Parameter addParameterToEvent(java.lang.String name,
                                                              java.lang.String commentString,
                                                              Event event,
                                                              java.lang.Class type)

  Adds a parameter to the given event.
  Parameters:
    `name` - the name of parameter
    `commentString` - the comment for this parameter
    `event` - the given event to which the parameter is to be added
    `type` - the Class of the parameter
  Returns:
    the adeded parameter for the given event

### destroyEvent

    public void destroyEvent(Event event)

  Destroys the given event, its parameters and its comment by unlinking them from their associations.
  Parameters:
    `event` - the given event to be destroyed

### destroyComment

    public void destroyComment(org.opencyc.uml.core.Comment comment)

  Destroys the given comment by unlinking it from its associations.
  Parameters:
    `comment` - the given comment to destroy

### destroyParameter

    public void destroyParameter(org.opencyc.uml.core.Parameter parameter)

  Destroys the given parameter by unlinking it from its associations.
  Parameters:
    `parameter` - the given parameter to destroy

### makeSimpleState

    public SimpleState makeSimpleState(java.lang.String name,
                                       java.lang.String commentString,
                                       CompositeState container,
                                       org.opencyc.uml.core.Procedure entry,
                                       org.opencyc.uml.core.Procedure exit,
                                       org.opencyc.uml.core.Procedure doActivity)

  Makes a new simple state object. The top (composite) state must be created first, then parent states should be created before their child simple states.
  Parameters:
    `name` - the identifier for the simple state within its containing namespace
    `commentString` - the comment for this simple state
    `container` - the container (parent) of this simple state, or null if top state
    `entry` - the entry action for this simple state, or null if none
    `exit` - the exit action for this simple state, or null if none
    `doActivity` - the do activity for this simple state, or null if none
  Returns:
    the newsimple state object

### makeFinalState

    public FinalState makeFinalState(java.lang.String name,
                                     java.lang.String commentString,
                                     CompositeState container,
                                     org.opencyc.uml.core.Procedure entry,
                                     org.opencyc.uml.core.Procedure exit,
                                     org.opencyc.uml.core.Procedure doActivity)

  Makes a new final state object. The top (composite) state must be created first, then parent states should be created before their child final states.
  Parameters:
    `name` - the identifier for the final state within its containing namespace
    `commentString` - the comment for this final state
    `container` - the container (parent) of this final state, or null if top state
    `entry` - the entry action for this final state, or null if none
    `exit` - the exit action for this final state, or null if none
    `doActivity` - the do activity for this final state, or null if none
  Returns:
    the newfinal state object

### makeCompositeState

    public CompositeState makeCompositeState(java.lang.String name,
                                             java.lang.String commentString,
                                             CompositeState container,
                                             org.opencyc.uml.core.Procedure entry,
                                             org.opencyc.uml.core.Procedure exit,
                                             org.opencyc.uml.core.Procedure doActivity,
                                             boolean isConcurrent)

  Makes a new composite state object.
  Parameters:
    `name` - the identifier for the composite state within its containing namespace
    `commentString` - the comment for this composite state
    `container` - the container of this composite state, or null if top state
    `entry` - the entry action for this composite state, or null if none
    `exit` - the exit action for this composite state, or null if none
    `doActivity` - the do activity for this composite state, or null if none
    `isConcurrent` - true if concurrent processes, otherwise false
  Returns:
    the new composite state object

### makePseudoState

    public PseudoState makePseudoState(java.lang.String name,
                                       java.lang.String commentString,
                                       CompositeState container,
                                       int kind)

  Makes a new pseudo state object.
  Parameters:
    `name` - the identifier for the pseudo state within its containing namespace
    `commentString` - the comment for this pseudo state
    `container` - the container of this pseudo state
    `kind` - the kind of PseudoState
  Returns:
    the new pseudo state object

### makeStateVertex

    public StateVertex makeStateVertex(java.lang.String name,
                                       java.lang.String commentString,
                                       CompositeState container)

  Makes a new state vertex object.
  Parameters:
    `name` - the identifier for the state vertex within its containing namespace
    `commentString` - the comment for this state vertex
    `container` - the container of this state vertex
  Returns:
    the new state vertex object

### setNamespaceNameComment

    protected void setNamespaceNameComment(org.opencyc.uml.core.ModelElement modelElement,
                                           java.lang.String name,
                                           java.lang.String commentString)

  Sets the namespace, name and comment string for the new model element.
  Parameters:
    `modelElement` - the given model element
    `name` - the identifier for the state machine within its containing namespace
    `commentString` - the comment for this state machine

### makeTransition

    public Transition makeTransition(java.lang.String name,
                                     java.lang.String commentString,
                                     java.lang.String guardExpressionLanguage,
                                     java.lang.String guardExpressionBody,
                                     org.opencyc.uml.core.Procedure effect,
                                     Event trigger,
                                     StateVertex source,
                                     StateVertex target)

  Makes a new transition object.
  Parameters:
    `name` - the identifier for the transition within its containing namespace
    `commentString` - the comment for this transition
    `guardExpressionLanguage` - the language in which the guard expression is written
    `guardExpressionBody` - the body of the guard expression, or null if no guard
    `effect` - the procedure which is the effect of this transition, or null if no effect
    `trigger` - the event which triggers this transition
    `source` - the source state of this transition
    `target` - the target state of this transition

### setStateMachine

    public void setStateMachine(StateMachine stateMachine)

  Sets the state machine for this state machine factory in the case where the state machine already exists.
  Parameters:
    `stateMachine` - the state machine to extend or modify

### setNamespace

    public void setNamespace(org.opencyc.uml.core.Namespace namespace)

  Sets the namespace for this state machine factory in the case where the state machine already exists.
  Parameters:
    `namespace` - the namespace for the state machine model elements