-
Notifications
You must be signed in to change notification settings - Fork 0
/
TemporalEdge.cpp
47 lines (37 loc) · 1.11 KB
/
TemporalEdge.cpp
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
#include <stdlib.h>
#include "TemporalEdge.h"
TemporalEdge::TemporalEdge(int isDestId, int isStartTime){
destId = isDestId;
interval = new Interval(isStartTime);
}
bool TemporalEdge::isValid(int start, int end){
Interval *temp1 = new Interval(start,end);
Interval *temp2 = interval->intersection(temp1);
bool answer = false;
if (temp2) answer = true;
free(temp1);
free(temp2);
return answer;
}
int TemporalEdge::getEndTime(){
return interval->getEndTime();
}
int TemporalEdge::getStartTime(){
return interval->getStartTime();
}
int TemporalEdge::getDestId(){
return destId;
}
void TemporalEdge::setEndTime(int isEndTime){
interval->setEndTime(isEndTime);
}
Interval* TemporalEdge::getInterval(){
return interval;
}
bool TemporalEdge::operator <( const TemporalEdge &rhs ) const{
if ( destId < rhs.destId ) return true;
if ((destId == rhs.destId)&&(interval->getStartTime() < rhs.interval->getStartTime())) return true;
if ((destId == rhs.destId)&&(interval->getStartTime() == rhs.interval->getStartTime())&&(interval->getEndTime() < rhs.interval->getEndTime())) return true;
return false;
}