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