## org.opencyc.conversation
Class ConversationFactory

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

public class ConversationFactory
extends java.lang.Object

Makes chat conversations which can be interpreted by the Interpreter.

The chat conversation is in the form of a text conversation using asynchronous receiving and sending of messages.

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 ActionFactory` `actionFactory` Action object factory
`protected static java.util.HashMap` `conversationCache` Caches conversation objects to keep from making them twice.
`protected static State` `currentState`
`protected static java.util.ArrayList` `globalArcs` Arcs which apply to every state.
`protected TemplateFactory` `templateFactory` Template object factory

Constructor Summary
`ConversationFactory()` Constructs a new ConversationFactory object.

Method Summary
`Conversation` `getConversation(java.lang.String name)` Returns the Conversation having the given name;
`java.util.ArrayList` `getGlobalArcs()` Returns the list of arcs which apply to every state.
`void` `initialize()` Initializes this object.
`protected void` `makeAllConversations()` Initialize all the conversations.
`protected void` `makeAllGlobalArcs()` Initializes the global arcs
`Conversation` `makeChat()` Makes a "chat" Conversation.
`void` `makeDoNotUnderstoodArc()` Makes a "do-not-understand" arc for every conversation state.
`void` `makeQuitArc()` Makes a "quit" arc for every conversation state.
`Conversation` `makeTermQuery()` Makes a "term-query" Conversation.
`static void` `reset()` Resets the conversation caches.

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

Field Detail

### conversationCache

    protected static java.util.HashMap conversationCache

  Caches conversation objects to keep from making them twice. name --> Conversation

### globalArcs

    protected static java.util.ArrayList globalArcs

  Arcs which apply to every state.

### actionFactory

    protected ActionFactory actionFactory

  Action object factory

### templateFactory

    protected TemplateFactory templateFactory

  Template object factory

### currentState

    protected static final State currentState

Constructor Detail

### ConversationFactory

    public ConversationFactory()

  Constructs a new ConversationFactory object.

Method Detail

### reset

    public static void reset()

  Resets the conversation caches.

### initialize

    public void initialize()

  Initializes this object.

### makeAllGlobalArcs

    protected void makeAllGlobalArcs()

  Initializes the global arcs

### makeAllConversations

    protected void makeAllConversations()

  Initialize all the conversations.

### getConversation

    public Conversation getConversation(java.lang.String name)

  Returns the Conversation having the given name;
  Parameters:
    `name` - the conversation name

### getGlobalArcs

    public java.util.ArrayList getGlobalArcs()

  Returns the list of arcs which apply to every state.
  Returns:
    the list of arcs which apply to every state

### makeDoNotUnderstoodArc

    public void makeDoNotUnderstoodArc()

  Makes a "do-not-understand" arc for every conversation state. Initial state is current-state. 1. If we are in the current-state state and get a not-understand performative, transition to the current-state state, and perform the do-not-understand action.

### makeQuitArc

    public void makeQuitArc()

  Makes a "quit" arc for every conversation state. Initial state is current-state. 1. If we are in the current-state state and get a quit performative, transition to the final state, and perform the do-finalization action.

### makeChat

    public Conversation makeChat()

  Makes a "chat" Conversation. Initial state is ready. 1. If we are in the ready state and get a term-query performative, transition to the ready state and perform the do-term-query action.

### makeTermQuery

    public Conversation makeTermQuery()

  Makes a "term-query" Conversation. Initial state is retrieve-fact.
  1. If we are in the retrieve-fact state and get a term-query performative, transition to the prompt-for-more state and perform the reply-with-first-fact action.
  2. If we are in the prompt-for-more state and get a more performative, transition to the prompt-for-more state and perform the reply-with-next-fact action.
  3. If we are in the prompt-for-more state and get a done performative, transition to the done state and perform no action.