org.cpsolver.studentsct.reservation

## Class Restriction

- java.lang.Object
- - org.cpsolver.studentsct.reservation.Restriction

- Direct Known Subclasses:
    CourseRestriction, CurriculumRestriction, IndividualRestriction

      public abstract class Restriction
      extends Object

  Abstract restriction. Restrictions are like reservations, that must be used and that do not reserve any space. Except, there can be more than one restriction on an offering and the student must meet at least one that applies to her/him.
  Version:
    StudentSct 1.3 (Student Sectioning)
    Copyright (C) 2007 - 2020 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

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Restriction(long id, Offering offering)` Constructor

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addConfig(Config config)` Add a configuration (of the offering `getOffering()`) to this restriction
    `void` | `addSection(Section section)` Add a section (of the offering `getOffering()`) to this restriction.
    `Set<Config>` | `getConfigs()` One or more configurations on which the restriction is set.
    `long` | `getId()` Restriction id
    `Offering` | `getOffering()` Instructional offering on which the restriction is set.
    `Map<Subpart,Set<Section>>` | `getSections()` One or more sections on which the restriction is set.
    `Set<Section>` | `getSections(Subpart subpart)` One or more sections on which the restriction is set (optional).
    `boolean` | `isApplicable(Student student)` Deprecated.
    `abstract boolean` | `isApplicable(Student student, Course course)` Returns true if the student is applicable for the restriction
    `boolean` | `isIncluded(Config config)`
    `boolean` | `isIncluded(Enrollment enrollment)` Return true if the given enrollment meets the restriction.
    `boolean` | `isIncluded(Section section)`

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

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

- - ### Constructor Detail

    - #### Restriction

          public Restriction(long id,
                             Offering offering)

      Constructor
      Parameters:
        `id` - restriction unique id
        `offering` - instructional offering on which the restriction is set

  - ### Method Detail

    - #### getId

          public long getId()

      Restriction id
      Returns:
        restriction unique id

    - #### isApplicable

          public abstract boolean isApplicable(Student student,
                                               Course course)

      Returns true if the student is applicable for the restriction
      Parameters:
        `student` - a student
        `course` - a course
      Returns:
        true if student can use the restriction to get into the course / configuration / section

    - #### isApplicable

          @Deprecated
          public boolean isApplicable(Student student)

      Deprecated.

    - #### getOffering

          public Offering getOffering()

      Instructional offering on which the restriction is set.
      Returns:
        instructional offering

    - #### getConfigs

          public Set<Config> getConfigs()

      One or more configurations on which the restriction is set.
      Returns:
        instructional offering configurations

    - #### addConfig

          public void addConfig(Config config)

      Add a configuration (of the offering `getOffering()`) to this restriction
      Parameters:
        `config` - instructional offering configuration

    - #### getSections

          public Map<Subpart,Set<Section>> getSections()

      One or more sections on which the restriction is set.
      Returns:
        class class restrictions

    - #### getSections

          public Set<Section> getSections(Subpart subpart)

      One or more sections on which the restriction is set (optional).
      Parameters:
        `subpart` - scheduling subpart
      Returns:
        class restrictions for the given scheduling subpart

    - #### addSection

          public void addSection(Section section)

      Add a section (of the offering `getOffering()`) to this restriction. This will also add all parent sections and the appropriate configuration to the offering.
      Parameters:
        `section` - a class restriction

    - #### isIncluded

          public boolean isIncluded(Enrollment enrollment)

      Return true if the given enrollment meets the restriction.
      Parameters:
        `enrollment` - given enrollment
      Returns:
        true if the given enrollment meets the restriction

    - #### isIncluded

          public boolean isIncluded(Config config)

    - #### isIncluded

          public boolean isIncluded(Section section)