Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
lib/gecoder/interface/constraints/set_enum/channel.rb | 45 | 29 | 100.00%
|
100.00%
|
Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.
1 module Gecode::SetEnum |
2 class SetEnumConstraintReceiver |
3 # Constrains this set enum to channel +int_enum_operand+. The i:th set |
4 # in the enumeration of set operands is constrained to include the value |
5 # of the j:th integer operand. |
6 # |
7 # Neither reification nor negation is supported. |
8 # |
9 # ==== Examples |
10 # |
11 # # +set_enum+ is constrained to channel +int_enum+. |
12 # int_enum.must.channel set_enum |
13 # |
14 # # This is another way of writing the above. |
15 # set_enum.must.channel int_enum |
16 def channel(enum, options = {}) |
17 unless enum.respond_to? :to_int_enum |
18 raise TypeError, "Expected integer enum, for #{enum.class}." |
19 end |
20 if @params[:negate] |
21 raise Gecode::MissingConstraintError, 'A negated channel constraint ' + |
22 'is not implemented.' |
23 end |
24 if options.has_key? :reify |
25 raise ArgumentError, 'The channel constraints does not support the ' + |
26 'reification option.' |
27 end |
28 |
29 @params.update(Gecode::Set::Util.decode_options(options)) |
30 @params.update(:rhs => enum) |
31 @model.add_constraint Channel::IntEnumChannelConstraint.new(@model, @params) |
32 end |
33 end |
34 |
35 # A module that gathers the classes and modules used in channel constraints. |
36 module Channel #:nodoc: |
37 class IntEnumChannelConstraint < Gecode::Constraint #:nodoc: |
38 def post |
39 lhs, rhs = @params.values_at(:lhs, :rhs) |
40 Gecode::Raw::channel(@model.active_space, rhs.to_int_enum.bind_array, |
41 lhs.to_set_enum.bind_array) |
42 end |
43 end |
44 end |
45 end |
Generated on Thu Jan 08 13:27:03 +0100 2015 with rcov 1.0.0