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 ⇒ Array<SPFFNode>
readonly
Sub-nodes (children).
Attributes inherited from SPPFNode
Instance Method Summary collapse
-
#add_subnode(aSubnode) ⇒ Object
Add a sub-node (child) to this one.
-
#initialize(aRange) ⇒ CompositeNode
constructor
Constructor.
-
#inspect ⇒ String
A text representation of the node.
- #key ⇒ String
Methods inherited from SPPFNode
Constructor Details
#initialize(aRange) ⇒ CompositeNode
Constructor
13 14 15 16 |
# File 'lib/rley/sppf/composite_node.rb', line 13 def initialize(aRange) super(aRange) @subnodes = [] end |
Instance Attribute Details
#subnodes ⇒ Array<SPFFNode> (readonly)
Returns Sub-nodes (children).
9 10 11 |
# File 'lib/rley/sppf/composite_node.rb', line 9 def subnodes @subnodes end |
Instance Method Details
#add_subnode(aSubnode) ⇒ Object
Add a sub-node (child) to this one.
20 21 22 |
# File 'lib/rley/sppf/composite_node.rb', line 20 def add_subnode(aSubnode) subnodes.unshift(aSubnode) end |
#inspect ⇒ String
Returns a text representation of the node.
25 26 27 |
# File 'lib/rley/sppf/composite_node.rb', line 25 def inspect() key end |
#key ⇒ String
30 31 32 |
# File 'lib/rley/sppf/composite_node.rb', line 30 def key() @key ||= to_string(0) end |