story.scheherazade.admin
Class StoryListener

java.lang.Object
  extended by story.scheherazade.admin.StoryListener
All Implemented Interfaces:
HearsStoryPoints

public class StoryListener
extends java.lang.Object
implements HearsStoryPoints

A listener for stories that interprets order-sensitive commands -- the sjuzhet of a story -- and maintains a Narrative object to represent the story graph as it is built.


Constructor Summary
StoryListener(java.io.BufferedReader reader)
          Constructor that takes a BufferedReader of Scheherazade output.
StoryListener(NarrativeID title)
           
StoryListener(NarrativeID title, StoryTelling coreStory, ProgressNotifier progressNotifier)
           
 
Method Summary
 HistoryFrameID getCurrentStateID()
          Get the HistoryFrameID of the current state
 StoryPoint getRedoableOperation()
          Returns the type of StoryPoint associated with the subsequent recent state-changing operation in the redo stack.
 StoryTelling getTelling()
          Return the StoryTelling heard thus far
 NarrativeID getTitle()
           
 StoryPoint getUndoableOperation()
          Returns the type of StoryPoint associated with the most recent state-changing operation, i.e., the operation at the top of the undo stack.
 java.lang.Object hear(StoryPoint storyPoint)
           
 void hear(StoryTelling telling)
           
 java.lang.StringBuffer printState()
          Render the state of the underlying db-core.
 java.lang.StringBuffer renderNarrative()
          Render the current state of the Narrative
 void shell()
          For testing ONLY: start a db-core shell
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StoryListener

public StoryListener(NarrativeID title)
              throws Scheherexception
Throws:
Scheherexception

StoryListener

public StoryListener(NarrativeID title,
                     StoryTelling coreStory,
                     ProgressNotifier progressNotifier)
              throws Scheherexception
Parameters:
coreStory - StoryPoints to interpret initially, and not represent on the undo stack. In particular, initial knowledge base setup instructions prior to user interaction. Can be null.
progressNotifier - Notifier for progress in interpreting coreStory. Every time a StoryPoint is interpreted, progress toward interpreting all StoryPoints is pushed out to this notifier. Can be null.
Throws:
Scheherexception

StoryListener

public StoryListener(java.io.BufferedReader reader)
              throws Scheherexception
Constructor that takes a BufferedReader of Scheherazade output. Loads back a serialized StoryTelling.

Throws:
Scheherexception
Method Detail

hear

public void hear(StoryTelling telling)
          throws Scheherexception
Throws:
Scheherexception

hear

public java.lang.Object hear(StoryPoint storyPoint)
                      throws Scheherexception
Specified by:
hear in interface HearsStoryPoints
Throws:
Scheherexception

getCurrentStateID

public HistoryFrameID getCurrentStateID()
Get the HistoryFrameID of the current state


getUndoableOperation

public StoryPoint getUndoableOperation()
Returns the type of StoryPoint associated with the most recent state-changing operation, i.e., the operation at the top of the undo stack. If there is nothing to undo, returns null.


getRedoableOperation

public StoryPoint getRedoableOperation()
Returns the type of StoryPoint associated with the subsequent recent state-changing operation in the redo stack. If there is nothing to undo, returns null.


printState

public java.lang.StringBuffer printState()
                                  throws Scheherexception
Render the state of the underlying db-core.

Throws:
Scheherexception

renderNarrative

public java.lang.StringBuffer renderNarrative()
                                       throws Scheherexception
Render the current state of the Narrative

Throws:
Scheherexception

getTelling

public StoryTelling getTelling()
                        throws Scheherexception
Return the StoryTelling heard thus far

Throws:
Scheherexception

getTitle

public NarrativeID getTitle()

shell

public void shell()
           throws Scheherexception
For testing ONLY: start a db-core shell

Throws:
Scheherexception


Copyright © 2011 David K. Elson. All Rights Reserved.