More cleanup and BList -> BObjectList.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38742 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -32,8 +32,9 @@ class BALMLayout;
|
|||||||
* Rectangular area in the GUI, defined by a tab on each side.
|
* Rectangular area in the GUI, defined by a tab on each side.
|
||||||
*/
|
*/
|
||||||
class Area {
|
class Area {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
~Area();
|
||||||
|
|
||||||
XTab* Left() const;
|
XTab* Left() const;
|
||||||
void SetLeft(XTab* left);
|
void SetLeft(XTab* left);
|
||||||
XTab* Right() const;
|
XTab* Right() const;
|
||||||
@@ -71,7 +72,8 @@ public:
|
|||||||
BAlignment Alignment() const;
|
BAlignment Alignment() const;
|
||||||
void SetAlignment(BAlignment alignment);
|
void SetAlignment(BAlignment alignment);
|
||||||
void SetHorizontalAlignment(alignment horizontal);
|
void SetHorizontalAlignment(alignment horizontal);
|
||||||
void SetVerticalAlignment(vertical_alignment vertical);
|
void SetVerticalAlignment(
|
||||||
|
vertical_alignment vertical);
|
||||||
|
|
||||||
int32 LeftInset() const;
|
int32 LeftInset() const;
|
||||||
void SetLeftInset(int32 left);
|
void SetLeftInset(int32 left);
|
||||||
@@ -93,8 +95,6 @@ public:
|
|||||||
Constraint* HasSameHeightAs(Area* area);
|
Constraint* HasSameHeightAs(Area* area);
|
||||||
BList* HasSameSizeAs(Area* area);
|
BList* HasSameSizeAs(Area* area);
|
||||||
|
|
||||||
~Area();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Area(BALMLayout* ls, XTab* left, YTab* top,
|
Area(BALMLayout* ls, XTab* left, YTab* top,
|
||||||
XTab* right, YTab* bottom,
|
XTab* right, YTab* bottom,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* Copyright 2007-2008, James Kim, [email protected]
|
* Copyright 2007-2008, James Kim, [email protected]
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef BALM_LAYOUT_H
|
#ifndef BALM_LAYOUT_H
|
||||||
#define BALM_LAYOUT_H
|
#define BALM_LAYOUT_H
|
||||||
|
|
||||||
@@ -14,14 +13,13 @@
|
|||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
|
#include "Area.h"
|
||||||
|
#include "Column.h"
|
||||||
#include "LayoutStyleType.h"
|
#include "LayoutStyleType.h"
|
||||||
|
#include "LinearSpec.h"
|
||||||
|
#include "Row.h"
|
||||||
#include "XTab.h"
|
#include "XTab.h"
|
||||||
#include "YTab.h"
|
#include "YTab.h"
|
||||||
#include "Area.h"
|
|
||||||
#include "Row.h"
|
|
||||||
#include "Column.h"
|
|
||||||
#include "Constraint.h"
|
|
||||||
#include "LinearSpec.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace BALM {
|
namespace BALM {
|
||||||
@@ -30,7 +28,6 @@ namespace BALM {
|
|||||||
* A GUI layout engine using the ALM.
|
* A GUI layout engine using the ALM.
|
||||||
*/
|
*/
|
||||||
class BALMLayout : public BAbstractLayout, public LinearSpec {
|
class BALMLayout : public BAbstractLayout, public LinearSpec {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BALMLayout();
|
BALMLayout();
|
||||||
void SolveLayout();
|
void SolveLayout();
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ typedef BObjectList<Constraint> ConstraintList;
|
|||||||
} // namespace LinearProgramming
|
} // namespace LinearProgramming
|
||||||
|
|
||||||
using LinearProgramming::Constraint;
|
using LinearProgramming::Constraint;
|
||||||
|
using LinearProgramming::ConstraintList;
|
||||||
|
|
||||||
#endif // CONSTRAINT_H
|
#endif // CONSTRAINT_H
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
#include "Constraint.h"
|
#include "Constraint.h"
|
||||||
|
|
||||||
#include "OperatorType.h"
|
#include "OperatorType.h"
|
||||||
#include "OptimizationType.h"
|
#include "OptimizationType.h"
|
||||||
#include "PenaltyFunction.h"
|
#include "PenaltyFunction.h"
|
||||||
@@ -25,14 +24,9 @@
|
|||||||
|
|
||||||
#include "lp_lib.h"
|
#include "lp_lib.h"
|
||||||
|
|
||||||
|
|
||||||
namespace LinearProgramming {
|
namespace LinearProgramming {
|
||||||
|
|
||||||
class Constraint;
|
|
||||||
class ObjFunctionSummand;
|
|
||||||
class PenaltyFunction;
|
|
||||||
class Variable;
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Specification of a linear programming problem.
|
* Specification of a linear programming problem.
|
||||||
*/
|
*/
|
||||||
@@ -106,8 +100,8 @@ public:
|
|||||||
void GetString(BString& string) const;
|
void GetString(BString& string) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BList* Variables() const;
|
VariableList* Variables() const;
|
||||||
BList* Constraints() const;
|
ConstraintList* Constraints() const;
|
||||||
|
|
||||||
int32 fCountColumns;
|
int32 fCountColumns;
|
||||||
|
|
||||||
@@ -116,8 +110,8 @@ private:
|
|||||||
OptimizationType fOptimization;
|
OptimizationType fOptimization;
|
||||||
lprec* fLP;
|
lprec* fLP;
|
||||||
SummandList* fObjFunction;
|
SummandList* fObjFunction;
|
||||||
BList fVariables;
|
VariableList fVariables;
|
||||||
BList fConstraints;
|
ConstraintList fConstraints;
|
||||||
ResultType fResult;
|
ResultType fResult;
|
||||||
double fObjectiveValue;
|
double fObjectiveValue;
|
||||||
double fSolvingTime;
|
double fSolvingTime;
|
||||||
|
|||||||
@@ -76,8 +76,13 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef BObjectList<Variable> VariableList;
|
||||||
|
|
||||||
|
|
||||||
} // namespace LinearProgramming
|
} // namespace LinearProgramming
|
||||||
|
|
||||||
using LinearProgramming::Variable;
|
using LinearProgramming::Variable;
|
||||||
|
using LinearProgramming::VariableList;
|
||||||
|
|
||||||
#endif // VARIABLE_H
|
#endif // VARIABLE_H
|
||||||
|
|||||||
@@ -542,10 +542,10 @@ LinearSpec::SetOptimization(OptimizationType value)
|
|||||||
*
|
*
|
||||||
* @return the variables
|
* @return the variables
|
||||||
*/
|
*/
|
||||||
BList*
|
VariableList*
|
||||||
LinearSpec::Variables() const
|
LinearSpec::Variables() const
|
||||||
{
|
{
|
||||||
return const_cast<BList*>(&fVariables);
|
return const_cast<VariableList*>(&fVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -554,10 +554,10 @@ LinearSpec::Variables() const
|
|||||||
*
|
*
|
||||||
* @return the constraints
|
* @return the constraints
|
||||||
*/
|
*/
|
||||||
BList*
|
ConstraintList*
|
||||||
LinearSpec::Constraints() const
|
LinearSpec::Constraints() const
|
||||||
{
|
{
|
||||||
return const_cast<BList*>(&fConstraints);
|
return const_cast<ConstraintList*>(&fConstraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -289,11 +289,10 @@ Variable::Invalidate()
|
|||||||
fLS->Variables()->RemoveItem(this);
|
fLS->Variables()->RemoveItem(this);
|
||||||
|
|
||||||
// invalidate all constraints that use this variable
|
// invalidate all constraints that use this variable
|
||||||
BList markedForInvalidation;
|
ConstraintList markedForInvalidation;
|
||||||
BList* constraints = fLS->Constraints();
|
ConstraintList* constraints = fLS->Constraints();
|
||||||
for (int i = 0; i < constraints->CountItems(); i++) {
|
for (int i = 0; i < constraints->CountItems(); i++) {
|
||||||
Constraint* constraint = static_cast<Constraint*>(
|
Constraint* constraint = constraints->ItemAt(i);
|
||||||
constraints->ItemAt(i));
|
|
||||||
|
|
||||||
if (!constraint->IsValid())
|
if (!constraint->IsValid())
|
||||||
continue;
|
continue;
|
||||||
@@ -308,8 +307,7 @@ Variable::Invalidate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < markedForInvalidation.CountItems(); i++)
|
for (int i = 0; i < markedForInvalidation.CountItems(); i++)
|
||||||
static_cast<Constraint*>(markedForInvalidation.ItemAt(i))
|
markedForInvalidation.ItemAt(i)->Invalidate();
|
||||||
->Invalidate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user