Class: Logica::Predicates::Negation

Inherits:
Base
  • Object
show all
Defined in:
lib/logica/predicates/negation.rb

Constant Summary

Constants inherited from Base

Base::ACCEPTOR_TYPE_ID

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#and, #and_not, #disjoint_with?, #exhaustive_with?, #generalization_of?, #generalization_of_other?, #iff, #implies, #method_missing, #or, #or_not, #partially_applied_with, #portion_satisfied_by, predicate_factory, #remainder_unsatisfied_by, #respond_to_missing?, #to_method, #to_proc, #to_s, #unsatisfied_by?, #xor

Methods included from ComparableByState

#==, #hash, #state

Constructor Details

#initialize(predicate) ⇒ Negation

Returns a new instance of Negation.



6
7
8
# File 'lib/logica/predicates/negation.rb', line 6

def initialize(predicate)
  @predicate = predicate
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Logica::Predicates::Base

Instance Attribute Details

#predicateObject (readonly)

Returns the value of attribute predicate.



4
5
6
# File 'lib/logica/predicates/negation.rb', line 4

def predicate
  @predicate
end

Instance Method Details

#arityObject



30
31
32
# File 'lib/logica/predicates/negation.rb', line 30

def arity
  predicate.arity
end

#disjoint_with_other?(other) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/logica/predicates/negation.rb', line 26

def disjoint_with_other?(other)
  predicate.generalization_of?(other)
end

#generalization_of_negation_of?(other) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/logica/predicates/negation.rb', line 22

def generalization_of_negation_of?(other)
  predicate.specialization_of?(other)
end

#name_and_attributesObject



34
35
36
# File 'lib/logica/predicates/negation.rb', line 34

def name_and_attributes
  "#{name}(#{predicate.name_and_attributes})"
end

#negatedObject



14
15
16
# File 'lib/logica/predicates/negation.rb', line 14

def negated
  predicate
end

#satisfied_by?(*arguments) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/logica/predicates/negation.rb', line 10

def satisfied_by?(*arguments)
  predicate.unsatisfied_by?(*arguments)
end

#specialization_of?(other) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/logica/predicates/negation.rb', line 18

def specialization_of?(other)
  other.generalization_of_negation_of?(predicate)
end