Sha256: 67107753052c3253f8ee3514545ff5afb040f9dc67ab20c69bcadb94b2cd3509

Contents?: true

Size: 951 Bytes

Versions: 4

Compression:

Stored size: 951 Bytes

Contents

# frozen_string_literal: true

module Rley # This module is used as a namespace
  module GFG # This module is used as a namespace
    # Abstract class. Represents an edge in a grammar flow graph.
    # Responsibilities:
    # - To know the successor vertex
    class Edge
      # @return [Vertex] The destination vertex of the edge .
      attr_reader :successor

      # Construct a directed edge between two given vertices
      # @param thePredecessor [Vertex]
      # @param theSuccessor [Vertex]
      def initialize(thePredecessor, theSuccessor)
        @successor = theSuccessor
        thePredecessor.add_edge(self)
      end

      # @return [String]
      def to_s()
        " --> #{successor.label}"
      end
      
      # Returns a string containing a human-readable representation of the 
      # production.
      # @return [String]
      def inspect()
        to_s
      end
    end # class
  end # module
end # module

# End of file

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rley-0.7.07 lib/rley/gfg/edge.rb
rley-0.7.06 lib/rley/gfg/edge.rb
rley-0.7.05 lib/rley/gfg/edge.rb
rley-0.7.04 lib/rley/gfg/edge.rb