    001package org.cpsolver.studentsct.model;
    002
    003import java.util.List;
    004import java.util.Set;
    005
    006import org.cpsolver.coursett.model.RoomLocation;
    007import org.cpsolver.coursett.model.TimeLocation;
    008import org.cpsolver.ifs.assignment.Assignment;
    009
    010
    011/**
    012 * Time and room assignment. This can be either {@link Section} or
    013 * {@link FreeTimeRequest}. <br>
    014 * <br>
    015 *
    016 * @version StudentSct 1.3 (Student Sectioning)<br>
    017 *          Copyright (C) 2007 - 2014 Tomáš Müller<br>
    018 *          <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
    019 *          <a href="http://muller.unitime.org">http://muller.unitime.org</a><br>
    020 * <br>
    021 *          This library is free software; you can redistribute it and/or modify
    022 *          it under the terms of the GNU Lesser General Public License as
    023 *          published by the Free Software Foundation; either version 3 of the
    024 *          License, or (at your option) any later version. <br>
    025 * <br>
    026 *          This library is distributed in the hope that it will be useful, but
    027 *          WITHOUT ANY WARRANTY; without even the implied warranty of
    028 *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    029 *          Lesser General Public License for more details. <br>
    030 * <br>
    031 *          You should have received a copy of the GNU Lesser General Public
    032 *          License along with this library; if not see
    033 *          <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a>.
    034 */
    035public interface SctAssignment {
    036    /** Time assignment
    037     * @return time assignment
    038     **/
    039    public TimeLocation getTime();
    040
    041    /**
    042     * Room assignment
    043     *
    044     * @return list of {@link org.cpsolver.coursett.model.RoomLocation}
    045     */
    046    public List<RoomLocation> getRooms();
    047
    048    /** Number of rooms in which a section meets
    049     * @return number of rooms in which a section meets
    050     **/
    051    public int getNrRooms();
    052
    053    /**
    054     * True, if this assignment is overlapping in time and space with the given
    055     * assignment.
    056     * @param assignment another assignment
    057     * @return true if there is an overlap
    058     */
    059    public boolean isOverlapping(SctAssignment assignment);
    060
    061    /**
    062     * True, if this assignment is overlapping in time and space with the given
    063     * set of assignments.
    064     * @param assignments a set of assignments
    065     * @return true if one of them overlaps
    066     */
    067    public boolean isOverlapping(Set<? extends SctAssignment> assignments);
    068
    069    /** Enrollment with this assignment was assigned to a {@link Request}.
    070     * @param assignment current assignment
    071     * @param enrollment an enrollment that was just assigned
    072     **/
    073    public void assigned(Assignment<Request, Enrollment> assignment, Enrollment enrollment);
    074
    075    /** Enrollment with this assignment was unassigned from a {@link Request}.
    076     * @param assignment current assignment
    077     * @param enrollment an enrollment that was just unassigned
    078     **/
    079    public void unassigned(Assignment<Request, Enrollment> assignment, Enrollment enrollment);
    080
    081    /** Return the list of assigned enrollments that contains this assignment.
    082     * @param assignment current assignments
    083     * @return a list of assigned enrollments (of this request) that contains this assignment
    084     **/
    085    public Set<Enrollment> getEnrollments(Assignment<Request, Enrollment> assignment);
    086
    087    /** Return true if overlaps are allowed, but the number of overlapping slots should be minimized.
    088     * @return true, if overlaps are allowed
    089     **/
    090    public boolean isAllowOverlap();
    091
    092    /** Unique id
    093     * @return section unique id
    094     **/
    095    public long getId();
    096
    097    /** Compare assignments by unique ids.
    098     * @param a another section assignment
    099     * @return comparison
    100     **/
    101    public int compareById(SctAssignment a);
    102}