Class Question
java.lang.Object
org.deltava.beans.DatabaseBean
org.deltava.beans.DatabaseBlobBean
org.deltava.beans.ImageBean
org.deltava.beans.testing.Question
- All Implemented Interfaces:
Serializable
,Comparable<Object>
,IDBean
,Cacheable
- Direct Known Subclasses:
MultiChoiceQuestion
,QuestionProfile
A class to store examination question information.
- Since:
- 1.0
- Version:
- 10.6
- Author:
- Luke
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.deltava.beans.ImageBean
ImageBean.ImageFormat
-
Field Summary
FieldsFields inherited from class org.deltava.beans.DatabaseBlobBean
_buffer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Compares to another Question by comparing the Question Numbers.Returns the User's answer to the Question.Returns the Correct Answer to the Question.boolean
Returns if the user has provided the exact correct answer.Returns the database image type.int
Returns the Question Number.Returns the Question text.Returns an optional reference to the correct answer.boolean
Returns if the question was answered correctly.void
Sets the User-provided answer to this Question.void
setCorrect
(boolean isOK) Marks a Question as correctly answered.void
setCorrectAnswer
(String answer) Sets the correct answer to this Question.void
setNumber
(int number) Updates the Question Number.void
setReference
(String ref) Sets the reference to the correct answer to this Question.Methods inherited from class org.deltava.beans.ImageBean
checkParam, getFormat, getHasImage, getHeight, getSize, getWidth, load, load, setFormat, setHeight, setSize, setWidth
Methods inherited from class org.deltava.beans.DatabaseBlobBean
clear, getInputStream, isLoaded
Methods inherited from class org.deltava.beans.DatabaseBean
cacheKey, equals, getHexID, getID, hashCode, setID, validateID, validateID
-
Field Details
-
_text
The question text.
-
-
Constructor Details
-
Question
Creates a new Question.- Parameters:
text
- the question text- Throws:
NullPointerException
- if text is null
-
-
Method Details
-
getImageType
Description copied from class:ImageBean
Returns the database image type.- Specified by:
getImageType
in classImageBean
- Returns:
- an ImageType
-
getQuestion
-
getCorrectAnswer
Returns the Correct Answer to the Question.- Returns:
- the correct answer
- See Also:
-
getAnswer
-
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
Sets the correct answer to this Question.- Parameters:
answer
- the correct answer- See Also:
-
setAnswer
Sets the User-provided answer to this Question.- Parameters:
answer
- the User's answer- See Also:
-
setReference
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
Compares to another Question by comparing the Question Numbers.- Specified by:
compareTo
in interfaceComparable<Object>
- Overrides:
compareTo
in classDatabaseBean
- See Also:
-