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

- old
+ new

@@ -6,33 +6,18 @@ unless element.kind_of?(FreeIntVar) or element.kind_of?(Fixnum) raise TypeError, 'Elements used with count can not be of type ' + "#{element.class}." end params = {:lhs => self, :element => element} - return Gecode::Constraints::IntEnum::Count::ExpressionStub.new( - @model, params) + Gecode::Constraints::SimpleExpressionStub.new(@model, params) do |m, ps| + Gecode::Constraints::IntEnum::Count::Expression.new(m, ps) + end end end end # A module that gathers the classes and modules used in count constraints. module Gecode::Constraints::IntEnum::Count - - - # Describes an expression stub started with an int var enum followed by - # #count . - class ExpressionStub < Gecode::Constraints::ExpressionStub - include Gecode::Constraints::LeftHandSideMethods - - private - - # Produces an expression with the element for the lhs module. - def expression(params) - params.update(@params) - Gecode::Constraints::IntEnum::Count::Expression.new(@model, params) - end - end - # Describes an expression class Expression < Gecode::Constraints::IntEnum::Expression def initialize(model, params) super unless params[:negate] \ No newline at end of file