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 iLimit;
032    private boolean iApply;
033    
034    /**
035     * Constructor 
036     * @param type reservation type
037     * @param id reservation unique id
038     * @param offering reservation offering
039     * @param priority reservation priority
040     * @param over true when the reservation allows the student to be assigned over the limit
041     * @param limit reservation limit
042     * @param apply true if the reservation applies to the given student
043     * @param mustUse true if the reservation must be used
044     * @param allowOverlap true if the reservation allows for time overlaps
045     * @param expired true if the reservation is expired
046     */
047    public OnlineReservation(int type, long id, Offering offering, int priority, boolean over, int limit, boolean apply, boolean mustUse, boolean allowOverlap, boolean expired) {
048            super(id, offering, priority, mustUse, over, allowOverlap);
049            iType = type;
050            iLimit = limit;
051            iApply = apply;
052            setExpired(expired);
053    }
054    
055    public int getType() {
056            return iType;
057    }
058    
059    @Override
060    public double getReservationLimit() {
061            return iLimit;
062    }
063
064    @Override
065    public boolean isApplicable(Student student) {
066            return iApply;
067    }
068}