xref: /haiku/src/libs/linprog/Summand.cpp (revision bc3955fea5b07e2e94a27fc05e4bb58fe6f0319b)
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 
7 #include "Summand.h"
8 #include "Variable.h"
9 #include "LinearSpec.h"
10 
11 
12 /**
13  * Gets the summmand's coefficient.
14  *
15  * @return the summand's coefficient
16  */
17 double
18 Summand::Coeff()
19 {
20 	return fCoeff;
21 }
22 
23 
24 /**
25  * Sets the summmand's coefficient.
26  *
27  * @param coeff	coefficient
28  */
29 void
30 Summand::SetCoeff(double coeff)
31 {
32 	fCoeff = coeff;
33 }
34 
35 
36 /**
37  * Gets the summand's variable.
38  *
39  * @return the summand's variable
40  */
41 Variable*
42 Summand::Var()
43 {
44 	return fVar;
45 }
46 
47 
48 /**
49  * Sets the summand's variable.
50  *
51  * @param var	variable
52  */
53 void
54 Summand::SetVar(Variable* var)
55 {
56 	fVar = var;
57 }
58 
59 
60 /**
61  * Destructor.
62  */
63 Summand::~Summand()
64 {
65 }
66 
67 
68 /**
69  * Constructor.
70  */
71 Summand::Summand(double coeff, Variable* var)
72 {
73 	fCoeff = coeff;
74 	fVar = var;
75 }
76 
77