COPASI API  4.16.103
CNormalFraction.h
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/compareExpressions/CNormalFraction.h,v $
3 // $Revision: 1.10 $
4 // $Name: $
5 // $Author: gauges $
6 // $Date: 2008/07/07 18:26:49 $
7 // End CVS Header
8 
9 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
11 // and The University of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc. and EML Research, gGmbH.
16 // All rights reserved.
17 
18 #ifndef COPASI_CNormalFraction_H__
19 #define COPASI_CNormalFraction_H__
20 
21 #include <string>
22 
23 #include "copasi/copasi.h"
25 
26 class CNormalSum;
27 class CNormalItemPower;
28 class CNormalLcm;
29 
30 //class CNormalLogical;
31 
33  {
34  private:
35  /**
36  * Enumeration of members
37  */
40 
41  public:
42  /**
43  * Default constructor
44  */
46 
47  /**
48  * Copy contructor
49  */
50  CNormalFraction(const CNormalFraction& src);
51 
52  /**
53  * Assignment operator
54  */
56 
57  /**
58  * smaller operator
59  */
60  bool operator<(const CNormalFraction& src) const;
61 
62  virtual CNormalBase * copy() const;
63 
64  /**
65  * Dtor.
66  */
67  virtual ~CNormalFraction();
68 
69  /**
70  * Set numerator of this fraction
71  * @return true.
72  */
73  bool setNumerator(const CNormalSum& numerator);
74 
75  /**
76  * Set denominator of this fraction.
77  * @return true.
78  */
79  bool setDenominator(const CNormalSum& denominator);
80 
81  /**
82  * Check if the numerator of this fraction equals 1.
83  * @return bool
84  */
85  bool checkNumeratorOne() const;
86 
87  /**
88  * Check if the denominator of this fraction equals 1.
89  * @return bool
90  */
91  bool checkDenominatorOne() const;
92 
93  /**
94  * Set the denominator of this fraction equal 1.
95  * @return true.
96  */
97  bool setDenominatorOne();
98 
99  /**
100  * Retrieve the numerator of this fraction.
101  * @return mpNumerator.
102  */
104 
105  /**
106  * Retrieve the denominator of this fraction.
107  * @return mpDenominator.
108  */
110 
111  /**
112  * Retrieve the numerator of this fraction.
113  * @return mpNumerator.
114  */
115  const CNormalSum& getNumerator() const;
116 
117  /**
118  * Retrieve the denominator of this fraction.
119  * @return mpDenominator.
120  */
121  const CNormalSum& getDenominator() const;
122 
123  /**
124  * Check if this fraction contains further fractions.
125  * @return bool.
126  */
127  bool checkForFractions() const;
128 
129  /**
130  * Expand this fraction by a lcm.
131  * @return true.
132  */
133  bool expand(const CNormalLcm& lcm);
134 
135  /**
136  * Cancel common items of mpNumerator and mpDenominator.
137  * @return true.
138  */
139  bool cancel();
140 
141  /**
142  * Multiply this fraction with a number.
143  * @return true.
144  */
145  bool multiply(const C_FLOAT64& number);
146 
147  /**
148  * Multiply a fraction with an itempower.
149  * @return true.
150  */
151  bool multiply(const CNormalItemPower& itemPower);
152 
153  /**
154  * Find lcm of denominators of respective fractions contained in this fraction.
155  * @return pointer to lcm.
156  */
157  const CNormalLcm* findLcm() const;
158 
159  /**
160  * Multiply this fraction by a lcm.
161  * @return CNormalSum*, pointer to result of multiplication ie. a normal sum.
162  * This fraction is useless now.
163  */
164  const CNormalSum* multiply(CNormalLcm lcm);
165 
166  /**
167  * Check if numerator and denominator contain fractions,
168  * find lcm of respective denominators, expand this fraction by lcm and cancel.
169  * @return true
170  */
171  virtual bool simplify();
172 
173  bool operator==(const CNormalFraction & rhs) const;
174 
175  virtual std::string toString() const;
176 
177  //std::set<const CNormalLogical*> findLogicals() const;
178 
179  bool checkIsOne() const;
180 
181  bool checkIsZero() const;
182 
183  /**
184  * Returns a fraction that is 1/1.
185  * It creates a new fraction and sets the numerator and the denominator to
186  * a unit sum.
187  */
189  };
190 
191 std::ostream & operator<< (std::ostream &os, const CNormalFraction & d);
192 
193 #endif // COPASI_CNormalFraction_decl__
virtual bool simplify()
CNormalSum & getNumerator()
bool checkIsOne() const
bool multiply(const C_FLOAT64 &number)
bool checkForFractions() const
virtual CNormalBase * copy() const
bool checkNumeratorOne() const
bool operator<(const CNormalFraction &src) const
bool operator==(const CNormalFraction &rhs) const
virtual ~CNormalFraction()
static CNormalFraction * createUnitFraction()
CNormalFraction & operator=(const CNormalFraction &src)
CNormalSum * mpNumerator
CNormalSum & getDenominator()
bool setDenominator(const CNormalSum &denominator)
bool checkIsZero() const
bool checkDenominatorOne() const
CNormalSum * mpDenominator
bool setNumerator(const CNormalSum &numerator)
virtual std::string toString() const
#define C_FLOAT64
Definition: copasi.h:92
std::ostream & operator<<(std::ostream &os, const CNormalFraction &d)
const CNormalLcm * findLcm() const
bool expand(const CNormalLcm &lcm)