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 * @version IFS 1.3 (Instructor Sectioning)<br>
011 *          Copyright (C) 2016 Tomáš Müller<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
027 *          <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a>.
028 */
029public class EnrolledClass extends TimeLocation {
030    private Long iCourseId;
031    private Long iClassId;
032    private String iCourse;
033    private String iSection;
034    private String iType;
035    private String iExternalId;
036    private String iRoom;
037    private boolean iInstructor;
038    
039    /**
040     * Constructor
041     * @param courseId course unique id
042     * @param classId class unique id
043     * @param course course name
044     * @param type instructional type
045     * @param section section name
046     * @param externalId external id
047     * @param dayCode days (combination of 1 for Monday, 2 for Tuesday, ...)
048     * @param startTime start slot
049     * @param length number of slots
050     * @param datePatternId date pattern unique id
051     * @param datePatternName date pattern name
052     * @param weekCode date pattern (binary string with 1 for each day when classes take place)
053     * @param breakTime break time in minutes
054     * @param room assigned room(s)
055     * @param instructor true if the instructor is teaching the class (not being a student)
056     */
057    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) {
058        super(dayCode, startTime, length, 0, 0.0, 0, datePatternId, datePatternName, weekCode, breakTime);
059        iCourseId = courseId;
060        iClassId = classId;
061        iCourse = course;
062        iType = type;
063        iSection = section;
064        iExternalId = externalId;
065        iRoom = room;
066        iInstructor = instructor;
067    }
068
069    /**
070     * Unique id of the enrolled course
071     * @return course unique id
072     */
073    public Long getCourseId() { return iCourseId; }
074    /**
075     * Unique id of the enrolled class
076     * @return class unique id
077     */
078    public Long getClassId() { return iClassId; }
079    /**
080     * Name of the enrolled course
081     * @return course name
082     */
083    public String getCourse() { return iCourse; }
084    /**
085     * Name of the enrolled class
086     * @return section name
087     */
088    public String getSection() { return iSection; }
089    /**
090     * Name of the instructional type of the enrolled class
091     * @return instructional type
092     */
093    public String getType() { return iType; }
094    /**
095     * External id of the enrolled class
096     * @return external id
097     */
098    public String getExternalId() { return iExternalId; }
099    /**
100     * Room or rooms (comma separated) of the enrolled class
101     * @return assigned room name
102     */
103    public String getRoom() { return iRoom; }
104    /**
105     * Role of the instructor
106     * @return true if the instructor is teaching this class
107     */
108    public boolean isInstructor() { return iInstructor; }
109    /**
110     * Role of the instructor
111     * @return true if the instructor is enrolled in this class as student
112     */
113    public boolean isStudent() { return !iInstructor; }
114    
115    @Override
116    public String toString() {
117        return getCourse() + " " + getSection() + " " + getLongName(true);
118    }
119}