Class MultiChoiceQuestion
java.lang.Object
org.deltava.beans.DatabaseBean
org.deltava.beans.DatabaseBlobBean
org.deltava.beans.ImageBean
org.deltava.beans.testing.Question
org.deltava.beans.testing.MultiChoiceQuestion
- All Implemented Interfaces:
Serializable, Comparable<Object>, IDBean, MultipleChoice, Cacheable
- Direct Known Subclasses:
RoutePlotQuestion
A bean to store multiple-choice examination questions.
- Since:
- 1.0
- Version:
- 9.0
- Author:
- Luke
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class ImageBean
ImageBean.ImageFormat -
Field Summary
Fields inherited from class DatabaseBlobBean
_buffer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a choice to the available choices.Returns the list of choices.final booleanReturns if the user has provided the exact correct answer.intReturns the maximum length of any of the answer choices.Methods inherited from class Question
compareTo, getAnswer, getCorrectAnswer, getImageType, getNumber, getQuestion, getReference, isCorrect, setAnswer, setCorrect, setCorrectAnswer, setNumber, setReferenceModifier and TypeMethodDescriptionintCompares to another Question by comparing the Question Numbers.Returns the User's answer to the Question.Returns the Correct Answer to the Question.Returns the database image type.intReturns the Question Number.Returns the Question text.Returns an optional reference to the correct answer.booleanReturns if the question was answered correctly.voidSets the User-provided answer to this Question.voidsetCorrect(boolean isOK) Marks a Question as correctly answered.voidsetCorrectAnswer(String answer) Sets the correct answer to this Question.voidsetNumber(int number) Updates the Question Number.voidsetReference(String ref) Sets the reference to the correct answer to this Question.Methods inherited from class ImageBean
checkParam, getFormat, getHasImage, getHeight, getSize, getWidth, load, load, setFormat, setHeight, setSize, setWidthModifier and TypeMethodDescriptionprotected static voidcheckParam(int param, String msg) Helper method to check for negative numeric parameters.Returns the type of image.booleanQueries if the bean has an associated Image.intReturns the height of the image.intgetSize()Returns the size of the image.intgetWidth()Returns the width of the image.final voidload(byte[] buffer) Updates the image buffer.final voidload(InputStream is) Loads an image into the buffer.voidUpdates the image format.voidsetHeight(int y) Updates the height of this image.voidsetSize(int newSize) Updates the size of this image.voidsetWidth(int x) Updates the width of this image.Methods inherited from class DatabaseBlobBean
clear, getInputStream, isLoadedMethods inherited from class DatabaseBean
cacheKey, equals, getHexID, getID, hashCode, setID, validateID, validateIDModifier and TypeMethodDescriptioncacheKey()Returns the cache key for this object.booleangetHexID()Returns the hexadecimal database ID of this object.intgetID()Returns the database ID of this object.inthashCode()voidsetID(int id) Update the database row ID of this bean.static voidvalidateID(int oldID, int newID) Validates a database ID.static voidvalidateID(int oldID, int newID, boolean allowZero) Validates a database ID.
-
Constructor Details
-
MultiChoiceQuestion
Creates a new Question bean- Parameters:
text- the Question text- Throws:
NullPointerException- if text is null
-
-
Method Details
-
getChoices
Returns the list of choices.- Specified by:
getChoicesin interfaceMultipleChoice- Returns:
- a List of choices
- See Also:
-
getMaxAnswerLength
public int getMaxAnswerLength()Returns the maximum length of any of the answer choices.- Returns:
- the maximum answer length
-
addChoice
Adds a choice to the available choices.- Specified by:
addChoicein interfaceMultipleChoice- Parameters:
choice- the choice text- Throws:
NullPointerException- if choice is null- See Also:
-
getExactMatch
public final boolean getExactMatch()Returns if the user has provided the exact correct answer.- Overrides:
getExactMatchin classQuestion- Returns:
- FALSE always
-