org.cpsolver.exam.model

## Class ExamRoomPlacement

- java.lang.Object
- - org.cpsolver.exam.model.ExamRoomPlacement

- All Implemented Interfaces:
    Comparable<ExamRoomPlacement>

      public class ExamRoomPlacement
      extends Object
      implements Comparable<ExamRoomPlacement>

  Representation of a room placement of an exam. It contains a room `ExamRoom` and a penalty associated with a placement of an exam into the given room.
  Version:
    ExamTT 1.3 (Examination Timetabling)
    Copyright (C) 2008 - 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

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExamRoomPlacement(ExamRoom room)` Constructor
    `ExamRoomPlacement(ExamRoom room, int penalty)` Constructor
    `ExamRoomPlacement(ExamRoom room, int penalty, int maxPenalty)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(ExamRoomPlacement o)` Compare two room placements
    `boolean` | `equals(Object o)` Compare two room placements for equality
    `double` | `getDistanceInMeters(ExamRoomPlacement other)` Room distance
    `long` | `getId()` Examination room id
    `int` | `getMaxPenalty()` Maximal penalty imposed of `ExamRoom.getPenalty(ExamPeriod)`, i.e., a placement with greater penalty is not allowed to be made
    `String` | `getName()` Examination room name
    `int` | `getPenalty()` Penalty for assignment of an exam into this room `Exam.getRoomPlacements()`
    `int` | `getPenalty(ExamPeriod period)` Penalty for assignment of an exam into this room `Exam.getRoomPlacements()` and the given examination period
    `ExamRoom` | `getRoom()` Examination room
    `int` | `getSize(boolean altSeating)` Room size
    `int` | `hashCode()` Hash code
    `boolean` | `isAvailable(ExamPeriod period)` Examination room availability
    `void` | `setMaxPenalty(int maxPenalty)` Maximal penalty imposed of `ExamRoom.getPenalty(ExamPeriod)`, i.e., a placement with greater penalty is not allowed to be made
    `void` | `setPenalty(int penalty)` Penalty for assignment of an exam into this room `Exam.getRoomPlacements()`
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### ExamRoomPlacement

          public ExamRoomPlacement(ExamRoom room)

      Constructor
      Parameters:
        `room` - examination room

    - #### ExamRoomPlacement

          public ExamRoomPlacement(ExamRoom room,
                                   int penalty)

      Constructor
      Parameters:
        `room` - examination room
        `penalty` - penalty for using this room

    - #### ExamRoomPlacement

          public ExamRoomPlacement(ExamRoom room,
                                   int penalty,
                                   int maxPenalty)

      Constructor
      Parameters:
        `room` - examination room
        `penalty` - penalty for using this room
        `maxPenalty` - maximal penalty imposed of `ExamRoom.getPenalty(ExamPeriod)`, i.e., a placement with greater penalty is not allowed to be made

  - ### Method Detail

    - #### getRoom

          public ExamRoom getRoom()

      Examination room
      Returns:
        examination room

    - #### getId

          public long getId()

      Examination room id
      Returns:
        examination room unique id

    - #### getName

          public String getName()

      Examination room name
      Returns:
        examination room name

    - #### isAvailable

          public boolean isAvailable(ExamPeriod period)

      Examination room availability
      Parameters:
        `period` - given period
      Returns:
        true if the given period is available in this room

    - #### getPenalty

          public int getPenalty()

      Penalty for assignment of an exam into this room `Exam.getRoomPlacements()`
      Returns:
        room assignment penalty

    - #### getMaxPenalty

          public int getMaxPenalty()

      Maximal penalty imposed of `ExamRoom.getPenalty(ExamPeriod)`, i.e., a placement with greater penalty is not allowed to be made
      Returns:
        maximal penalty

    - #### setPenalty

          public void setPenalty(int penalty)

      Penalty for assignment of an exam into this room `Exam.getRoomPlacements()`
      Parameters:
        `penalty` - room assignment penalty

    - #### setMaxPenalty

          public void setMaxPenalty(int maxPenalty)

      Maximal penalty imposed of `ExamRoom.getPenalty(ExamPeriod)`, i.e., a placement with greater penalty is not allowed to be made
      Parameters:
        `maxPenalty` - maximal penalty

    - #### getPenalty

          public int getPenalty(ExamPeriod period)

      Penalty for assignment of an exam into this room `Exam.getRoomPlacements()` and the given examination period
      Parameters:
        `period` - given period
      Returns:
        `getPenalty()` + `ExamRoom.getPenalty(ExamPeriod)`

    - #### getSize

          public int getSize(boolean altSeating)

      Room size
      Parameters:
        `altSeating` - examination seating (pass `Exam.hasAltSeating()`)
      Returns:
        room size or room alternative size, based on given seating

    - #### getDistanceInMeters

          public double getDistanceInMeters(ExamRoomPlacement other)

      Room distance
      Parameters:
        `other` - another placement
      Returns:
        appropriate `ExamRoom.getDistanceInMeters(ExamRoom)`

    - #### hashCode

          public int hashCode()

      Hash code
      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Compare two room placements for equality
      Overrides:
        `equals` in class `Object`

    - #### compareTo

          public int compareTo(ExamRoomPlacement o)

      Compare two room placements
      Specified by:
        `compareTo` in interface `Comparable<ExamRoomPlacement>`