Timetabler
course.cpp
1 #include "fields/course.h"
2 
3 #include <string>
4 #include <vector>
5 #include "fields/instructor.h"
6 #include "fields/is_minor.h"
7 #include "fields/program.h"
8 #include "fields/segment.h"
9 
19 Course::Course(std::string name, unsigned classSize, int instructor,
20  int segment, MinorType isMinor) {
21  this->name = name;
22  this->classSize = classSize;
23  this->instructor = instructor;
24  this->segment = segment;
25  this->isMinor = isMinor;
26 }
27 
39 Course::Course(std::string name, unsigned classSize, int instructor,
40  int segment, MinorType isMinor, std::vector<int> programs) {
41  this->name = name;
42  this->classSize = classSize;
43  this->instructor = instructor;
44  this->segment = segment;
45  this->isMinor = isMinor;
46  this->programs = programs;
47 }
48 
55 void Course::setPrograms(std::vector<int> programs) {
56  this->programs = programs;
57 }
58 
64 void Course::addProgram(int programs) { this->programs.push_back(programs); }
65 
71 void Course::addClassroom(int cr) { this->classroom = cr; }
72 
78 void Course::addSlot(int s) { this->slot = s; }
79 
88 bool Course::operator==(const Course &other) {
89  return (this->name == other.name);
90 }
91 
97 std::string Course::getName() { return name; }
98 
104 int Course::getInstructor() { return instructor; }
105 
111 std::vector<int> Course::getPrograms() { return programs; }
112 
118 int Course::getSegment() { return segment; }
119 
125 MinorType Course::getIsMinor() { return isMinor; }
126 
132 int Course::getClassroom() { return classroom; }
133 
139 int Course::getSlot() { return slot; }
140 
146 unsigned Course::getClassSize() { return classSize; }
std::string getName()
Gets the name of the Course.
Definition: course.cpp:97
MinorType getIsMinor()
Gets the &#39;is minor&#39; index of the Course.
Definition: course.cpp:125
Class for a course.
Definition: course.h:16
void setPrograms(std::vector< int >)
Sets the programs for which the Course is applicable.
Definition: course.cpp:55
std::vector< int > getPrograms()
Gets the indices of the programs of the Course.
Definition: course.cpp:111
void addClassroom(int)
Adds a classroom that is applicable to the Course.
Definition: course.cpp:71
void addProgram(int)
Adds a program that is applicable to the Course.
Definition: course.cpp:64
MinorType
Enum to represent the types of "Is Minor".
Definition: is_minor.h:16
int getInstructor()
Gets the instructor index of the Course.
Definition: course.cpp:104
void addSlot(int)
Adds a slot that is applicable to the Course.
Definition: course.cpp:78
bool operator==(const Course &other)
Checks if two Course objects are identical, i.e., if they represent the same Course.
Definition: course.cpp:88
int getSegment()
Gets the segment index of the Course.
Definition: course.cpp:118
unsigned getClassSize()
Gets the class size of the Course.
Definition: course.cpp:146
int getSlot()
Gets the &#39;slot&#39; index of the Course.
Definition: course.cpp:139
int getClassroom()
Gets the &#39;classroom&#39; index of the Course.
Definition: course.cpp:132
Course(std::string, unsigned, int, int, MinorType)
Constructs the Course object.
Definition: course.cpp:19