Class: Gecode::Constraints::Expression

Inherits:
Object
  • Object
show all
Defined in:
lib/gecoder/interface/constraints.rb

Overview

Describes a constraint expressions. An expression is produced by calling some form of must on a left hand side. The expression waits for a right hand side so that it can post the corresponding constraint.

Instance Method Summary collapse

Constructor Details

#initialize(model, params) ⇒ Expression

Constructs a new expression with the specified parameters. The parameters shoud at least contain the keys :lhs, and :negate.

Raises ArgumentError if any of those keys are missing.



262
263
264
265
266
267
268
269
270
# File 'lib/gecoder/interface/constraints.rb', line 262

def initialize(model, params)
  unless params.has_key?(:lhs) and params.has_key?(:negate)
    raise ArgumentError, 'Expression requires at least :lhs, ' + 
      "and :negate as parameter keys, got #{params.keys.join(', ')}."
  end
  
  @model = model
  @params = params
end