jitas.core
Class Domain

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

public class Domain
extends java.lang.Object

A domain stores all the material related to a particular tutor subject, that is not specific to a subdomain. Note: Problems are specific to a subdomain.

Version:
08 October 2007
Author:
DeathMarch (c314g2)

Constructor Summary
Domain(java.lang.String name, java.lang.String longName, java.lang.String description, boolean userCreation, java.lang.String type, java.lang.String subdomainTerm, java.util.Set<Subdomain> subdomains)
          Constructor -This is called from DOMDomainParser to set all of the variables
 
Method Summary
static void addDomain(Domain domain)
          Add a domain to the global domains list in XML
 void addSubdomain(java.lang.String name, java.lang.String desc)
          Creates a new Subdomain and adds this to the Set of Subdomains
 int compareTo(java.lang.Object object)
          Standard compareTo override, based on the Domain name
 boolean equals(java.lang.Object object)
          Standard equals override, based on the Domain name
 java.lang.String getDescription()
          Allows read only access to the description of the domain
static java.util.Set<java.lang.String> getDomainNames()
          Get all the domain names from the XML file
 Feedback getFeedbackObject()
          Return the custom feedback object for this domain.
 java.lang.String getLongName()
          Get the long name for the domain
 java.lang.String getName()
          Get the name of the domain
 Problem getNextProblem(Student student, Domain domain, java.util.SortedMap<java.lang.Integer,Problem> problems, java.lang.String subdomainName)
          Get the next problem (as selected by the system) from a subdomain
 java.util.SortedMap<java.lang.Integer,Problem> getProblems(java.lang.String subdomainName)
          Get all the problems for a given subdomain
 jess.Rete getRules()
          Get the RuleBase for this domain
 ProblemSelectionAlgorithm getSelectionAlgorithm()
          Return custom problem selection algorithm.
 Solution getSolution(java.lang.String subdomainName, java.lang.Integer problemID)
          Get the Solution of a problem, given the subdomain name and problem ID
 Subdomain getSubdomain(java.lang.String name)
          Get the specific subdomain by its name
 java.util.Set<java.lang.String> getSubdomainNames()
          Gets the set of subdomain names for this domain
 java.util.Set<Subdomain> getSubdomains()
          Get all the subdomains related to this domain
 java.lang.String getSubdomainTerm()
          Get a description of each subdomains
 java.lang.String getType()
          Get the type of this domain
 int hashCode()
          Standard hashCode override, based on the Domain name
static Domain loadDomain(java.lang.String domainName)
          Load a domain from XML
 void loadSpecificAlgorithm(java.lang.String className)
          Loads a domain-specific problem-selection algorithm
 void loadSpecificFeedback(java.lang.String className)
          Loads a domain-specific feedback object
 void loadSubdomains()
          Load all the subdomains for this domain.
 void readRules()
          Read the rules for this domain in from clp files.
 void setLongName(java.lang.String longName)
          Set the long name for the domain
 void setRules(jess.Rete rules)
          Set the RuleBase for the domain
 boolean userCreationAllowed()
          Returns whether or not we are allowed to add users to this domain.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Domain

public Domain(java.lang.String name,
              java.lang.String longName,
              java.lang.String description,
              boolean userCreation,
              java.lang.String type,
              java.lang.String subdomainTerm,
              java.util.Set<Subdomain> subdomains)
Constructor -This is called from DOMDomainParser to set all of the variables

Parameters:
name - The name of the domain
longName - The more detailed name of the domain
description - The description of the domain
userCreation - Indicate whether the user is allowed to be created in the domain
type - The type of domain
subdomainTerm - The term used to describe the nature of each subdomain
subdomains - A Set of subdomains contained within this Domain
Method Detail

addSubdomain

public void addSubdomain(java.lang.String name,
                         java.lang.String desc)
Creates a new Subdomain and adds this to the Set of Subdomains

Parameters:
name - The name of the new subdomain
desc - Description for the new Subdomain

getDescription

public java.lang.String getDescription()
Allows read only access to the description of the domain

Returns:
The "private" variable description

getName

public java.lang.String getName()
Get the name of the domain

Returns:
A copy of the Name string.

getSubdomains

public java.util.Set<Subdomain> getSubdomains()
Get all the subdomains related to this domain

Returns:
An unmodifiable copy of the set of subdomains

