-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPeriod.cpp
More file actions
28 lines (21 loc) · 817 Bytes
/
Copy pathPeriod.cpp
File metadata and controls
28 lines (21 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "Period.h"
using namespace std;
int
Period::getClashes(const DataTuplesRaw& tuples)
{
int clashes = 0;
vector<int>::iterator it1, it2;
for (it1 = _tuplesIDs.begin(); it1 != _tuplesIDs.end(); ++it1) {
const DataTupleRaw* first = tuples.get(*it1);
for (it2 = it1 + 1; it2 != _tuplesIDs.end(); ++it2) {
const DataTupleRaw* second = tuples.get(*it2);
if (first->classID == second->classID)
clashes++;
if (first->roomID == second->roomID)
clashes++;
if (first->teacherID == second->teacherID)
clashes++;
}
}
return clashes;
}