Package dsa

Class SymbolDiGraph


  • public class SymbolDiGraph
    extends Object
    An immutable data type to represent a directed symbol graph.
    • Constructor Detail

      • SymbolDiGraph

        public SymbolDiGraph​(stdlib.In in,
                             String delim)
        Constructs a symbol digraph from the input stream in using delim as the delimiter.
        Parameters:
        in - the input stream.
        delim - the delimiter between fields.
    • Method Detail

      • contains

        public boolean contains​(String s)
        Returns true if this symbol digraph contains vertex s, and false otherwise.
        Parameters:
        s - the vertex name.
        Returns:
        true if this symbol digraph contains vertex s, and false otherwise.
      • indexOf

        public int indexOf​(String s)
        Returns the integer associated with the vertex s in this symbol digraph.
        Parameters:
        s - the vertex name.
        Returns:
        the integer associated with the vertex s in this symbol digraph.
      • nameOf

        public String nameOf​(int v)
        Returns the name of the vertex associated with the integer v in this symbol digraph.
        Parameters:
        v - the integer corresponding to a vertex.
        Returns:
        the name of the vertex associated with the integer v in this symbol digraph.
      • diGraph

        public DiGraph diGraph()
        Returns the digraph associated with this symbol digraph.
        Returns:
        the digraph associated with this symbol digraph.
      • toString

        public String toString()
        Returns a string representation of this symbol digraph.
        Overrides:
        toString in class Object
        Returns:
        a string representation of this symbol digraph.
      • main

        public static void main​(String[] args)
        Unit tests the data type.
        Parameters:
        args - the command-line arguments.