Solves cassowary constraints.

Typically clients will create a solver, addConstraints, and then call flushUpdates to actually solve the constraints.

Constructors

Solver()

Properties

hashCode int

Get a hash code for this object.

read-only, inherited
runtimeType Type

A representation of the runtime type of the object.

read-only, inherited

Operators

operator ==(other) bool

The equality operator.

inherited

Methods

addConstraint(Constraint constraint) Result

Attempts to add an individual Constraint to the solver.

addConstraints(List<Constraint> constraints) Result

Attempts to add the constraints in the list to the solver. If it cannot add any for some reason, a cleanup is attempted so that either all constraints will be added or none.

addEditVariable(Variable variable, double priority) Result

Attempt to add a single edit Variable to the Solver at the given priority. No edit variables may be added to the Solver at Priority.required.

addEditVariables(List<Variable> variables, double priority) Result

Adds a list of edit Variables to the Solver at a given priority. Either all edit Variable are added or none. No edit variables may be added at Priority.required.

flushUpdates() Set

Flush the results of solver. The set of all context objects associated with variables in the Solver is returned. If a Variable does not contain an associated context, its updates are ignored.

hasConstraint(Constraint constraint) bool

Returns whether the given Constraint is present in the solver.

hasEditVariable(Variable variable) bool

Returns whether the given edit Variable is present in the solver.

removeConstraint(Constraint constraint) Result

Attempt to remove an individual Constraint from the solver.

removeConstraints(List<Constraint> constraints) Result

Attempts to remove a list of constraints from the solver. Either all constraints are removed or none. If more fine-grained control over the removal is required (for example, not failing on removal of constraints not already present in the solver), try removing the each Constraint individually and check the result on each attempt.

removeEditVariable(Variable variable) Result

Attempt to remove the specified edit Variable from the solver.

removeEditVariables(List<Variable> variables) Result

Attempt the remove the list of edit Variable from the solver. Either all the specified edit variables are removed or none.

suggestValueForVariable(Variable variable, double value) Result

Suggest an updated value for the edit variable. The edit variable must already be added to the solver.

toString() String

Returns a string representation of this object.

noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited