onlineTests
Class User

java.lang.Object
  extended byonlineTests.User

public class User
extends java.lang.Object

User class represents the User in OnlineTests system. Stores information about test results, id, questions

Author:
Silvia Kopcheva
See Also:
LoadDataModel, Utils, DBConnections

Field Summary
private  java.lang.Integer id
          ID represents user unique id, gotten from Users table of DataBase
private  int level
          Represent difficulty level for this user.
private  boolean loginCorrect
          Represents whether user is logged correct in this session
private  LoadDataModel model
          LoadDataModel of this user for loading questions and updating user info
 int qNo
          Represent current question number for this user.
private  java.util.Vector questions
          Questions from DataBase.
 int score
          Represent current session score for this user
 java.util.Vector userInfo
          Represent user info, gotten from DataBase
 
Constructor Summary
User()
          Constructs an empty User.
 
Method Summary
 java.lang.Integer getID()
          Gets id for the user.
 java.util.Vector getNextQuestion()
          Gets next question for this user, according to current user level.
 void getQuestions()
          Gets questions from DataBase.
 boolean isLoginCorrect()
          Returns true is login is correct.
 void processAnswer(java.lang.String param)
          Process the answer and refresh user score and level.
 void setID(java.lang.Integer ID)
          Sets initial data for the user.
 void setLoginCorrect(boolean loginCorrect)
          Sets correct login in the system.
 void updateInfo()
          Updates user info in Users table in DataBase with new maximum score and new last score.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

private java.lang.Integer id
ID represents user unique id, gotten from Users table of DataBase


loginCorrect

private boolean loginCorrect
Represents whether user is logged correct in this session


questions

private java.util.Vector questions
Questions from DataBase. Represents questions left for this user. Initially contains all questions in OnlineTests DataBase.


score

public int score
Represent current session score for this user


level

private int level
Represent difficulty level for this user. Initially set to 3


qNo

public int qNo
Represent current question number for this user. Set to 0 in the beginning of the test


userInfo

public java.util.Vector userInfo
Represent user info, gotten from DataBase


model

private LoadDataModel model
LoadDataModel of this user for loading questions and updating user info

Constructor Detail

User

public User()
Constructs an empty User.

Method Detail

setID

public void setID(java.lang.Integer ID)
Sets initial data for the user. ID, level, score.

Parameters:
ID - The id of this user

getID

public java.lang.Integer getID()
Gets id for the user.

Returns:
ID. The id of this user as an Integer

setLoginCorrect

public void setLoginCorrect(boolean loginCorrect)
Sets correct login in the system.

Parameters:
loginCorrect - boolean

isLoginCorrect

public boolean isLoginCorrect()
Returns true is login is correct.

Returns:
true if login is correct, false - otherwise.

getQuestions

public void getQuestions()
Gets questions from DataBase. This is initial operation.


getNextQuestion

public java.util.Vector getNextQuestion()
Gets next question for this user, according to current user level.

Returns:
next question as a Vector.

processAnswer

public void processAnswer(java.lang.String param)
Process the answer and refresh user score and level.

Parameters:
param - Shows if the answer is correct or not.

updateInfo

public void updateInfo()
Updates user info in Users table in DataBase with new maximum score and new last score.