001package org.cpsolver.studentsct.online;
002
003import java.util.List;
004
005import org.cpsolver.coursett.model.Placement;
006import org.cpsolver.studentsct.model.Instructor;
007import org.cpsolver.studentsct.model.Section;
008import org.cpsolver.studentsct.model.Student;
009import org.cpsolver.studentsct.model.Subpart;
010
011/**
012 * An online section. A simple extension of the {@link Section} class that allows to set the current section enrollment.
013 * This class is particularly useful when a model containing only the given student is constructed (to provide him/her with a schedule or suggestions).
014 * 
015 * @author  Tomáš Müller
016 * @version StudentSct 1.3 (Student Sectioning)<br>
017 *          Copyright (C) 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 <a href='http://www.gnu.org/licenses'>http://www.gnu.org/licenses</a>.
033 * 
034 */
035public class OnlineSection extends Section {
036    private int iEnrollment = 0;
037    private boolean iAlwaysEnabled = false;
038    private Integer iDayOfWeekOffset = null;
039
040    public OnlineSection(long id, int limit, String name, Subpart subpart, Placement placement, List<Instructor> instructors, Section parent) {
041        super(id, limit, name, subpart, placement, instructors, parent);
042    }
043 
044    @Deprecated
045    public OnlineSection(long id, int limit, String name, Subpart subpart, Placement placement, String instructorIds, String instructorNames, Section parent) {
046        super(id, limit, name, subpart, placement, instructorIds, instructorNames, parent);
047    }
048    
049    /**
050     * Set current enrollment
051     * @param enrollment current enrollment
052     */
053    public void setEnrollment(int enrollment) { iEnrollment = enrollment; }
054    
055    /**
056     * Get current enrollment
057     * @return current enrollment
058     */
059    public int getEnrollment() { return iEnrollment; }
060    
061    public void setAlwaysEnabled(boolean alwaysEnabled) { iAlwaysEnabled = alwaysEnabled; }
062    public boolean isAlwaysEnabled() { return iAlwaysEnabled; }
063    
064    @Override
065    public boolean isEnabled() {
066        if (iAlwaysEnabled) return true;
067        return super.isEnabled();
068    }
069    
070    @Override
071    public boolean isEnabled(Student student) {
072        if (iAlwaysEnabled) return true;
073        return super.isEnabled(student);
074    }
075    
076    @Override
077    protected int getDayOfWeekOffset() {
078        if (iDayOfWeekOffset != null) return iDayOfWeekOffset;
079        return super.getDayOfWeekOffset();
080    }
081    public void setDayOfWeekOffset(Integer dayOfWeekOffset) {
082        iDayOfWeekOffset = dayOfWeekOffset;
083    }
084    
085}