Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| ABLE 2.3.0 07/13/2005 14:21:00
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.conversation.base
Class BasicCpState

    java.lang.Object
      com.ibm.conversation.base.BasicCpState

All Implemented Interfaces:
  CpState

public class BasicCpState
extends java.lang.Object
implements CpState

The BasicCpState class is a straightforward, vanilla-Java implementation of the CpState interface.

Field Summary

Fields inherited from interface com.ibm.conversation.CpState
`IN_CHILD, NO_TYPE, NORMAL, TERMINAL, TYPE_STRINGS`

Constructor Summary
`BasicCpState(int newType)` Constructs a BasicCpState object of the given state type.

Method Summary
`boolean` | `addTransition(CpStateTransition newTrans)` Attempts to add the given transition to this state's transitions.
`java.lang.String` | `getChildPolicyName()` Returns the name of the child policy to be loaded when this state is entered.
`java.lang.String` | `getChildPolicyRole(java.lang.String parentRole)` Returns the role of the child conversation policy which will be played by the agent that is playing the given role in the current conversation policy (i.e., the conversation policy of which this CpState is a state).
`java.lang.String` | `getName()` Returns the state's name.
`int` | `getNumTransitions()` Returns the number of transitions from this state (i.e., its out-degree).
`java.lang.String` | `getReturnCode()` Returns the state's return code.
`long` | `getTimeoutInMillis()` Returns the state's timeout value.
`CpStateTransition` | `getTransition(java.lang.String transName)` Returns the transition with the given name.
`java.util.Collection` | `getTransitions()` Returns a Collection containing this state's transitions.
`java.util.Collection` | `getTransitionsWithSender(java.lang.String role)` Returns a Collection containing all of the transitions for which the given role is the sender of a message.
`int` | `getType()` Returns the states's type.
`int` | `getTypeFromString(java.lang.String str)` Returns the state type matching the given string.
`java.lang.String` | `getTypeString()` Returns a string corresponding to the state's type.
`boolean` | `hasTransitionWithSender(java.lang.String role)` Indicates whether this state has a transition in which the given role sends a message.
`boolean` | `setChildPolicyName(java.lang.String newName)` Attempts to set the name of the child policy to be loaded when this state is entered.
`boolean` | `setChildPolicyRole(java.lang.String parentRole, java.lang.String childRole)` Sets the role that will be played, in the child policy, by the agent that plays the given role in the current policy.
`void` | `setName(java.lang.String newName)` Sets the state's name.
`boolean` | `setReturnCode(java.lang.String rc)` Sets the state's return code.
`void` | `setTimeoutInMillis(long millis)` Sets the state's timeout value.

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

Constructor Detail

### BasicCpState

    public BasicCpState(int newType)

  Constructs a BasicCpState object of the given state type.

  See `CpState` for the list of allowed types.

Parameters:
  `newType` - The state type.

Method Detail

### getType

    public int getType()

  Description copied from interface: `CpState`
  Returns the states's type.

  Specified by:
    `getType` in interface `CpState`
  Returns:
    The state type. The value will be one of {NO_TYPE, NORMAL, IN_CHILD, TERMINAL}.

### getTypeString

    public java.lang.String getTypeString()

  Description copied from interface: `CpState`
  Returns a string corresponding to the state's type.

  Specified by:
    `getTypeString` in interface `CpState`
  Returns:
    The string giving the state's type.

### getTypeFromString

    public int getTypeFromString(java.lang.String str)

  Description copied from interface: `CpState`
  Returns the state type matching the given string.

  Does not change this state's type. (This method would be static, if static methods were allowed for interfaces.)

  Specified by:
    `getTypeFromString` in interface `CpState`
  Parameters:
    `str` - The string for the state type.
  Returns:
    The state type correponding to the given string. If no match was found, returns NO_TYPE.

### getName

    public java.lang.String getName()

  Description copied from interface: `CpState`
  Returns the state's name.

  Specified by:
    `getName` in interface `CpState`
  Returns:
    The state's name.

### setName

    public void setName(java.lang.String newName)

  Description copied from interface: `CpState`
  Sets the state's name.

  Specified by:
    `setName` in interface `CpState`
  Parameters:
    `newName` - The new name.

### getTimeoutInMillis

    public long getTimeoutInMillis()

  Description copied from interface: `CpState`
  Returns the state's timeout value.

  The timeout value gives the amount of time that the conversation may remain in this state.

  Specified by:
    `getTimeoutInMillis` in interface `CpState`
  Returns:
    The timout value, in milliseconds. If no timeout has been set, returns 0.

### setTimeoutInMillis

    public void setTimeoutInMillis(long millis)

  Description copied from interface: `CpState`
  Sets the state's timeout value.

  The timeout value gives the amount of time that the conversation may remain in this state.

  Specified by:
    `setTimeoutInMillis` in interface `CpState`
  Parameters:
    `millis` - The new timeout value, in milliseconds.

