org.sourceforge.espro.model
Class RunnableQuestionnaire

java.lang.Object
  extended by org.sourceforge.espro.model.AbstractModel
      extended by org.sourceforge.espro.model.RunnableQuestionnaire
All Implemented Interfaces:
java.io.Serializable, ModelInterface

public class RunnableQuestionnaire
extends AbstractModel

The RunnableQuestionnaire is a copy of the questionnaire and is thought to run for the user. It is neccessary to copy the original questionnaire, because the user changes the values which must not be recorded to the original questionnaire. In java terms you could say, the Questionnaire provides a Class for the user, because there he can create and modify the questionnaire to his/her preferences. The RunnableQuestionnaire can then be thought as an Object from the Questionnaire, where every subject gets his own object or copy.

Version:
2.0
Author:
(c) 2007 Martin Kaffanke
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.sourceforge.espro.model.AbstractModel
pcs
 
Constructor Summary
RunnableQuestionnaire(java.util.ArrayList<Item> items, Settings settings, Questionnaire parent)
          Creates a new instance of RunnableQuestionnaire
 
Method Summary
 Item getCurrent()
           
 Item getItem(java.lang.String id)
          Returns one item given the id.
 java.util.ArrayList<Item> getItems()
          Returns the items.
 Questionnaire getParent()
          Returns the original questionnaire where this runnable questionnaire was derived from.
 Settings getSettings()
          Returns the settings.
 java.lang.String getSid()
          Returns the subject id.
 boolean isDone()
          Tells us if all of the items are done.
 void setCurrent(Item item)
          Sets the current item.
 void setParent(Questionnaire parent)
          Sets the parent questionnaire.
 void setSettings(Settings settings)
          Sets the settings.
 void setSid(java.lang.String sid)
          Sets the subject id.
 void start()
          Starts the questionnaire.
 void storeData()
          Stores the recorded data in the parent questionnaire.
 
Methods inherited from class org.sourceforge.espro.model.AbstractModel
addPropertyChangeListener, addPropertyChangeListener, isSaved, removePropertyChangeListener, setSaved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RunnableQuestionnaire

public RunnableQuestionnaire(java.util.ArrayList<Item> items,
                             Settings settings,
                             Questionnaire parent)
Creates a new instance of RunnableQuestionnaire

Parameters:
items - The items of the questionnaire.
settings - The settings of the questionnaire.
parent - The parent or lets say, the questionnaire itself.
Method Detail

getItems

public java.util.ArrayList<Item> getItems()
Returns the items.

Returns:
The Items

getItem

public Item getItem(java.lang.String id)
Returns one item given the id.

Parameters:
id - The id.
Returns:
The item.

setCurrent

public void setCurrent(Item item)
Sets the current item.

Parameters:
item - The item.

getCurrent

public Item getCurrent()

getSettings

public Settings getSettings()
Returns the settings.

Returns:
The Settings.

setSettings

public void setSettings(Settings settings)
Sets the settings.

Parameters:
settings - The Settings

isDone

public boolean isDone()
Tells us if all of the items are done. All the items are done if they were seen by the user. This is used to check if we can view the 'done' item.

Returns:
State if all items are done. Then its true.

start

public void start()
Starts the questionnaire. This acutally starts recording if an item was done or not.


getParent

public Questionnaire getParent()
Returns the original questionnaire where this runnable questionnaire was derived from.

Returns:
The questionnaire.

setParent

public void setParent(Questionnaire parent)
Sets the parent questionnaire.

Parameters:
parent - The Questionnaire.

getSid

public java.lang.String getSid()
Returns the subject id.

Returns:
The subject id.

setSid

public void setSid(java.lang.String sid)
Sets the subject id.

Parameters:
sid - The subject id.

storeData

public void storeData()
Stores the recorded data in the parent questionnaire. If you forget to do this, all data is lost. This will only save the data if the questionnaire this RunnableQuestionnaire is created from is frozen.