public class Vertex extends java.util.Observable implements java.lang.Comparable<Vertex>
| Constructor and Description | 
|---|
Vertex(Graph g)
Default constructor 
 | 
Vertex(Vertex orig)
Copy constructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addDirectedEdge(Vertex vertex)
This method adds a directed edge from this vertex to the vertex that was passed in. 
 | 
void | 
addEdge(Vertex vertex)
This method creates an undirected edge between this vertex and the vertex that was passed in. 
 | 
void | 
clearSelectionData()
Clear all selection data. 
 | 
int | 
compareTo(Vertex other)
From the Comparable interface. 
 | 
boolean | 
coordinatesChanged()
Tells whether or not the coordinates of this vertex are different than its initial coordinates 
 | 
void | 
decrementSelectedNeighbors()
Reduces the number of selected neighbors by 1 
 | 
void | 
deleteAllNeighbors()
This method causes all edges from the vertices adjacent this one to be deleted. 
 | 
java.util.List<Vertex> | 
getAdjacencyList()
This method returns the list of all vertices that are adjacent to this one. 
 | 
java.awt.Point | 
getCoordinates()
This method returns the coordinates of this vertex. 
 | 
int | 
getDegree()
Returns the number of edges connected to this vertex 
 | 
int | 
getIndex()
Returns the index of this vertex 
 | 
int | 
getIndexWhenFirstAddedOrBeforeRemoved()
Gets the original index of this vertex 
 | 
java.awt.Point | 
getInitCoordinates()
This method returns the intial coordinates of this vertex on the graph. 
 | 
Graph | 
getMyGraph()
This method returns the graph that this vertex contains. 
 | 
int | 
getTimeStamp()
Returns the time stamp which has to do with the order that the vertices are added to a graph 
 | 
void | 
incrementSelectedNeighbors()
Increases the number of selected neighbors by 1 
 | 
boolean | 
isAdjacent(Vertex vertex)
This method checks to see if this vertex is connected to the vertex that is passed in. 
 | 
boolean | 
isSelected()  | 
boolean | 
isTarget()  | 
void | 
removeDirectedEdge(Vertex vertex)
This method will remove a directed edge that is between this vertex and the vertex that is passed in. 
 | 
void | 
removeEdge(Vertex vertex)
This method removes the edge between this vertex and the vertex that is passed in. 
 | 
void | 
resetCoordinates()
This method resets the coordinates of this vertex (moves it back to its intial location). 
 | 
void | 
setAdjacencyList(java.util.List<Vertex> adjList)
This method sets the list of adjacent vertices to be the list of vertices that is passed in to this method. 
 | 
void | 
setCoordinates(java.awt.Point coordinates)
This method sets the coordinates of this vertex to the input value. 
 | 
void | 
setIndexWhenFirstAddedOrBeforeRemoved(int indexWhenFirstAddedOrBeforeRemoved)
Sets the original index of this vertex 
 | 
void | 
setIndexWhenFirstAddedOrBeforeRemovedToCurrentIndex()
Sets the original index of this vertex to its current index 
 | 
void | 
setInitCoordinates(java.awt.Point initCoordinates)
This method sets the initial coordinates of a vertex on the graph. 
 | 
void | 
setInitCoordinatesToCurrentCoordinates()
This method sets the initial coordinates of this vertex to its current coordinates 
 | 
void | 
setMyGraph(Graph g)
Sets the graph that this vertex belongs to to the passed in graph 
 | 
void | 
setSelected(boolean selected)
This method should not be called by anyone except PuzzleInstance!
 Doing so will cause the data structures to get out of sync. 
 | 
void | 
setTimeStamp(int timeStamp)
Sets the times stamp which has to do with the order that the vertices are added to a graph 
 | 
void | 
translate(java.awt.Point change)
Adds the x and y values of the passed in Point to this vertex's coordinates. 
 | 
public Vertex(Vertex orig)
orig - public Vertex(Graph g)
g - The graph object that this vertex needs to holdpublic int getTimeStamp()
public void setTimeStamp(int timeStamp)
timeStamp - the time stamppublic boolean isTarget()
public boolean isSelected()
public void setSelected(boolean selected)
selected - the selected to setpublic void decrementSelectedNeighbors()
public void incrementSelectedNeighbors()
public void clearSelectionData()
public int getDegree()
public java.awt.Point getInitCoordinates()
public void setInitCoordinates(java.awt.Point initCoordinates)
initCoordinates - The point that represents this vertex's coordinatespublic void setInitCoordinatesToCurrentCoordinates()
public java.awt.Point getCoordinates()
public void setCoordinates(java.awt.Point coordinates)
coordinates - The coordinates that this vertex will be moved topublic boolean coordinatesChanged()
public void translate(java.awt.Point change)
change - The point that represents the shift.public boolean isAdjacent(Vertex vertex)
vertex - The vertex that needs to compared with this vertexpublic void addDirectedEdge(Vertex vertex)
vertex - The vertex that this vertex will have a directed edge point topublic void addEdge(Vertex vertex)
vertex - The vertex that will share and undirected edge with this onepublic void removeDirectedEdge(Vertex vertex)
vertex - The vertex that the edge will be pointed towards (The direction is from this vertex to the passed
            in vertex)public void removeEdge(Vertex vertex)
vertex - The second vertex that the edge will exist betweenpublic void deleteAllNeighbors()
public java.util.List<Vertex> getAdjacencyList()
public void setAdjacencyList(java.util.List<Vertex> adjList)
adjList - The list of vertices that are going to be set as adjacent to this vertexpublic void resetCoordinates()
public Graph getMyGraph()
public void setMyGraph(Graph g)
g - The graph that this vertex is to belong topublic int getIndex()
public int getIndexWhenFirstAddedOrBeforeRemoved()
public void setIndexWhenFirstAddedOrBeforeRemoved(int indexWhenFirstAddedOrBeforeRemoved)
public void setIndexWhenFirstAddedOrBeforeRemovedToCurrentIndex()
public int compareTo(Vertex other)
compareTo in interface java.lang.Comparable<Vertex>