org.jsurveylib.model.script.interpreter
Class ScriptInterpreter

java.lang.Object
  extended by org.jsurveylib.model.script.interpreter.ScriptInterpreter
All Implemented Interfaces:
AnswerListener, InsertQuestionListener

public class ScriptInterpreter
extends java.lang.Object
implements InsertQuestionListener, AnswerListener

FOR INTERNAL USE ONLY.

Copyright (c)2007, Daniel Kaplan

Since:
7.10.4
Author:
Daniel Kaplan

Constructor Summary
ScriptInterpreter(Survey survey, java.lang.String initScript, java.lang.String onAnswerChanged)
           
 
Method Summary
 void answerChanged(Question question, boolean evaluateScript)
          This method will be called when the answer of a question is changed
 java.lang.Object eval(java.lang.String expression)
           
 java.lang.String getOnAnswerChanged()
           
 java.util.Collection<Question> getQuestions()
           
 void questionInserted(Question question, int page, int row)
           
 void updateValue(Question question)
           
protected  void wrapAndThrowException(java.lang.Exception e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptInterpreter

public ScriptInterpreter(Survey survey,
                         java.lang.String initScript,
                         java.lang.String onAnswerChanged)
Method Detail

updateValue

public void updateValue(Question question)

eval

public java.lang.Object eval(java.lang.String expression)

wrapAndThrowException

protected void wrapAndThrowException(java.lang.Exception e)

answerChanged

public final void answerChanged(Question question,
                                boolean evaluateScript)
Description copied from interface: AnswerListener
This method will be called when the answer of a question is changed

Specified by:
answerChanged in interface AnswerListener
Parameters:
question - The question whose answer changed
evaluateScript - If true, the survey's script will be evaluated. If false, the script will not be evaluated.

questionInserted

public void questionInserted(Question question,
                             int page,
                             int row)
Specified by:
questionInserted in interface InsertQuestionListener

getQuestions

public java.util.Collection<Question> getQuestions()

getOnAnswerChanged

public java.lang.String getOnAnswerChanged()