net.sf.cpsolver.studentsct.model

## Class Enrollment

- java.lang.Object
- - net.sf.cpsolver.ifs.model.Value<Request,Enrollment>
  - - net.sf.cpsolver.studentsct.model.Enrollment

- All Implemented Interfaces:
    Comparable<Enrollment>

      public class Enrollment
      extends Value<Request,Enrollment>

  Representation of an enrollment of a student into a course. A student needs to be enrolled in a section of each subpart of a selected configuration. When parent-child relation is defined among sections, if a student is enrolled in a section that has a parent section defined, he/she has be enrolled in the parent section as well. Also, the selected sections cannot overlap in time.
  Version:
    StudentSct 1.2 (Student Sectioning)
    Copyright (C) 2007 - 2010 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/.

- - ### Field Summary

    - ### Fields inherited from class net.sf.cpsolver.ifs.model.Value

      `iValue`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Enrollment(Request request, int priority, Config config, Set<? extends Assignment> assignments)` Constructor
    `Enrollment(Request request, int priority, Course course, Config config, Set<? extends Assignment> assignments, Reservation reservation)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Set<DistanceConflict.Conflict>` | `distanceConflicts()` Distance conflicts, in which this enrollment is involved.
    `boolean` | `equals(Object o)` By default, comparison is made on unique ids
    `String` | `getApproval()` Approval of the enrollment (only used by the online student sectioning)
    `Set<Assignment>` | `getAssignments()` List of assignments (selected sections)
    `Config` | `getConfig()` Config of the course request
    `Course` | `getCourse()` Course of the course request
    `int` | `getLimit()` Enrollment limit, i.e., the number of students that would be able to get into the offering using this enrollment (if all the sections are empty)
    `String` | `getName()` Enrollment name
    `int` | `getNrSlots()` Return total number of slots of all sections in the enrollment.
    `Offering` | `getOffering()` Offering of the course request
    `double` | `getPenalty()` Enrollment penalty -- sum of section penalties (see `Section.getPenalty()`)
    `int` | `getPriority()` Return enrollment priority
    `Request` | `getRequest()` Request
    `Reservation` | `getReservation()` Return reservation used for this enrollment
    `Set<Section>` | `getSections()` List of sections (only for course request)
    `Student` | `getStudent()` Student
    `Long` | `getTimeStamp()` Time stamp of the enrollment
    `void` | `guessReservation(boolean onlyAvailable)` Guess the reservation based on the enrollment
    `boolean` | `isAllowOverlap()` True if this enrollment can overlap with other enrollments of the student.
    `boolean` | `isCourseRequest()` True if the request is course request
    `boolean` | `isOverlapping(Enrollment enrl)` True when this enrollment is overlapping with the given enrollment
    `boolean` | `isSelected()` True if all the sections are selected
    `boolean` | `isWaitlisted()` True if all the sections are wait-listed
    `double` | `percentInitial()` Percent of sections that are initial
    `double` | `percentSelected()` Percent of sections that are selected
    `double` | `percentWaitlisted()` Percent of sections that are wait-listed
    `void` | `setApproval(String approval)` Approval of the enrollment (only used by the online student sectioning)
    `void` | `setReservation(Reservation reservation)` Set reservation for this enrollment
    `void` | `setTimeStamp(Long timeStamp)` Time stamp of the enrollment
    `Set<TimeOverlapsCounter.Conflict>` | `timeOverlappingConflicts()` Time overlapping conflicts, in which this enrollment is involved.
    `double` | `toDouble()` Enrollment value
    `double` | `toDouble(boolean precise)` Enrollment value
    `String` | `toString()`

    - ### Methods inherited from class net.sf.cpsolver.ifs.model.Value

      `assigned, compareTo, conflicts, countAssignments, getDescription, getExtra, getId, hashCode, isConsistent, lastAssignmentIteration, lastUnassignmentIteration, setExtra, setVariable, unassigned, valueEquals, variable`

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

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

- - ### Constructor Detail

    - #### Enrollment

          public Enrollment(Request request,
                            int priority,
                            Course course,
                            Config config,
                            Set<? extends Assignment> assignments,
                            Reservation reservation)

      Constructor
      Parameters:
        `request` - course / free time request
        `priority` - zero for the course, one for the first alternative, two for the second alternative
        `course` - selected course
        `config` - selected configuration
        `assignments` - valid list of sections

    - #### Enrollment

          public Enrollment(Request request,
                            int priority,
                            Config config,
                            Set<? extends Assignment> assignments)

      Constructor
      Parameters:
        `request` - course / free time request
        `priority` - zero for the course, one for the first alternative, two for the second alternative
        `config` - selected configuration
        `assignments` - valid list of sections

  - ### Method Detail

    - #### guessReservation

          public void guessReservation(boolean onlyAvailable)

      Guess the reservation based on the enrollment

    - #### getStudent

          public Student getStudent()

      Student

    - #### getRequest

          public Request getRequest()

      Request

    - #### isCourseRequest

          public boolean isCourseRequest()

      True if the request is course request

    - #### getOffering

          public Offering getOffering()

      Offering of the course request

    - #### getConfig

          public Config getConfig()

      Config of the course request

    - #### getCourse

          public Course getCourse()

      Course of the course request

    - #### getAssignments

          public Set<Assignment> getAssignments()

      List of assignments (selected sections)

    - #### getSections

          public Set<Section> getSections()

      List of sections (only for course request)

    - #### isOverlapping

          public boolean isOverlapping(Enrollment enrl)

      True when this enrollment is overlapping with the given enrollment

    - #### percentWaitlisted

          public double percentWaitlisted()

      Percent of sections that are wait-listed

    - #### percentSelected

          public double percentSelected()

      Percent of sections that are selected

    - #### percentInitial

          public double percentInitial()

      Percent of sections that are initial

    - #### isWaitlisted

          public boolean isWaitlisted()

      True if all the sections are wait-listed

    - #### isSelected

          public boolean isSelected()

      True if all the sections are selected

    - #### getPenalty

          public double getPenalty()

      Enrollment penalty -- sum of section penalties (see `Section.getPenalty()`)

    - #### toDouble

          public double toDouble()

      Enrollment value
      Overrides:
        `toDouble` in class `Value<Request,Enrollment>`

    - #### toDouble

          public double toDouble(boolean precise)

      Enrollment value
      Parameters:
        `precise` - if false, distance conflicts and time overlaps are ignored (i.e., much faster, but less precise computation)

    - #### getName

          public String getName()

      Enrollment name
      Overrides:
        `getName` in class `Value<Request,Enrollment>`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Value<Request,Enrollment>`

    - #### equals

          public boolean equals(Object o)

      Description copied from class: `Value`
      By default, comparison is made on unique ids
      Overrides:
        `equals` in class `Value<Request,Enrollment>`

    - #### distanceConflicts

          public Set<DistanceConflict.Conflict> distanceConflicts()

      Distance conflicts, in which this enrollment is involved.

    - #### timeOverlappingConflicts

          public Set<TimeOverlapsCounter.Conflict> timeOverlappingConflicts()

      Time overlapping conflicts, in which this enrollment is involved.

    - #### getPriority

          public int getPriority()

      Return enrollment priority
      Returns:
        zero for the course, one for the first alternative, two for the second alternative

    - #### getNrSlots

          public int getNrSlots()

      Return total number of slots of all sections in the enrollment.

    - #### getReservation

          public Reservation getReservation()

      Return reservation used for this enrollment

    - #### setReservation

          public void setReservation(Reservation reservation)

      Set reservation for this enrollment

    - #### getTimeStamp

          public Long getTimeStamp()

      Time stamp of the enrollment

    - #### setTimeStamp

          public void setTimeStamp(Long timeStamp)

      Time stamp of the enrollment

    - #### getApproval

          public String getApproval()

      Approval of the enrollment (only used by the online student sectioning)

    - #### setApproval

          public void setApproval(String approval)

      Approval of the enrollment (only used by the online student sectioning)

    - #### isAllowOverlap

          public boolean isAllowOverlap()

      True if this enrollment can overlap with other enrollments of the student.

    - #### getLimit

          public int getLimit()

      Enrollment limit, i.e., the number of students that would be able to get into the offering using this enrollment (if all the sections are empty)