org.cpsolver.studentsct.model

## Class Course

- java.lang.Object
- - org.cpsolver.ifs.assignment.context.AbstractClassWithContext<Request,Enrollment,Course.CourseContext>
  - - org.cpsolver.studentsct.model.Course

- All Implemented Interfaces:
    CanHoldContext, CanInheritContext<Request,Enrollment,Course.CourseContext>, HasAssignmentContext<Request,Enrollment,Course.CourseContext>

      public class Course
      extends AbstractClassWithContext<Request,Enrollment,Course.CourseContext>
      implements CanInheritContext<Request,Enrollment,Course.CourseContext>

  Representation of a course offering. A course offering contains id, subject area, course number and an instructional offering.
  Each instructional offering (see `Offering`) is offered under one or more course offerings.
  Version:
    StudentSct 1.3 (Student Sectioning)
    Copyright (C) 2007 - 2014 Tomáš Müller
    muller@unitime.org
    http://muller.unitime.org
    This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    You should have received a copy of the GNU Lesser General Public License along with this library; if not see http://www.gnu.org/licenses/.
  Author:
    Tomáš Müller

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `Course.CourseContext`

  - ### Field Summary

    - ### Fields inherited from interface org.cpsolver.ifs.assignment.context.CanHoldContext

      `sMaxSize`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Course(long id, String subjectArea, String courseNumber, Offering offering)` Constructor
    `Course(long id, String subjectArea, String courseNumber, Offering offering, int limit, int projected)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addRequestGroup(RequestGroup group)` Add request group of this course.
    `void` | `assigned(Assignment<Request,Enrollment> assignment, Enrollment enrollment)` Called when an enrollment with this course is assigned to a request
    `Course.CourseContext` | `createAssignmentContext(Assignment<Request,Enrollment> assignment)` Create a new assignment context for the given assignment.
    `boolean` | `equals(Object o)`
    `double` | `getArrHrsBound()`
    `Set<Course>` | `getChildren()` Courses that this course is a parent of.
    `String` | `getCourseNumber()` Course number
    `String` | `getCredit()` Get credit (Online Student Scheduling only)
    `Float` | `getCreditValue()` Get course credit value (null if not set) return course credit value
    `Set<Enrollment>` | `getEnrollments(Assignment<Request,Enrollment> assignment)` Set of assigned enrollments
    `double` | `getEnrollmentWeight(Assignment<Request,Enrollment> assignment, Request excludeRequest)` Enrollment weight -- weight of all requests that are enrolled into this course, excluding the given one.
    `long` | `getId()` Course offering unique id
    `int` | `getLimit()` Course offering limit
    `double` | `getMaxEnrollmentWeight(Assignment<Request,Enrollment> assignment)` Maximal weight of a single enrollment in the course
    `double` | `getMinEnrollmentWeight(Assignment<Request,Enrollment> assignment)` Minimal weight of a single enrollment in the course
    `Model<Request,Enrollment>` | `getModel()` Get the model.
    `String` | `getName()` Course offering name: subject area + course number
    `String` | `getNote()` Course note
    `Offering` | `getOffering()` Instructional offering which is offered under this course offering.
    `double` | `getOnlineBound()`
    `Course` | `getParent()` Parent course is set if the course depends on the parent.
    `double` | `getPastBound()`
    `int` | `getProjected()` Course offering projected number of students
    `Set<RequestGroup>` | `getRequestGroups()` Lists all the request groups of this course
    `Set<CourseRequest>` | `getRequests()` Set of course requests requesting this course
    `String` | `getSubjectArea()` Subject area
    `String` | `getTitle()` Course title
    `String` | `getType()` Course type
    `boolean` | `hasChildren()` Return true if this course is a parent of at least one other course.
    `boolean` | `hasCreditValue()` True if this course has a credit value defined
    `int` | `hashCode()`
    `boolean` | `hasParent()` Parent course is set if the course depends on the parent.
    `Course.CourseContext` | `inheritAssignmentContext(Assignment<Request,Enrollment> assignment, Course.CourseContext parentContext)` Create a new assignment context for the given assignment.
    `void` | `removeRequestGroup(RequestGroup group)` Remove request group from this course.
    `void` | `setCredit(String credit)` Set credit (Online Student Scheduling only)
    `void` | `setCreditValue(Float creditValue)` Set course credit value (null if not set)
    `void` | `setLimit(int limit)` Set course offering limit
    `void` | `setNote(String note)` Course note
    `void` | `setParent(Course parent)` Parent course is set if the course depends on the parent.
    `void` | `setTitle(String title)` Course title
    `void` | `setType(String type)` Course type
    `String` | `toString()`
    `void` | `unassigned(Assignment<Request,Enrollment> assignment, Enrollment enrollment)` Called when an enrollment with this course is unassigned from a request

    - ### Methods inherited from class org.cpsolver.ifs.assignment.context.AbstractClassWithContext

      `getAssignmentContextReference, getContext, getContext, setAssignmentContextReference`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Course

          public Course(long id,
                        String subjectArea,
                        String courseNumber,
                        Offering offering)

      Constructor
      Parameters:
        `id` - course offering unique id
        `subjectArea` - subject area (e.g., MA, CS, ENGL)
        `courseNumber` - course number under the given subject area
        `offering` - instructional offering which is offered under this course offering

    - #### Course

          public Course(long id,
                        String subjectArea,
                        String courseNumber,
                        Offering offering,
                        int limit,
                        int projected)

      Constructor
      Parameters:
        `id` - course offering unique id
        `subjectArea` - subject area (e.g., MA, CS, ENGL)
        `courseNumber` - course number under the given subject area
        `offering` - instructional offering which is offered under this course offering
        `limit` - course offering limit (-1 for unlimited)
        `projected` - projected demand

  - ### Method Detail

    - #### getId

          public long getId()

      Course offering unique id
      Returns:
        coure offering unqiue id

    - #### getSubjectArea

          public String getSubjectArea()

      Subject area
      Returns:
        subject area abbreviation

    - #### getCourseNumber

          public String getCourseNumber()

      Course number
      Returns:
        course number

    - #### getName

          public String getName()

      Course offering name: subject area + course number
      Returns:
        course name

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getOffering

          public Offering getOffering()

      Instructional offering which is offered under this course offering.
      Returns:
        instructional offering

    - #### getLimit

          public int getLimit()

      Course offering limit
      Returns:
        course offering limit, -1 if unlimited

    - #### setLimit

          public void setLimit(int limit)

      Set course offering limit
      Parameters:
        `limit` - course offering limit, -1 if unlimited

    - #### getProjected

          public int getProjected()

      Course offering projected number of students
      Returns:
        course projection

    - #### assigned

          public void assigned(Assignment<Request,Enrollment> assignment,
                               Enrollment enrollment)

      Called when an enrollment with this course is assigned to a request
      Parameters:
        `assignment` - current assignment
        `enrollment` - assigned enrollment

    - #### unassigned

          public void unassigned(Assignment<Request,Enrollment> assignment,
                                 Enrollment enrollment)

      Called when an enrollment with this course is unassigned from a request
      Parameters:
        `assignment` - current assignment
        `enrollment` - unassigned enrollment

    - #### getRequests

          public Set<CourseRequest> getRequests()

      Set of course requests requesting this course
      Returns:
        request for this course

    - #### getNote

          public String getNote()

      Course note
      Returns:
        course note

    - #### setNote

          public void setNote(String note)

      Course note
      Parameters:
        `note` - course note

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getModel

          public Model<Request,Enrollment> getModel()

      Description copied from class: `AbstractClassWithContext`
      Get the model. This is used to create an assignment context if needed.
      Specified by:
        `getModel` in class `AbstractClassWithContext<Request,Enrollment,Course.CourseContext>`
      Returns:
        model

    - #### getEnrollmentWeight

          public double getEnrollmentWeight(Assignment<Request,Enrollment> assignment,
                                            Request excludeRequest)

      Enrollment weight -- weight of all requests that are enrolled into this course, excluding the given one. See `Request.getWeight()`.
      Parameters:
        `assignment` - current assignment
        `excludeRequest` - request to exclude
      Returns:
        enrollment weight

    - #### getEnrollments

          public Set<Enrollment> getEnrollments(Assignment<Request,Enrollment> assignment)

      Set of assigned enrollments
      Parameters:
        `assignment` - current assignment
      Returns:
        assigned enrollments for this course offering

    - #### getMaxEnrollmentWeight

          public double getMaxEnrollmentWeight(Assignment<Request,Enrollment> assignment)

      Maximal weight of a single enrollment in the course
      Parameters:
        `assignment` - current assignment
      Returns:
        maximal enrollment weight

    - #### getMinEnrollmentWeight

          public double getMinEnrollmentWeight(Assignment<Request,Enrollment> assignment)

      Minimal weight of a single enrollment in the course
      Parameters:
        `assignment` - current assignment
      Returns:
        minimal enrollment weight

    - #### addRequestGroup

          public void addRequestGroup(RequestGroup group)

      Add request group of this course. This is automatically called by the constructor of the `RequestGroup`.
      Parameters:
        `group` - request group to be added

    - #### removeRequestGroup

          public void removeRequestGroup(RequestGroup group)

      Remove request group from this course.
      Parameters:
        `group` - request group to be removed

    - #### getRequestGroups

          public Set<RequestGroup> getRequestGroups()

      Lists all the request groups of this course
      Returns:
        all request groups of this course

    - #### setCredit

          public void setCredit(String credit)

      Set credit (Online Student Scheduling only)
      Parameters:
        `credit` - scheduling course credit

    - #### getCredit

          public String getCredit()

      Get credit (Online Student Scheduling only)
      Returns:
        scheduling course credit

    - #### hasCreditValue

          public boolean hasCreditValue()

      True if this course has a credit value defined
      Returns:
        true if a credit value is set

    - #### setCreditValue

          public void setCreditValue(Float creditValue)

      Set course credit value (null if not set)
      Parameters:
        `creditValue` - course credit value

    - #### getCreditValue

          public Float getCreditValue()

      Get course credit value (null if not set) return course credit value

    - #### createAssignmentContext

          public Course.CourseContext createAssignmentContext(Assignment<Request,Enrollment> assignment)

      Description copied from interface: `HasAssignmentContext`
      Create a new assignment context for the given assignment. If there are already some variables assigned in the value, the method should make sure that the context is appropriately initialized.
      Specified by:
        `createAssignmentContext` in interface `HasAssignmentContext<Request,Enrollment,Course.CourseContext>`
      Parameters:
        `assignment` - an assignment for which there needs to be an assignment context
      Returns:
        a new instance of the assignment context, filled according to the given assignment

    - #### inheritAssignmentContext

          public Course.CourseContext inheritAssignmentContext(Assignment<Request,Enrollment> assignment,
                                                               Course.CourseContext parentContext)

      Description copied from interface: `CanInheritContext`
      Create a new assignment context for the given assignment. This method can be used to clone the parent context if desired.
      Specified by:
        `inheritAssignmentContext` in interface `CanInheritContext<Request,Enrollment,Course.CourseContext>`
      Parameters:
        `assignment` - an assignment for which there needs to be an assignment context
        `parentContext` - context of the parent assignment
      Returns:
        a new instance of the assignment context, filled according to the given assignment

    - #### getOnlineBound

          public double getOnlineBound()

    - #### getArrHrsBound

          public double getArrHrsBound()

    - #### getPastBound

          public double getPastBound()

    - #### getTitle

          public String getTitle()

      Course title

    - #### setTitle

          public void setTitle(String title)

      Course title

    - #### getType

          public String getType()

      Course type

    - #### setType

          public void setType(String type)

      Course type

    - #### getParent

          public Course getParent()

      Parent course is set if the course depends on the parent. If the student is requesting both this course and its parent, they cannot get this course without also getting the parent course.
      Returns:
        parent offering

    - #### hasParent

          public boolean hasParent()

      Parent course is set if the course depends on the parent. If the student is requesting both this course and its parent, they cannot get this course without also getting the parent course.
      Returns:
        true if parent is set (this course depends on some other course)

    - #### hasChildren

          public boolean hasChildren()

      Return true if this course is a parent of at least one other course.

    - #### getChildren

          public Set<Course> getChildren()

      Courses that this course is a parent of.

    - #### setParent

          public void setParent(Course parent)

      Parent course is set if the course depends on the parent. If the student is requesting both this course and its parent, they cannot get this course without also getting the parent course. parameter parent parent course, null if this offering has no parent