class Wongi::Engine::OrNode

Attributes

parents[R]
rete[R]

Public Class Methods

new(parents) click to toggle source
Calls superclass method
# File lib/wongi-engine/beta/or_node.rb, line 8
def initialize parents
  super nil
  @parents = parents
  parents.each do |parent|
    parent.children << self
  end
  retes = parents.map( &:rete ).uniq
  raise "Cannot combine variants from several Retes" if retes.size > 1
  @rete = retes.first
end

Public Instance Methods

depth() click to toggle source
# File lib/wongi-engine/beta/or_node.rb, line 25
def depth
  parents.map( &:depth ).max + 1
end
ident() click to toggle source
# File lib/wongi-engine/beta/or_node.rb, line 19
def ident
  ids = parents.map( &:id ).join ", "
  "<R> #{self.class} #{id}, parents #{ids}"
end
refresh() click to toggle source
# File lib/wongi-engine/beta/or_node.rb, line 29
def refresh
  parents.each do |parent|
    parent.refresh_child self
  end
end