Class: Wongi::Engine::BetaTest
- Inherits:
-
Object
- Object
- Wongi::Engine::BetaTest
- Defined in:
- lib/wongi-engine/beta/join_node.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#variable ⇒ Object
readonly
Returns the value of attribute variable.
Instance Method Summary collapse
- #equivalent?(other) ⇒ Boolean
-
#initialize(field, variable) ⇒ BetaTest
constructor
A new instance of BetaTest.
- #matches?(token, wme) ⇒ Boolean
Constructor Details
#initialize(field, variable) ⇒ BetaTest
Returns a new instance of BetaTest.
6 7 8 9 |
# File 'lib/wongi-engine/beta/join_node.rb', line 6 def initialize(field, variable) @field = field @variable = variable end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
4 5 6 |
# File 'lib/wongi-engine/beta/join_node.rb', line 4 def field @field end |
#variable ⇒ Object (readonly)
Returns the value of attribute variable.
4 5 6 |
# File 'lib/wongi-engine/beta/join_node.rb', line 4 def variable @variable end |
Instance Method Details
#equivalent?(other) ⇒ Boolean
18 19 20 |
# File 'lib/wongi-engine/beta/join_node.rb', line 18 def equivalent?(other) other.field == field && other.variable == variable end |
#matches?(token, wme) ⇒ Boolean
11 12 13 14 15 16 |
# File 'lib/wongi-engine/beta/join_node.rb', line 11 def matches?(token, wme) assignment = token[variable] field = wme.send(self.field) # field.nil? || !token.has_var?(variable) || field == assignment end |