Class ActiveWoolDialogue


  • public class ActiveWoolDialogue
    extends Object
    An ActiveWoolDialogue is a wrapper around a WoolDialogue, which contains a static definition of a dialogue (referred to as the dialogueDefinition). The ActiveWoolDialogue also contains utility functions to keep track of the state during "execution" of the dialogue.
    • Method Detail

      • getDialogueDefinition

        public WoolDialogue getDialogueDefinition()
      • getCurrentNode

        public WoolNode getCurrentNode()
      • setCurrentNode

        public void setCurrentNode​(WoolNode currentNode)
      • setDialogueState

        public void setDialogueState​(DialogueState dialogueState)
      • startDialogue

        public WoolNode startDialogue​(String nodeId,
                                      org.joda.time.DateTime time)
                               throws WoolException,
                                      EvaluationException
        "Starts" this ActiveWoolDialogue at the provided WoolNode, returning that node and updating the dialogue's internal state. If you set the nodeId to null, it will return the start node.
        Parameters:
        nodeId - the node ID or null
        time - the time in the time zone of the user. This will be stored with changes in the variable store.
        Returns:
        the WoolNode
        Throws:
        WoolException - if the request is invalid
        EvaluationException - if an expression cannot be evaluated
      • processReplyAndGetNodePointer

        public WoolNodePointer processReplyAndGetNodePointer​(int replyId,
                                                             org.joda.time.DateTime time)
                                                      throws EvaluationException
        Retrieves the pointer to the next node based on the provided reply id. This might be a pointer to the end node. This method also performs any "set" actions associated with the reply.
        Parameters:
        replyId - the reply ID
        time - the time in the time zone of the user
        Returns:
        WoolNodePointer the pointer to the next node
        Throws:
        EvaluationException - if an expression cannot be evaluated
      • progressDialogue

        public WoolNode progressDialogue​(WoolNodePointerInternal nodePointer,
                                         org.joda.time.DateTime time)
                                  throws EvaluationException
        Takes the next node pointer from the selected reply and determines the next node. The pointer might point to the end note, which means that there is no next node. If there is no next node, or the next node has no reply options, then the dialogue is considered finished.

        If there is a next node, then it returns the executed version of that next WoolNode which results from a call to the executeWoolNode(WoolNode, DateTime) function.

        Parameters:
        nodePointer - the next node pointer from the selected reply
        time - the time in the time zone of the user. This will be stored with changes in the variable store.
        Returns:
        the next WoolNode that follows on the selected reply or null
        Throws:
        EvaluationException - if an expression cannot be evaluated
      • storeReplyInput

        public void storeReplyInput​(Map<String,​?> variables,
                                    org.joda.time.DateTime time)
        Stores the specified variables in the variable store.
        Parameters:
        variables - the variables
        time - the time in the time zone of the user
      • getUserStatementFromReplyId

        public String getUserStatementFromReplyId​(int replyId)
                                           throws WoolException
        The user's client returned the given replyId - what was the statement that was uttered by the user?
        Parameters:
        replyId - the reply ID
        Returns:
        the statement
        Throws:
        WoolException - if no reply with the specified ID is found