## org.opencyc.conversation
Class FsmClass

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

public class FsmClass
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 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 class
`protected FsmClass` `superClass` The fsm superClass or null for the root fsm class.

Constructor Summary
`protected` `FsmClass(java.lang.String name, FsmClass superClass)` Constructs a new FsmClass object given the fsm name and superclass.
`protected` `FsmClass(java.lang.String name, java.lang.String superClassName)` Constructs a new FsmClass object given the fsm name and superclass 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
`protected void` `fixupClonedStates(java.util.HashMap states)` Fixes up references to states embedded in arcs, after the states have been cloned.
`Performative` `getDefaultPerformative()` Returns the default performative.
`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.
`Fsm` `makeInstance(java.lang.String name)` Makes a new fsm instance of this fsm class.
`static Fsm` `makeInstance(java.lang.String name, java.lang.String className)` Makes a new fsm instance of the fsm class name.
`FsmClass` `makeSubClass(java.lang.String name)` Makes a new fsm subclass of this fsm class.
`static FsmClass` `makeSubClass(java.lang.String name, java.lang.String superClassName)` Makes a new fsm subclass of this fsm class name.
`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 class 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 class

### superClass

    protected FsmClass superClass

  The fsm superClass or null for the root fsm class.

### 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

### FsmClass

    protected FsmClass(java.lang.String name,
                       FsmClass superClass)

  Constructs a new FsmClass object given the fsm name and superclass.
  Parameters:
    `name` - the fsm class name
    `superClass` - the fsm superclass

### FsmClass

    protected FsmClass(java.lang.String name,
                       java.lang.String superClassName)

  Constructs a new FsmClass object given the fsm name and superclass name.
  Parameters:
    `name` - the fsm class name
    `superClassName` - the fsm superclass name

Method Detail

### getName

    public java.lang.String getName()

  Returns the fsm name.
  Returns:
    the fsm name

### 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:
    `fsmState` - 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

### makeSubClass

    public static FsmClass makeSubClass(java.lang.String name,
                                        java.lang.String superClassName)

  Makes a new fsm subclass of this fsm class name.
  Parameters:
    `name` - the name of the fsm subclass
    `name` - the name of the fsm superclass
  Returns:
    new fsm subclass

### makeSubClass

    public FsmClass makeSubClass(java.lang.String name)

  Makes a new fsm subclass of this fsm class.
  Parameters:
    `name` - the name of the fsm subclass
  Returns:
    new fsm subclass

### makeInstance

    public static Fsm makeInstance(java.lang.String name,
                                   java.lang.String className)

  Makes a new fsm instance of the fsm class name.
  Parameters:
    `name` - the name of the fsm instance
    `className` - the name of the fsm class
  Returns:
    new fsm instance

### makeInstance

    public Fsm makeInstance(java.lang.String name)

  Makes a new fsm instance of this fsm class.
  Parameters:
    `name` - the name of the fsm instance
  Returns:
    new fsm instance of the fsm class name

### fixupClonedStates

    protected void fixupClonedStates(java.util.HashMap states)

  Fixes up references to states embedded in arcs, after the states have been cloned.

### 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 class integrity.