Class: Ruleby::Core::AtomNode
- Inherits:
-
ParentNode
- Object
- Printable
- Node
- ParentNode
- Ruleby::Core::AtomNode
- Defined in:
- lib/core/nodes.rb
Overview
This is a base class for all single input nodes that match facts based on some properties. It is essentially a wrapper for an Atom. These nodes make up the Alpha network.
Direct Known Subclasses
FunctionNode, HashedNode, PropertyNode, ReferenceNode, SelfReferenceNode
Instance Attribute Summary collapse
-
#atom ⇒ Object
readonly
Returns the value of attribute atom.
Attributes inherited from ParentNode
Attributes inherited from Printable
Instance Method Summary collapse
- #==(node) ⇒ Object
-
#initialize(bucket, atom) ⇒ AtomNode
constructor
A new instance of AtomNode.
- #shareable?(node) ⇒ Boolean
- #to_s ⇒ Object
Methods inherited from ParentNode
#add_out_node, #assert, #modify, #propagate, #propagate_assert, #propagate_modify, #propagate_retract, #retract
Methods inherited from Node
Methods inherited from Printable
Constructor Details
#initialize(bucket, atom) ⇒ AtomNode
Returns a new instance of AtomNode.
363 364 365 366 |
# File 'lib/core/nodes.rb', line 363 def initialize(bucket, atom) super(bucket) @atom = atom end |
Instance Attribute Details
#atom ⇒ Object (readonly)
Returns the value of attribute atom.
362 363 364 |
# File 'lib/core/nodes.rb', line 362 def atom @atom end |
Instance Method Details
#==(node) ⇒ Object
368 369 370 |
# File 'lib/core/nodes.rb', line 368 def ==(node) AtomNode === node && @atom == node.atom end |
#shareable?(node) ⇒ Boolean
372 373 374 |
# File 'lib/core/nodes.rb', line 372 def shareable?(node) @atom.shareable?(node.atom) end |
#to_s ⇒ Object
376 377 378 |
# File 'lib/core/nodes.rb', line 376 def to_s super + " - #{@atom.slot}" end |