bpp-seq3  3.0.0
IntegerAlphabet.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_SEQ_ALPHABET_INTEGERALPHABET_H
6 #define BPP_SEQ_ALPHABET_INTEGERALPHABET_H
7 
8 
9 #include "AbstractAlphabet.h"
10 #include <Bpp/Text/TextTools.h>
11 
12 namespace bpp
13 {
20  public AbstractAlphabet
21 {
22 private:
23  unsigned int MAX_;
24 
25 public:
26  // class constructor
27  IntegerAlphabet(unsigned int max);
28 
30 
32  {
34  MAX_ = bia.MAX_;
35 
36  return *this;
37  }
38 
40  {
41  return new IntegerAlphabet(*this);
42  }
43  // class destructor
44  virtual ~IntegerAlphabet() {}
45 
46 public:
47  unsigned int getSize() const { return MAX_; }
48 
49  unsigned int getNumberOfTypes() const { return MAX_ + 1; }
50 
51  std::string getAlphabetType() const { return "Integer(N=" + TextTools::toString(MAX_) + ")"; }
52 
53  int getUnknownCharacterCode() const { return static_cast<int>(MAX_); }
54 
55  bool isUnresolved(int state) const { return state == static_cast<int>(MAX_); }
56 
57  bool isUnresolved(const std::string& state) const { return state == "-" or state == "?"; }
58 };
59 } // end of namespace bpp.
60 #endif // BPP_SEQ_ALPHABET_INTEGERALPHABET_H
A partial implementation of the Alphabet interface.
AbstractAlphabet & operator=(const AbstractAlphabet &alph)
The Integer Alphabet class, letters are from 0 to a given number, MAX.
IntegerAlphabet(unsigned int max)
unsigned int getNumberOfTypes() const
Get the number of distinct states in alphabet (e.g. return 15 for DNA alphabet). This is the number o...
int getUnknownCharacterCode() const
bool isUnresolved(int state) const
bool isUnresolved(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)....
std::string getAlphabetType() const
Identification method.
IntegerAlphabet(const IntegerAlphabet &bia)
IntegerAlphabet * clone() const
IntegerAlphabet & operator=(const IntegerAlphabet &bia)
std::string toString(T t)
This alphabet is used to deal NumericAlphabet.