All Packages Class Hierarchy This Package Previous Next Index
Class distans.AnswerData
java.lang.Object
|
+----java.util.Dictionary
|
+----java.util.Hashtable
|
+----distans.AnswerData
- public class AnswerData
- extends Hashtable
This class is responsible for storing the students answers. The class extends hashtable,
the hashtable uses a PageData object as key. The key is associated to a String array that
holds the answers and the grade.
The String array thus has an structure like this
answerI,gradeI,answerII,gradeII and so on.
For QuestionPages of type cross and alt the answers strings are integers, for written though a text string is used.
The AnswerData also hold two Class variable (static) vectors with the cedulas and the name of the students as well as a hashtable for mapping between name and cedula.
-
ALT
-
-
cedulaNo
- The CedulaNo of the student
-
CROSS
-
-
nameToCedulaHT
- Hashtable with key == name value == cedula
-
NO_OF_DATA
-
-
studentCedulas
- Static vector with all the cedulas
-
studentName
- The name of the student (both first and last name)
-
studentNames
- Static vector with all the student names
-
UNDEFINED_TYPE
-
-
WRITTEN
-
-
AnswerData(String)
-
-
AnswerData(String, String, String)
- Created a new AnswerData for a student, the first and last name are put in one string with space separating them.
-
addStudentCedula(String)
- A very primitive sort function, but it's only done once so no big deal.
-
addStudentName(String)
- A very primitive sort function, but it's only done once so no big deal.
-
getGrade(PageData, int)
-
-
getNoOfCorrects(PageData)
-
-
getStudentAnswerNumerical(PageData, int)
-
-
getStudentAnswerText(PageData, int)
-
-
getStudentCedulas()
- Static method returning all the student cedulas
-
getStudentName()
-
-
getStudentNames()
- Static method returning all the student names
-
hasAnswered(PageData)
-
-
hashCode()
- The hashcode is taken from the cedula number.
-
nameToCedula(String)
-
-
parseCedula(String)
- Static method that parse a String into an int, if the String can't be parsed 0 is returned.
-
putStudentAnswers(PageData, String[])
- puts a String array with the answers that the student has given for the PageData object into the hashtable
-
setGrade(PageData, int, int)
- Sets the grade
-
setStudentName(String)
- Sets the name of the student
-
toString()
- This method writes the AnswerData on a String, used for debugging
ALT
static final int ALT
CROSS
static final int CROSS
WRITTEN
static final int WRITTEN
UNDEFINED_TYPE
static final int UNDEFINED_TYPE
NO_OF_DATA
static final int NO_OF_DATA
cedulaNo
private String cedulaNo
- The CedulaNo of the student
studentCedulas
static Vector studentCedulas
- Static vector with all the cedulas
studentNames
static Vector studentNames
- Static vector with all the student names
nameToCedulaHT
static Hashtable nameToCedulaHT
- Hashtable with key == name value == cedula
studentName
private String studentName
- The name of the student (both first and last name)
AnswerData
public AnswerData(String cedulaNo,
String studentFirstName,
String studentLastName)
- Created a new AnswerData for a student, the first and last name are put in one string with space separating them.
- Parameters:
- cedulaNo - the cedula number
- studentFirstName - the First name of the student
- studentLastName - the students family name.
AnswerData
public AnswerData(String cedula)
hashCode
public int hashCode()
- The hashcode is taken from the cedula number.
- Overrides:
- hashCode in class Object
nameToCedula
public static String nameToCedula(String name)
- Parameters:
- name - a student name
- Returns:
- the cedula number for a student name
toString
public String toString()
- This method writes the AnswerData on a String, used for debugging
- Overrides:
- toString in class Hashtable
getStudentAnswerNumerical
public int getStudentAnswerNumerical(PageData pd,
int question)
- Parameters:
- pd - a PageData object for a QuestionPage
- question - the number of the subquestion on the QuestionPage
- Returns:
- the numerical answer given by the student for PageData pd and subquestion question. This method don't have a lot of meaning for
QuestionPAges of type written.
getStudentAnswerText
public String getStudentAnswerText(PageData pd,
int question)
- Returns:
- the String answer for subquestion question and the given PageData object
This is not nessecarally the correct answer.
getGrade
public int getGrade(PageData pd,
int question)
- Returns:
- the grade for the given subquestion and PageData. This is however not used in the current version has there is no way to save the grades on the server.
setGrade
public void setGrade(PageData pd,
int question,
int grade)
- Sets the grade
- Parameters:
- pd - the PageData containing the questions
- question - the subquestion
- grade - the new grade
- See Also:
- getGrade
hasAnswered
public boolean hasAnswered(PageData pd)
- Returns:
- true if a student has responded to the QuestionPage given by the PageData object
getNoOfCorrects
public int getNoOfCorrects(PageData pd)
- Returns:
- the number of correctly answered subquestions for the QuestionPage given by the PageData object.
putStudentAnswers
public void putStudentAnswers(PageData pd,
String answers[])
- puts a String array with the answers that the student has given for the PageData object into the hashtable
getStudentName
public String getStudentName()
- Returns:
- the name of the student
setStudentName
public void setStudentName(String name)
- Sets the name of the student
- Parameters:
- name - the students name
parseCedula
static int parseCedula(String cedula)
- Static method that parse a String into an int, if the String can't be parsed 0 is returned.
- Parameters:
- cedula - the String to parse
- Returns:
- the int parsed
getStudentNames
public static Enumeration getStudentNames()
- Static method returning all the student names
getStudentCedulas
public static Enumeration getStudentCedulas()
- Static method returning all the student cedulas
addStudentCedula
private static void addStudentCedula(String cedula)
- A very primitive sort function, but it's only done once so no big deal.
It sorts the studentCedulas vector nummerically
addStudentName
private static void addStudentName(String name)
- A very primitive sort function, but it's only done once so no big deal.
It sorts the studentNames Vector alphabetically.
All Packages Class Hierarchy This Package Previous Next Index