Class: Gecode::SetEnum::Element::ElementSetOperand

Inherits:
Gecode::Set::ShortCircuitEqualityOperand show all
Defined in:
lib/gecoder/interface/constraints/set_enum/element.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Gecode::Set::ShortCircuitEqualityOperand

#model

Instance Method Summary collapse

Methods inherited from Gecode::Set::ShortCircuitEqualityOperand

#construct_receiver, #to_set_var

Methods included from Gecode::Set::SetOperand

#disjoint_union, #elements, #intersection, #method_missing, #minus, #size, #union

Methods included from Operand

#model, #must, #must_not

Constructor Details

#initialize(model, enum_op, position_int_op) ⇒ ElementSetOperand

Returns a new instance of ElementSetOperand.



62
63
64
65
66
# File 'lib/gecoder/interface/constraints/set_enum/element.rb', line 62

def initialize(model, enum_op, position_int_op)
  super model
  @enum = enum_op
  @position = position_int_op
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Gecode::Set::SetOperand

Instance Method Details

#constrain_equal(set_operand, constrain, propagation_options) ⇒ Object



68
69
70
71
72
73
74
75
76
# File 'lib/gecoder/interface/constraints/set_enum/element.rb', line 68

def constrain_equal(set_operand, constrain, propagation_options)
  enum = @enum.to_set_enum
  if constrain
    set_operand.must_be.subset_of enum.upper_bound_range
  end

  Gecode::Raw::element(@model.active_space, enum.bind_array, 
    @position.to_int_var.bind, set_operand.to_set_var.bind)
end