Sha256: 869ebda3ad9e22da337d01c8d54e95d41aba55c974b789cbb77a3e3f6463631f

Contents?: true

Size: 1.38 KB

Versions: 11

Compression:

Stored size: 1.38 KB

Contents

# A module containing constraints that have enumerations of instances of
# Fixnum as left hand side.
module Gecode::FixnumEnum #:nodoc:
  # A FixnumEnumOperand is a enumeration of Fixnum on which the
  # constraints defined in FixnumEnumConstraintReceiver can be placed.
  # They typically service as constant arrays or constant sets.
  #
  # The fixnum enumeration operands are created by wrapping an enumeration 
  # of fixnum Gecode::Mixin#wrap_enum. The enumerations created that way
  # all respond to the properties defined by FixnumEnumOperand.
  #
  # ==== Examples 
  #
  # Uses Gecode::Mixin#wrap_enum inside a problem formulation to create
  # a FixnumEnumOperand from an existing enumeration of Fixnum:
  #
  #   fixnum_enum = wrap_enum([3, 5, 7])
  #   
  #--
  # Classes that mix in FixnumEnumOperand must define #model.
  module FixnumEnumOperand
    include Gecode::Operand 

    def method_missing(method, *args) #:nodoc:
      if Gecode::FixnumEnum::Dummy.instance_methods.include? method.to_s
        # Delegate to the fixnum enum.
        to_fixnum_enum.method(method).call(*args)
      else
        super
      end
    end

    private
  
    def construct_receiver(params)
      raise NotImplementedError, 'Fixnum enums do not have constraints.'
    end
  end
end

require 'gecoder/interface/constraints/fixnum_enum/element'
require 'gecoder/interface/constraints/fixnum_enum/operation'

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
gecoder-with-gecode-1.1.1.1 lib/gecoder/interface/constraints/fixnum_enum_constraints.rb
gecoder-with-gecode-1.1.1 lib/gecoder/interface/constraints/fixnum_enum_constraints.rb
gecoder-1.1.1 lib/gecoder/interface/constraints/fixnum_enum_constraints.rb
gecoder-with-gecode-1.1.0 lib/gecoder/interface/constraints/fixnum_enum_constraints.rb
gecoder-1.1.0 lib/gecoder/interface/constraints/fixnum_enum_constraints.rb
gecoder-1.0.0 lib/gecoder/interface/constraints/fixnum_enum_constraints.rb
gecoder-0.9.1 lib/gecoder/interface/constraints/fixnum_enum_constraints.rb
gecoder-with-gecode-0.9.1-x86-mswin32-60 lib/gecoder/interface/constraints/fixnum_enum_constraints.rb
gecoder-with-gecode-1.0.0-x86-mswin32-60 lib/gecoder/interface/constraints/fixnum_enum_constraints.rb
gecoder-with-gecode-0.9.1 lib/gecoder/interface/constraints/fixnum_enum_constraints.rb
gecoder-with-gecode-1.0.0 lib/gecoder/interface/constraints/fixnum_enum_constraints.rb