module Gecode::SetEnumMethods
A module containing the methods needed by enumerations containing set operands. Requires that it’s included in an enumerable.
Public Instance Methods
bind_array()
click to toggle source
Returns a set variable array with all the bound variables.
# File doc/tmp/rdoc_dev/gecoder/interface/enum_wrapper.rb, line 145 def bind_array space = @model.active_space unless @bound_space == space elements = to_a @bound_arr = Gecode::Raw::SetVarArray.new(active_space, elements.size) elements.each_with_index{ |var, index| @bound_arr[index] = var.bind } @bound_space = space end return @bound_arr end
to_set_enum()
click to toggle source
Returns the receiver.
# File doc/tmp/rdoc_dev/gecoder/interface/enum_wrapper.rb, line 157 def to_set_enum self end
upper_bound_range()
click to toggle source
Returns the range of the union of the contained sets’ upper bounds.
# File doc/tmp/rdoc_dev/gecoder/interface/enum_wrapper.rb, line 162 def upper_bound_range inject(nil) do |range, var| upper_bound = var.upper_bound min = upper_bound.min max = upper_bound.max next min..max if range.nil? range = min..range.last if min < range.first range = range.first..max if max > range.last range end end