Example #1
0
bool Task::isEqualTo(Task another){
	if (another.getDone() != _done){
		return false;
	}	
	switch(another.getType()){

	case FLOATING_TASK:
		return another.getTitle() == _title
			&& another.getType() == _type;
		break;
	case DEADLINE_TASK:
		return another.getTitle() == _title
			&& another.getEnd().compareTo(_end) == 0
			&& another.getType() == _type;
		break;
	case TIMED_TASK:
		return another.getTitle() == _title
			&& another.getStart().compareTo(_start) == 0
			&& another.getEnd().compareTo(_end) == 0
			&& another.getType() == _type;
		break;
	default:
		return false;
		break;
	}
	return false;
}
Example #2
0
bool Task::isClashingWith(Task another){
	bool startClash = false;
	bool endClash = false;
	bool spanClash = false;

	if(another.getStart().compareTo(_start) >= 0 && another.getStart().compareTo(_end) < 0)
		startClash = true;

	if(another.getEnd().compareTo(_start) > 0 && another.getEnd().compareTo(_end) <= 0)
		endClash = true;

	if(another.getStart().compareTo(_start) <= 0 && another.getEnd().compareTo(_end) >= 0)
		spanClash = true;

	return startClash || endClash || spanClash;
}
Example #3
0
bool Task::operator<(Task& a){
	
	if(a.getType() == TIMED_TASK)
		return (_start.compareTo(a.getStart()) < 0);
	else if(a.getType() == DEADLINE_TASK)
		return (_end.compareTo(a.getEnd()) < 0);
	else
		return false;
}