jitas.core
Class StudentModel

java.lang.Object
  extended by jitas.core.StudentModel

public class StudentModel
extends java.lang.Object

The student model is a model of the student knowledge for a particular domain

Version:
05 July 2007
Author:
DeathMarch (c314g2)

Constructor Summary
StudentModel(java.lang.String userName)
          Constructor.
StudentModel(java.lang.String userName, java.util.Set<java.lang.String> solvedProblems, java.util.SortedMap<java.lang.String,java.lang.String> problemsStatus)
          Constructor.
 
Method Summary
 void addSatisfiedConstraints(java.util.Collection<java.lang.String> satisfiedConstraints)
          Adds the satisfied constraint to the collection of satisfied constraint names
 void addSolvedProblem(int problemID, java.lang.String subdomainName)
          Add a problem to the collection of solved problems.
 void addViolatedConstraints(java.util.Collection<java.lang.String> violatedConstraints)
          Adds the violated constraint to the collection of violated constraint names
 void changedSubdomain(java.lang.String currentSubdomain)
          Set current problem to problem one
 int compareTo(java.lang.Object object)
          Standard compareTo override, based on the userName
static StudentModel emptyModelFactory(java.lang.String username)
          Returns a new empty model with just username set
 boolean equals(java.lang.Object object)
          Standard equals override, based on the userName
 java.util.SortedMap<java.lang.String,java.lang.String> getAllProblemsStatus()
          Get the map of problem status'
 int getCurrentProblemID()
          Get the Problem the student is currently working on
 Problem getNextProblem(java.util.SortedMap<java.lang.Integer,Problem> problems, int problemNumber)
          Gets a problem with a given ID from a collection of problems
 Problem getNextProblem(java.util.SortedMap<java.lang.Integer,Problem> problems, java.lang.String subdomainName)
          Gets the next problem that hasn't yet been solved by the student from the set(map) of problems, based on id.
 java.lang.String getProblemStatus(java.lang.String subdomain, int problemID)
          Get the status for a problem.
 double getRating()
          Get The ability rating of the student
 java.util.Collection<java.lang.String> getSatisfiedConstraints()
          Get the collection of satisfied constraint names
 java.util.Set<java.lang.String> getSolvedProblems()
          Get all solved problems
 java.util.Set<java.lang.Integer> getSolvedProblems(java.lang.String subdomainName)
          Get all solved problems of a particular subdomain
 java.lang.String getUserName()
          Get the userName of this user.
 java.util.Collection<java.lang.String> getViolatedConstraints()
          Get the collection of violated constraint names
 int hashCode()
          Standard hashCode override, based on the userName
 void incrementRating(double increment)
          Increment the rating by some value
 void save(java.lang.String domainName)
          Save this model to XML
 void setCurrentProblem(int currentProblemID)
          Set the Problem the student is currently working on
 void setCurrentProblemStatus(java.lang.String subdomainName, java.lang.String status)
          Set the status of the current problem for a subdomain
 void setProblemStatus(java.lang.String subdomain, int problemID, java.lang.String status)
          Set the status of a problem
 void setRating(double rating)
          Set The ability rating of the student
 void setSatisfiedConstraints(java.util.Collection<java.lang.String> satisfiedConstraints)
          Set the collection of satisfied constraint names
 void setViolatedConstraints(java.util.Collection<java.lang.String> violatedConstraints)
          Set the collection of violated constraint names
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StudentModel

public StudentModel(java.lang.String userName)
Constructor.

Parameters:
userName - The students userName.

StudentModel

public StudentModel(java.lang.String userName,
                    java.util.Set<java.lang.String> solvedProblems,
                    java.util.SortedMap<java.lang.String,java.lang.String> problemsStatus)
Constructor.

Parameters:
userName - The students userName.
solvedProblems - A Map of solved problems
problemsStatus - A Map of problem status'
Method Detail

getUserName

public java.lang.String getUserName()
Get the userName of this user.

Returns:
A copy of the username

getCurrentProblemID

public int getCurrentProblemID()
Get the Problem the student is currently working on

Returns:
currentProblem The Problem the student is working on

getNextProblem

public Problem getNextProblem(java.util.SortedMap<java.lang.Integer,Problem> problems,
                              java.lang.String subdomainName)
Gets the next problem that hasn't yet been solved by the student from the set(map) of problems, based on id. This also sets the current problem

Returns:
The next problem to be solved by the user

getNextProblem

public Problem getNextProblem(java.util.SortedMap<java.lang.Integer,Problem> problems,
                              int problemNumber)
