Init version
This commit is contained in:
31
individual/Trait.cpp
Normal file
31
individual/Trait.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "Trait.h"
|
||||
#include <iostream>
|
||||
|
||||
//Trait::Trait(const Trait& _t)
|
||||
//{
|
||||
// *this = _t;
|
||||
//}
|
||||
|
||||
Trait::Trait(Trait::idType _ID, std::string _name, float value):
|
||||
ID(_ID), name(_name), traitValueCont(value), traitType(Continious)
|
||||
{}
|
||||
|
||||
Trait::Trait(Trait::idType _ID, std::string _name, int value):
|
||||
ID(_ID), name(_name), traitValueDiscr(value), traitType(Discrete)
|
||||
{}
|
||||
|
||||
void Trait::setTraitValue(float _value){
|
||||
if(this->traitType == Continious){
|
||||
this->traitValueCont = _value;
|
||||
return;
|
||||
}
|
||||
/*throw*/std::cerr<<"Trait.cpp(17) Warning: can't assign float value to discrete trait\n";
|
||||
}
|
||||
|
||||
void Trait::setTraitValue(int _value){
|
||||
if(this->traitType == Discrete){
|
||||
this->traitValueDiscr = _value;
|
||||
return;
|
||||
}
|
||||
/*throw*/std::cerr<<"Trait.cpp(25) Warning: can't assign int value to continious trait\n";
|
||||
}
|
||||
Reference in New Issue
Block a user