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