module
Cassowary::Operand
Overview
Provides the arithmetic operators that build an Expression and the comparison
operators that build a Constraint.
Included by Variable, Term and Expression. Number accepts operands on its right side too.
x = Variable.new("x")
y = Variable.new("y")
2 * x + y / 2 - 10 # => Expression
x + 10 <= y # => Constraint
NOTE #== builds a constraint, so it does not test equality, and #!= does not compile.
Use same? to compare variables.
Direct including types
Defined in:
cassowary/operand.crInstance Method Summary
-
#!=(other : Operand | Number) : NoReturn
Fails to compile: an inequation is not a linear constraint, and
#!=would otherwise negate aConstraintintofalse. -
#*(other : Number) : Expression
Returns this operand multiplied by other.
-
#+(other : Operand) : Expression
Returns the sum of this operand and other.
-
#+(other : Number) : Expression
Returns the sum of this operand and other.
-
#-(other : Operand) : Expression
Returns the difference of this operand and other.
-
#-(other : Number) : Expression
Returns the difference of this operand and other.
-
#- : Expression
Returns the negation of this operand.
-
#/(other : Number) : Expression
Returns this operand divided by other.
-
#<=(other : Operand | Number) : Constraint
Returns a required constraint that this operand is at most other.
-
#==(other : Operand | Number) : Constraint
Returns a required constraint that this operand equals other.
-
#>=(other : Operand | Number) : Constraint
Returns a required constraint that this operand is at least other.
-
#to_expression : Expression
Returns this operand as an expression.
Instance Method Detail
Fails to compile: an inequation is not a linear constraint, and #!= would otherwise
negate a Constraint into false. Use same? to compare variables.
Returns the difference of this operand and other.
Returns the difference of this operand and other.
Returns a required constraint that this operand is at most other.
Returns a required constraint that this operand equals other.
Returns a required constraint that this operand is at least other.