Class: LogicTools::NodeValue
Overview
Represents a value node.
Instance Method Summary collapse
-
#==(node) ⇒ Object
Compares with
node. -
#eval ⇒ Object
Computes the value of the node.
-
#get_variablesRecurse ⇒ Object
Gets the variables, recursively, without postprocessing.
-
#op ⇒ Object
Gets the operator.
-
#to_s ⇒ Object
Converts to a string.
-
#to_sym ⇒ Object
Converts to a symbol.
Methods inherited from Node
#cover?, #distribute, #each, #each_line, #each_maxterm, #each_minterm, #eql?, #flatten, #flatten_deep, #get_variables, #hash, #include?, #inspect, #is_parent?, #reduce, #simplify, #size, #to_cover, #to_std_conjunctive, #to_std_disjunctive, #to_sum_product
Instance Method Details
#==(node) ⇒ Object
Compares with node.
320 321 322 323 |
# File 'lib/logic_tools/logictree.rb', line 320 def ==(node) # :nodoc: return false unless node.is_a?(NodeValue) return self.eval() == node.eval() end |
#eval ⇒ Object
Computes the value of the node.
332 333 334 |
# File 'lib/logic_tools/logictree.rb', line 332 def eval return @value end |
#get_variablesRecurse ⇒ Object
Gets the variables, recursively, without postprocessing.
Returns the variables into sets of arrays with possible doublon
315 316 317 |
# File 'lib/logic_tools/logictree.rb', line 315 def get_variablesRecurse() # :nodoc: return [ ] end |
#op ⇒ Object
Gets the operator.
337 338 339 |
# File 'lib/logic_tools/logictree.rb', line 337 def op return @value.to_s.to_sym end |
#to_s ⇒ Object
Converts to a string.
348 349 350 |
# File 'lib/logic_tools/logictree.rb', line 348 def to_s # :nodoc: return @value ? "1" : "0" end |
#to_sym ⇒ Object
Converts to a symbol.
342 343 344 345 |
# File 'lib/logic_tools/logictree.rb', line 342 def to_sym # :nodoc: @sym = @value.to_s.to_sym unless @sym return @sym end |