Commit 1340937a authored by Alexis Lebis's avatar Alexis Lebis

new mutation

parent adedcb1e
......@@ -232,8 +232,8 @@ bool Course::_duplicataProtection(std::vector<std::pair<Competency,double>> *tea
bool Course::_lazyEquality(const Course & c) const
{
return (this->_id == c.id() &&
this->_name.compare(c.name()) == 0 &&
return ( (this->_id == c.id() ||
this->_name.compare(c.name()) == 0 ) &&
this->_ects == c.ects()
);
}
......@@ -298,4 +298,25 @@ int Course::assignID4TMP()
}
return ++COURSE_TMP_COUNTER;
}
/** It produces a new vector, which is another view of courses in param, sorted by TF
* Duplicates the behaviour of CSDVP::_makeCoursesSortedByTF() except that it applies to any vector of courses
* size of timeFrames must be equal to the maximal TF value in courses.timeFrames !
*/
std::vector<std::vector<Course>> Course::organiseByTF(std::vector<Course> courses, std::vector<int> timeFrames)
{
std::vector<std::vector<Course>> coursesByTF(timeFrames.size());
int tmpIdx;
for(int i = 0; i < courses.size(); i++)
{
for(int j = 0; j < courses.at(i).timeFrame().size(); j++)
{
tmpIdx = courses.at(i).timeFrame().at(j) - timeFrames.at(0);
coursesByTF.at(tmpIdx).push_back(courses.at(i));
}
}
return coursesByTF;
}
// === END STATIC
\ No newline at end of file
......@@ -67,6 +67,8 @@ class Course
static Course build(int ects = 0, std::string name = "");
static Course buildTMP(int ects = 0, std::string name = "");
static std::vector<std::vector<Course>> organiseByTF(std::vector<Course> courses, std::vector<int> timeFrames);
/// Default constructor. Use Course::build instead !
Course() = default;
......@@ -75,6 +77,7 @@ class Course
const std::string name() const{return this->_name;};
const int ects() const{return this->_ects;}
const std::vector<Competency> prerequisites() const {return this->_prerequisites;}
std::vector<Competency>& unlocked_prerequisites() {return this->_prerequisites;}
const std::vector<int> timeFrame() const {return this->_temporalAvailability;}
const std::vector<std::pair<Competency, double>> teachedCompetenciesWeighted() const{return this->_weightedTeached;}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment