xref: /haiku/headers/libs/linprog/Summand.h (revision 68ea01249e1e2088933cb12f9c28d4e5c5d1c9ef)
1 /*
2  * Copyright 2007-2008, Christof Lutteroth, lutteroth@cs.auckland.ac.nz
3  * Copyright 2007-2008, James Kim, jkim202@ec.auckland.ac.nz
4  * Distributed under the terms of the MIT License.
5  */
6 #ifndef	SUMMAND_H
7 #define	SUMMAND_H
8 
9 #include <ObjectList.h>
10 
11 
12 namespace LinearProgramming {
13 
14 class LinearSpec;
15 class Variable;
16 
17 /**
18  * A summand of a linear term.
19  */
20 class Summand {
21 public:
22 								Summand(Summand* summand);
23 								Summand(double coeff, Variable* var);
24 								~Summand();
25 
26 			double				Coeff();
27 			void				SetCoeff(double coeff);
28 			Variable*			Var();
29 			void				SetVar(Variable* var);
30 
31 			int32				VariableIndex();
32 private:
33 			double				fCoeff;
34 			Variable*			fVar;
35 };
36 
37 typedef BObjectList<Summand> SummandList;
38 
39 }	// namespace LinearProgramming
40 
41 using LinearProgramming::Summand;
42 using LinearProgramming::SummandList;
43 
44 
45 #endif	// OBJ_FUNCTION_SUMMAND_H
46 
47