COPASI API  4.16.103
CNormalProduct.h
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/compareExpressions/CNormalProduct.h,v $
3 // $Revision: 1.9 $
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_CNormalProduct_H__
19 #define COPASI_CNormalProduct_H__
20 
21 #include <set>
22 #include <string>
23 
25 
26 class CNormalItem;
27 class CNormalItemPower;
28 class CNormalSum;
29 class CNormalLcm;
30 class CNormalFunction;
32 class CNormalChoice;
33 
35  {
36  public:
37  bool operator()(const CNormalItemPower* itemPower1, const CNormalItemPower* itemPower2);
38  };
39 
40 /**
41  * The class for products used in CNormal
42  */
44  {
45  private:
46  /**
47  * Enumeration of members
48  */
50  std::set<CNormalItemPower*, compareItemPowers > mItemPowers;
51 
52  public:
53 
54  /**
55  * Default constructor
56  */
58 
59  /**
60  * Copy contructor
61  */
62  CNormalProduct(const CNormalProduct& src);
63 
64  virtual CNormalBase * copy() const;
65 
66  /**
67  * Assignment operator
68  */
70 
71  /**
72  * Smaller operator
73  */
74  bool operator<(const CNormalProduct& rhs) const;
75 
76  /**
77  * Destructor
78  */
79  virtual ~CNormalProduct();
80 
81  /**
82  * Set the factor for this product.
83  * @return true.
84  */
85  bool setFactor(const C_FLOAT64& number);
86 
87  /**
88  * Multiply this product with a number.
89  * @return true.
90  */
91  bool multiply(const C_FLOAT64& number);
92 
93  /**
94  * Multiply an item to this product.
95  * @return true.
96  */
97  bool multiply(const CNormalItem& item);
98 
99  /**
100  * Multiply a function to this product.
101  * @return true.
102  */
103  bool multiply(const CNormalFunction& fun);
104 
105  /**
106  * Multiply a function to this product.
107  * @return true.
108  */
109  bool multiply(const CNormalChoice& choice);
110 
111  /**
112  * Multiply a general power to this product.
113  * @return true.
114  */
115  bool multiply(const CNormalGeneralPower& pow);
116 
117  /**
118  * Multiply an itempower to this product.
119  * @return true.
120  */
121  bool multiply(const CNormalItemPower& itemPower);
122 
123  /**
124  * Multiply a list of itempowers to this product.
125  * @return true.
126  */
127  bool multiply(const std::set <CNormalItemPower*, compareItemPowers >& itemPowers);
128 
129  /**
130  * Remove an itempower from this product, provided it is a factor of it.
131  * @return true.
132  */
133  bool remove(std::set<CNormalItemPower*, compareItemPowers >::iterator it);
134 
135  /**
136  * Remove an itempower from this product, provided it is a factor of it.
137  * -used in multiplication with lcm-
138  * @return true.
139  */
140  bool remove(const CNormalItemPower& itemPower);
141 
142  /**
143  * Multiply this product with another product.
144  * @return true
145  */
146  bool multiply(const CNormalProduct& product);
147 
148  /**
149  * Multiply this product with a sum NOT CONTAINING FRACTIONS!.
150  * @return sum.
151  */
152  CNormalSum* multiply(const CNormalSum& sum);
153 
154  /**
155  * Multiply this product with a lcm.
156  * @return true
157  */
158  const CNormalSum* multiply(const CNormalLcm& lcm);
159 
160  /**
161  * Retrieve the factor of this product.
162  * @return mFactor.
163  */
164  const C_FLOAT64 & getFactor() const;
165 
166  /**
167  * Retrieve the set of itempowers of this product.
168  * @return mItemPowers.
169  */
170  const std::set <CNormalItemPower*, compareItemPowers >& getItemPowers() const;
171 
172  /**
173  * Sets the item powers of this product.
174  */
175  void setItemPowers(const std::set<CNormalItemPower*, compareItemPowers>& set);
176 
177  bool checkSamePowerList(const CNormalProduct & rhs) const;
178 
179  bool operator==(const CNormalProduct & rhs) const;
180 
181  virtual std::string toString() const;
182 
183  virtual bool simplify();
184 
186 
187  void setDenominatorsOne();
188 
189  /**
190  * Returns a product that is 1.
191  * In this case it only creates a new product instance with new.
192  */
194 
195  friend std::ostream & operator<< (std::ostream &os,
196  const CNormalProduct & d);
197  };
198 
199 #endif // COPASI_CNormalProduct_H__
friend std::ostream & operator<<(std::ostream &os, const CNormalProduct &d)
C_FLOAT64 mFactor
static CNormalProduct * createUnitProduct()
virtual std::string toString() const
virtual bool simplify()
CNormalGeneralPower * getDenominator() const
std::set< CNormalItemPower *, compareItemPowers > mItemPowers
virtual ~CNormalProduct()
const std::set< CNormalItemPower *, compareItemPowers > & getItemPowers() const
bool operator<(const CNormalProduct &rhs) const
bool setFactor(const C_FLOAT64 &number)
virtual CNormalBase * copy() const
const C_FLOAT64 & getFactor() const
bool checkSamePowerList(const CNormalProduct &rhs) const
void setItemPowers(const std::set< CNormalItemPower *, compareItemPowers > &set)
CNormalProduct & operator=(const CNormalProduct &src)
#define C_FLOAT64
Definition: copasi.h:92
bool operator()(const CNormalItemPower *itemPower1, const CNormalItemPower *itemPower2)
bool multiply(const C_FLOAT64 &number)
bool operator==(const CNormalProduct &rhs) const