org.cpsolver.studentsct.model

## Class Choice

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

-     public class Choice
      extends Object

  Student choice. Students have a choice of availabe time (but not room) and instructor(s). Choices of subparts that have the same instrutional type are also merged together. For instance, a student have a choice of a time/instructor of a Lecture and of a Recitation.
  Version:
    StudentSct 1.3 (Student Sectioning)
    Copyright (C) 2007 - 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
    `Choice(Config config)` Constructor
    `Choice(Offering offering, String choiceId)` Constructor
    `Choice(Offering offering, String instructionalType, TimeLocation time, List<Instructor> instructors)` Constructor
    `Choice(Offering offering, String instructionalType, TimeLocation time, String instructorIds, String instructorNames)` Deprecated.
    `Choice(Section section)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)` Compare two choices, based on `getId()`
    `Long` | `getConfigId()` config id
    `String` | `getId()` Choice id combined from instructionalType, time and instructorIds in the following format: instructionalType|time|instructorIds where time is of format dayCode:startSlot:length:datePatternId
    `String` | `getInstructionalType()` Instructional type (e.g., Lecture, Recitation or Laboratory) to which this choice belongs
    `String` | `getInstructorIds()` Deprecated.
    `String` | `getInstructorNames()` Deprecated.
    `String` | `getInstructorNames(String delim)` Instructor names
    `List<Instructor>` | `getInstructors()` Instructors of this choice
    `String` | `getName()` Choice name: name of the appropriate subpart + long name of time + instructor(s) name
    `Offering` | `getOffering()` Instructional offering to which this choice belongs
    `Set<Section>` | `getParentSections()` List of parent sections of sections of the instructional offering which represent this choice.
    `Long` | `getSectionId()` section id
    `Set<Section>` | `getSections()` List of sections of the instructional offering which represent this choice.
    `Long` | `getSubpartId()` subpart id
    `TimeLocation` | `getTime()` Time location of the choice
    `int` | `hashCode()` Choice hash id, based on `getId()`
    `boolean` | `hasInstructors()` Has any instructors
    `boolean` | `isMatching(Section section)` True if this choice is applicable to the given section (that is, the choice is a config choice or with the same subpart / instructional type)
    `int` | `nrInstructors()` Return number of instructors of this choice
    `boolean` | `sameChoice(Section section)` True if the time assignment as well as the instructor(s) are the same
    `boolean` | `sameConfiguration(Enrollment enrollment)` True if the configuration is the very same
    `boolean` | `sameConfiguration(Section section)` True if the configuration is the very same
    `boolean` | `sameInstructionalType(Section section)` True if the instructional type is the same
    `boolean` | `sameInstructors(Section section)` True if the section contains all instructors of this choice
    `boolean` | `sameOffering(Section section)` True if the offering is the same
    `boolean` | `sameSection(Enrollment enrollment)` True if the configuration is the very same
    `boolean` | `sameSection(Section section)` True if the section is the very same
    `boolean` | `sameSubart(Section section)` True if the subpart is the very same
    `boolean` | `sameTime(Choice choice)` Return true if the given choice has the same instructional type and time return true if the two choices have the same time
    `boolean` | `sameTime(Section section)` True if the time assignment is the same
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### Choice

          public Choice(Offering offering,
                        String instructionalType,
                        TimeLocation time,
                        List<Instructor> instructors)

      Constructor
      Parameters:
        `offering` - instructional offering to which the choice belongs
        `instructionalType` - instructional type to which the choice belongs (e.g., Lecture, Recitation or Laboratory)
        `time` - time assignment
        `instructors` - instructor(s)

    - #### Choice

          @Deprecated
          public Choice(Offering offering,
                                    String instructionalType,
                                    TimeLocation time,
                                    String instructorIds,
                                    String instructorNames)

      Deprecated.

    - #### Choice

          public Choice(Section section)

      Constructor
      Parameters:
        `section` - section to base the choice on

    - #### Choice

          public Choice(Config config)

      Constructor
      Parameters:
        `config` - configuration to base the choice on

    - #### Choice

          public Choice(Offering offering,
                        String choiceId)

      Constructor
      Parameters:
        `offering` - instructional offering to which the choice belongs
        `choiceId` - choice id is in format instructionalType|time|instructorIds where time is of format dayCode:startSlot:length:datePatternId

  - ### Method Detail

    - #### getOffering

          public Offering getOffering()

      Instructional offering to which this choice belongs
      Returns:
        instructional offering

    - #### getInstructionalType

          public String getInstructionalType()

      Instructional type (e.g., Lecture, Recitation or Laboratory) to which this choice belongs
      Returns:
        instructional type

    - #### getTime

          public TimeLocation getTime()

      Time location of the choice
      Returns:
        selected time

    - #### sameTime

          public boolean sameTime(Choice choice)

      Return true if the given choice has the same instructional type and time return true if the two choices have the same time

    - #### getInstructorIds

          @Deprecated
          public String getInstructorIds()

      Deprecated.
      Instructor(s) id of the choice, can be null if the section has no instructor assigned
      Returns:
        selected instructors

    - #### getInstructorNames

          @Deprecated
          public String getInstructorNames()

      Deprecated.
      Instructor(s) name of the choice, can be null if the section has no instructor assigned
      Returns:
        selected instructors

    - #### getInstructorNames

          public String getInstructorNames(String delim)

      Instructor names
      Parameters:
        `delim` - delimiter
      Returns:
        instructor names

    - #### getId

          public String getId()

      Choice id combined from instructionalType, time and instructorIds in the following format: instructionalType|time|instructorIds where time is of format dayCode:startSlot:length:datePatternId
      Returns:
        choice id

    - #### equals

          public boolean equals(Object o)

      Compare two choices, based on `getId()`
      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Choice hash id, based on `getId()`
      Overrides:
        `hashCode` in class `Object`

    - #### getSections

          public Set<Section> getSections()

      List of sections of the instructional offering which represent this choice. Note that there can be multiple sections with the same choice (e.g., only if the room location differs).
      Returns:
        set of sections for matching this choice

    - #### getParentSections

          public Set<Section> getParentSections()

      List of parent sections of sections of the instructional offering which represent this choice. Note that there can be multiple sections with the same choice (e.g., only if the room location differs).
      Returns:
        set of parent sections

    - #### getName

          public String getName()

      Choice name: name of the appropriate subpart + long name of time + instructor(s) name
      Returns:
        choice name

    - #### sameInstructionalType

          public boolean sameInstructionalType(Section section)

      True if the instructional type is the same

    - #### sameTime

          public boolean sameTime(Section section)

      True if the time assignment is the same

    - #### sameInstructors

          public boolean sameInstructors(Section section)

      True if the section contains all instructors of this choice

    - #### sameOffering

          public boolean sameOffering(Section section)

      True if the offering is the same

    - #### sameChoice

          public boolean sameChoice(Section section)

      True if the time assignment as well as the instructor(s) are the same

    - #### sameSection

          public boolean sameSection(Section section)

      True if the section is the very same

    - #### sameSubart

          public boolean sameSubart(Section section)

      True if the subpart is the very same

    - #### sameConfiguration

          public boolean sameConfiguration(Section section)

      True if the configuration is the very same

    - #### sameConfiguration

          public boolean sameConfiguration(Enrollment enrollment)

      True if the configuration is the very same

    - #### sameSection

          public boolean sameSection(Enrollment enrollment)

      True if the configuration is the very same

    - #### isMatching

          public boolean isMatching(Section section)

      True if this choice is applicable to the given section (that is, the choice is a config choice or with the same subpart / instructional type)

    - #### getSectionId

          public Long getSectionId()

      section id

    - #### getSubpartId

          public Long getSubpartId()

      subpart id

    - #### getConfigId

          public Long getConfigId()

      config id

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getInstructors

          public List<Instructor> getInstructors()

      Instructors of this choice
      Returns:
        list of instructors

    - #### hasInstructors

          public boolean hasInstructors()

      Has any instructors
      Returns:
        return true if there is at least one instructor in this choice

    - #### nrInstructors

          public int nrInstructors()

      Return number of instructors of this choice
      Returns:
        number of instructors of this choice