Module: Cassowary::Equalities

Included in:
LinearExpression, Variable, Numeric
Defined in:
lib/utils/equalities.rb

Instance Method Summary collapse

Instance Method Details

#cn_equal(expr, strength = Strength::RequiredStrength, weight = 1.0) ⇒ Object



5
6
7
# File 'lib/utils/equalities.rb', line 5

def cn_equal(expr, strength = Strength::RequiredStrength, weight = 1.0)
  cn_equality(LinearEquation, self - expr, strength, weight)
end

#cn_geq(expr, strength = Strength::RequiredStrength, weight = 1.0) ⇒ Object



9
10
11
# File 'lib/utils/equalities.rb', line 9

def cn_geq(expr, strength = Strength::RequiredStrength, weight = 1.0)
  cn_equality(LinearInequality, self - expr, strength, weight)
end

#cn_leq(expr, strength = Strength::RequiredStrength, weight = 1.0) ⇒ Object



13
14
15
16
# File 'lib/utils/equalities.rb', line 13

def cn_leq(expr, strength = Strength::RequiredStrength, weight = 1.0)
  expr = expr.as_linear_expression if expr.is_a?(Numeric)
  cn_equality(LinearInequality, expr - self, strength, weight)
end