#include "GoodSupport.h"
#include "DebugAI.h"

GoodSupport::GoodSupport(void){
	name = GOOD_SUPPORT;
	begin = 30;
	end = 50;
}

GoodSupport::~GoodSupport(void)
{
}
GoodSupport::GoodSupport(Support* aFuzzyNumber){
	fuzzyNumber = aFuzzyNumber;
	fuzzyNumber->addFV(this);
	name = GOOD_SUPPORT;
	begin = 30;
	end = 50;
}
void GoodSupport::update(){
	if (this->getFuzzyNumberValue()>= 0 && this->getFuzzyNumberValue()<begin){
		setValue(0);
	}
	if (this->getFuzzyNumberValue()>= end && this->getFuzzyNumberValue()<=100){
		setValue(1);
	}
	if (this->getFuzzyNumberValue()> 100||this->getFuzzyNumberValue()<0){
		//If the execution go here they must have a problem.
		setValue(-1);
	}
	if (this->getFuzzyNumberValue()>= begin && this->getFuzzyNumberValue()<end){
		setValue((this->getFuzzyNumberValue() * (1/(end-begin))) - (begin/(end-begin)));
	}
	DebugAI::trace('v', toString());
}

void GoodSupport::setBegin(float aBegin){
	begin = aBegin;
}

void GoodSupport::setEnd(float aEnd){
	end = aEnd;
}