Class: Gecode::Constraints::SetEnum::Selection::SetAccessStub
- Inherits:
-
ExpressionStub
- Object
- ExpressionStub
- Gecode::Constraints::SetEnum::Selection::SetAccessStub
- Includes:
- LeftHandSideMethods
- Defined in:
- lib/gecoder/interface/constraints/set_enum/selection.rb
Overview
Describes an expression stub started with a set var enum followed with an array access using a set variable.
Instance Method Summary collapse
-
#intersection(options = {}) ⇒ Object
Starts a intersection selection constraint on the selected sets.
-
#union ⇒ Object
Starts a union selection constraint on the selected sets.
Methods included from LeftHandSideMethods
Methods inherited from ExpressionStub
Constructor Details
This class inherits a constructor from Gecode::Constraints::ExpressionStub
Instance Method Details
#intersection(options = {}) ⇒ Object
Starts a intersection selection constraint on the selected sets. The option :with may optionally be specified, in which case the value should be an enumeration of the elements in the universe.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/gecoder/interface/constraints/set_enum/selection.rb', line 48 def intersection( = {}) unless .empty? unless .size == 1 and .has_key?(:with) raise ArgumentError, "Expected option key :with, got #{options.keys}." else universe = [:with] unless universe.kind_of?(Enumerable) and universe.all?{ |element| element.kind_of? Fixnum } raise TypeError, "Expected the universe to be specified as " + "an enumeration of fixnum, got #{universe.class}." end @params.update(:universe => universe) end end IntersectionExpressionStub.new(@model, @params) end |
#union ⇒ Object
Starts a union selection constraint on the selected sets.
41 42 43 |
# File 'lib/gecoder/interface/constraints/set_enum/selection.rb', line 41 def union UnionExpressionStub.new(@model, @params) end |