getSubdomain

public Subdomain getSubdomain(java.lang.String name)
                       throws SubdomainNotFoundException
Get the specific subdomain by its name

Parameters:
name - The name of the subdomain to be searched for
Returns:
s The relevant subdomain
Throws:
SubdomainNotFound
ProblemsNotFoundException
SubdomainNotFoundException

getSubdomainTerm

public java.lang.String getSubdomainTerm()
Get a description of each subdomains

Returns:
A copy of the subdomain term.

getType

public java.lang.String getType()
Get the type of this domain

Returns:
A copy of the type of the domain.

getRules

public jess.Rete getRules()
Get the RuleBase for this domain

Returns:
The RuleBase

setRules

public void setRules(jess.Rete rules)
Set the RuleBase for the domain

Parameters:
rules - The RuleBase

loadSpecificAlgorithm

public void loadSpecificAlgorithm(java.lang.String className)
Loads a domain-specific problem-selection algorithm


getSelectionAlgorithm

public ProblemSelectionAlgorithm getSelectionAlgorithm()
Return custom problem selection algorithm. If no custom algorithm exists, return default algorithm.


loadSpecificFeedback

public void loadSpecificFeedback(java.lang.String className)
Loads a domain-specific feedback object


getFeedbackObject

public Feedback getFeedbackObject()
Return the custom feedback object for this domain. If no custom feedback exists, return default.

Returns:
A Feedback object

userCreationAllowed

public boolean userCreationAllowed()
Returns whether or not we are allowed to add users to this domain. If there is no listed valid users we assume we can add them

Returns:
True if we are allowed to add users to this domain.

readRules

public void readRules()
               throws jess.JessException
Read the rules for this domain in from clp files. Note: this does not read in subdomain rules.

Throws:
jess.JessException

equals

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

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 Domain name

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 Domain name

Overrides:
hashCode in class java.lang.Object

getLongName

public java.lang.String getLongName()
Get the long name for the domain

Returns:
longName The long name

setLongName

public void setLongName(java.lang.String longName)
Set the long name for the domain

Parameters:
longName - The new long name

getSubdomainNames

public java.util.Set<java.lang.String> getSubdomainNames()
Gets the set of subdomain names for this domain

Returns:
The set of subdomain names

loadSubdomains

public void loadSubdomains()
                    throws ProblemsNotFoundException
Load all the subdomains for this domain.

Throws:
ProblemsNotFoundException - If some problems cannot be found for a subdomain

getProblems

public java.util.SortedMap<java.lang.Integer,Problem> getProblems(java.lang.String subdomainName)
                                                           throws SubdomainNotFoundException
Get all the problems for a given subdomain

Parameters:
subdomainName - The name of the subdomain
Returns:
The problems of the given subdomain
Throws:
SubdomainNotFoundException

getSolution

public Solution getSolution(java.lang.String subdomainName,
                            java.lang.Integer problemID)
                     throws SubdomainNotFoundException
Get the Solution of a problem, given the subdomain name and problem ID

Parameters:
subdomainName - The name of the subdomain the problem belongs to
problemID - The ID of the problem for which the solution is required
Returns:
The Solution to the problem
Throws:
SubdomainNotFoundException - If no subdomain exists with the given name

getNextProblem

public Problem getNextProblem(Student student,
                              Domain domain,
                              java.util.SortedMap<java.lang.Integer,Problem> problems,
                              java.lang.String subdomainName)
Get the next problem (as selected by the system) from a subdomain

Parameters:
student - The Student who wants the problem
domain - The domain
problems - A sollection of problems to select a problem from
subdomainName - The name of the subdomain
Returns:
A problem as recommened by the system

addDomain

public static void addDomain(Domain domain)
Add a domain to the global domains list in XML

Parameters:
domain -

getDomainNames

public static java.util.Set<java.lang.String> getDomainNames()
                                                      throws java.io.IOException
Get all the domain names from the XML file

Returns:
A set of domain names
Throws:
java.io.IOException - If an IO exception occurs while trying to read the XML file

loadDomain

public static Domain loadDomain(java.lang.String domainName)
                         throws DomainNotFoundException
Load a domain from XML

Parameters:
domainName - The name of the domain to laod
Returns:
The loaded Domain
Throws:
DomainNotFoundException - If a Domain with the given name cannot be found