Class: LogicTools::NodeVar
Overview
Represents a variable node.
Instance Attribute Summary collapse
-
#variable ⇒ Object
readonly
The variable held by the node.
Instance Method Summary collapse
-
#==(node) ⇒ Object
Compares with
node. -
#eval ⇒ Object
Computes the value of the node.
-
#getVariablesRecurse ⇒ Object
Gets the variables, recursively, without postprocessing.
-
#initialize(name) ⇒ NodeVar
constructor
Creates a node with variable
name. -
#to_s ⇒ Object
Converts to a string.
-
#to_sym ⇒ Object
Converts to a symbol.
Methods inherited from Node
#distribute, #each, #each_line, #each_maxterm, #each_minterm, #eql?, #flatten, #flatten_deep, #getVariables, #hash, #inspect, #op, #simplify, #size, #to_std_conjunctive, #to_std_disjunctive, #to_sum_product
Constructor Details
Instance Attribute Details
#variable ⇒ Object (readonly)
The variable held by the node.
322 323 324 |
# File 'lib/logic_tools/logictree.rb', line 322 def variable @variable end |
Instance Method Details
#==(node) ⇒ Object
Compares with node.
348 349 350 351 |
# File 'lib/logic_tools/logictree.rb', line 348 def ==(node) # :nodoc: return false unless node.is_a?(NodeVar) return self.variable == node.variable end |
#eval ⇒ Object
Computes the value of the node.
331 332 333 |
# File 'lib/logic_tools/logictree.rb', line 331 def eval() return @variable.value end |
#getVariablesRecurse ⇒ Object
Gets the variables, recursively, without postprocessing.
Returns the variables into sets of arrays with possible doublon
343 344 345 |
# File 'lib/logic_tools/logictree.rb', line 343 def getVariablesRecurse() # :nodoc: return [ @variable ] end |
#to_s ⇒ Object
Converts to a string.
354 355 356 |
# File 'lib/logic_tools/logictree.rb', line 354 def to_s # :nodoc: return variable.to_s end |
#to_sym ⇒ Object
Converts to a symbol.
336 337 338 |
# File 'lib/logic_tools/logictree.rb', line 336 def to_sym # :nodoc: return @sym end |