bpp-seq3  3.0.0
ProbabilisticSite.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_PROBABILISTICSITE_H
6 #define BPP_SEQ_PROBABILISTICSITE_H
7 
8 
9 #include "CoreSite.h"
11 
12 namespace bpp
13 {
25  public virtual CoreSiteInterface,
27 {
28 public:
30 
31 public:
32  virtual ProbabilisticSiteInterface* clone() const = 0;
33 };
34 
36  public virtual ProbabilisticSiteInterface,
37  public AbstractCoreSite,
38  public virtual ProbabilisticSymbolList // Diamond inheritance
39 {
40 public:
46  ProbabilisticSite(std::shared_ptr<const Alphabet>& alpha) :
49  {}
50 
51 
58  ProbabilisticSite(std::shared_ptr<const Alphabet>& alpha, int position) :
60  AbstractCoreSite(position)
61  {}
62 
63 
72  ProbabilisticSite(const Table<double>& site, std::shared_ptr<const Alphabet>& alpha) :
73  ProbabilisticSymbolList(site, alpha),
75  {}
76 
77 
87  ProbabilisticSite(const Table<double>& site, std::shared_ptr<const Alphabet>& alpha, int position) :
88  ProbabilisticSymbolList(site, alpha),
89  AbstractCoreSite(position)
90  {}
91 
92 
98  AbstractCoreSite(site)
99  {}
100 
101 
105  {}
106 
107 
112  {
115  return *this;
116  }
117 
119  {
122  return *this;
123  }
124 
130  ProbabilisticSite* clone() const { return new ProbabilisticSite(*this); }
131 
136  // class destructor
137  virtual ~ProbabilisticSite() {}
138 
139  double getStateValueAt(size_t sequencePosition, int state) const
140  {
141  if (sequencePosition >= size()) throw IndexOutOfBoundsException("ProbabilisticSites::getStateValueAt.", sequencePosition, 0, size() - 1);
142  return (*this)[sequencePosition][static_cast<size_t>(state)];
143  }
144 };
145 } // end of namespace bpp.
146 #endif // BPP_SEQ_PROBABILISTICSITE_H
A partial implementation of the CoreSite interface.
Definition: CoreSite.h:80
AbstractCoreSite & operator=(const CoreSiteInterface &site)
Definition: CoreSite.h:124
int getCoordinate() const override
Get the coordinate associated to this site.
Definition: CoreSite.h:144
The core site interface.
Definition: CoreSite.h:25
The ProbabilisticSite interface.
virtual ProbabilisticSiteInterface * clone() const =0
ProbabilisticSite(const Table< double > &site, std::shared_ptr< const Alphabet > &alpha)
Build a new ProbabilisticSite object with the specified alphabet. The content of the site is initiali...
ProbabilisticSite(std::shared_ptr< const Alphabet > &alpha)
Build a new void ProbabilisticSite object with the specified alphabet.
ProbabilisticSite(const ProbabilisticSite &site)
The copy constructor.
ProbabilisticSite & operator=(const ProbabilisticSiteInterface &site)
ProbabilisticSite & operator=(const ProbabilisticSite &site)
The assignment operator.
double getStateValueAt(size_t sequencePosition, int state) const
get value of a state at a position
ProbabilisticSite(std::shared_ptr< const Alphabet > &alpha, int position)
Build a new void ProbabilisticSite object with the specified alphabet and position.
ProbabilisticSite(const ProbabilisticSiteInterface &site)
ProbabilisticSite(const Table< double > &site, std::shared_ptr< const Alphabet > &alpha, int position)
Build a new ProbabilisticSite object with the specified alphabet and position. The content of the pro...
ProbabilisticSite * clone() const
The ProbabilisticSymbolList interface.
ProbabilisticSymbolList object.
ProbabilisticSymbolList & operator=(const ProbabilisticSymbolListInterface &list)
The generic assignment operator.
size_t size() const override
Get the number of elements in the list.
This alphabet is used to deal NumericAlphabet.