Class State
- java.lang.Object
 - 
- State
 
 
- 
public class State extends java.lang.ObjectThis class represents a single state vertex in a graph of states.- Version:
 - V2.0, 4/2021
 - Author:
 - Nathan Sprague
 
 
- 
- 
Constructor Summary
Constructors Constructor Description State(java.lang.String name)Construct a vertex. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNeighbor(State neighbor)Add a neighbor to the adjacency list for this vertex.java.lang.StringgetName()Return the name associated with this vertex.java.util.ArrayList<State>getNeighbors()Return the adjacency list for this vertex.booleanisVisited()Check to see if the current vertex has been visited.voidsetVisited(boolean visited)Set or un-set the visited flag for this vertex.java.lang.StringtoString() 
 - 
 
- 
- 
Method Detail
- 
addNeighbor
public void addNeighbor(State neighbor)
Add a neighbor to the adjacency list for this vertex.- Parameters:
 neighbor- A vertex to add to the adjacency list.
 
- 
getNeighbors
public java.util.ArrayList<State> getNeighbors()
Return the adjacency list for this vertex.- Returns:
 - The list of adjacent vertices.
 
 
- 
isVisited
public boolean isVisited()
Check to see if the current vertex has been visited. This value is not set automatically -- it must be set by by calling setVisited. (This could be useful in conducting recursive graph traversals.)- Returns:
 - True if the vertex has been visited, false otherwise.
 
 
- 
setVisited
public void setVisited(boolean visited)
Set or un-set the visited flag for this vertex.- Parameters:
 visited- New value for the visited flag.
 
- 
getName
public java.lang.String getName()
Return the name associated with this vertex.- Returns:
 - The name.
 
 
- 
toString
public java.lang.String toString()
- Overrides:
 toStringin classjava.lang.Object
 
 - 
 
 -