Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
lib/gecoder/interface/constraints/int_enum/arithmetic.rb | 63 | 40 | 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::IntEnum |
2 module IntEnumOperand |
3 # Produces an IntOperand representing the maximum value of the |
4 # integer operands in this enumeration. |
5 # |
6 # ==== Examples |
7 # |
8 # # The maximum of +int_enum+. |
9 # int_enum.max |
10 def max |
11 Arithmetic::IntEnumMaxOperand.new(@model, self) |
12 end |
13 |
14 # Produces an IntOperand representing the minimum value of the |
15 # integer operands in this enumeration. |
16 # |
17 # ==== Examples |
18 # |
19 # # The minimum of +int_enum+. |
20 # int_enum.min |
21 def min |
22 Arithmetic::IntEnumMinOperand.new(@model, self) |
23 end |
24 end |
25 |
26 # A module that gathers the classes and modules used by arithmetic |
27 # constraints. |
28 module Arithmetic #:nodoc: |
29 class IntEnumMaxOperand < Gecode::Int::ShortCircuitEqualityOperand #:nodoc: |
30 def initialize(model, int_enum) |
31 super model |
32 @int_enum = int_enum |
33 end |
34 |
35 def constrain_equal(int_operand, constrain, propagation_options) |
36 enum = @int_enum.to_int_enum |
37 if constrain |
38 int_operand.must_be.in enum.domain_range |
39 end |
40 |
41 Gecode::Raw::max(@model.active_space, enum.bind_array, |
42 int_operand.to_int_var.bind, *propagation_options) |
43 end |
44 end |
45 |
46 class IntEnumMinOperand < Gecode::Int::ShortCircuitEqualityOperand #:nodoc: |
47 def initialize(model, int_enum) |
48 super model |
49 @int_enum = int_enum |
50 end |
51 |
52 def constrain_equal(int_operand, constrain, propagation_options) |
53 enum = @int_enum.to_int_enum |
54 if constrain |
55 int_operand.must_be.in enum.domain_range |
56 end |
57 |
58 Gecode::Raw::min(@model.active_space, enum.bind_array, |
59 int_operand.to_int_var.bind, *propagation_options) |
60 end |
61 end |
62 end |
63 end |
Generated on Thu Jan 08 13:27:03 +0100 2015 with rcov 1.0.0