Module: Alf::Predicate::Expr
Constant Summary
collapse
- OP_NEGATIONS =
{
:eq => :neq,
:neq => :eq,
:lt => :gte,
:lte => :gt,
:gt => :lte,
:gte => :lt
}
Instance Method Summary
collapse
Methods included from Factory
#_factor_predicate, #and, #between, #comp, #contradiction, #in, #literal, #native, #not, #or, #relation, #tautology, #var_ref
Instance Method Details
#! ⇒ Object
23
24
25
|
# File 'lib/alf-predicate/alf/predicate/nodes/expr.rb', line 23
def !
sexpr([:not, self])
end
|
#&(other) ⇒ Object
27
28
29
30
31
|
# File 'lib/alf-predicate/alf/predicate/nodes/expr.rb', line 27
def &(other)
return other if other.contradiction?
return self if other.tautology?
sexpr([:and, self, other])
end
|
#and_split(attr_list) ⇒ Object
39
40
41
|
# File 'lib/alf-predicate/alf/predicate/nodes/expr.rb', line 39
def and_split(attr_list)
(free_variables & attr_list).empty? ? [ tautology, self ] : [ self, tautology ]
end
|
#constant_variables ⇒ Object
47
48
49
|
# File 'lib/alf-predicate/alf/predicate/nodes/expr.rb', line 47
def constant_variables
AttrList::EMPTY
end
|
#contradiction? ⇒ Boolean
19
20
21
|
# File 'lib/alf-predicate/alf/predicate/nodes/expr.rb', line 19
def contradiction?
false
end
|
#rename(renaming) ⇒ Object
43
44
45
|
# File 'lib/alf-predicate/alf/predicate/nodes/expr.rb', line 43
def rename(renaming)
Renamer.call(self, :renaming => renaming.to_hash)
end
|
#sexpr(arg) ⇒ Object
59
60
61
|
# File 'lib/alf-predicate/alf/predicate/nodes/expr.rb', line 59
def sexpr(arg)
Factory.sexpr(arg)
end
|
#tautology? ⇒ Boolean
15
16
17
|
# File 'lib/alf-predicate/alf/predicate/nodes/expr.rb', line 15
def tautology?
false
end
|
#to_proc(options = {}) ⇒ Object
55
56
57
|
# File 'lib/alf-predicate/alf/predicate/nodes/expr.rb', line 55
def to_proc(options = {})
ToProc.call(self, options)
end
|
#to_ruby_code(options = {}) ⇒ Object
51
52
53
|
# File 'lib/alf-predicate/alf/predicate/nodes/expr.rb', line 51
def to_ruby_code(options = {})
ToRubyCode.call(self, options)
end
|
#|(other) ⇒ Object
33
34
35
36
37
|
# File 'lib/alf-predicate/alf/predicate/nodes/expr.rb', line 33
def |(other)
return other if other.tautology?
return self if other.contradiction?
sexpr([:or, self, other])
end
|