Class: Rley::GFG::Edge
- Inherits:
-
Object
- Object
- Rley::GFG::Edge
- Defined in:
- lib/rley/gfg/edge.rb
Overview
Abstract class. Represents an edge in a grammar flow graph. Responsibilities:
- To know the successor vertex
Direct Known Subclasses
Instance Attribute Summary collapse
-
#successor ⇒ Object
readonly
The destination vertex of the edge .
Instance Method Summary collapse
-
#initialize(thePredecessor, theSuccessor) ⇒ Edge
constructor
A new instance of Edge.
- #to_s ⇒ Object
Constructor Details
#initialize(thePredecessor, theSuccessor) ⇒ Edge
Returns a new instance of Edge.
10 11 12 13 |
# File 'lib/rley/gfg/edge.rb', line 10 def initialize(thePredecessor, theSuccessor) @successor = theSuccessor thePredecessor.add_edge(self) end |
Instance Attribute Details
#successor ⇒ Object (readonly)
The destination vertex of the edge .
8 9 10 |
# File 'lib/rley/gfg/edge.rb', line 8 def successor @successor end |
Instance Method Details
#to_s ⇒ Object
15 16 17 |
# File 'lib/rley/gfg/edge.rb', line 15 def to_s() " --> #{successor.label}" end |