org.opencyc.conversation
Class State

java.lang.Object
  |
  +--org.opencyc.conversation.State
All Implemented Interfaces:
java.lang.Comparable

public class State
extends java.lang.Object
implements java.lang.Comparable

Contains the attributes and behavior of a chat fsm Finite State Machine State.

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  java.util.HashMap arcs
          performative --> Arc
protected  java.lang.String stateId
          state identifier within the fsm
 
Constructor Summary
State(java.lang.String stateId)
          Constructs a new State object.
State(java.lang.String stateId, Fsm fsm)
          Constructs a new State object.
State(java.lang.String stateId, FsmClass fsmClass)
          Constructs a new State object.
 
Method Summary
 void addArc(Arc arc)
          Records the arc to take when the its performative is observed.
 void addArc(Performative performative, Arc arc)
          Records the arc to take when the given performative is observed.
 java.lang.Object clone()
          Creates a clone of this object.
 int compareTo(java.lang.Object object)
          Compares this object with the specified object for order.
 boolean equals(java.lang.Object object)
          Returns true iff some object equals this object
 Arc getArc(Performative performative)
          Returns the arc to take for the given performative.
 java.util.Collection getArcs()
          Returns the collection of the arcs from this state.
 java.lang.String getStateId()
          Returns the state id.
 java.lang.String toString()
          Returns the string representation of the State
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

stateId

protected java.lang.String stateId
state identifier within the fsm

arcs

protected java.util.HashMap arcs
performative --> Arc
Constructor Detail

State

public State(java.lang.String stateId)
Constructs a new State object.
Parameters:
stateId - unique state identifier within the fsm

State

public State(java.lang.String stateId,
             FsmClass fsmClass)
Constructs a new State object.
Parameters:
stateId - unique state identifier within the fsm
fsmClass - the fsm class containing this new state

State

public State(java.lang.String stateId,
             Fsm fsm)
Constructs a new State object.
Parameters:
stateId - unique state identifier within the fsm
fsm - the fsm containing this new state
Method Detail

getStateId

public java.lang.String getStateId()
Returns the state id.
Returns:
the state id

getArcs

public java.util.Collection getArcs()
Returns the collection of the arcs from this state.
Returns:
the collection of the arcs from this state

addArc

public void addArc(Arc arc)
Records the arc to take when the its performative is observed.
Parameters:
arc - the FSM arc which specifies a transition-to state and an action

addArc

public void addArc(Performative performative,
                   Arc arc)
Records the arc to take when the given performative is observed.
Parameters:
performative - the given performative
arc - the FSM arc which specifies a transition-to state and an action

getArc

public Arc getArc(Performative performative)
Returns the arc to take for the given performative.
Parameters:
performative - the given performative
Returns:
the FSM arc which specifies a transition-to state and an action

compareTo

public int compareTo(java.lang.Object object)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Specified by:
compareTo in interface java.lang.Comparable
Parameters:
object - the reference object with which to compare.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object

equals

public boolean equals(java.lang.Object object)
Returns true iff some object equals this object
Overrides:
equals in class java.lang.Object
Parameters:
object - the Object for equality comparison
Returns:
equals boolean value indicating equality or non-equality.

toString

public java.lang.String toString()
Returns the string representation of the State
Overrides:
toString in class java.lang.Object
Returns:
the representation of the State as a String

clone

public java.lang.Object clone()
Creates a clone of this object.
Overrides:
clone in class java.lang.Object