Class: Rley::GFG::Vertex
- Inherits:
-
Object
- Object
- Rley::GFG::Vertex
- Defined in:
- lib/rley/gfg/vertex.rb
Overview
Abstract class. Represents a vertex in a grammar flow graph Responsibilities:
- To know its outgoing edges
- To know its label
Direct Known Subclasses
Instance Attribute Summary collapse
-
#edges ⇒ Array<Edge>
readonly
The edges linking the successor vertices to this one.
Instance Method Summary collapse
-
#add_edge(anEdge) ⇒ Object
Add an graph edge to this vertex.
-
#complete? ⇒ Boolean
Determine if the vertex corresponds to an dotted item that has its dot at the end of a production (i.e. is a reduced item).
-
#initialize ⇒ Vertex
constructor
Constructor to extend in subclasses.
-
#next_symbol ⇒ GrmSymbol, NilClass
Retrieve the grammar symbol after the dot.
-
#prev_symbol ⇒ GrmSymbol, NilClass
Retrieve the grammar symbol before the dot.
Constructor Details
#initialize ⇒ Vertex
Constructor to extend in subclasses.
13 14 15 |
# File 'lib/rley/gfg/vertex.rb', line 13 def initialize() @edges = [] end |
Instance Attribute Details
#edges ⇒ Array<Edge> (readonly)
The edges linking the successor vertices to this one.
10 11 12 |
# File 'lib/rley/gfg/vertex.rb', line 10 def edges @edges end |
Instance Method Details
#add_edge(anEdge) ⇒ Object
Add an graph edge to this vertex.
19 20 21 22 |
# File 'lib/rley/gfg/vertex.rb', line 19 def add_edge(anEdge) arrow = check_add_edge(anEdge) edges << arrow end |
#complete? ⇒ Boolean
Determine if the vertex corresponds to an dotted item that has its dot at the end of a production (i.e. is a reduced item).
27 28 29 |
# File 'lib/rley/gfg/vertex.rb', line 27 def complete?() return false # Default implementation end |
#next_symbol ⇒ GrmSymbol, NilClass
Retrieve the grammar symbol after the dot.
39 40 41 |
# File 'lib/rley/gfg/vertex.rb', line 39 def next_symbol() return nil # Default implementation end |
#prev_symbol ⇒ GrmSymbol, NilClass
Retrieve the grammar symbol before the dot.
33 34 35 |
# File 'lib/rley/gfg/vertex.rb', line 33 def prev_symbol() return nil # Default implementation end |