bpp-seq  2.2.0
DefaultAlphabet.h
Go to the documentation of this file.
1 //
2 // File: DefaultAlphabet.h
3 // Author: Julien Dutheil
4 //
5 
6 /*
7  Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
8 
9  This software is a computer program whose purpose is to provide classes
10  for sequences analysis.
11 
12  This software is governed by the CeCILL license under French law and
13  abiding by the rules of distribution of free software. You can use,
14  modify and/ or redistribute the software under the terms of the CeCILL
15  license as circulated by CEA, CNRS and INRIA at the following URL
16  "http://www.cecill.info".
17 
18  As a counterpart to the access to the source code and rights to copy,
19  modify and redistribute granted by the license, users are provided only
20  with a limited warranty and the software's author, the holder of the
21  economic rights, and the successive licensors have only limited
22  liability.
23 
24  In this respect, the user's attention is drawn to the risks associated
25  with loading, using, modifying and/or developing or reproducing the
26  software by the user in light of its specific status of free software,
27  that may mean that it is complicated to manipulate, and that also
28  therefore means that it is reserved for developers and experienced
29  professionals having in-depth computer knowledge. Users are therefore
30  encouraged to load and test the software's suitability as regards their
31  requirements in conditions enabling the security of their systems and/or
32  data to be ensured and, more generally, to use and operate it in the
33  same conditions as regards security.
34 
35  The fact that you are presently reading this means that you have had
36  knowledge of the CeCILL license and that you accept its terms.
37 */
38 
39 #ifndef _DEFAULTALPHABET_H_
40 #define _DEFAULTALPHABET_H_
41 
42 #include "LetterAlphabet.h"
43 #include <Bpp/Text/TextTools.h>
44 
45 namespace bpp
46 {
47 
55  public LetterAlphabet
56  {
57  protected:
58  void registerState(AlphabetState* st) throw (Exception) {
60  }
61  std::string chars_;
62 
63  public:
64  // class constructor
66 
68 
70  {
72  chars_=bia.chars_;
73  return *this;
74  }
75 
77  {
78  return new DefaultAlphabet(*this);
79  }
80 
81 
82 
83  // class destructor
84  virtual ~DefaultAlphabet() {}
85 
86  public:
87  unsigned int getSize() const { return 26; }
88  unsigned int getNumberOfTypes() const { return 27; }
89  std::string getAlphabetType() const { return "Default alphabet"; }
90  int getUnknownCharacterCode() const { return 37; }
91  bool isUnresolved(int state) const { return state == 37; }
92  bool isUnresolved(const std::string& state) const { return false; }
93 
94  };
95 
96 } //end of namespace bpp.
97 
98 #endif // _DEFAULTALPHABET_H_
99 
LetterAlphabet & operator=(const LetterAlphabet &bia)
This is the base class to describe states in an Alphabet.
Definition: AlphabetState.h:54
int getUnknownCharacterCode() const
DefaultAlphabet & operator=(const DefaultAlphabet &bia)
This alphabet is used to deal NumericAlphabet.
unsigned int getNumberOfTypes() const
Get the number of distinct states in alphabet (e.g. return 15 for DNA alphabet). This is the number o...
DefaultAlphabet * clone() const
std::string getAlphabetType() const
Identification method.
Specialized partial implementation of Alphabet using single letters.
unsigned int getSize() const
Get the number of resolved states in the alphabet (e.g. return 4 for DNA alphabet). This is the method you&#39;ll need in most cases.
The DefaultAlphabet class.
DefaultAlphabet(const DefaultAlphabet &bia)
bool isUnresolved(const std::string &state) const
void registerState(AlphabetState *st)
Add a state to the Alphabet.
bool isUnresolved(int state) const
virtual void registerState(AlphabetState *st)
Add a state to the Alphabet.