net.sourceforge.jsurveyor
Class QuestionFreeText

java.lang.Object
  extended bynet.sourceforge.jsurveyor.Question
      extended bynet.sourceforge.jsurveyor.QuestionFreeText

public class QuestionFreeText
extends net.sourceforge.jsurveyor.Question

Class to model a freetext question. Doesn't do much other that what it inherits from the Question Class. It is used to be the class for the most basic question type, the freetext kind.

Version:
1.0
Author:
Claus Methmann Christensen, Anders Spliid Hansen, Esben Iversen Hansen, Lars H Jensen, Marcus Overheu, Thomas Ramdal, Peter Thomsen

Constructor Summary
QuestionFreeText()
          Constructor for QuestionFreeText
QuestionFreeText(int questionID, java.lang.String text, boolean writeable, boolean required, boolean depends, java.util.ArrayList dependency)
          Constructor for QuestionFreeText, use through DataAccess.
QuestionFreeText(java.lang.String text, boolean writeable)
          Constructor for QuestionFreeText
 
Method Summary
 java.util.ArrayList getDependency()
          Returns the ArrayList representation of dependency
 boolean getDepends()
          Does the question depend on a specific answer from another question for it to be asked?
 int getQuestionID()
          Returns the ID of the question.
 java.lang.String getText()
          Returns the question text.
 boolean getWriteable()
          Returns true if the question is writeable
 boolean isWriteable()
          Returns true if the question is writeable.
 void removeDependency()
          Removes any dependency on the question.
 void setDependency(QuestionMultipleChoice question, int[] choices)
          Sets the dependency of this question to specific answers of a multiplechoice question.
 void setQuestionID(int questionID)
          Sets the ID of the question.
 void setText(java.lang.String text)
          Sets the question text.
 void setWriteable(boolean writeable)
          Sets the writable parameter.
 java.lang.String toString()
          Returns the questionID prefixed with a F to represent it is a freetext.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QuestionFreeText

public QuestionFreeText()
Constructor for QuestionFreeText


QuestionFreeText

public QuestionFreeText(java.lang.String text,
                        boolean writeable)
Constructor for QuestionFreeText

Parameters:
text - String
writeable - boolean

QuestionFreeText

public QuestionFreeText(int questionID,
                        java.lang.String text,
                        boolean writeable,
                        boolean required,
                        boolean depends,
                        java.util.ArrayList dependency)
Constructor for QuestionFreeText, use through DataAccess.

Parameters:
questionID - int
text - String
writeable - boolean
required - boolean
depends - boolean
dependency - ArrayList
Method Detail

toString

public java.lang.String toString()
Returns the questionID prefixed with a F to represent it is a freetext.

Returns:
String

getQuestionID

public int getQuestionID()
Returns the ID of the question.

Returns:
int

setQuestionID

public void setQuestionID(int questionID)
Sets the ID of the question.

Parameters:
questionID - int

getText

public java.lang.String getText()
Returns the question text.

Returns:
String

setText

public void setText(java.lang.String text)
             throws java.lang.IllegalAccessException
Sets the question text. Throws IllegalAccessException if the question is active

Parameters:
text - String
Throws:
java.lang.IllegalAccessException

getDepends

public boolean getDepends()
Does the question depend on a specific answer from another question for it to be asked? Returns true if that is the case, otherwise it returns false.

Returns:
boolean

setDependency

public void setDependency(QuestionMultipleChoice question,
                          int[] choices)
                   throws java.lang.IllegalAccessException
Sets the dependency of this question to specific answers of a multiplechoice question.

Parameters:
question - QuestionMultipleChoice
choices - int[]
Throws:
java.lang.IllegalAccessException
PRE condition:
the numbers in the integer array must match possible choices in the dependency question.

removeDependency

public void removeDependency()
                      throws java.lang.IllegalAccessException
Removes any dependency on the question.

Throws:
java.lang.IllegalAccessException

getDependency

public java.util.ArrayList getDependency()
Returns the ArrayList representation of dependency

Returns:
ArrayList

isWriteable

public boolean isWriteable()
Returns true if the question is writeable.

Returns:
boolean

setWriteable

public void setWriteable(boolean writeable)
Sets the writable parameter.

Parameters:
writeable - boolean

getWriteable

public boolean getWriteable()
Returns true if the question is writeable

Returns:
boolean