Class: Gecode::IntEnum::Count::IntEnumCountOperand

Inherits:
Gecode::Int::ShortCircuitRelationsOperand show all
Defined in:
lib/gecoder/interface/constraints/int_enum/count.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Gecode::Int::ShortCircuitRelationsOperand

#model

Instance Method Summary collapse

Methods inherited from Gecode::Int::ShortCircuitRelationsOperand

#construct_receiver, #to_int_var

Methods included from Gecode::Int::IntOperand

#*, #+, #-, #abs, #method_missing, #pre_arith_mult, #square_root, #squared

Methods included from Operand

#model, #must, #must_not

Constructor Details

#initialize(model, int_enum, element) ⇒ IntEnumCountOperand

:nodoc:



26
27
28
29
30
# File 'lib/gecoder/interface/constraints/int_enum/count.rb', line 26

def initialize(model, int_enum, element)
  super model
  @enum = int_enum
  @element = element
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Gecode::Int::IntOperand

Instance Method Details

#relation_constraint(relation, int_operand_or_fix, params) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/gecoder/interface/constraints/int_enum/count.rb', line 32

def relation_constraint(relation, int_operand_or_fix, params)
  unless params[:negate]
    relation_type = 
      Gecode::Util::RELATION_TYPES[relation]
  else
    relation_type = 
      Gecode::Util::NEGATED_RELATION_TYPES[relation]
  end
  
  params.update(:enum => @enum, :element => @element, 
    :rhs => int_operand_or_fix, :relation_type => relation_type)
  CountConstraint.new(@model, params)
end