org.activemath.exercises
Class InteractionGenerator

java.lang.Object
  extended by org.activemath.exercises.openmath.OpenMath
      extended by org.activemath.exercises.InteractionGenerator
Direct Known Subclasses:
CasConsole, DRGenerator, EmbeddedHTMLGenerator, FractionsGenerator, HTWGenerator, MAPSMossaicControl, MAPSMossaicFremdPlannung, MathCoachGenerator, MathDoxInteractionManager, OmegaTutorGenerator, SelfRegulateStrategy, SelfRegulateStrategy2, SelfRegulateStrategyTest, STACKGenerator, Static, StrategyAction, TruthTables

public class InteractionGenerator
extends OpenMath

Base class for interaction element generators.

Version:
$Revision: 1.18 $ $Date: 2011/08/24 16:48:11 $

Field Summary
protected static org.jdom.Namespace activemathNamespace
           
protected static org.jdom.Namespace dublinCoreNamespace
           
protected  org.jdom.Document exercise
           
protected  String exerciseId
           
protected  Map<String,org.jdom.Element> knownInteractions
           
protected  String lang
           
protected  LocalUserModel localUserModel
           
protected  boolean localUserModelActive
           
protected  InteractionGenerator masterGenerator
           
protected static OpenMath om
           
protected static org.jdom.Namespace omdocNamespace
           
protected static org.jdom.Namespace openmathNamespace
           
protected  List parameters
           
protected  PresentationStrategy presentationStrategy
           
protected  org.jdom.output.XMLOutputter serializer
           
protected  AppSession session
           
protected  String theoryId
           
 
Constructor Summary
InteractionGenerator()
           
InteractionGenerator(LocalUserModel localUserModel)
           
InteractionGenerator(LocalUserModel localUserModel, String lang)
           
 
Method Summary
protected static void abort(String message)
          Abort and display a critical error to the user, by throwing a RuntimeException.
 Evaluator getAnswerEvaluator()
          Provide an answer evaluator, if this generator requires a custom one.
 org.jdom.Document getExerciseDocument()
           
 String getExerciseId()
           
 org.jdom.Element getFeedback(String id)
           
 org.jdom.Element getInteraction()
          Produce the initial node, where the exercise really starts.
 org.jdom.Element getInteraction(String id)
          Produce an interaction element from the given ID attribute.
 String getName()
           
 List getParameters()
           
 PresentationStrategy getPresentationStrategy()
           
 AppSession getSession()
           
 String getTheoryId()
           
protected  boolean hasAnswerMap(org.jdom.Element interaction)
           
 boolean isStrategy()
           
 void setExerciseDocument(org.jdom.Document exercise)
           
 void setExerciseId(String exerciseId)
           
 void setIsStrategy(boolean isStrategy)
           
 void setLang(String lang)
           
 void setMasterGenerator(InteractionGenerator masterGenerator)
           
 void setName(String name)
           
 void setParameters(List parameters)
           
 void setPresentationStrategy(PresentationStrategy presentationStrategy)
           
 void setSession(AppSession session)
           
 void setTheoryId(String theoryId)
           
 
Methods inherited from class org.activemath.exercises.openmath.OpenMath
applyBinding, getOmobjContents, oma, oma, oma, oma, oma, ombind, ombind, ombind, ombind, ombind, ombvar, ombvar, ombvar, ombvar, ome, ome, ome, ome, omf, omf, omi, omi, omobj, oms, omstr, omv, output, setOmNamespace, substituteVariables, tidyForOpenMath1, toDouble, toInt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serializer

protected org.jdom.output.XMLOutputter serializer

exercise

protected org.jdom.Document exercise

theoryId

protected String theoryId

exerciseId

protected String exerciseId

parameters

protected List parameters

openmathNamespace

protected static final org.jdom.Namespace openmathNamespace

dublinCoreNamespace

protected static final org.jdom.Namespace dublinCoreNamespace

omdocNamespace

protected static final org.jdom.Namespace omdocNamespace

activemathNamespace

protected static final org.jdom.Namespace activemathNamespace

om

protected static OpenMath om

localUserModel

protected LocalUserModel localUserModel

localUserModelActive

protected boolean localUserModelActive

masterGenerator

protected InteractionGenerator masterGenerator

presentationStrategy

protected PresentationStrategy presentationStrategy

knownInteractions

protected Map<String,org.jdom.Element> knownInteractions

session

protected AppSession session

lang

protected String lang
Constructor Detail

InteractionGenerator

public InteractionGenerator()

InteractionGenerator

public InteractionGenerator(LocalUserModel localUserModel)

InteractionGenerator

public InteractionGenerator(LocalUserModel localUserModel,
                            String lang)
Method Detail

setLang

public void setLang(String lang)

getExerciseDocument

public org.jdom.Document getExerciseDocument()

getTheoryId

public String getTheoryId()

getExerciseId

public String getExerciseId()

getParameters

public List getParameters()

setExerciseDocument

public void setExerciseDocument(org.jdom.Document exercise)

setTheoryId

public void setTheoryId(String theoryId)

setExerciseId

public void setExerciseId(String exerciseId)

setParameters

public void setParameters(List parameters)

setMasterGenerator

public void setMasterGenerator(InteractionGenerator masterGenerator)

getInteraction

public org.jdom.Element getInteraction()
Produce the initial node, where the exercise really starts.

Returns:
JDOM element. Can be null only if the exercise item doesn't have a root element.

getInteraction

public org.jdom.Element getInteraction(String id)
Produce an interaction element from the given ID attribute. TODO: document here the basic structure of an interaction element.

Parameters:
id - value of the "id" attribute of the desired element.
Returns:
element found, or null.

getFeedback

public org.jdom.Element getFeedback(String id)

hasAnswerMap

protected boolean hasAnswerMap(org.jdom.Element interaction)

getAnswerEvaluator

public Evaluator getAnswerEvaluator()
Provide an answer evaluator, if this generator requires a custom one. Normally it would be enough with the default evaluator.

Returns:
Evaluator object.

abort

protected static void abort(String message)
Abort and display a critical error to the user, by throwing a RuntimeException.

Parameters:
message - description of the problem.

getPresentationStrategy

public PresentationStrategy getPresentationStrategy()

setPresentationStrategy

public void setPresentationStrategy(PresentationStrategy presentationStrategy)

getName

public String getName()

setName

public void setName(String name)

isStrategy

public boolean isStrategy()

setIsStrategy

public void setIsStrategy(boolean isStrategy)

getSession

public AppSession getSession()

setSession

public void setSession(AppSession session)