Gets a problem with a given ID from a collection of problems

Parameters:
problems - The problems to choose from
problemNumber - The ID of the wanted problem
Returns:
The Problem

addSolvedProblem

public void addSolvedProblem(int problemID,
                             java.lang.String subdomainName)
Add a problem to the collection of solved problems. for a subdomain

Parameters:
problemID - The ID of the solved problem
subdomainName - The subdomain name

getSolvedProblems

public java.util.Set<java.lang.String> getSolvedProblems()
Get all solved problems

Returns:
solvedProblems All the problems that the user has completed.

getSolvedProblems

public java.util.Set<java.lang.Integer> getSolvedProblems(java.lang.String subdomainName)
Get all solved problems of a particular subdomain

Parameters:
subdomainName - The name of the subdomain
Returns:
solvedProblems All the problems that the user has completed of a subdomain.

emptyModelFactory

public static StudentModel emptyModelFactory(java.lang.String username)
Returns a new empty model with just username set

Parameters:
username - The username of the Student
Returns:
A new StudentModelObject

setProblemStatus

public void setProblemStatus(java.lang.String subdomain,
                             int problemID,
                             java.lang.String status)
Set the status of a problem

Parameters:
problemID - The id of the problem
status - The status must be one of "solved", "attempted" or "not attempted"

getProblemStatus

public java.lang.String getProblemStatus(java.lang.String subdomain,
                                         int problemID)
Get the status for a problem.

Parameters:
problemID - The id of the problem
Returns:
r The status has to be one of "solved", "attempted" or "not attempted"

getAllProblemsStatus

public java.util.SortedMap<java.lang.String,java.lang.String> getAllProblemsStatus()
Get the map of problem status'

Returns:
The map

changedSubdomain

public void changedSubdomain(java.lang.String currentSubdomain)
Set current problem to problem one

Parameters:
currentSubdomain -

getRating

public double getRating()
Get The ability rating of the student

Returns:
rating The Ability rating of the student

setRating

public void setRating(double rating)
Set The ability rating of the student


setCurrentProblem

public void setCurrentProblem(int currentProblemID)
Set the Problem the student is currently working on

Parameters:
currentProblemID - The ID of the Problem the student wants to work on

getViolatedConstraints

public java.util.Collection<java.lang.String> getViolatedConstraints()
Get the collection of violated constraint names

Returns:
violatedConstraints The set of violated constraints names

getSatisfiedConstraints

public java.util.Collection<java.lang.String> getSatisfiedConstraints()
Get the collection of satisfied constraint names

Returns:
satisfiedConstraints The set of satisfied constraint names

setViolatedConstraints

public void setViolatedConstraints(java.util.Collection<java.lang.String> violatedConstraints)
Set the collection of violated constraint names

Parameters:
violatedConstraints - The violated constraints names

addViolatedConstraints

public void addViolatedConstraints(java.util.Collection<java.lang.String> violatedConstraints)
Adds the violated constraint to the collection of violated constraint names

Parameters:
violatedConstraints - The violated constraints names

addSatisfiedConstraints

public void addSatisfiedConstraints(java.util.Collection<java.lang.String> satisfiedConstraints)
Adds the satisfied constraint to the collection of satisfied constraint names

Parameters:
satisfiedConstraints - The satisfied constraints names

setSatisfiedConstraints

public void setSatisfiedConstraints(java.util.Collection<java.lang.String> satisfiedConstraints)
Set the collection of satisfied constraint names

Parameters:
satisfiedConstraints - The satisfied constraint names

equals

public boolean equals(java.lang.Object object)
Standard equals override, based on the userName

Overrides:
equals in class java.lang.Object
Returns:
true if the objects are equal

compareTo

public int compareTo(java.lang.Object object)
              throws java.lang.ClassCastException
Standard compareTo override, based on the userName

Parameters:
object - the Object to be compared
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
java.lang.ClassCastException

hashCode

public int hashCode()
Standard hashCode override, based on the userName

Overrides:
hashCode in class java.lang.Object

incrementRating

public void incrementRating(double increment)
Increment the rating by some value

Parameters:
increment - The value to increase the rating by

setCurrentProblemStatus

public void setCurrentProblemStatus(java.lang.String subdomainName,
                                    java.lang.String status)
Set the status of the current problem for a subdomain

Parameters:
subdomainName - The subdomain name
status - The status

save

public void save(java.lang.String domainName)
Save this model to XML

Parameters:
domainName - The name of the domain this model is for