org.cpsolver.studentsct.online

## Class OnlineReservation

- java.lang.Object
- - org.cpsolver.ifs.assignment.context.AbstractClassWithContext<Request,Enrollment,Reservation.ReservationContext>
  - - org.cpsolver.studentsct.reservation.Reservation
    - - org.cpsolver.studentsct.online.OnlineReservation

- All Implemented Interfaces:
    Comparable<Reservation>, AssignmentComparable<Reservation,Request,Enrollment>, CanHoldContext, CanInheritContext<Request,Enrollment,Reservation.ReservationContext>, HasAssignmentContext<Request,Enrollment,Reservation.ReservationContext>

      public class OnlineReservation
      extends Reservation

  An online reservation. A simple class modeling any reservation of a student. This class is particularly useful when a model containing only the given student is constructed (to provide him/her with a schedule or suggestions).
  Version:
    StudentSct 1.3 (Student Sectioning)
    Copyright (C) 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/interfaces inherited from class org.cpsolver.studentsct.reservation.Reservation

      `Reservation.ReservationContext`

  - ### Field Summary

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

      `sMaxSize`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OnlineReservation(int type, long id, Offering offering, int priority, boolean over, int limit, boolean apply, boolean mustUse, boolean allowOverlap, boolean expired)` Constructor
    `OnlineReservation(int type, long id, Offering offering, int priority, boolean over, int limit, boolean apply, boolean mustUse, boolean allowOverlap, boolean expired, boolean override)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `double` | `getLimitCap()` Compute limit cap (maximum number of students that can get into the offering using this reservation)
    `double` | `getReservationLimit()` Reservation limit
    `int` | `getType()`
    `boolean` | `isApplicable(Student student)` Returns true if the student is applicable for the reservation
    `boolean` | `isOverride()`
    `boolean` | `mustBeUsed()` If true, student must use the reservation (if applicable).

    - ### Methods inherited from class org.cpsolver.studentsct.reservation.Reservation

      `addConfig, addSection, addSection, areRestrictionsInclusive, canAssignOverLimit, canBatchAssignOverLimit, canBreakLinkedSections, canEnroll, compareTo, compareTo, createAssignmentContext, getConfigs, getEnrollments, getId, getLimit, getLimit, getLimitCap, getModel, getOffering, getPriority, getReservedAvailableSpace, getReservedAvailableSpace, getRestrictivity, getSections, getSections, inheritAssignmentContext, isAllowDisabled, isAllowOverlap, isExpired, isIncluded, mustBeUsedIgnoreExpiration, neverIncluded, setAllowDisabled, setAllowOverlap, setBreakLinkedSections, setCanAssignOverLimit, setExpired, setMustBeUsed, setNeverIncluded, setPriority`

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

      `getAssignmentContextReference, getContext, getContext, setAssignmentContextReference`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OnlineReservation

          public OnlineReservation(int type,
                                   long id,
                                   Offering offering,
                                   int priority,
                                   boolean over,
                                   int limit,
                                   boolean apply,
                                   boolean mustUse,
                                   boolean allowOverlap,
                                   boolean expired,
                                   boolean override)

      Constructor
      Parameters:
        `type` - reservation type
        `id` - reservation unique id
        `offering` - reservation offering
        `priority` - reservation priority
        `over` - true when the reservation allows the student to be assigned over the limit
        `limit` - reservation limit
        `apply` - true if the reservation applies to the given student
        `mustUse` - true if the reservation must be used
        `allowOverlap` - true if the reservation allows for time overlaps
        `expired` - true if the reservation is expired
        `override` - true if the reservation is reservation override

    - #### OnlineReservation

          public OnlineReservation(int type,
                                   long id,
                                   Offering offering,
                                   int priority,
                                   boolean over,
                                   int limit,
                                   boolean apply,
                                   boolean mustUse,
                                   boolean allowOverlap,
                                   boolean expired)

      Constructor
      Parameters:
        `type` - reservation type
        `id` - reservation unique id
        `offering` - reservation offering
        `priority` - reservation priority
        `over` - true when the reservation allows the student to be assigned over the limit
        `limit` - reservation limit
        `apply` - true if the reservation applies to the given student
        `mustUse` - true if the reservation must be used
        `allowOverlap` - true if the reservation allows for time overlaps
        `expired` - true if the reservation is expired

  - ### Method Detail

    - #### getType

          public int getType()

    - #### getReservationLimit

          public double getReservationLimit()

      Description copied from class: `Reservation`
      Reservation limit
      Specified by:
        `getReservationLimit` in class `Reservation`
      Returns:
        reservation limit, -1 for unlimited

    - #### isApplicable

          public boolean isApplicable(Student student)

      Description copied from class: `Reservation`
      Returns true if the student is applicable for the reservation
      Specified by:
        `isApplicable` in class `Reservation`
      Parameters:
        `student` - a student
      Returns:
        true if student can use the reservation to get into the course / configuration / section

    - #### isOverride

          public boolean isOverride()

    - #### mustBeUsed

          public boolean mustBeUsed()

      Description copied from class: `Reservation`
      If true, student must use the reservation (if applicable). Expired reservations do not need to be used.
      Overrides:
        `mustBeUsed` in class `Reservation`
      Returns:
        must this reservation be used

    - #### getLimitCap

          public double getLimitCap()

      Description copied from class: `Reservation`
      Compute limit cap (maximum number of students that can get into the offering using this reservation)
      Overrides:
        `getLimitCap` in class `Reservation`
      Returns:
        reservation limit cap