jitas.core
Class Subdomain

java.lang.Object
  extended by jitas.core.Subdomain
All Implemented Interfaces:
java.lang.Comparable<Subdomain>

public class Subdomain
extends java.lang.Object
implements java.lang.Comparable<Subdomain>

A subdomain object. Subdomains contain problems and solutions, and also can potentially have specific constraints relevant to the subdomain. A domain can have many subdomains, but must have at least one.

Version:
13 September 2007
Author:
DeathMarch (c314g2)

Constructor Summary
Subdomain(java.lang.String name, java.lang.String description, java.lang.String domainName)
          Constructor -- This is called when the DOM Domain Parser parses the domain
 
Method Summary
 boolean addProblem(Problem p)
          Adds a problem to the List
 int compareTo(Subdomain object)
          Standard compareTo override, based on the Subdomain name
 boolean equals(java.lang.Object object)
          Standard equals override, based on the Subdomain name
 java.lang.String getDescription()
          Returns the description of the subdomain
 java.lang.String getName()
          Returns the name of the subdomain.
 Problem getProblem(int problemNumber)
          Gets a problem specified by the problem number
 java.util.SortedMap<java.lang.Integer,Problem> getProblems()
          Returns the map of problems associated with this subdomain
 Solution getSolution(int problemNumber)
           
 int hashCode()
          Standard hashCode override, based on the Subdomain name
 void loadProblems()
          Load problems for the subdomain from the correct xml file eg domains//-problems.xml Note: General, (ie non subdomain-specific) problems are no longer supported; every problem must be in a subdomain.
 java.lang.String toString()
          Standard toString override
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Subdomain

public Subdomain(java.lang.String name,
                 java.lang.String description,
                 java.lang.String domainName)
Constructor -- This is called when the DOM Domain Parser parses the domain

Parameters:
name - The subdomain name
description - The description of the subdomain
domainName - The owning domain name
Method Detail

getName

public java.lang.String getName()
Returns the name of the subdomain. Names must be unique within each domain.

Returns:
The name of the subdomain

getDescription

public java.lang.String getDescription()
Returns the description of the subdomain

Returns:
The description of the subdomain

getProblems

public java.util.SortedMap<java.lang.Integer,Problem> getProblems()
Returns the map of problems associated with this subdomain

Returns:
problems The map of problems

getProblem

public Problem getProblem(int problemNumber)
Gets a problem specified by the problem number

Parameters:
problemNumber - The number of the problem you want
Returns:
The problem of the specified problem number

getSolution

public Solution getSolution(int problemNumber)

addProblem

public boolean addProblem(Problem p)
                   throws ProblemAlreadyExistsException
Adds a problem to the List

Parameters:
p - The problem which is to be stored.
Returns:
True if the problem was added
Throws:
ProblemAlreadyExistsException

loadProblems

public void loadProblems()
                  throws ProblemsNotFoundException
Load problems for the subdomain from the correct xml file eg domains//-problems.xml Note: General, (ie non subdomain-specific) problems are no longer supported; every problem must be in a subdomain.

Throws:
ProblemsNotFoundException

equals

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

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

compareTo

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

Specified by:
compareTo in interface java.lang.Comparable<Subdomain>
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 Subdomain name

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Standard toString override

Overrides:
toString in class java.lang.Object