Class Question

All Implemented Interfaces:
Serializable, Comparable<Object>, IDBean, Cacheable
Direct Known Subclasses:
MultiChoiceQuestion, QuestionProfile

public class Question extends ImageBean
A class to store examination question information.
Since:
1.0
Version:
10.6
Author:
Luke
See Also:
  • Field Details

    • _text

      protected String _text
      The question text.
  • Constructor Details

    • Question

      public Question(String text)
      Creates a new Question.
      Parameters:
      text - the question text
      Throws:
      NullPointerException - if text is null
  • Method Details

    • getImageType

      public ImageType getImageType()
      Description copied from class: ImageBean
      Returns the database image type.
      Specified by:
      getImageType in class ImageBean
      Returns:
      an ImageType
    • getQuestion

      public String getQuestion()
      Returns the Question text.
      Returns:
      the text of the question
      See Also:
    • getCorrectAnswer

      public String getCorrectAnswer()
      Returns the Correct Answer to the Question.
      Returns:
      the correct answer
      See Also:
    • getAnswer

      public String getAnswer()
      Returns the User's answer to the Question.
      Returns:
      the answer
      See Also:
    • getReference

      public String getReference()
      Returns an optional reference to the correct answer.
      Returns:
      a citation
      See Also:
    • getNumber

      public int getNumber()
      Returns the Question Number.
      Returns:
      the question number
      See Also:
    • getExactMatch

      public boolean getExactMatch()
      Returns if the user has provided the exact correct answer. This may indicate a copy/paste.
      Returns:
      TRUE if the answer exactly matches the correct answer
    • isCorrect

      public boolean isCorrect()
      Returns if the question was answered correctly.
      Returns:
      TRUE if the answer is correct, otherwise FALSE
      See Also:
    • setCorrectAnswer

      public void setCorrectAnswer(String answer)
      Sets the correct answer to this Question.
      Parameters:
      answer - the correct answer
      See Also:
    • setAnswer

      public void setAnswer(String answer)
      Sets the User-provided answer to this Question.
      Parameters:
      answer - the User's answer
      See Also:
    • setReference

      public void setReference(String ref)
      Sets the reference to the correct answer to this Question.
      Parameters:
      ref - a citation
      See Also:
    • setCorrect

      public void setCorrect(boolean isOK)
      Marks a Question as correctly answered.
      Parameters:
      isOK - TRUE if the Question was answered correctly, otherwise FALSE
      See Also:
    • setNumber

      public void setNumber(int number)
      Updates the Question Number.
      Parameters:
      number - the question number
      See Also:
    • compareTo

      public int compareTo(Object o2)
      Compares to another Question by comparing the Question Numbers.
      Specified by:
      compareTo in interface Comparable<Object>
      Overrides:
      compareTo in class DatabaseBean
      See Also: