Class Semester

java.lang.Object
  |
  +--Semester
All Implemented Interfaces:
Variable

public class Semester
extends Object
implements Variable


Field Summary
protected  Set availableCourses
          The set of courses that have not been successfully passed.
protected  Set courses
          The set of Courses currently assigned to this semester.
protected  boolean debug
          Debug flag for displaying information about the possible Course assignment for this semester.
protected  Set failedCourses
          The set of courses that were taken in this semester that were failed.
protected  boolean isSpringSemester
          The flag for whether this semester is in the spring.
protected static int MAX_NUMBER_OF_COURSES
          The maximum number of courses that can be taken in one semester.
protected  boolean NAIVE_DOMAIN_ORDERING
          Flag for whether the naive ordering of domain variables should be used in place of the heuristic based ordering.
protected  int semesterNumber
          The number of this semester.
 
Constructor Summary
Semester(int semesterNumber, boolean isSpringSemester, Set availableCourses)
           
 
Method Summary
 void add(Value v)
          Sets this variable equal to this value.
 Iterator getCourses()
          Returns an iterator over the Courses in the semseter.
 Iterator getDomainValues()
          Returns a list of all the possible Values that this variable could be assigned to.
private  Iterator getHeuristicBasedOrdering()
          Returns a list of the Courses with the Major-required courses, followed by the remaining courses in no particular order.
private  Iterator getNaiveOrdering()
          Returns a randomized list of all the courses that have not been successfully passed.
 boolean isFull(CourseFeasibilityCalculator calculator)
          Returns true if the semester has been scheduled for the maximum number of courses, or if the number of available courses left to take given the current assignment is zero.
 boolean isSpring()
          Whether this semester is in the spring.
 void markCourseAsFailed(Course failed)
          Adds this course to the semester with the specification that this course has been failed.
 void remove(Value v)
          Removes the value from the list of possible assignments for this variable as well as removes the possible assignment of this variable to the value.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

isSpringSemester

protected final boolean isSpringSemester
The flag for whether this semester is in the spring.


courses

protected final Set courses
The set of Courses currently assigned to this semester.


availableCourses

protected final Set availableCourses
The set of courses that have not been successfully passed. This may include courses that are not offered during this semester, courses that have been failed, and courses for which not all the prerequisites have been met.


failedCourses

protected final Set failedCourses
The set of courses that were taken in this semester that were failed.


MAX_NUMBER_OF_COURSES

protected static final int MAX_NUMBER_OF_COURSES
The maximum number of courses that can be taken in one semester.

See Also:
Constant Field Values

semesterNumber

protected final int semesterNumber
The number of this semester.


debug

protected boolean debug
Debug flag for displaying information about the possible Course assignment for this semester.


NAIVE_DOMAIN_ORDERING

protected final boolean NAIVE_DOMAIN_ORDERING
Flag for whether the naive ordering of domain variables should be used in place of the heuristic based ordering.

See Also:
Constant Field Values
Constructor Detail

Semester

public Semester(int semesterNumber,
                boolean isSpringSemester,
                Set availableCourses)
Method Detail

getCourses

public Iterator getCourses()
Returns an iterator over the Courses in the semseter.


isSpring

public boolean isSpring()
Whether this semester is in the spring.


getDomainValues

public Iterator getDomainValues()
Description copied from interface: Variable
Returns a list of all the possible Values that this variable could be assigned to.

Specified by:
getDomainValues in interface Variable

getNaiveOrdering

private Iterator getNaiveOrdering()
Returns a randomized list of all the courses that have not been successfully passed.


getHeuristicBasedOrdering

private Iterator getHeuristicBasedOrdering()
Returns a list of the Courses with the Major-required courses, followed by the remaining courses in no particular order. All courses are sorted by course number with lower level courses coming before upper level courses.


add

public void add(Value v)
Description copied from interface: Variable
Sets this variable equal to this value.

Specified by:
add in interface Variable

remove

public void remove(Value v)
Description copied from interface: Variable
Removes the value from the list of possible assignments for this variable as well as removes the possible assignment of this variable to the value.

Specified by:
remove in interface Variable

markCourseAsFailed

public void markCourseAsFailed(Course failed)
Adds this course to the semester with the specification that this course has been failed. Courses that were not taken and attempted to be removed will not be added to the listing of failed courses.


isFull

public boolean isFull(CourseFeasibilityCalculator calculator)
Returns true if the semester has been scheduled for the maximum number of courses, or if the number of available courses left to take given the current assignment is zero. Note, that there still may be untaken courses, but that the semester in which they are offered is not the current semester.


toString

public String toString()
Overrides:
toString in class Object