001package org.cpsolver.studentsct.online;
002
003import org.cpsolver.studentsct.model.Offering;
004import org.cpsolver.studentsct.model.Student;
005
006/**
007 * An online reservation. A simple class modeling any reservation of a student. This class is particularly useful when a model containing only the given
008 * student is constructed (to provide him/her with a schedule or suggestions).
009 * 
010 * @version StudentSct 1.3 (Student Sectioning)<br>
011 *          Copyright (C) 2014 Tomas Muller<br>
012 *          <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
013 *          <a href="http://muller.unitime.org">http://muller.unitime.org</a><br>
014 * <br>
015 *          This library is free software; you can redistribute it and/or modify
016 *          it under the terms of the GNU Lesser General Public License as
017 *          published by the Free Software Foundation; either version 3 of the
018 *          License, or (at your option) any later version. <br>
019 * <br>
020 *          This library is distributed in the hope that it will be useful, but
021 *          WITHOUT ANY WARRANTY; without even the implied warranty of
022 *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
023 *          Lesser General Public License for more details. <br>
024 * <br>
025 *          You should have received a copy of the GNU Lesser General Public
026 *          License along with this library; if not see <a href='http://www.gnu.org/licenses'>http://www.gnu.org/licenses</a>.
027 * 
028 */
029public class OnlineReservation extends org.cpsolver.studentsct.reservation.Reservation {
030    private int iType;
031    private int iPriority;
032    private boolean iOver;
033    private int iLimit;
034    private boolean iApply;
035    private boolean iMustUse;
036    private boolean iAllowOverlap;
037    
038    /**
039     * Constructor 
040     * @param type reservation type
041     * @param id reservation unique id
042     * @param offering reservation offering
043     * @param priority reservation priority
044     * @param over true when the reservation allows the student to be assigned over the limit
045     * @param limit reservation limit
046     * @param apply true if the reservation applies to the given student
047     * @param mustUse true if the reservation must be used
048     * @param allowOverlap true if the reservation allows for time overlaps
049     * @param expired true if the reservation is expired
050     */
051    public OnlineReservation(int type, long id, Offering offering, int priority, boolean over, int limit, boolean apply, boolean mustUse, boolean allowOverlap, boolean expired) {
052            super(id, offering);
053            iType = type;
054            iPriority = priority;
055            iOver = over;
056            iLimit = limit;
057            iApply = apply;
058            iMustUse = mustUse;
059            iAllowOverlap = allowOverlap;
060            setExpired(expired);
061    }
062    
063    public int getType() {
064            return iType;
065    }
066    
067    @Override
068    public boolean canAssignOverLimit() {
069            return iOver;
070    }
071
072    @Override
073    public boolean mustBeUsed() {
074            return iMustUse;
075    }
076    
077    @Override
078    public double getReservationLimit() {
079            return iLimit;
080    }
081
082    @Override
083    public int getPriority() {
084            return iPriority;
085    }
086
087    @Override
088    public boolean isApplicable(Student student) {
089            return iApply;
090    }
091
092    @Override
093    public boolean isAllowOverlap() {
094            return iAllowOverlap;
095    }
096}