module Predicate::Expr
Constants
- OP_NEGATIONS
Public Instance Methods
!()
click to toggle source
# File lib/predicate/nodes/expr.rb, line 34 def ! sexpr([:not, self]) end
&(other)
click to toggle source
# File lib/predicate/nodes/expr.rb, line 40 def &(other) return other if other.contradiction? return self if other.tautology? return other & self if other.dyadic_priority > self.dyadic_priority sexpr([:and, self, other]) end
and_split(attr_list)
click to toggle source
# File lib/predicate/nodes/expr.rb, line 53 def and_split(attr_list) # If we have no reference to attr_list, then we are P2, else we are P1 (free_variables & attr_list).empty? ? [ tautology, self ] : [ self, tautology ] end
attr_split()
click to toggle source
# File lib/predicate/nodes/expr.rb, line 58 def attr_split # if I have only one variable reference, then I can return # myself mapped to that variable... if (vars = free_variables).size == 1 { vars.first => self } else # I must still map myself to nil to meet the conjunction # specification { nil => self } end end
bind(binding)
click to toggle source
# File lib/predicate/nodes/expr.rb, line 82 def bind(binding) Binder.new(binding).call(self) end
constant_variables()
click to toggle source
# File lib/predicate/nodes/expr.rb, line 86 def constant_variables [] end
constants()
click to toggle source
# File lib/predicate/nodes/expr.rb, line 90 def constants {} end
contradiction?()
click to toggle source
# File lib/predicate/nodes/expr.rb, line 18 def contradiction? false end
dyadic_priority()
click to toggle source
# File lib/predicate/nodes/expr.rb, line 38 def dyadic_priority; 0; end
identifier?()
click to toggle source
# File lib/predicate/nodes/expr.rb, line 30 def identifier? sexpr_type == :identifier end
literal?()
click to toggle source
# File lib/predicate/nodes/expr.rb, line 22 def literal? sexpr_type == :literal end
opaque?()
click to toggle source
# File lib/predicate/nodes/expr.rb, line 26 def opaque? sexpr_type == :opaque end
qualify(qualifier)
click to toggle source
# File lib/predicate/nodes/expr.rb, line 74 def qualify(qualifier) Qualifier.new(qualifier).call(self) end
rename(renaming)
click to toggle source
# File lib/predicate/nodes/expr.rb, line 70 def rename(renaming) Renamer.call(self, :renaming => renaming) end
sexpr(arg)
click to toggle source
# File lib/predicate/nodes/expr.rb, line 102 def sexpr(arg) Factory.sexpr(arg) end
tautology?()
click to toggle source
# File lib/predicate/nodes/expr.rb, line 14 def tautology? false end
to_hash()
click to toggle source
# File lib/predicate/nodes/expr.rb, line 98 def to_hash raise ArgumentError, "Unable to represent #{self} to a Hash" end
to_s(scope = nil)
click to toggle source
# File lib/predicate/nodes/expr.rb, line 94 def to_s(scope = nil) ToS.call(self, scope: scope) end
to_sequel()
click to toggle source
# File lib/predicate/sequel.rb, line 5 def to_sequel ToSequel.call(self) end
unqualify()
click to toggle source
# File lib/predicate/nodes/expr.rb, line 78 def unqualify Unqualifier.new.call(self) end
|(other)
click to toggle source
# File lib/predicate/nodes/expr.rb, line 47 def |(other) return other if other.tautology? return self if other.contradiction? sexpr([:or, self, other]) end