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 ⇒ Object
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
Returns true iff 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
A new instance of Vertex.
-
#next_symbol ⇒ Object
Return the symbol after the dot else nil.
-
#prev_symbol ⇒ Object
Return the symbol before the dot else nil.
Constructor Details
#initialize ⇒ Vertex
Returns a new instance of Vertex.
11 12 13 |
# File 'lib/rley/gfg/vertex.rb', line 11 def initialize() @edges = [] end |
Instance Attribute Details
#edges ⇒ Object (readonly)
The edges linking the successor vertices to this one.
9 10 11 |
# File 'lib/rley/gfg/vertex.rb', line 9 def edges @edges end |
Instance Method Details
#add_edge(anEdge) ⇒ Object
Add an graph edge to this vertex
16 17 18 19 |
# File 'lib/rley/gfg/vertex.rb', line 16 def add_edge(anEdge) arrow = check_add_edge(anEdge) edges << arrow end |
#complete? ⇒ Boolean
Returns true iff the vertex corresponds to an dotted item that has its dot at the end of a production (i.e. is a reduced item).
23 24 25 |
# File 'lib/rley/gfg/vertex.rb', line 23 def complete?() return false # Default implementation end |
#next_symbol ⇒ Object
Return the symbol after the dot else nil.
33 34 35 |
# File 'lib/rley/gfg/vertex.rb', line 33 def next_symbol() return nil # Default implementation end |
#prev_symbol ⇒ Object
Return the symbol before the dot else nil.
28 29 30 |
# File 'lib/rley/gfg/vertex.rb', line 28 def prev_symbol() return nil # Default implementation end |