public class Vertex<V>
extends java.lang.Object
vertexInfo(v)
Modifier and Type | Field and Description |
---|---|
static int |
MAX_COST
Maximum possible cost to reach a vertex from another; treat this as "infinity".
|
Constructor and Description |
---|
Vertex(V v)
Constructs information for the given vertex.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Resets the previous, visited, cost, and number data fields to their original values.
|
int |
cost()
Returns the value of the internal 'cost' to reach this vertex.
|
boolean |
equals(java.lang.Object o)
Returns true if o refers to a Vertex object correspending to the same
underlying 'V' object as this one.
|
int |
hashCode()
Returns an integer code for placing this vertex into a hash-based collection.
|
int |
number()
Returns the value of the internal 'number' vertex marker for this vertex.
|
V |
previous()
Returns the value of the internal 'previous' vertex marker for this vertex.
|
void |
setCost(int cost)
Sets the value of the internal 'cost' to reach this vertex.
|
void |
setNumber(int number)
Sets the value of the internal 'number' vertex marker for this vertex.
|
void |
setPrevious(V previous)
Sets the value of the internal 'previous' vertex marker for this vertex.
|
void |
setVisited()
Sets the value of the internal 'previous' vertex marker to true for this vertex.
|
void |
setVisited(boolean visited)
Sets the value of the internal 'previous' vertex marker for this vertex.
|
java.lang.String |
toString()
Returns a string representation of the information about this vertex.
|
V |
vertex()
Returns the vertex value that this Vertex object stores information about.
|
boolean |
visited()
Returns the value of the internal 'visited' vertex marker for this vertex.
|
public static final int MAX_COST
public Vertex(V v)
v
- The vertex this information is about.java.lang.NullPointerException
- If the vertex is null.public void clear()
public int cost()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int number()
public V previous()
public void setCost(int cost)
cost
- the new cost to usepublic void setNumber(int number)
number
- the new number to usepublic void setPrevious(V previous)
java.lang.NullPointerException
- If the previous vertex is null.public void setVisited()
public void setVisited(boolean visited)
public V vertex()
public boolean visited()
public java.lang.String toString()
toString
in class java.lang.Object