Table of Contents

Class Solver

Namespace
Nalu.Cassowary
Assembly
Nalu.Maui.Layouts.dll

The constraint solver class.

public class Solver
Inheritance
Solver
Inherited Members

Constructors

Solver()

Construct a new Solver.

public Solver()

Properties

MaxIterations

The max number of solver iterations before an error is thrown, in order to prevent infinite iteration. Default: 10,000.

public int MaxIterations { get; set; }

Property Value

int

Methods

AddConstraint(Constraint)

Add a constraint to the solver.

public void AddConstraint(Constraint constraint)

Parameters

constraint Constraint

Constraint to add to the solver

AddConstraints(params Constraint[])

Add multiple constraints to the solver.

public void AddConstraints(params Constraint[] constraints)

Parameters

constraints Constraint[]

AddEditVariable(Variable, double)

Add an edit variable to the solver.

public void AddEditVariable(Variable variable, double strength)

Parameters

variable Variable

Edit variable to add to the solver

strength double

Strength, should be less than Strength.Required

FetchChanges()

Updates the variables.

public void FetchChanges()

GetConstraints()

Get an array of the current constraints.

public IEnumerable<Constraint> GetConstraints()

Returns

IEnumerable<Constraint>

Array of constraints

HasConstraint(Constraint)

Test whether the solver contains the constraint.

public bool HasConstraint(Constraint constraint)

Parameters

constraint Constraint

Constraint to test for

Returns

bool

True or false

HasEditVariable(Variable)

Test whether the solver contains the edit variable.

public bool HasEditVariable(Variable variable)

Parameters

variable Variable

Edit variable to test for

Returns

bool

True or false

RemoveConstraint(Constraint)

Remove a constraint from the solver.

public void RemoveConstraint(Constraint constraint)

Parameters

constraint Constraint

Constraint to remove from the solver

RemoveEditVariable(Variable)

Remove an edit variable from the solver.

public void RemoveEditVariable(Variable variable)

Parameters

variable Variable

Edit variable to remove from the solver

SuggestValue(Variable, double)

Suggest the value of an edit variable.

public void SuggestValue(Variable variable, double value)

Parameters

variable Variable

Edit variable to suggest a value for

value double

Suggested value

UpdateVariables()

Update the values of the variables.

public void UpdateVariables()