001package org.cpsolver.instructor.model;
002
003import java.util.BitSet;
004
005import org.cpsolver.coursett.model.TimeLocation;
006
007/**
008 * Enrolled class to be used as an instructor unavailability.
009 * 
010 * @author  Tomáš Müller
011 * @version IFS 1.3 (Instructor Sectioning)<br>
012 *          Copyright (C) 2016 Tomáš Müller<br>
013 *          <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
014 *          <a href="http://muller.unitime.org">http://muller.unitime.org</a><br>
015 * <br>
016 *          This library is free software; you can redistribute it and/or modify
017 *          it under the terms of the GNU Lesser General Public License as
018 *          published by the Free Software Foundation; either version 3 of the
019 *          License, or (at your option) any later version. <br>
020 * <br>
021 *          This library is distributed in the hope that it will be useful, but
022 *          WITHOUT ANY WARRANTY; without even the implied warranty of
023 *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
024 *          Lesser General Public License for more details. <br>
025 * <br>
026 *          You should have received a copy of the GNU Lesser General Public
027 *          License along with this library; if not see
028 *          <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a>.
029 */
030public class EnrolledClass extends TimeLocation {
031    private Long iCourseId;
032    private Long iClassId;
033    private String iCourse;
034    private String iSection;
035    private String iType;
036    private String iExternalId;
037    private String iRoom;
038    private boolean iInstructor;
039    
040    /**
041     * Constructor
042     * @param courseId course unique id
043     * @param classId class unique id
044     * @param course course name
045     * @param type instructional type
046     * @param section section name
047     * @param externalId external id
048     * @param dayCode days (combination of 1 for Monday, 2 for Tuesday, ...)
049     * @param startTime start slot
050     * @param length number of slots
051     * @param datePatternId date pattern unique id
052     * @param datePatternName date pattern name
053     * @param weekCode date pattern (binary string with 1 for each day when classes take place)
054     * @param breakTime break time in minutes
055     * @param room assigned room(s)
056     * @param instructor true if the instructor is teaching the class (not being a student)
057     */
058    public EnrolledClass(Long courseId, Long classId, String course, String type, String section, String externalId, int dayCode, int startTime, int length, Long datePatternId, String datePatternName, BitSet weekCode, int breakTime, String room, boolean instructor) {
059        super(dayCode, startTime, length, 0, 0.0, 0, datePatternId, datePatternName, weekCode, breakTime);
060        iCourseId = courseId;
061        iClassId = classId;
062        iCourse = course;
063        iType = type;
064        iSection = section;
065        iExternalId = externalId;
066        iRoom = room;
067        iInstructor = instructor;
068    }
069
070    /**
071     * Unique id of the enrolled course
072     * @return course unique id
073     */
074    public Long getCourseId() { return iCourseId; }
075    /**
076     * Unique id of the enrolled class
077     * @return class unique id
078     */
079    public Long getClassId() { return iClassId; }
080    /**
081     * Name of the enrolled course
082     * @return course name
083     */
084    public String getCourse() { return iCourse; }
085    /**
086     * Name of the enrolled class
087     * @return section name
088     */
089    public String getSection() { return iSection; }
090    /**
091     * Name of the instructional type of the enrolled class
092     * @return instructional type
093     */
094    public String getType() { return iType; }
095    /**
096     * External id of the enrolled class
097     * @return external id
098     */
099    public String getExternalId() { return iExternalId; }
100    /**
101     * Room or rooms (comma separated) of the enrolled class
102     * @return assigned room name
103     */
104    public String getRoom() { return iRoom; }
105    /**
106     * Role of the instructor
107     * @return true if the instructor is teaching this class
108     */
109    public boolean isInstructor() { return iInstructor; }
110    /**
111     * Role of the instructor
112     * @return true if the instructor is enrolled in this class as student
113     */
114    public boolean isStudent() { return !iInstructor; }
115    
116    @Override
117    public String toString() {
118        return getCourse() + " " + getSection() + " " + getLongName(true);
119    }
120}