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(
    widget: ConstraintWidget!,
    target: ConstraintWidget!,
    angle: Float,
    radius: Int
)

Add the equations constraining a widget center to another widget center, positioned on a circle, following an angle and radius

Unit
addCentering(
    a: SolverVariable!,
    b: SolverVariable!,
    m1: Int,
    bias: Float,
    c: SolverVariable!,
    d: SolverVariable!,
    m2: Int,
    strength: Int
)

Add an equation of the form (1 - bias) * (a - b) = bias * (c - d)

Unit

Add the equation to the system

Unit

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(
    a: SolverVariable!,
    b: SolverVariable!,
    margin: Int,
    hasMatchConstraintWidgets: Boolean
)
Unit
addGreaterThan(
    a: SolverVariable!,
    b: SolverVariable!,
    margin: Int,
    strength: Int
)

Add an equation of the form a >= b + margin

Unit
addLowerBarrier(
    a: SolverVariable!,
    b: SolverVariable!,
    margin: Int,
    hasMatchConstraintWidgets: Boolean
)
Unit
addLowerThan(
    a: SolverVariable!,
    b: SolverVariable!,
    margin: Int,
    strength: Int
)

Add an equation of the form a <= b + margin

Unit
addRatio(
    a: SolverVariable!,
    b: SolverVariable!,
    c: SolverVariable!,
    d: SolverVariable!,
    ratio: Float,
    strength: Int
)
Unit
SolverVariable!
createErrorVariable(strength: Int, prefix: String!)
SolverVariable!
SolverVariable!
ArrayRow!
java-static ArrayRow!
createRowDimensionPercent(
    linearSystem: LinearSystem!,
    variableA: SolverVariable!,
    variableC: SolverVariable!,
    percent: Float
)

Create a constraint to express A = C * percent

SolverVariable!
Unit
Unit
Unit
fillMetrics(metrics: Metrics!)
Cache!
Int
java-static Metrics!
Int
Int
Int
Unit

Minimize the current goal of the system.

Unit
Unit

Reset the LinearSystem object so that it can be reused.

Constants

DEBUG

Added in 1.1.0-alpha13
const val DEBUG = false: Boolean

FULL_DEBUG

Added in 1.1.0-alpha13
const val FULL_DEBUG = false: Boolean

Public constructors

LinearSystem

Added in 1.1.0-alpha13
LinearSystem()

Public functions

addCenterPoint

Added in 1.1.0-alpha13
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

Parameters
angle: Float

from 0 to 360

radius: Int

the distance between the two centers

addCentering

Added in 1.1.0-alpha13
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

Added in 1.1.0-alpha13
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

Added in 1.1.0-alpha13
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

Added in 1.1.0-alpha13
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

Added in 1.1.0-alpha13
fun addGreaterBarrier(
    a: SolverVariable!,
    b: SolverVariable!,
    margin: Int,
    hasMatchConstraintWidgets: Boolean
): Unit

addGreaterThan

Added in 1.1.0-alpha13
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

Added in 1.1.0-alpha13
fun addLowerBarrier(
    a: SolverVariable!,
    b: SolverVariable!,
    margin: Int,
    hasMatchConstraintWidgets: Boolean
): Unit

addLowerThan

Added in 1.1.0-alpha13
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

Added in 1.1.0-alpha13
fun addRatio(
    a: SolverVariable!,
    b: SolverVariable!,
    c: SolverVariable!,
    d: SolverVariable!,
    ratio: Float,
    strength: Int
): Unit

addSynonym

Added in 1.1.0-alpha13
fun addSynonym(a: SolverVariable!, b: SolverVariable!, margin: Int): Unit

createErrorVariable

Added in 1.1.0-alpha13
fun createErrorVariable(strength: Int, prefix: String!): SolverVariable!

createExtraVariable

Added in 1.1.0-alpha13
fun createExtraVariable(): SolverVariable!

createObjectVariable

Added in 1.1.0-alpha13
fun createObjectVariable(anchor: Any!): SolverVariable!

createRow

Added in 1.1.0-alpha13
fun createRow(): ArrayRow!

createRowDimensionPercent

Added in 1.1.0-alpha13
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

createSlackVariable

Added in 1.1.0-alpha13
fun createSlackVariable(): SolverVariable!

displayReadableRows

Added in 1.1.0-alpha13
fun displayReadableRows(): Unit

displayVariablesReadableRows

Added in 1.1.0-alpha13
fun displayVariablesReadableRows(): Unit

fillMetrics

Added in 1.1.0-alpha13
fun fillMetrics(metrics: Metrics!): Unit

getCache

Added in 1.1.0-alpha13
fun getCache(): Cache!

getMemoryUsed

Added in 1.1.0-alpha13
fun getMemoryUsed(): Int

getMetrics

Added in 1.1.0-alpha13
java-static fun getMetrics(): Metrics!

getNumEquations

Added in 1.1.0-alpha13
fun getNumEquations(): Int

getNumVariables

Added in 1.1.0-alpha13
fun getNumVariables(): Int

getObjectVariableValue

Added in 1.1.0-alpha13
fun getObjectVariableValue(object: Any!): Int

minimize

Added in 1.1.0-alpha13
fun minimize(): Unit

Minimize the current goal of the system.

removeRow

Added in 1.1.0-alpha13
fun removeRow(row: ArrayRow!): Unit

reset

Added in 1.1.0-alpha13
fun reset(): Unit

Reset the LinearSystem object so that it can be reused.

Public properties

ARRAY_ROW_CREATION

Added in 1.1.0-alpha13
java-static val ARRAY_ROW_CREATIONLong

OPTIMIZED_ARRAY_ROW_CREATION

Added in 1.1.0-alpha13
java-static val OPTIMIZED_ARRAY_ROW_CREATIONLong

OPTIMIZED_ENGINE

Added in 1.1.0-alpha13
java-static val OPTIMIZED_ENGINEBoolean

SIMPLIFY_SYNONYMS

Added in 1.1.0-alpha13
java-static val SIMPLIFY_SYNONYMSBoolean

SKIP_COLUMNS

Added in 1.1.0-alpha13
java-static val SKIP_COLUMNSBoolean

USE_BASIC_SYNONYMS

Added in 1.1.0-alpha13
java-static val USE_BASIC_SYNONYMSBoolean

USE_DEPENDENCY_ORDERING

Added in 1.1.0-alpha13
java-static val USE_DEPENDENCY_ORDERINGBoolean

USE_SYNONYMS

Added in 1.1.0-alpha13
java-static val USE_SYNONYMSBoolean

graphOptimizer

Added in 1.1.0-alpha13
val graphOptimizerBoolean

hasSimpleDefinition

Added in 1.1.0-alpha13
val hasSimpleDefinitionBoolean

newgraphOptimizer

Added in 1.1.0-alpha13
val newgraphOptimizerBoolean

sMetrics

Added in 1.1.0-alpha13
java-static val sMetricsMetrics!