Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
lib/gecoder/interface/constraints/set_enum/operation.rb | 69 | 38 | 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 module SetEnumOperand |
3 # Produces a SetOperand representing the union of all sets in this |
4 # enumeration. |
5 # |
6 # ==== Examples |
7 # |
8 # # The union of all sets in +set_enum+. |
9 # set_enum.union |
10 def union |
11 set_operation(:union) |
12 end |
13 |
14 # Produces a SetOperand representing the intersection of all sets in this |
15 # enumeration. |
16 # |
17 # ==== Examples |
18 # |
19 # # The intersection of all sets in +set_enum+. |
20 # set_enum.intersection |
21 def intersection |
22 set_operation(:intersection) |
23 end |
24 |
25 # Produces a SetOperand representing the disjoint union of all sets |
26 # in this enumeration. |
27 # |
28 # ==== Examples |
29 # |
30 # # The disjoint union of all sets in +set_enum+. |
31 # set_enum.disjoint_union |
32 def disjoint_union |
33 set_operation(:disjoint_union) |
34 end |
35 |
36 private |
37 |
38 # Produces the SetOperand resulting from +operator+ applied to this |
39 # operand. |
40 def set_operation(operator) |
41 Operation::OperationSetOperand.new(model, self, operator) |
42 end |
43 end |
44 |
45 # A module that gathers the classes and modules used in operation constraints. |
46 module Operation #:nodoc: |
47 class OperationSetOperand < Gecode::Set::ShortCircuitEqualityOperand #:nodoc: |
48 def initialize(model, enum, operator) |
49 super model |
50 @enum = enum |
51 @operator = operator |
52 end |
53 |
54 def constrain_equal(set_operand, constrain_domain, propagation_options) |
55 operation = Gecode::Util::SET_OPERATION_TYPES[@operator] |
56 if constrain_domain |
57 if operation == Gecode::Raw::SOT_INTER |
58 set_operand.must_be.subset_of @enum.first.upper_bound |
59 else |
60 set_operand.must_be.subset_of @enum.upper_bound_range |
61 end |
62 end |
63 |
64 Gecode::Raw::rel(@model.active_space, operation, |
65 @enum.to_set_enum.bind_array, set_operand.to_set_var.bind) |
66 end |
67 end |
68 end |
69 end |
Generated on Thu Jan 08 13:27:03 +0100 2015 with rcov 1.0.0