# class Gecode::SetElements::SetElementsConstraintReceiver

SetElementsConstraintReceiver contains all constraints that can be placed on a SetElementsOperand.

Constraints are placed by calling Gecode::Operand#must (or any other of the variations defined in Operand), which produces a SetElementsConstraintReceiver from which the desired constraint can be used.

Each constraint accepts a number of options. See ConstraintReceiver for more information.

#### Examples ¶ ↑

Constrains all elements in `set_operand`

to be strictly greater
than 17 using SetOperand#elements and SetElementsConstraintReceiver#>:

set.elements.must > 17

Constrains all elements in `set_operand`

to be strictly greater
than `int_operand`

using SetOperand#elements and
SetElementsConstraintReceiver#>:

set.elements.must > int_operand

The same as above, but specifying that strength :domain should be used and
that the constraint should be reified with `bool_operand`

:

set.elements.must_be.greater_than(int_operand, :strength => :domain, :reify => bool_operand)

### Public Instance Methods

Constrains the set elements to be strictly less than `operand`

(either a constant integer or an integer operand).

#### Examples ¶ ↑

# The elements of +set+ must be strictly less than +int+ set.elements.must < int # The elements of +set+ must be strictly less than 17 set.elements.must < 17

# File doc/tmp/rdoc_dev/gecoder/interface/constraints/set_elements/relation.rb, line 55 def <(operand, options = {}) comparison(:<, operand, options) end

Constrains the set elements to be less than or equal to
`operand`

(either a constant integer or an integer operand).

#### Examples ¶ ↑

# The elements of +set+ must be less than or equal to +int+ set.elements.must <= int # The elements of +set+ must be less than or equal to 17 set.elements.must <= 17

# File doc/tmp/rdoc_dev/gecoder/interface/constraints/set_elements/relation.rb, line 69 def <=(operand, options = {}) comparison(:<=, operand, options) end

Constrains the set elements to equal `operand`

(either a
constant integer or an integer operand).

#### Examples ¶ ↑

# The elements of +set+ must equal +int+ set.elements.must == int # The elements of +set+ must equal 17 set.elements.must == 17

# File doc/tmp/rdoc_dev/gecoder/interface/constraints/set_elements/relation.rb, line 13 def ==(operand, options = {}) comparison(:==, operand, options) end

Constrains the set elements to be strictly greater than
`operand`

(either a constant integer or an integer operand).

#### Examples ¶ ↑

# The elements of +set+ must be strictly greater than +int+ set.elements.must > int # The elements of +set+ must be strictly greater than 17 set.elements.must > 17

# File doc/tmp/rdoc_dev/gecoder/interface/constraints/set_elements/relation.rb, line 27 def >(operand, options = {}) comparison(:>, operand, options) end

Constrains the set elements to be greater than or equal to
`operand`

(either a constant integer or an integer operand).

#### Examples ¶ ↑

# The elements of +set+ must be greater than or equal to +int+ set.elements.must >= int # The elements of +set+ must be greater than or equal to 17 set.elements.must >= 17

# File doc/tmp/rdoc_dev/gecoder/interface/constraints/set_elements/relation.rb, line 41 def >=(operand, options = {}) comparison(:>=, operand, options) end

### Public Class Methods

Raises TypeError unless the left hand side is set elements operand.

# File doc/tmp/rdoc_dev/gecoder/interface/constraints/set_elements_constraints.rb, line 72 def initialize(model, params) super unless params[:lhs].respond_to? :to_set_elements raise TypeError, 'Must have set elements operand as left hand side.' end end