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 ⇒ Vertex
readonly
The destination vertex of the edge .
Instance Method Summary collapse
-
#initialize(thePredecessor, theSuccessor) ⇒ Edge
constructor
Construct a directed edge between two given vertices.
-
#inspect ⇒ String
Returns a string containing a human-readable representation of the production.
- #to_s ⇒ String
Constructor Details
#initialize(thePredecessor, theSuccessor) ⇒ Edge
Construct a directed edge between two given vertices
13 14 15 16 |
# File 'lib/rley/gfg/edge.rb', line 13 def initialize(thePredecessor, theSuccessor) @successor = theSuccessor thePredecessor.add_edge(self) end |
Instance Attribute Details
#successor ⇒ Vertex (readonly)
Returns The destination vertex of the edge .
8 9 10 |
# File 'lib/rley/gfg/edge.rb', line 8 def successor @successor end |
Instance Method Details
#inspect ⇒ String
Returns a string containing a human-readable representation of the production.
26 27 28 |
# File 'lib/rley/gfg/edge.rb', line 26 def inspect() to_s end |
#to_s ⇒ String
19 20 21 |
# File 'lib/rley/gfg/edge.rb', line 19 def to_s() " --> #{successor.label}" end |