## org.opencyc.conversation
Class Fsm

    java.lang.Object
      |
      +--org.opencyc.conversation.Fsm

public class Fsm
extends java.lang.Object

Contains the attributes and behavior of a finite state machine instance.

Fsms have a class structure in which instances of a class have the same arcs and states, with the exception that instances may have differing actions and sub fsms on their arcs.
Subclass fsms inherit states and arcs from their superclass fsm. A subclass fsm may override arcs which would otherwise be inherited.

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 Performative` `defaultPerformative` default performative for the initial state
`protected FsmClass` `fsmClass` class of the fsm instance
`protected java.util.HashMap` `fsmStates` dictionary of fsm states, stateName --> State
`protected State` `initialState` inital fsm state
`protected java.lang.String` `name` name of the fsm instance

Constructor Summary
`protected` `Fsm(java.lang.String name)` Constructs a new Fsm object given the fsm name

Method Summary
`void` `addState(State fsmState)` Records the stateId and associated State
`void` `addState(java.lang.String stateId, State fsmState)` Records the stateId and associated State
`Performative` `getDefaultPerformative()` Returns the default performative.
`FsmClass` `getFsmClass()` Returns the fsm class.
`State` `getInitialState()` Returns the initial fsm state.
`java.lang.String` `getName()` Returns the fsm name.
`State` `getState(java.lang.String stateId)` Returns the state having the given id.
`void` `setDefaultPerformative(Performative defaultPerformative)` Sets the default performative.
`void` `setInitialState(State initialState)` Sets the initial fsm state.
`java.lang.String` `toString()` Returns a string representation of this object.
`protected void` `validateIntegrity()` Validates fsm integrity.

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

Field Detail

### name

    protected java.lang.String name

  name of the fsm instance

### fsmClass

    protected FsmClass fsmClass

  class of the fsm instance

### initialState

    protected State initialState

  inital fsm state

### defaultPerformative

    protected Performative defaultPerformative

  default performative for the initial state

### fsmStates

    protected java.util.HashMap fsmStates

  dictionary of fsm states, stateName --> State

Constructor Detail

### Fsm

    protected Fsm(java.lang.String name)

  Constructs a new Fsm object given the fsm name
  Parameters:
    `name` - the fsm name

Method Detail

### getName

    public java.lang.String getName()

  Returns the fsm name.
  Returns:
    the fsm name

### getFsmClass

    public FsmClass getFsmClass()

  Returns the fsm class.
  Returns:
    the fsm class

### setInitialState

    public void setInitialState(State initialState)

  Sets the initial fsm state.
  Parameters:
    `initialState` - the initial fsm state

### getInitialState

    public State getInitialState()

  Returns the initial fsm state.
  Returns:
    the initial fsm state

### setDefaultPerformative

    public void setDefaultPerformative(Performative defaultPerformative)

  Sets the default performative.
  Parameters:
    `defaultPerformative` - the default performative for the initial state, for those cases in which the performative is computed, rather than input directly from the user

### getDefaultPerformative

    public Performative getDefaultPerformative()

  Returns the default performative.
  Returns:
    the default performative for the initial state, for those cases in which the performative is computed, rather than input directly from the user

### addState

    public void addState(State fsmState)

  Records the stateId and associated State
  Parameters:
    `fsmFsmState` - the FSM node identified by its stateId

### addState

    public void addState(java.lang.String stateId,
                         State fsmState)

  Records the stateId and associated State
  Parameters:
    `stateId` - the given stateId
    `fsmState` - the FSM node identified by the stateId

### getState

    public State getState(java.lang.String stateId)

  Returns the state having the given id.
  Parameters:
    `stateId` - the state id
  Returns:
    the state having the given id

### toString

    public java.lang.String toString()

  Returns a string representation of this object.
  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a string representation of this object

### validateIntegrity

    protected void validateIntegrity()

  Validates fsm integrity.