LinearSystem
class LinearSystem
Represents and solves a system of linear equations.
Summary
Constants |
|
|---|---|
const Boolean |
DEBUG = false |
const Boolean |
FULL_DEBUG = false |
Public constructors |
|---|
Public functions |
|
|---|---|
Unit |
addCenterPoint(Add the equations constraining a widget center to another widget center, positioned on a circle, following an angle and radius |
Unit |
addCentering(Add an equation of the form (1 - bias) * (a - b) = bias * (c - d) |
Unit |
addConstraint(row: ArrayRow!)Add the equation to the system |
Unit |
addEquality(a: SolverVariable!, value: Int)Add an equation of the form a = value |
ArrayRow! |
addEquality(a: SolverVariable!, b: SolverVariable!, margin: Int, strength: Int)Add an equation of the form a = b + margin |
Unit |
addGreaterBarrier( |
Unit |
addGreaterThan(Add an equation of the form a >= b + margin |
Unit |
addLowerBarrier( |
Unit |
addLowerThan(Add an equation of the form a <= b + margin |
Unit |
addRatio( |
Unit |
addSynonym(a: SolverVariable!, b: SolverVariable!, margin: Int) |
SolverVariable! |
createErrorVariable(strength: Int, prefix: String!) |
SolverVariable! |
|
SolverVariable! |
createObjectVariable(anchor: Any!) |
ArrayRow! |
|
java-static ArrayRow! |
createRowDimensionPercent(Create a constraint to express A = C * percent |
SolverVariable! |
|
Unit |
|
Unit |
|
Unit |
fillMetrics(metrics: Metrics!) |
Cache! |
getCache() |
Int |
|
java-static Metrics! |
|
Int |
|
Int |
|
Int |
getObjectVariableValue(object: Any!) |
Unit |
minimize()Minimize the current goal of the system. |
Unit |
|
Unit |
reset()Reset the LinearSystem object so that it can be reused. |
Public properties |
|
|---|---|
java-static Long |
|
java-static Long |
|
java-static Boolean |
|
java-static Boolean |
|
java-static Boolean |
|
java-static Boolean |
|
java-static Boolean |
|
java-static Boolean |
|
Boolean |
|
Boolean |
|
Boolean |
|
java-static Metrics! |
Constants
Public constructors
Public functions
addCenterPoint
fun addCenterPoint(
widget: ConstraintWidget!,
target: ConstraintWidget!,
angle: Float,
radius: Int
): Unit
Add the equations constraining a widget center to another widget center, positioned on a circle, following an angle and radius
addCentering
fun addCentering(
a: SolverVariable!,
b: SolverVariable!,
m1: Int,
bias: Float,
c: SolverVariable!,
d: SolverVariable!,
m2: Int,
strength: Int
): Unit
Add an equation of the form (1 - bias) * (a - b) = bias * (c - d)
| Parameters | |
|---|---|
a: SolverVariable! |
variable a |
b: SolverVariable! |
variable b |
m1: Int |
margin 1 |
bias: Float |
bias between ab - cd |
c: SolverVariable! |
variable c |
d: SolverVariable! |
variable d |
m2: Int |
margin 2 |
strength: Int |
strength used |
addConstraint
fun addConstraint(row: ArrayRow!): Unit
Add the equation to the system
| Parameters | |
|---|---|
row: ArrayRow! |
the equation we want to add expressed as a system row. |
addEquality
fun addEquality(a: SolverVariable!, value: Int): Unit
Add an equation of the form a = value
| Parameters | |
|---|---|
a: SolverVariable! |
variable a |
value: Int |
the value we set |
addEquality
fun addEquality(a: SolverVariable!, b: SolverVariable!, margin: Int, strength: Int): ArrayRow!
Add an equation of the form a = b + margin
| Parameters | |
|---|---|
a: SolverVariable! |
variable a |
b: SolverVariable! |
variable b |
margin: Int |
margin used |
strength: Int |
strength used |
addGreaterBarrier
fun addGreaterBarrier(
a: SolverVariable!,
b: SolverVariable!,
margin: Int,
hasMatchConstraintWidgets: Boolean
): Unit
addGreaterThan
fun addGreaterThan(
a: SolverVariable!,
b: SolverVariable!,
margin: Int,
strength: Int
): Unit
Add an equation of the form a >= b + margin
| Parameters | |
|---|---|
a: SolverVariable! |
variable a |
b: SolverVariable! |
variable b |
margin: Int |
margin |
strength: Int |
strength used |
addLowerBarrier
fun addLowerBarrier(
a: SolverVariable!,
b: SolverVariable!,
margin: Int,
hasMatchConstraintWidgets: Boolean
): Unit
addLowerThan
fun addLowerThan(
a: SolverVariable!,
b: SolverVariable!,
margin: Int,
strength: Int
): Unit
Add an equation of the form a <= b + margin
| Parameters | |
|---|---|
a: SolverVariable! |
variable a |
b: SolverVariable! |
variable b |
margin: Int |
margin |
strength: Int |
strength used |
addRatio
fun addRatio(
a: SolverVariable!,
b: SolverVariable!,
c: SolverVariable!,
d: SolverVariable!,
ratio: Float,
strength: Int
): Unit
createErrorVariable
fun createErrorVariable(strength: Int, prefix: String!): SolverVariable!
createRowDimensionPercent
java-static fun createRowDimensionPercent(
linearSystem: LinearSystem!,
variableA: SolverVariable!,
variableC: SolverVariable!,
percent: Float
): ArrayRow!
Create a constraint to express A = C * percent
| Parameters | |
|---|---|
linearSystem: LinearSystem! |
the system we create the row on |
variableA: SolverVariable! |
variable a |
variableC: SolverVariable! |
variable c |
percent: Float |
the percent used |
| Returns | |
|---|---|
ArrayRow! |
the created row |
minimize
fun minimize(): Unit
Minimize the current goal of the system.
| Throws | |
|---|---|
java.lang.Exception |