Class: Ruleby::Core::Node

Inherits:
Printable show all
Defined in:
lib/core/nodes.rb

Overview

Base Node class used by all nodes in the network that do some kind of matching.

Direct Known Subclasses

ParentNode, TerminalNode

Instance Attribute Summary

Attributes inherited from Printable

#parent_nodes

Instance Method Summary collapse

Methods inherited from Printable

#initialize, #print

Constructor Details

This class inherits a constructor from Ruleby::Core::Printable

Instance Method Details

#resolve(mr1, mr2) ⇒ Object

This method determines if all common tags have equal values. If any values are not equal then the method returns false.



269
270
271
272
273
274
275
276
277
278
# File 'lib/core/nodes.rb', line 269

def resolve(mr1, mr2)    
  mr1.variables.each_key do |t1|
    mr2.variables.each_key do |t2|
      if t2 == t1 && mr1.fact_hash[t1] != mr2.fact_hash[t2]
        return false 
      end
    end
  end 
  return true
end