#include "boundary_check.h"


bool is_it_higher_than_learned_boundary(Sensor* sensor, int score, int boundary) {
	return (sensor->get_sensorValue() > sensor->get_learned_threshold(score, boundary));
}

bool is_it_higher_than_hardcoded_boundary(Sensor* sensor, int score, int boundary) {
	return (sensor->get_sensorValue() > sensor->get_hardcoded_threshold(score, boundary));
}

bool is_it_lower_than_learned_boundary(Sensor* sensor, int score, int boundary) {
	return (sensor->get_sensorValue() < sensor->get_learned_threshold(score, boundary));
}

bool is_it_lower_than_hardcoded_boundary(Sensor* sensor, int score, int boundary) {
	return (sensor->get_sensorValue() < sensor->get_hardcoded_threshold(score, boundary));
}

bool is_it_higher_than_boundary(Sensor* sensor, int score, int boundary) {
	if(sensor->get_flag_learned_boundary_exist(score, boundary)) {
		return is_it_higher_than_learned_boundary(sensor, score, boundary);
	}
	else {
		return is_it_higher_than_hardcoded_boundary(sensor, score, boundary);
	}
}

bool is_it_lower_than_boundary(Sensor* sensor, int score, int boundary) {
	if(sensor->get_flag_learned_boundary_exist(score, boundary)) {
		return is_it_lower_than_learned_boundary(sensor, score, boundary);
	}
	else {
		return is_it_lower_than_hardcoded_boundary(sensor, score, boundary);
	}
}