The Fib multimedia system
Fib is a system for storing multimedia data (like images or films).
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cInequation.h
Go to the documentation of this file.
1 /**
2  * @file cInequation
3  * file name: cInequation.h
4  * @author Betti Oesterholz
5  * @date 09.06.2010
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This header specifies a class for a inequiation.
11  * Copyright (C) @c GPL3 2010 Betti Oesterholz
12  *
13  * This program is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License (GPL) as
15  * published by the Free Software Foundation, either version 3 of the
16  * License, or any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program. If not, see <http://www.gnu.org/licenses/>.
25  *
26  *
27  * This header specifies a class for a inequiation.
28  * The inequiation has the form:
29  * constant <= vecFactors[0] * x_0 + ... + vecFactors[n] * x_n
30  *
31  * The elements are:
32  * - constant: a constant for the inequiation
33  * - vecFactors[i]: the factors for the inequiation
34  * - x_i: variables for the inequiation, theas are not given explicite
35  *
36  * You can give the factors identifiers to relate them to other formulars.
37  */
38 /*
39 History:
40 09.06.2010 Oesterholz created
41 26.01.2011 Oesterholz method evalue() added
42 03.04.2011 Oesterholz method evalueValue() added
43 */
44 
45 #ifndef ___C_INEQUATION_H__
46 #define ___C_INEQUATION_H__
47 
48 #include "version.h"
49 
50 #include <vector>
51 #include <ostream>
52 
53 using namespace std;
54 
55 
56 namespace fib{
57 
58 namespace algorithms{
59 
60 namespace nLinearInequation{
61 
62 
63 template <class tFactors>
65 public:
66 
67  /**
68  * The constant factor for the inequiation.
69  */
70  tFactors constant;
71 
72  /**
73  * The factors for the inequiation.
74  */
75  vector< tFactors > vecFactors;
76 
77  /**
78  * This vector contains the identifiers for the factors.
79  * It should contain exactly the same number of elements as
80  * @see vecFactors, so the i'th element is the i'th identifier for
81  * the i'th factor in vecFactors.
82  *
83  * @see vecFactors
84  */
85  vector< long > vecIdentifiers;
86 
87 
88  /**
89  * standardconstructor
90  */
91  cInequation();
92 
93  /**
94  * This method print the inequiation in a readebel form to the given
95  * output stream outputSream.
96  *
97  * @param outputSream the stream wher to print this inequiation to
98  */
99  void print( ostream & outputStream ) const;
100 
101  /**
102  * This method evalues the inequiation for the given values.
103  * constant <= vecFactors[0] * vecValues[0] + ... + vecFactors[n] * vecValues[n]
104  *
105  * @return true if the inequiation is true for the values, else false
106  */
107  bool evalue( const vector< tFactors > & vecValues ) const;
108 
109  /**
110  * This method evalues the inequiation for the given values.
111  * constant <= vecFactors[0] * vecValues[0] + ... + vecFactors[n] * vecValues[n]
112  *
113  * @return vecFactors[0] * vecValues[0] + ... + vecFactors[n] * vecValues[n] - constant;
114  * if the value is negativ the inequiation is not fulfilled, else it is
115  * fulfilled
116  */
117  tFactors evalueValue( const vector< tFactors > & vecValues ) const;
118 
119  /**
120  * @return true if the given inequiation is the same as this inequiation,
121  * else false;
122  * two inequiations are the same, if all factors and the constant of
123  * one inequiation multiplyed ba a fixed constant are the same to
124  * the other inequiation
125  */
126  bool sameInequiation( const cInequation< tFactors > & inequiation ) const;
127 
128  /**
129  * @return true if the given inequiation is the same as this inequiation
130  * except that the constant (or operator) sign is switched, else false;
131  * two inequiations are the same, if all factors and the constant of
132  * one inequiation multiplyed ba a fixed constant are the same to
133  * the other inequiation
134  */
135  bool antiInequiation( const cInequation< tFactors > & inequiation ) const;
136 
137  /**
138  * @return true if the inequiation is fulfilled for all values, else false
139  */
140  bool isTrue() const;
141 
142  /**
143  * @return true if the inequiation is not fulfilled for all values
144  */
145  bool isFalse() const;
146 
147 };
148 
149 
150 };//end namespace nLinearInequation
151 };//end namespace algorithms
152 };//end namespace fib
153 
154 //include template implementation
155 #include "../src/cInequation.cpp"
156 
157 
158 #endif //___C_INEQUATION_H__