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.
318 319 320 321 |
# File 'lib/logic_tools/logictree.rb', line 318 def ==(node) # :nodoc: return false unless node.is_a?(NodeValue) return self.eval() == node.eval() end |
#eval ⇒ Object
Computes the value of the node.
330 331 332 |
# File 'lib/logic_tools/logictree.rb', line 330 def eval return @value end |
#get_variablesRecurse ⇒ Object
Gets the variables, recursively, without postprocessing.
Returns the variables into sets of arrays with possible doublon
313 314 315 |
# File 'lib/logic_tools/logictree.rb', line 313 def get_variablesRecurse() # :nodoc: return [ ] end |
#op ⇒ Object
Gets the operator.
335 336 337 |
# File 'lib/logic_tools/logictree.rb', line 335 def op return @value.to_s.to_sym end |
#to_s ⇒ Object
Converts to a string.
346 347 348 |
# File 'lib/logic_tools/logictree.rb', line 346 def to_s # :nodoc: return @value ? "1" : "0" end |
#to_sym ⇒ Object
Converts to a symbol.
340 341 342 343 |
# File 'lib/logic_tools/logictree.rb', line 340 def to_sym # :nodoc: @sym = @value.to_s.to_sym unless @sym return @sym end |