org.cpsolver.studentsct.model

## Class Unavailability

- java.lang.Object
- - org.cpsolver.studentsct.model.Unavailability

- All Implemented Interfaces:
    SctAssignment

      public class Unavailability
      extends Object
      implements SctAssignment

  Representation of an unavailability. This is typically used when the student is also an instructor and he/she is teaching during some time (and hence not available for attending classes as a student). An unavailability can be marked as can overlap in time, in which case the time overlap is allowed but the overlapping time is to be minimized.
  Version:
    StudentSct 1.3 (Student Sectioning)
    Copyright (C) 2007 - 2016 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/.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Unavailability(Student student, Section section, boolean canOverlap)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `assigned(Assignment<Request,Enrollment> assignment, Enrollment enrollment)` Enrollment with this assignment was assigned to a `Request`.
    `int` | `compareById(SctAssignment a)` Compare assignments by unique ids.
    `Enrollment` | `createEnrollment()` Create dummy enrollment of this unavailability
    `boolean` | `equals(Object o)`
    `Set<Enrollment>` | `getEnrollments(Assignment<Request,Enrollment> assignment)` Not used, always null
    `long` | `getId()` Unique id
    `int` | `getNrRooms()` Number of rooms in which a section meets
    `List<RoomLocation>` | `getRooms()` Room assignment
    `Section` | `getSection()` Section
    `Student` | `getStudent()` Student
    `TimeLocation` | `getTime()` Time assignment
    `int` | `hashCode()`
    `boolean` | `isAllowOverlap()` Can student have classes during this unavailability?
    `boolean` | `isOverlapping(SctAssignment assignment)` True, if this assignment is overlapping in time and space with the given assignment.
    `boolean` | `isOverlapping(Set<? extends SctAssignment> assignments)` True, if this assignment is overlapping in time and space with the given set of assignments.
    `void` | `unassigned(Assignment<Request,Enrollment> assignment, Enrollment enrollment)` Enrollment with this assignment was unassigned from a `Request`.

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

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

- - ### Constructor Detail

    - #### Unavailability

          public Unavailability(Student student,
                                Section section,
                                boolean canOverlap)

      Constructor
      Parameters:
        `student` - student
        `section` - section that the student is teaching
        `canOverlap` - true if student can have classes during the time, but the overlapping time should be minimized

  - ### Method Detail

    - #### getStudent

          public Student getStudent()

      Student

    - #### getSection

          public Section getSection()

      Section

    - #### getId

          public long getId()

      Description copied from interface: `SctAssignment`
      Unique id
      Specified by:
        `getId` in interface `SctAssignment`
      Returns:
        section unique id

    - #### getTime

          public TimeLocation getTime()

      Description copied from interface: `SctAssignment`
      Time assignment
      Specified by:
        `getTime` in interface `SctAssignment`
      Returns:
        time assignment

    - #### isAllowOverlap

          public boolean isAllowOverlap()

      Can student have classes during this unavailability? The overlapping time should be minimized in this case (like with lower priority free time requests).
      Specified by:
        `isAllowOverlap` in interface `SctAssignment`
      Returns:
        true, if overlaps are allowed

    - #### getRooms

          public List<RoomLocation> getRooms()

      Description copied from interface: `SctAssignment`
      Room assignment
      Specified by:
        `getRooms` in interface `SctAssignment`
      Returns:
        list of `RoomLocation`

    - #### getNrRooms

          public int getNrRooms()

      Description copied from interface: `SctAssignment`
      Number of rooms in which a section meets
      Specified by:
        `getNrRooms` in interface `SctAssignment`
      Returns:
        number of rooms in which a section meets

    - #### isOverlapping

          public boolean isOverlapping(SctAssignment assignment)

      Description copied from interface: `SctAssignment`
      True, if this assignment is overlapping in time and space with the given assignment.
      Specified by:
        `isOverlapping` in interface `SctAssignment`
      Parameters:
        `assignment` - another assignment
      Returns:
        true if there is an overlap

    - #### isOverlapping

          public boolean isOverlapping(Set<? extends SctAssignment> assignments)

      Description copied from interface: `SctAssignment`
      True, if this assignment is overlapping in time and space with the given set of assignments.
      Specified by:
        `isOverlapping` in interface `SctAssignment`
      Parameters:
        `assignments` - a set of assignments
      Returns:
        true if one of them overlaps

    - #### assigned

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

      Description copied from interface: `SctAssignment`
      Enrollment with this assignment was assigned to a `Request`.
      Specified by:
        `assigned` in interface `SctAssignment`
      Parameters:
        `assignment` - current assignment
        `enrollment` - an enrollment that was just assigned

    - #### unassigned

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

      Description copied from interface: `SctAssignment`
      Enrollment with this assignment was unassigned from a `Request`.
      Specified by:
        `unassigned` in interface `SctAssignment`
      Parameters:
        `assignment` - current assignment
        `enrollment` - an enrollment that was just unassigned

    - #### getEnrollments

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

      Not used, always null
      Specified by:
        `getEnrollments` in interface `SctAssignment`
      Parameters:
        `assignment` - current assignments
      Returns:
        a list of assigned enrollments (of this request) that contains this assignment

    - #### compareById

          public int compareById(SctAssignment a)

      Description copied from interface: `SctAssignment`
      Compare assignments by unique ids.
      Specified by:
        `compareById` in interface `SctAssignment`
      Parameters:
        `a` - another section assignment
      Returns:
        comparison

    - #### createEnrollment

          public Enrollment createEnrollment()

      Create dummy enrollment of this unavailability
      Returns:
        created enrollment (warning: the returned enrollment has no request)

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`