org.activemath.abstractcontent
Interface AbstractpPlanner

All Superinterfaces:
Runnable

public interface AbstractpPlanner
extends Runnable

A presentation-planner is a object implementing this interface. Such an object has been created with a precise scenario and set of goals and should not be accessible before its content is ready to be displayed.

In (or under) a presentation-planner is expected to happen all the presentation mechanisms including grabbing, gathering, rule applications, linearizing and beautifying.

This interface is meant for a "client-like" usage, eg the session-manager serving and filtering machine.

Version:
0.1

Field Summary
static org.jdom.DocType doctype
           
static org.jdom.Namespace pagesNS
           
 
Method Summary
 Exception getException()
          Returns an exception that possibly happened during the process.
 org.jdom.Document getNextBest()
          Returns the NextBest document to be displayed by the session-manager to NextBest queries.
 int getNumPages()
          Returns the number of pages that the static book has.
 org.jdom.Element getPage(int pageNumber)
          Provides a similar structure document as the getStaticBook but only to some page.
 org.jdom.Document getStaticBook()
          Provides a structured list of elements to be presented to the user according to a pPlanner decision.
 int getStatus()
          Returns an integer mentionning the status.
 boolean isNextBestReady()
          Relays the the query for the possibility of a NextBest for the current user's session to the UserModel.
 boolean shouldNextBest()
          Relays the query to the userModel which should respond if yes or not NextBest should be offered.
 
Methods inherited from interface java.lang.Runnable
run
 

Field Detail

pagesNS

static final org.jdom.Namespace pagesNS

doctype

static final org.jdom.DocType doctype
Method Detail

getStaticBook

org.jdom.Document getStaticBook()
Provides a structured list of elements to be presented to the user according to a pPlanner decision. It is supposed to represent all the instructions for the display.

For a syntax of this element, see the class org.activemath.sessionManager.StaticBookServlet.

Returns:
a JDOM document with pages and mathematical elements as kid.
Throws:
RuntimeException - which should be related to the user and discard any further use of the planner's instance.
IllegalStateException

getPage

org.jdom.Element getPage(int pageNumber)
Provides a similar structure document as the getStaticBook but only to some page. Should not return before that page is ready or before it is realized that this page will not exist. This method must be callable before the planning of the complete book is made.

Throws:
ArrayIndexOutOfBoundsException - in case there is no such page.

getNumPages

int getNumPages()
Returns the number of pages that the static book has.


getException

Exception getException()
Returns an exception that possibly happened during the process.


getStatus

int getStatus()
Returns an integer mentionning the status.


isNextBestReady

boolean isNextBestReady()
Relays the the query for the possibility of a NextBest for the current user's session to the UserModel.

NextBest computations should be triggered by the planner as soon as he's ready with his material. This method should return immediately, telling yes or no for the completion of the computations.
A result of false should have the nextBest "button-applet" display a "thinking" icon.


shouldNextBest

boolean shouldNextBest()
Relays the query to the userModel which should respond if yes or not NextBest should be offered.

shouldNextBest should only be called after isNextBestReady has answered true otherwise the result of shouldNextBest is unpredictable.


getNextBest

org.jdom.Document getNextBest()
Returns the NextBest document to be displayed by the session-manager to NextBest queries.

This should not be called before the isNextBestReady displays true.

Returns:
a JDOM document.
Throws:
RuntimeException - relating trouble of the UserModel mechanism or communication... This should be displayed to the user.