/* 
 * Tactic is the legal property of its developers, whose names are too numerous 
 * to list here.  Please refer to the COPYRIGHT file distributed with this 
 * source distribution. 
 * 
 * This library is free software; you can redistribute it and/or 
 * modify it under the terms of the GNU Lesser General Public 
 * License as published by the Free Software Foundation; either 
 * version 2.1 of the License, or (at your option) any later version. 
 * 
 * This library is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
 * Lesser General Public License for more details. 
 * 
 * You should have received a copy of the GNU Lesser General Public 
 * License along with this library; if not, write to the Free Software 
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
 *
 * See README for more informations
 *
 * FuzzyNumber.cpp
 *
 * Date 18/03/06
 *
 */

#include "FuzzyNumber.h"

using namespace std;
	
FuzzyNumber::FuzzyNumber(void){
	name = ABSTRACT_FUZZY_NUMBER;
	value = -1;
}

FuzzyNumber::~FuzzyNumber(void){}

void FuzzyNumber::setVect(std::vector<FuzzyValue*> vect){
	vectFV = vect;
}

void FuzzyNumber::addFV(FuzzyValue* ptFv){
	vectFV.push_back(ptFv);
}

FuzzyNumberName FuzzyNumber::getName(void){
	return name;
}

float FuzzyNumber::getValue(void){
	return value;
}

void FuzzyNumber::update(void){
	cout << '\t' << "Error : FuzzyNumber not created" << '\n';
}

void FuzzyNumber::notify(void){
	for(int i=0; i<vectFV.size(); i++){
		vectFV.at(i)->update();
	}
}

std::string FuzzyNumber::toString(void){
	std::string res;
	res += "FuzzyNumber ";
	res += Converter::convert(this->name);
	res += " = ";
	res += Converter::floatToString(this->getValue());
	res += '\n';
	res += '\t';
	res += "associated with :";
	res += '\n';
	for(int i=0; i<vectFV.size(); i++){
		res += '\t';
		res += '\t';
		res += vectFV.at(i)->toString();
		res += '\n';
	}
	res += '\n';
	return res;
}
