Package dsa
Class SymbolDiGraph
java.lang.Object
dsa.SymbolDiGraph
An immutable data type to represent a directed symbol graph.
-
Constructor Summary
ConstructorDescriptionSymbolDiGraph
(stdlib.In in, String delim) Constructs a symbol digraph from the input streamin
usingdelim
as the delimiter. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returnstrue
if this symbol digraph contains vertexs
, andfalse
otherwise.diGraph()
Returns the digraph associated with this symbol digraph.int
Returns the integer associated with the vertexs
in this symbol digraph.static void
Unit tests the data type.nameOf
(int v) Returns the name of the vertex associated with the integerv
in this symbol digraph.toString()
Returns a string representation of this symbol digraph.
-
Constructor Details
-
SymbolDiGraph
Constructs a symbol digraph from the input streamin
usingdelim
as the delimiter.- Parameters:
in
- the input stream.delim
- the delimiter between fields.
-
-
Method Details
-
contains
Returnstrue
if this symbol digraph contains vertexs
, andfalse
otherwise.- Parameters:
s
- the vertex name.- Returns:
true
if this symbol digraph contains vertexs
, andfalse
otherwise.
-
indexOf
Returns the integer associated with the vertexs
in this symbol digraph.- Parameters:
s
- the vertex name.- Returns:
- the integer associated with the vertex
s
in this symbol digraph.
-
nameOf
Returns the name of the vertex associated with the integerv
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
Returns the digraph associated with this symbol digraph.- Returns:
- the digraph associated with this symbol digraph.
-
toString
Returns a string representation of this symbol digraph. -
main
Unit tests the data type.- Parameters:
args
- the command-line arguments.
-