24 for (
size_t i = 0; i < size; ++i)
32 pdd_(na.pdd_->clone()),
54 catch (std::bad_cast&)
56 throw Exception(
"NumericAlphabet::setState. Incorrect alphabet type.");
69 catch (std::bad_cast&)
71 throw Exception(
"NumericAlphabet::registerState. Incorrect alphabet type.");
113 return static_cast<unsigned int>(
values_.size());
118 return static_cast<unsigned int>(
values_.size());
125 for (
size_t pos = 0; pos <
getSize(); pos++)
A partial implementation of the Alphabet interface.
virtual AlphabetState & getStateAt(size_t stateIndex)
Get a state at a position in the alphabet_ vector.
AbstractAlphabet & operator=(const AbstractAlphabet &alph)
const AlphabetState & getState(const std::string &letter) const
Get a state by its letter.
virtual void setState(size_t pos, AlphabetState *st)
Set a state in the Alphabet.
virtual void registerState(AlphabetState *st)
Add a state to the Alphabet.
void remap()
Re-update the maps using the alphabet_ vector content.
double getUpperBound() const
Vdouble getCategories() const
double getValueCategory(double value) const
size_t getNumberOfCategories() const
double getLowerBound() const
States that do have a double value.
double getValue() const
Get the state value.
This is the base class to describe states in an Alphabet.
double intToValue(int state) const
Returns the value for the character number.
NumericAlphabet & operator=(const NumericAlphabet &)
double getDelta() const
Returns the difference between successive values.
bool containsGap(const std::string &state) const
unsigned int getSize() const
Get the number of resolved states in the alphabet (e.g. return 4 for DNA alphabet)....
const UniformDiscreteDistribution * pdd_
AlphabetNumericState & getStateAt(size_t stateIndex)
Get a state at a position in the alphabet_ vector.
std::map< double, size_t > values_
void setState(size_t pos, AlphabetState *st)
Set a state in the Alphabet.
void registerState(AlphabetState *st)
Add a state to the Alphabet.
void remap()
Re-update the maps.
bool isUnresolved(int state) const
size_t getValueIndex(double value) const
Returns the CategoryIndex of the category to which the value belongs.
unsigned int getNumberOfTypes() const
Get the number of distinct states in alphabet (e.g. return 15 for DNA alphabet). This is the number o...
std::vector< int > getAlias(int state) const
Get all resolved states that match a generic state.
NumericAlphabet(const UniformDiscreteDistribution &)
bool isGap(int state) const
std::string toString(T t)
This alphabet is used to deal NumericAlphabet.
std::vector< double > Vdouble