Class: Wongi::Engine::BetaTest

Inherits:
Object
  • Object
show all
Defined in:
lib/wongi-engine/beta/join_node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field, variable) ⇒ BetaTest

Returns a new instance of BetaTest.



9
10
11
# File 'lib/wongi-engine/beta/join_node.rb', line 9

def initialize field, variable
  @field, @variable = field, variable
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



6
7
8
# File 'lib/wongi-engine/beta/join_node.rb', line 6

def field
  @field
end

#variableObject (readonly)

Returns the value of attribute variable.



7
8
9
# File 'lib/wongi-engine/beta/join_node.rb', line 7

def variable
  @variable
end

Instance Method Details

#equivalent?(other) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/wongi-engine/beta/join_node.rb', line 20

def equivalent? other
  other.field == self.field && other.variable == self.variable
end

#matches?(token, wme) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
# File 'lib/wongi-engine/beta/join_node.rb', line 13

def matches? token, wme
  assignment = token[ self.variable ]
  field = wme.send( self.field )
  #field.nil? ||
  assignment && field == assignment
end