Init version
This commit is contained in:
39
DEC_GUI/DEC-0.0/individual/genome/Gene.cpp
Normal file
39
DEC_GUI/DEC-0.0/individual/genome/Gene.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "Gene.h"
|
||||
#include <iostream>
|
||||
|
||||
Gene::Gene(idType _ID, std::string _name, float value):
|
||||
ID(_ID), name(_name), geneValueCont(value), geneType(Continious)
|
||||
{}
|
||||
|
||||
Gene::Gene(idType _ID, std::string _name, int value):
|
||||
ID(_ID), name(_name), geneValueDiscr(value), geneType(Discrete)
|
||||
{}
|
||||
|
||||
Gene::Gene(idType _ID, std::string _name, std::string _seq):
|
||||
ID(_ID), name(_name), sequence(_seq), geneType(Sequence)
|
||||
{}
|
||||
|
||||
void Gene::setGeneValue(float _value){
|
||||
if(this->geneType == Continious){
|
||||
this->geneValueCont = _value;
|
||||
return;
|
||||
}
|
||||
/*throw*/std::cerr<<"Gene.cpp(17) Warning: can't assign float value to discrete Gene\n";
|
||||
}
|
||||
|
||||
void Gene::setGeneValue(int _value){
|
||||
if(this->geneType == Discrete){
|
||||
this->geneValueDiscr = _value;
|
||||
return;
|
||||
}
|
||||
/*throw*/std::cerr<<"Gene.cpp(25) Warning: can't assign int value to continious Gene\n";
|
||||
}
|
||||
|
||||
void Gene::setGeneValue(std::string _seq){
|
||||
if(this->geneType == Sequence){
|
||||
this->sequence = _seq;
|
||||
return;
|
||||
}
|
||||
/*throw*/std::cerr<<"Gene.cpp(37) Warning: can't assign numerical value to sequence Gene\n";
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user