Files
DEC/individual/genome/Gene.cpp
2024-10-03 18:43:04 +07:00

39 lines
1.1 KiB
C++

#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";
}