Class: Logica::Predicates::Compounds::Conjunction
- Inherits:
-
Base
- Object
- Base
- Base
- Logica::Predicates::Compounds::Conjunction
show all
- Defined in:
- lib/logica/predicates/compounds/conjunction.rb
Constant Summary
Constants inherited
from Base
Base::ACCEPTOR_TYPE_ID
Instance Attribute Summary
Attributes inherited from Base
#predicates
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#arity, #initialize, #name_and_attributes, new_from_list, new_from_pair, #with_extra_predicate_last, #with_extra_predicates, #without
Methods inherited from Base
#and_not, #arity, #disjoint_with?, #exhaustive_with?, #generalization_of?, #generalization_of_negation_of?, #generalization_of_other?, #iff, #implies, #method_missing, #name_and_attributes, #negated, #or, #or_not, #partially_applied_with, predicate_factory, #respond_to_missing?, #to_method, #to_proc, #to_s, #unsatisfied_by?, #xor
#==, #hash, #state
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Logica::Predicates::Base
Class Method Details
.absorbing_element ⇒ Object
14
15
16
|
# File 'lib/logica/predicates/compounds/conjunction.rb', line 14
def absorbing_element
predicate_factory.contradiction
end
|
.internal_binary_operation ⇒ Object
6
7
8
|
# File 'lib/logica/predicates/compounds/conjunction.rb', line 6
def internal_binary_operation
:and
end
|
.neutral_element ⇒ Object
10
11
12
|
# File 'lib/logica/predicates/compounds/conjunction.rb', line 10
def neutral_element
predicate_factory.tautology
end
|
Instance Method Details
#and(other) ⇒ Object
23
24
25
|
# File 'lib/logica/predicates/compounds/conjunction.rb', line 23
def and(other)
other.and_with_conjunction(self)
end
|
#and_with_other(other) ⇒ Object
27
28
29
|
# File 'lib/logica/predicates/compounds/conjunction.rb', line 27
def and_with_other(other)
(other)
end
|
#portion_satisfied_by(*arguments) ⇒ Object
40
41
42
43
|
# File 'lib/logica/predicates/compounds/conjunction.rb', line 40
def portion_satisfied_by(*arguments)
satisfied_predicates = predicates_satisfied_by(*arguments)
predicate_factory.conjunction(satisfied_predicates)
end
|
#remainder_unsatisfied_by(*arguments) ⇒ Object
45
46
47
48
49
50
51
52
|
# File 'lib/logica/predicates/compounds/conjunction.rb', line 45
def remainder_unsatisfied_by(*arguments)
unsatisfied_predicates = predicates_unsatisfied_by(*arguments)
if unsatisfied_predicates.empty?
predicate_factory.contradiction
else
predicate_factory.conjunction(unsatisfied_predicates)
end
end
|
#satisfied_by?(*arguments) ⇒ Boolean
19
20
21
|
# File 'lib/logica/predicates/compounds/conjunction.rb', line 19
def satisfied_by?(*arguments)
predicates.all? { |predicate| predicate.satisfied_by?(*arguments) }
end
|
#specialization_of?(other) ⇒ Boolean
31
32
33
|
# File 'lib/logica/predicates/compounds/conjunction.rb', line 31
def specialization_of?(other)
other.generalization_of_conjunction?(self)
end
|
#specialization_of_other?(other) ⇒ Boolean
35
36
37
38
|
# File 'lib/logica/predicates/compounds/conjunction.rb', line 35
def specialization_of_other?(other)
other.generalization_of_other?(self) ||
predicates.any? { |pred| pred.specialization_of?(other) }
end
|