T
- public class Vertex<T> extends Object
Constructor and Description |
---|
Vertex()
Calls this(null, null).
|
Vertex(String n)
Create a vertex with the given name and no data
|
Vertex(String n,
T data)
Create a Vertex with name n and given data
|
Modifier and Type | Method and Description |
---|---|
boolean |
addEdge(Edge<T> e)
Add an edge to the vertex.
|
void |
addIncomingEdge(Vertex<T> from,
int cost)
Add an incoming edge starting at from
|
void |
addOutgoingEdge(Vertex<T> to,
int cost)
Add an outgoing edge ending at to.
|
void |
clearMark()
Clear the visited mark flag.
|
int |
cost(Vertex<T> dest)
What is the cost from this vertext to the dest vertex.
|
Edge<T> |
findEdge(Edge<T> e)
Search the outgoing edges for a match to e.
|
Edge<T> |
findEdge(Vertex<T> dest)
Search the outgoing edges looking for an edge whose's
edge.to == dest.
|
T |
getData() |
Edge<T> |
getIncomingEdge(int i)
Get the ith incoming edge
|
int |
getIncomingEdgeCount() |
List |
getIncomingEdges()
Get the incoming edges
|
int |
getMarkState()
Get the mark state value.
|
String |
getName() |
Edge<T> |
getOutgoingEdge(int i)
Get the ith outgoing edge
|
int |
getOutgoingEdgeCount() |
List |
getOutgoingEdges()
Get the outgoing edges
|
boolean |
hasEdge(Edge<T> e)
Check the vertex for either an incoming or outgoing edge
mathcing e.
|
boolean |
hasEdge(Vertex<T> dest)
Is there an outgoing edge ending at dest.
|
void |
mark()
Set the vertex mark flag.
|
boolean |
remove(Edge<T> e)
Remove an edge from this vertex
|
void |
setData(T data) |
void |
setMarkState(int state)
Set the mark state to state.
|
String |
toString() |
void |
visit()
Visit the vertex and set the mark flag to true.
|
boolean |
visited()
Has this vertex been marked during a visit
|
public Vertex()
public Vertex(String n)
n
- public String getName()
public T getData()
public void setData(T data)
data
- The data to set.public boolean addEdge(Edge<T> e)
e
- - the edge to addpublic void addOutgoingEdge(Vertex<T> to, int cost)
to
- - the destination vertexcost
- the edge costpublic void addIncomingEdge(Vertex<T> from, int cost)
from
- - the starting vertexcost
- the edge costpublic boolean hasEdge(Edge<T> e)
e
- the edge to checkpublic boolean remove(Edge<T> e)
e
- - the edge to removepublic int getIncomingEdgeCount()
public Edge<T> getIncomingEdge(int i)
i
- the index into incoming edgespublic List getIncomingEdges()
public int getOutgoingEdgeCount()
public Edge<T> getOutgoingEdge(int i)
i
- the index into outgoing edgespublic List getOutgoingEdges()
public Edge<T> findEdge(Vertex<T> dest)
dest
- the destinationpublic Edge<T> findEdge(Edge<T> e)
e
- - the edge to checkpublic int cost(Vertex<T> dest)
dest
- - the destination vertex.public boolean hasEdge(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()
Copyright © 2018 JBoss by Red Hat. All rights reserved.