Victor
 All Data Structures Functions Variables Friends Pages
AGPFunction.h
1 /* This file is part of Victor.
2 
3  Victor is free software: you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation, either version 3 of the License, or
6  (at your option) any later version.
7 
8  Victor is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with Victor. If not, see <http://www.gnu.org/licenses/>.
15  */
16 #ifndef __AGPFunction_H__
17 #define __AGPFunction_H__
18 
19 #include <GapFunction.h>
20 
21 namespace Victor { namespace Align2{
22 
26  class AGPFunction : public GapFunction {
27  public:
28 
29  // CONSTRUCTORS:
30 
32 
33  AGPFunction() : o(12.00), e(3.00) {
34  }
35 
37 
38  AGPFunction(double o, double e) : o(o), e(e) {
39  }
40 
42 
43  AGPFunction(const AGPFunction &orig) : GapFunction(orig) {
44  copy(orig);
45  }
46 
48 
49  virtual ~AGPFunction() {
50  }
51 
52 
53  // OPERATORS:
54 
56  AGPFunction& operator =(const AGPFunction &orig);
57 
58 
59  // PREDICATES:
60 
62  virtual double getOpenPenalty(int p);
63 
65  virtual double getExtensionPenalty(int p);
66 
67 
68  // MODIFIERS:
69 
71  virtual void copy(const AGPFunction &orig);
72 
74  virtual AGPFunction* newCopy();
75 
77  virtual void setOpenPenalty(double pen);
78 
80  virtual void setExtensionPenalty(double pen);
81 
82 
83  protected:
84 
85 
86  private:
87 
88  // ATTRIBUTES:
89 
90  double o;
91  double e;
92 
93  };
94 
95  // -----------------------------------------------------------------------------
96  // AGPFunction
97  // -----------------------------------------------------------------------------
98 
99  // OPERATORS:
100 
101  inline AGPFunction&
103  if (&orig != this)
104  copy(orig);
105  POSTCOND((orig == *this), exception);
106  return *this;
107  }
108 
109 
110  // PREDICATES:
111 
112  inline double
114  return o;
115  }
116 
117  inline double
119  return e;
120  }
121 
122 
123  // MODIFIERS:
124 
125  inline void
127  GapFunction::copy(orig);
128  o = orig.o;
129  e = orig.e;
130  }
131 
132  inline AGPFunction*
134  AGPFunction *tmp = new AGPFunction(*this);
135  return tmp;
136  }
137 
138  inline void
140  o = pen;
141  }
142 
143  inline void
145  e = pen;
146  }
147 
148 }} // namespace
149 
150 #endif
Base class for gap functions.
Definition: GapFunction.h:31
AGPFunction(const AGPFunction &orig)
Copy constructor.
Definition: AGPFunction.h:43
virtual void setExtensionPenalty(double pen)
Set extension gap penalty.
Definition: AGPFunction.h:144
virtual void setOpenPenalty(double pen)
Set open gap penalty.
Definition: AGPFunction.h:139
AGPFunction()
Default constructor.
Definition: AGPFunction.h:33
virtual double getOpenPenalty(int p)
Return open gap penalty for template position p.
Definition: AGPFunction.h:113
Implement AGP (Affine Gap Penalty) function.
Definition: AGPFunction.h:26
AGPFunction(double o, double e)
Constructor assigning o and e.
Definition: AGPFunction.h:38
AGPFunction & operator=(const AGPFunction &orig)
Assignment operator.
Definition: AGPFunction.h:102
virtual void copy(const AGPFunction &orig)
Copy orig object to this object ("deep copy").
Definition: AGPFunction.h:126
virtual ~AGPFunction()
Destructor.
Definition: AGPFunction.h:49
virtual double getExtensionPenalty(int p)
Return extension gap penalty for template position p.
Definition: AGPFunction.h:118
virtual AGPFunction * newCopy()
Construct a new "deep copy" of this object.
Definition: AGPFunction.h:133
virtual void copy(const GapFunction &orig)
Copy orig object to this object ("deep copy").
Definition: GapFunction.h:108