Remove unused fOwner variable. Cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38740 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler 2010-09-20 05:42:31 +00:00
parent aa519a9e14
commit 0401a9c712
5 changed files with 36 additions and 54 deletions

View File

@ -62,9 +62,6 @@ public:
Variable* DNeg() const;
Variable* DPos() const;
void SetOwner(void* owner);
void* Owner() const;
bool IsValid();
void Invalidate();
@ -85,7 +82,6 @@ private:
double fRightSide;
Summand* fDNegObjSummand;
Summand* fDPosObjSummand;
void* fOwner;
BString fLabel;
bool fIsValid;

View File

@ -339,40 +339,41 @@ Constraint::SetLabel(const char* label)
void
Constraint::WriteXML(BFile* file)
{
if (file->IsWritable() && fOwner == NULL) {
char buffer[200];
if (!file->IsWritable())
return;
file->Write(buffer, sprintf(buffer, "\t<constraint>\n"));
file->Write(buffer, sprintf(buffer, "\t\t<leftside>\n"));
char buffer[200];
Summand* summand;
for (int32 i = 0; i < fLeftSide->CountItems(); i++) {
summand = (Summand*)fLeftSide->ItemAt(i);
file->Write(buffer, sprintf(buffer, "\t\t\t<summand>\n"));
file->Write(buffer, sprintf(buffer, "\t\t\t\t<coeff>%f</coeff>\n",
summand->Coeff()));
BString varStr = *(summand->Var());
file->Write(buffer, sprintf(buffer, "\t\t\t\t<var>%s</var>\n",
varStr.String()));
file->Write(buffer, sprintf(buffer, "\t\t\t</summand>\n"));
}
file->Write(buffer, sprintf(buffer, "\t<constraint>\n"));
file->Write(buffer, sprintf(buffer, "\t\t<leftside>\n"));
file->Write(buffer, sprintf(buffer, "\t\t</leftside>\n"));
const char* op = "??";
if (fOp == OperatorType(EQ))
op = "EQ";
else if (fOp == OperatorType(LE))
op = "LE";
else if (fOp == OperatorType(GE))
op = "GE";
file->Write(buffer, sprintf(buffer, "\t\t<op>%s</op>\n", op));
file->Write(buffer, sprintf(buffer, "\t\t<rightside>%f</rightside>\n", fRightSide));
//~ file->Write(buffer, sprintf(buffer, "\t\t<penaltyneg>%s</penaltyneg>\n", PenaltyNeg()));
//~ file->Write(buffer, sprintf(buffer, "\t\t<penaltypos>%s</penaltypos>\n", PenaltyPos()));
file->Write(buffer, sprintf(buffer, "\t</constraint>\n"));
Summand* summand;
for (int32 i = 0; i < fLeftSide->CountItems(); i++) {
summand = (Summand*)fLeftSide->ItemAt(i);
file->Write(buffer, sprintf(buffer, "\t\t\t<summand>\n"));
file->Write(buffer, sprintf(buffer, "\t\t\t\t<coeff>%f</coeff>\n",
summand->Coeff()));
BString varStr = *(summand->Var());
file->Write(buffer, sprintf(buffer, "\t\t\t\t<var>%s</var>\n",
varStr.String()));
file->Write(buffer, sprintf(buffer, "\t\t\t</summand>\n"));
}
file->Write(buffer, sprintf(buffer, "\t\t</leftside>\n"));
const char* op = "??";
if (fOp == OperatorType(EQ))
op = "EQ";
else if (fOp == OperatorType(LE))
op = "LE";
else if (fOp == OperatorType(GE))
op = "GE";
file->Write(buffer, sprintf(buffer, "\t\t<op>%s</op>\n", op));
file->Write(buffer, sprintf(buffer, "\t\t<rightside>%f</rightside>\n", fRightSide));
//~ file->Write(buffer, sprintf(buffer, "\t\t<penaltyneg>%s</penaltyneg>\n", PenaltyNeg()));
//~ file->Write(buffer, sprintf(buffer, "\t\t<penaltypos>%s</penaltypos>\n", PenaltyPos()));
file->Write(buffer, sprintf(buffer, "\t</constraint>\n"));
}
@ -404,20 +405,6 @@ Constraint::DPos() const
}
void
Constraint::SetOwner(void* owner)
{
fOwner = owner;
}
void*
Constraint::Owner() const
{
return fOwner;
}
bool
Constraint::IsValid()
{
@ -497,11 +484,11 @@ Constraint::GetString(BString& string) const
*/
Constraint::Constraint(LinearSpec* ls, BList* summands, OperatorType op,
double rightSide, double penaltyNeg, double penaltyPos)
: fLS(ls),
:
fLS(ls),
fLeftSide(summands),
fOp(op),
fRightSide(rightSide),
fOwner(NULL),
fIsValid(true)
{
double coeffs[summands->CountItems() + 2];

View File

@ -12,7 +12,8 @@
* Creates a new specification for a linear programming problem.
*/
LinearSpec::LinearSpec()
: fCountColumns(0),
:
fCountColumns(0),
fLpPresolved(NULL),
fOptimization(MINIMIZE),
fObjFunction(new BList()),

View File

@ -4,9 +4,9 @@
* Distributed under the terms of the MIT License.
*/
#include "LinearSpec.h"
#include "Summand.h"
#include "Variable.h"
#include "LinearSpec.h"
/**
@ -76,4 +76,3 @@ Summand::Summand(double coeff, Variable* var)
fUsedInPenaltyFunction = false;
fVar->fUsingSummands.AddItem(this);
}

View File

@ -319,7 +319,6 @@ Variable::Invalidate()
Variable::Variable(LinearSpec* ls)
:
fLS(ls),
fValue(NAN),
fMin(0),
fMax(DBL_MAX),