net.sf.cpsolver.exam.model

## Class ExamPlacement

- java.lang.Object
- - net.sf.cpsolver.ifs.model.Value<Exam,ExamPlacement>
  - - net.sf.cpsolver.exam.model.ExamPlacement

- All Implemented Interfaces:
    Comparable<ExamPlacement>

      public class ExamPlacement
      extends Value<Exam,ExamPlacement>

  Representation of an exam placement (problem value), i.e., assignment of an exam to period and room(s). Each placement has defined a period and a set of rooms. The exam as well as the rooms have to be available during the given period (see `Exam.getPeriodPlacements()` and `Exam.getRoomPlacements()`). The total size of rooms have to be equal or greater than the number of students enrolled in the exam `Exam.getSize()`, using either `ExamRoom.getSize()` or `ExamRoom.getAltSize()`, depending on `Exam.hasAltSeating()`. Also, the number of rooms has to be smaller or equal to `Exam.getMaxRooms()`. If `Exam.getMaxRooms()` is zero, the exam is only to be assigned to period (the set of rooms is empty).
  Version:
    ExamTT 1.2 (Examination Timetabling)
    Copyright (C) 2008 - 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
    `ExamPlacement(Exam exam, ExamPeriodPlacement periodPlacement, Set<ExamRoomPlacement> roomPlacements)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `contains(ExamRoom room)` True if given room is between `getRoomPlacements()`
    `boolean` | `equals(Object o)` Compare two assignments for equality
    `double` | `getDistanceInMeters(ExamPlacement other)` Distance between two placements, i.e., maximal distance between a room of this placement and a room of the given placement.
    `String` | `getName()` Assignment name (period / room(s))
    `ExamPeriod` | `getPeriod()` Assigned period
    `ExamPeriodPlacement` | `getPeriodPlacement()` Assigned period placement
    `double` | `getRoomCost()` Overall cost of using this set or rooms.
    `String` | `getRoomName(String delim)` Room names separated with the given delimiter
    `Set<ExamRoomPlacement>` | `getRoomPlacements()` Assigned rooms (it is empty when `Exam.getMaxRooms()` is zero)
    `double` | `getTimeCost()` Overall cost of using this period.
    `int` | `hashCode()` Hash code
    `double` | `toDouble()` Overall cost of using this placement.
    `String` | `toString()` String representation -- returns a list of assignment costs

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

      `assigned, compareTo, conflicts, countAssignments, getDescription, getExtra, getId, 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

    - #### ExamPlacement

          public ExamPlacement(Exam exam,
                               ExamPeriodPlacement periodPlacement,
                               Set<ExamRoomPlacement> roomPlacements)

      Constructor
      Parameters:
        `exam` - an exam
        `periodPlacement` - period placement
        `roomPlacements` - a set of room placements `ExamRoomPlacement`

  - ### Method Detail

    - #### getPeriod

          public ExamPeriod getPeriod()

      Assigned period

    - #### getPeriodPlacement

          public ExamPeriodPlacement getPeriodPlacement()

      Assigned period placement

    - #### getRoomPlacements

          public Set<ExamRoomPlacement> getRoomPlacements()

      Assigned rooms (it is empty when `Exam.getMaxRooms()` is zero)
      Returns:
        list of `ExamRoomPlacement`

    - #### getDistanceInMeters

          public double getDistanceInMeters(ExamPlacement other)

      Distance between two placements, i.e., maximal distance between a room of this placement and a room of the given placement. Method `ExamRoom.getDistanceInMeters(ExamRoom)` is used to get a distance between two rooms.

    - #### toDouble

          public double toDouble()

      Overall cost of using this placement.
      Overrides:
        `toDouble` in class `Value<Exam,ExamPlacement>`

    - #### getTimeCost

          public double getTimeCost()

      Overall cost of using this period.

    - #### getRoomCost

          public double getRoomCost()

      Overall cost of using this set or rooms.

    - #### getRoomName

          public String getRoomName(String delim)

      Room names separated with the given delimiter

    - #### getName

          public String getName()

      Assignment name (period / room(s))
      Overrides:
        `getName` in class `Value<Exam,ExamPlacement>`

    - #### toString

          public String toString()

      String representation -- returns a list of assignment costs
      Overrides:
        `toString` in class `Value<Exam,ExamPlacement>`

    - #### equals

          public boolean equals(Object o)

      Compare two assignments for equality
      Overrides:
        `equals` in class `Value<Exam,ExamPlacement>`

    - #### hashCode

          public int hashCode()

      Hash code
      Overrides:
        `hashCode` in class `Value<Exam,ExamPlacement>`

    - #### contains

          public boolean contains(ExamRoom room)

      True if given room is between `getRoomPlacements()`