Class: Ravensat::AndNode
Instance Attribute Summary
Attributes inherited from Node
#children
Instance Method Summary
collapse
Methods inherited from OprNode
#initialize
Methods inherited from Node
#clauses_size, #cnf?, #each, #each_by_descriptive, #initialize, #to_s, #vars, #vars_size, #|
Instance Method Details
#&(object) ⇒ Object
3
4
5
6
7
8
9
|
# File 'lib/ravensat/ast/and_node.rb', line 3
def &(object)
raise TypeError.new("#{object.class} can't be coerced into Ravensat::Node") unless object.is_a? Node
return self if object.is_a? NilNode
@children.append object
self
end
|
#eval ⇒ Object
15
16
17
|
# File 'lib/ravensat/ast/and_node.rb', line 15
def eval
@children.map(&:eval).reduce(:&)
end
|
#to_dimacs ⇒ Object
11
12
13
|
# File 'lib/ravensat/ast/and_node.rb', line 11
def to_dimacs
" 0\n"
end
|