lib/gecoder/interface/constraints/int_enum/distinct.rb in gecoder-0.4.0 vs lib/gecoder/interface/constraints/int_enum/distinct.rb in gecoder-0.5.0

- old
+ new

@@ -5,12 +5,14 @@ def with_offsets(*offsets) if offsets.kind_of? Enumerable offsets = *offsets end params = {:lhs => self, :offsets => offsets} - return Gecode::Constraints::IntEnum::Distinct::OffsetExpressionStub.new( - @model, params) + + Gecode::Constraints::SimpleExpressionStub.new(@model, params) do |m, ps| + Gecode::Constraints::IntEnum::Expression.new(m, ps) + end end end end module Gecode::Constraints::IntEnum @@ -29,23 +31,9 @@ end end # A module that gathers the classes and modules used in distinct constraints. module Distinct - # Describes an expression started with an int var enum following with - # #with_offsets . - class OffsetExpressionStub < Gecode::Constraints::ExpressionStub - include Gecode::Constraints::LeftHandSideMethods - - private - - # Produces an expression with offsets for the lhs module. - def expression(params) - params.update(@params) - Gecode::Constraints::IntEnum::Expression.new(@model, params) - end - end - # Describes a distinct constraint (optionally with offsets). class DistinctConstraint < Gecode::Constraints::Constraint def post # Bind lhs. @params[:lhs] = @params[:lhs].to_int_var_array \ No newline at end of file