Class: Rley::SPPF::CompositeNode
- Defined in:
- lib/rley/sppf/composite_node.rb
Overview
Abstract class. The generalization for nodes that have children node(s).
Direct Known Subclasses
Instance Attribute Summary collapse
-
#subnodes ⇒ Object
readonly
Array of sub-nodes.
Attributes inherited from SPPFNode
Instance Method Summary collapse
- #add_subnode(aSubnode) ⇒ Object
-
#initialize(aRange) ⇒ CompositeNode
constructor
A new instance of CompositeNode.
- #key ⇒ Object
Methods inherited from SPPFNode
Constructor Details
#initialize(aRange) ⇒ CompositeNode
Returns a new instance of CompositeNode.
11 12 13 14 |
# File 'lib/rley/sppf/composite_node.rb', line 11 def initialize(aRange) super(aRange) @subnodes = [] end |
Instance Attribute Details
#subnodes ⇒ Object (readonly)
Array of sub-nodes.
9 10 11 |
# File 'lib/rley/sppf/composite_node.rb', line 9 def subnodes @subnodes end |
Instance Method Details
#add_subnode(aSubnode) ⇒ Object
16 17 18 |
# File 'lib/rley/sppf/composite_node.rb', line 16 def add_subnode(aSubnode) subnodes.unshift(aSubnode) end |
#key ⇒ Object
20 21 22 |
# File 'lib/rley/sppf/composite_node.rb', line 20 def key() @key ||= to_string(0) end |