lib/gecoder/interface/constraints/bool/channel.rb in gecoder-0.8.2 vs lib/gecoder/interface/constraints/bool/channel.rb in gecoder-0.8.3
- old
+ new
@@ -1,23 +1,8 @@
module Gecode::Constraints::Bool
class Expression
- alias_method :pre_channel_equals, :==
-
# Constrains the boolean variable to be equal to the specified integer
# variable.
- def ==(int, options = {})
- unless @params[:lhs].kind_of?(Gecode::FreeBoolVar) and
- int.kind_of?(Gecode::FreeIntVar)
- return pre_channel_equals(int, options)
- end
-
- # Provide commutivity to the corresponding int variable constraint.
- if @params[:negate]
- int.must_not.equal(@params[:lhs], options)
- else
- int.must.equal(@params[:lhs], options)
- end
- end
-
+ provide_commutivity(:==){ |rhs, _| rhs.kind_of?(Gecode::FreeIntVar) }
alias_comparison_methods
end
end