001    package net.sf.cpsolver.studentsct.model;
002    
003    /**
004     * Representation of a course offering. A course offering contains id, subject area, course number and an instructional offering.
005     * <br><br>
006     * Each instructional offering (see {@link Offering}) is offered under one or more course offerings.
007     *  
008     * <br><br>
009     * 
010     * @version
011     * StudentSct 1.1 (Student Sectioning)<br>
012     * Copyright (C) 2007 Tomáš Müller<br>
013     * <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
014     * Lazenska 391, 76314 Zlin, Czech Republic<br>
015     * <br>
016     * This library is free software; you can redistribute it and/or
017     * modify it under the terms of the GNU Lesser General Public
018     * License as published by the Free Software Foundation; either
019     * version 2.1 of the License, or (at your option) any later version.
020     * <br><br>
021     * This library is distributed in the hope that it will be useful,
022     * but 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.
025     * <br><br>
026     * You should have received a copy of the GNU Lesser General Public
027     * License along with this library; if not, write to the Free Software
028     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
029     */
030    public class Course {
031        private long iId = -1;
032        private String iSubjectArea = null;
033        private String iCourseNumber = null;
034        private Offering iOffering = null;
035        private int iLimit =0, iProjected = 0; 
036        
037        /**
038         * Constructor
039         * @param id course offering unique id
040         * @param subjectArea subject area (e.g., MA, CS, ENGL)
041         * @param courseNumber course number under the given subject area
042         * @param offering instructional offering which is offered under this course offering
043         */
044        public Course(long id, String subjectArea, String courseNumber, Offering offering) {
045            iId = id; 
046            iSubjectArea = subjectArea;
047            iCourseNumber = courseNumber;
048            iOffering = offering;
049            iOffering.getCourses().add(this);
050        }
051    
052        /**
053         * Constructor
054         * @param id course offering unique id
055         * @param subjectArea subject area (e.g., MA, CS, ENGL)
056         * @param courseNumber course number under the given subject area
057         * @param offering instructional offering which is offered under this course offering
058         * @param limit course offering limit
059         * @param projected projected demand
060         */
061        public Course(long id, String subjectArea, String courseNumber, Offering offering, int limit, int projected) {
062            iId = id; 
063            iSubjectArea = subjectArea;
064            iCourseNumber = courseNumber;
065            iOffering = offering;
066            iOffering.getCourses().add(this);
067            iLimit = limit;
068            iProjected = projected;
069        }
070        
071        /** Course offering unique id */ 
072        public long getId() {
073            return iId;
074        }
075        
076        /** Subject area */
077        public String getSubjectArea() {
078            return iSubjectArea;
079        }
080    
081        /** Course number */
082        public String getCourseNumber() {
083            return iCourseNumber;
084        }
085    
086        /** Course offering name: subject area + course number */
087        public String getName() {
088            return iSubjectArea + " " + iCourseNumber;
089        }
090        
091        public String toString() {
092            return getName();
093        }
094        
095        /** Instructional offering which is offered under this course offering. */
096        public Offering getOffering() {
097            return iOffering;
098        }
099        
100        /** Course offering limit */
101        public int getLimit() {
102            return iLimit;
103        }
104        
105        /** Set course offering limit */
106        public void setLimit(int limit) {
107            iLimit = limit;
108        }
109    
110        /** Course offering projected number of students */
111        public int getProjected() {
112            return iProjected;
113        }
114    }