Class: LogicTools::NodeValue

Inherits:
Node
  • Object
show all
Defined in:
lib/logic_tools/logictree.rb

Overview

Represents a value node.

Direct Known Subclasses

NodeFalse, NodeTrue

Instance Method Summary collapse

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

Instance Method Details

#==(node) ⇒ Object

Compares with node.



277
278
279
280
# File 'lib/logic_tools/logictree.rb', line 277

def ==(node) # :nodoc:
    return false unless node.is_a?(NodeValue)
    return self.eval() == node.eval()
end

#evalObject

Computes the value of the node.



283
284
285
# File 'lib/logic_tools/logictree.rb', line 283

def eval
    return @value
end

#getVariablesRecurseObject

Gets the variables, recursively, without postprocessing.

Returns the variables into sets of arrays with possible doublon


272
273
274
# File 'lib/logic_tools/logictree.rb', line 272

def getVariablesRecurse() # :nodoc:
    return [ ]
end

#to_sObject

Converts to a string.



293
294
295
# File 'lib/logic_tools/logictree.rb', line 293

def to_s # :nodoc:
    return @value.to_s
end

#to_symObject

Converts to a symbol.



288
289
290
# File 'lib/logic_tools/logictree.rb', line 288

def to_sym # :nodoc:
    return @sym
end