T - Generic objectpublic static final class Grafo.Vertex<T>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private T |
data |
private java.util.List<Grafo.Edge<T>> |
incomingEdges |
private boolean |
mark |
private int |
markState |
private java.lang.String |
name |
private java.util.List<Grafo.Edge<T>> |
outgoingEdges |
| Constructor and Description |
|---|
Vertex()
Calls this(null, null).
|
Vertex(java.lang.String n)
Create a vertex with the given name and no data
|
Vertex(java.lang.String n,
T data)
Create a Vertex with name n and given data
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addEdge(Grafo.Edge<T> e)
Add an edge to the vertex.
|
void |
addIncomingEdge(Grafo.Vertex<T> from,
int cost)
Add an incoming edge starting at from
|
void |
addOutgoingEdge(Grafo.Vertex<T> to,
int cost)
Add an outgoing edge ending at to.
|
void |
clearMark()
Clear the visited mark flag.
|
int |
cost(Grafo.Vertex<T> dest)
What is the cost from this vertext to the dest vertex.
|
Grafo.Edge<T> |
findEdge(Grafo.Edge<T> e)
Search the outgoing edges for a match to e.
|
Grafo.Edge<T> |
findEdge(Grafo.Vertex<T> dest)
Search the outgoing edges looking for an edge whose's edge.to == dest.
|
T |
getData() |
Grafo.Edge<T> |
getIncomingEdge(int i)
Get the ith incoming edge
|
int |
getIncomingEdgeCount() |
java.util.List |
getIncomingEdges()
Get the incoming edges
|
int |
getMarkState()
Get the mark state value.
|
java.lang.String |
getName() |
Grafo.Edge<T> |
getOutgoingEdge(int i)
Get the ith outgoing edge
|
int |
getOutgoingEdgeCount() |
java.util.List |
getOutgoingEdges()
Get the outgoing edges
|
boolean |
hasEdge(Grafo.Edge<T> e)
Check the vertex for either an incoming or outgoing edge mathcing e.
|
boolean |
hasEdge(Grafo.Vertex<T> dest)
Is there an outgoing edge ending at dest.
|
void |
mark()
Set the vertex mark flag.
|
boolean |
remove(Grafo.Edge<T> e)
Remove an edge from this vertex
|
void |
setData(T data) |
void |
setMarkState(int state)
Set the mark state to state.
|
java.lang.String |
toString() |
void |
visit()
Visit the vertex and set the mark flag to true.
|
boolean |
visited()
Has this vertex been marked during a visit
|
private java.util.List<Grafo.Edge<T>> incomingEdges
private java.util.List<Grafo.Edge<T>> outgoingEdges
private java.lang.String name
private boolean mark
private int markState
private T data
public Vertex()
public Vertex(java.lang.String n)
n - -
return npublic Vertex(java.lang.String n,
T data)
n - -
name of vertexdata - -
data associated with vertexpublic java.lang.String getName()
public T getData()
public void setData(T data)
data - The data to set.public boolean addEdge(Grafo.Edge<T> e)
e - -
the edge to addpublic void addOutgoingEdge(Grafo.Vertex<T> to, int cost)
to - -
the destination vertexcost - the edge costpublic void addIncomingEdge(Grafo.Vertex<T> from, int cost)
from - -
the starting vertexcost - the edge costpublic boolean hasEdge(Grafo.Edge<T> e)
e - the edge to checkpublic boolean remove(Grafo.Edge<T> e)
e - -
the edge to removepublic int getIncomingEdgeCount()
public Grafo.Edge<T> getIncomingEdge(int i)
i - the index into incoming edgespublic java.util.List getIncomingEdges()
public int getOutgoingEdgeCount()
public Grafo.Edge<T> getOutgoingEdge(int i)
i - the index into outgoing edgespublic java.util.List getOutgoingEdges()
public Grafo.Edge<T> findEdge(Grafo.Vertex<T> dest)
dest - the destinationpublic Grafo.Edge<T> findEdge(Grafo.Edge<T> e)
e - -
the edge to checkpublic int cost(Grafo.Vertex<T> dest)
dest - -
the destination vertex.public boolean hasEdge(Grafo.Vertex<T> dest)
dest - -
the vertex to checkpublic boolean visited()
public void mark()
public void setMarkState(int state)
state - the statepublic int getMarkState()
public void visit()
public void clearMark()
public java.lang.String toString()
toString in class java.lang.Object