org.cpsolver.exam.model

## Class PredefinedExamRoomSharing

- java.lang.Object
- - org.cpsolver.exam.model.ExamRoomSharing
  - - org.cpsolver.exam.model.PredefinedExamRoomSharing

-     public class PredefinedExamRoomSharing
      extends ExamRoomSharing

  Room sharing model based on a pre-defined list of examination pairs. The relation needs to be populated using `addPair(Exam, Exam)` and it is persisted with the solution XML (see `ExamModel.save(Assignment)`, canShareRoom element for each exam containing a comma separated list of exam ids).
  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/.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PredefinedExamRoomSharing(Model<Exam,ExamPlacement> model, DataProperties config)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPair(Exam x1, Exam x2)` Add a pair of exams that are allowed to share a room
    `void` | `addPair(Long examId1, Long examId2)` Add a pair of exams that are allowed to share a room
    `boolean` | `canShareRoom(Exam x1, Exam x2)` True if given two exams can share a room
    `void` | `clear()` Clear examination pairs
    `void` | `load(Exam exam, Element element)` Load sharing information (if needed) for a given exam
    `void` | `save(Exam exam, Element element, IdConvertor idConvertor)` Save sharing information (if needed) for a given exam

    - ### Methods inherited from class org.cpsolver.exam.model.ExamRoomSharing

      `computeConflicts, computeConflicts, inConflict, inConflict`

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

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

- - ### Constructor Detail

    - #### PredefinedExamRoomSharing

          public PredefinedExamRoomSharing(Model<Exam,ExamPlacement> model,
                                           DataProperties config)

  - ### Method Detail

    - #### canShareRoom

          public boolean canShareRoom(Exam x1,
                                      Exam x2)

      Description copied from class: `ExamRoomSharing`
      True if given two exams can share a room
      Specified by:
        `canShareRoom` in class `ExamRoomSharing`
      Parameters:
        `x1` - first exam
        `x2` - second exam
      Returns:
        true if the two exams can share a room

    - #### addPair

          public void addPair(Exam x1,
                              Exam x2)

      Add a pair of exams that are allowed to share a room
      Parameters:
        `x1` - first exam
        `x2` - second exam

    - #### addPair

          public void addPair(Long examId1,
                              Long examId2)

      Add a pair of exams that are allowed to share a room
      Parameters:
        `examId1` - first exam unique id
        `examId2` - second exam unique id

    - #### clear

          public void clear()

      Clear examination pairs

    - #### save

          public void save(Exam exam,
                           Element element,
                           IdConvertor idConvertor)

      Description copied from class: `ExamRoomSharing`
      Save sharing information (if needed) for a given exam
      Overrides:
        `save` in class `ExamRoomSharing`
      Parameters:
        `exam` - exam in question
        `element` - XML exam element to include sharing information
        `idConvertor` - id converter

    - #### load

          public void load(Exam exam,
                           Element element)

      Description copied from class: `ExamRoomSharing`
      Load sharing information (if needed) for a given exam
      Overrides:
        `load` in class `ExamRoomSharing`
      Parameters:
        `exam` - exam in question
        `element` - XML exam element including sharing information