ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.conversation.base
Class BasicCpHandlerStack

java.lang.Object
  |
  +--com.ibm.conversation.base.BasicCpHandlerStack
All Implemented Interfaces:
ConversationContext

public class BasicCpHandlerStack
extends java.lang.Object
implements ConversationContext

Class BasicCpHandlerStack implements the ConversationContext interface as a stack of ConversationPolicyHandlers.


Constructor Summary
BasicCpHandlerStack()
          Constructs a BasicCpHandlerStack object.
 
Method Summary
 void clear()
          Clears the stack of policy handlers.
 ConversationPolicyHandler getActivePolicyHandler()
          Returns the currently active ConversationPolicyHandler.
 int getActivePolicyLevel()
          Returns the level of the currently active conversation policy.
 java.lang.String getActivePolicyName()
          Returns the name of the currently active conversation policy.
 java.lang.String getActiveSelfRole()
          Returns the role this agent is playing in the currently active conversation policy.
 java.lang.String getActiveStateName()
          Returns the name of the current state of the currently active conversation policy.
 ConversationPolicyHandler getConversationPolicyHandlerAt(int level)
          Returns the ConversationPolicyHandler at the given level.
 int getNumPolicyLevels()
          Returns the current number of conversation policy levels.
 java.lang.String getPolicyNameAt(int level)
          Returns the name of the policy at the given level.
 java.lang.String getSelfRoleAt(int level)
          Returns the role this agent in playing in the policy at the given level.
 java.lang.String getStateNameAt(int level)
          Returns the current state of the policy at the given level.
 ConversationPolicyHandler pop()
          Pops the bottom policy handler off the stack.
 void push(ConversationPolicyHandler cph)
          Pushes the given policy handler on the stack.
 java.lang.String toString()
          Returns a human-readable, multi-line description of the stack.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicCpHandlerStack

public BasicCpHandlerStack()
Constructs a BasicCpHandlerStack object.
Method Detail

getNumPolicyLevels

public int getNumPolicyLevels()
Description copied from interface: ConversationContext
Returns the current number of conversation policy levels.

Specified by:
getNumPolicyLevels in interface ConversationContext
Following copied from interface: com.ibm.conversation.ConversationContext
Returns:
The current number of conversation policy levels.

getActivePolicyLevel

public int getActivePolicyLevel()
Description copied from interface: ConversationContext
Returns the level of the currently active conversation policy.

This is equal to getNumPolicyLevels()-1.

Specified by:
getActivePolicyLevel in interface ConversationContext
Following copied from interface: com.ibm.conversation.ConversationContext
Returns:
The level of the currently active conversation policy.

getActivePolicyName

public java.lang.String getActivePolicyName()
Description copied from interface: ConversationContext
Returns the name of the currently active conversation policy.

Specified by:
getActivePolicyName in interface ConversationContext
Following copied from interface: com.ibm.conversation.ConversationContext
Returns:
The name of the currently active conversation policy, or null if there is none.

getActiveSelfRole

public java.lang.String getActiveSelfRole()
Description copied from interface: ConversationContext
Returns the role this agent is playing in the currently active conversation policy.

Specified by:
getActiveSelfRole in interface ConversationContext
Following copied from interface: com.ibm.conversation.ConversationContext
Returns:
The role this agent is playing in the currently active conversation policy, or null if there is none.

getActiveStateName

public java.lang.String getActiveStateName()
Description copied from interface: ConversationContext
Returns the name of the current state of the currently active conversation policy.

See ConversationPolicyHandler for a discussion of the meaning of "current state".

Specified by:
getActiveStateName in interface ConversationContext
Following copied from interface: com.ibm.conversation.ConversationContext
Returns:
The name of the current state of the currently active conversation policy, or null if there is none.

getPolicyNameAt

public java.lang.String getPolicyNameAt(int level)
Description copied from interface: ConversationContext
Returns the name of the policy at the given level.

The root policy is level 0.

Specified by:
getPolicyNameAt in interface ConversationContext
Following copied from interface: com.ibm.conversation.ConversationContext
Parameters:
level - The level in question.
Returns:
The name of the policy at the given level.

getSelfRoleAt

public java.lang.String getSelfRoleAt(int level)
Description copied from interface: ConversationContext
Returns the role this agent in playing in the policy at the given level.

The root policy is level 0.

Specified by:
getSelfRoleAt in interface ConversationContext
Following copied from interface: com.ibm.conversation.ConversationContext
Parameters:
level - The level in question.
Returns:
The role at the given level.

getStateNameAt

public java.lang.String getStateNameAt(int level)
Description copied from interface: ConversationContext
Returns the current state of the policy at the given level.

The root policy is level 0. See ConversationPolicyHandler for a discussion of the meaning of "current state".

Specified by:
getStateNameAt in interface ConversationContext
Following copied from interface: com.ibm.conversation.ConversationContext
Parameters:
level - The level in question.
Returns:
The name of the current state in the conversation policy at the given level, or null if there is none.

getActivePolicyHandler

public ConversationPolicyHandler getActivePolicyHandler()
Returns the currently active ConversationPolicyHandler.

Returns:
The currently active ConversationPolicyHandler, or null if there is none.

getConversationPolicyHandlerAt

public ConversationPolicyHandler getConversationPolicyHandlerAt(int level)
Returns the ConversationPolicyHandler at the given level.

The root conversation policy is at level 0.

Parameters:
level - The desired level in the stack.
Returns:
The ConversationPolicyHandler at the desired level, or null if there is none.

push

public void push(ConversationPolicyHandler cph)
Pushes the given policy handler on the stack.

It will become the new "bottom" level--i.e., the one with the highest numerical value.

Parameters:
cph - The policy handler to be pushed onto the stack.

pop

public ConversationPolicyHandler pop()
Pops the bottom policy handler off the stack.

"Bottom" means, having the highest numerical value of level.

Returns:
The policy handler poppoed of the stack.

clear

public void clear()
Clears the stack of policy handlers.

toString

public java.lang.String toString()
Returns a human-readable, multi-line description of the stack.

For debugging and unit testing.

Overrides:
toString in class java.lang.Object

ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003