### getNumTransitions

    public int getNumTransitions()

  Description copied from interface: `CpState`
  Returns the number of transitions from this state (i.e., its out-degree).

  Specified by:
    `getNumTransitions` in interface `CpState`
  Returns:
    The number of transitions.

### getTransitions

    public java.util.Collection getTransitions()

  Description copied from interface: `CpState`
  Returns a Collection containing this state's transitions.

  The elements of the Collection are type `CpStateTransition`.

  Specified by:
    `getTransitions` in interface `CpState`
  Returns:
    The state's transitions.

### getTransitionsWithSender

    public java.util.Collection getTransitionsWithSender(java.lang.String role)

  Description copied from interface: `CpState`
  Returns a Collection containing all of the transitions for which the given role is the sender of a message.

  The elements of the Collection are type `CpStateTransition`.

  Specified by:
    `getTransitionsWithSender` in interface `CpState`
  Parameters:
    `role` - The role in question.
  Returns:
    The transitions in which the given role sends a message.

### getTransition

    public CpStateTransition getTransition(java.lang.String transName)

  Description copied from interface: `CpState`
  Returns the transition with the given name.

  Specified by:
    `getTransition` in interface `CpState`
  Parameters:
    `transName` - The transition name.
  Returns:
    The transition with the given name, or `null` if not found.

### addTransition

    public boolean addTransition(CpStateTransition newTrans)

  Description copied from interface: `CpState`
  Attempts to add the given transition to this state's transitions.

  In order for the transition to be added, it must obey the connectivity constraints that determine what types of transition may be added to each type of state. See `CpStateTransition` for more information.

  Specified by:
    `addTransition` in interface `CpState`
  Parameters:
    `newTrans` - the transition to add.
  Returns:
    true if the transition was addded, false if not.

### hasTransitionWithSender

    public boolean hasTransitionWithSender(java.lang.String role)

  Description copied from interface: `CpState`
  Indicates whether this state has a transition in which the given role sends a message.

  This is meaningful only for normal states.

  Specified by:
    `hasTransitionWithSender` in interface `CpState`
  Returns:
    true if such a transition exists, false if not.

### getChildPolicyName

    public java.lang.String getChildPolicyName()

  Description copied from interface: `CpState`
  Returns the name of the child policy to be loaded when this state is entered.

  This is meaningful only for in-child states.

  Specified by:
    `getChildPolicyName` in interface `CpState`
  Returns:
    The name of the child policy, or `null` if there is none.

### setChildPolicyName

    public boolean setChildPolicyName(java.lang.String newName)

  Description copied from interface: `CpState`
  Attempts to set the name of the child policy to be loaded when this state is entered.

  This is allowed only for in-child states.

  Specified by:
    `setChildPolicyName` in interface `CpState`
  Parameters:
    `newName` - The name of the child policy.
  Returns:
    true if the state is an in-child state, false if not.

### getChildPolicyRole

    public java.lang.String getChildPolicyRole(java.lang.String parentRole)

  Description copied from interface: `CpState`
  Returns the role of the child conversation policy which will be played by the agent that is playing the given role in the current conversation policy (i.e., the conversation policy of which this CpState is a state).

  This is meaningful only for in-child states.

  Specified by:
    `getChildPolicyRole` in interface `CpState`
  Parameters:
    `parentRole` - The role in the current policy.
  Returns:
    The role in the child policy, or `null` if undefined.

### setChildPolicyRole

    public boolean setChildPolicyRole(java.lang.String parentRole,
                                      java.lang.String childRole)

  Description copied from interface: `CpState`
  Sets the role that will be played, in the child policy, by the agent that plays the given role in the current policy.

  This is allowed only for in-child states.

  Specified by:
    `setChildPolicyRole` in interface `CpState`
  Parameters:
    `parentRole` - The role in the current policy.
    `childRole` - The role in the child policy.
  Returns:
    true if this state is an in-child state, false if not.

### getReturnCode

    public java.lang.String getReturnCode()

  Description copied from interface: `CpState`
  Returns the state's return code.

  This is meaningful only for terminal states.

  Specified by:
    `getReturnCode` in interface `CpState`
  Returns:
    The return code, or `null` if undefined.

### setReturnCode

    public boolean setReturnCode(java.lang.String rc)

  Description copied from interface: `CpState`
  Sets the state's return code.

  This is allowed only for terminal states.

  Specified by:
    `setReturnCode` in interface `CpState`
  Parameters:
    `rc` - The return code.
  Returns:
    true if this state is a terminal state, false if not.

Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| ABLE 2.3.0 07/13/2005 14:21:00
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

(C) Copyright IBM Corporation 1999, 2005