|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectfi.joensuu.cs.tra.Vertex
public class Vertex
Vertices are objects that are connected to other vertices by
Edges to form a graph.
Edge,
Graph,
DiGraph| Nested Class Summary | |
|---|---|
class |
Vertex.EdgeIteratorWrapper
|
class |
Vertex.NeighborIteratorWrapper
|
| Method Summary | |
|---|---|
Edge |
addEdge(Vertex vertex)
Attaches a new Edge between this
Vertex and the specified one. |
Edge |
addEdge(Vertex vertex,
float weight)
Attaches a new Edge between this
Vertex and the specified one. |
Edge |
addEdge(Vertex vertex,
int color)
Attaches a new Edge between this
Vertex and the specified one. |
Edge |
addEdge(Vertex vertex,
int color,
float weight)
Attaches a new Edge between this
Vertex and the specified one. |
Edge |
addEdge(Vertex vertex,
String label)
Attaches a new Edge between this
Vertex and the specified one. |
Edge |
addEdge(Vertex vertex,
String label,
int color)
Attaches a new Edge between this
Vertex and the specified one. |
Edge |
addEdge(Vertex vertex,
String label,
int color,
float weight)
Attaches a new Edge between this
Vertex and the specified one. |
int |
compareTo(Object o)
Defined in Comparable. |
Iterator<Edge> |
edgeIterator()
Returns an Iterator over the Edges attached
to this Vertex. |
Iterable<Edge> |
edges()
Returns an Iterable over this Vertex's
Edges that can be used in a foreach construct. |
int |
getColor()
Gets this Vertex's color. |
Edge |
getEdge(Vertex destination)
Returns the edge from this Vertex to the specified one or null if one doesn't exist. |
int |
getIndex()
Gets this Vertex's index. |
String |
getLabel()
Gets this Vertex's label. |
float |
getWeight()
Gets this Vertex's weight. |
boolean |
isAdjacent(Vertex vertex)
Determines if the specified Vertex is adjacent to this one (whether they are connected with an Edge.) |
Iterator<Edge> |
iterator()
Returns an Iterator over the Edges attached
to this Vertex. |
Iterator<Vertex> |
neighborIterator()
Returns an Iterator over this Vertex's
neighbors. |
Iterable<Vertex> |
neighbors()
Returns an Iterable over this Vertex's
neighbors that can be used in a foreach construct. |
boolean |
removeEdge(Edge edge)
Removes the specified Edge. |
void |
removeEdges()
Removes all the Edges attached to this Vertex. |
int |
setColor(int color)
Sets this Vertex's color. |
int |
setIndex(int index)
Sets this Vertex's index. |
String |
setLabel(String label)
Sets this Vertex's label. |
float |
setWeight(float weight)
Sets this Vertex's weight. |
String |
toString()
Returns a String representation of this Vertex. |
String |
toString(boolean neighborsToo)
Returns a String representation of this Vertex and optionally its neighbors and their connecting Edges. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public String getLabel()
public String setLabel(String label)
label - the new label for this Vertex.
public int getColor()
public int setColor(int color)
color - the new color for this Vertex
public int getIndex()
public int setIndex(int index)
index - the new index for this Vertex
public float getWeight()
public float setWeight(float weight)
weight - the new weight for this Vertex
public int compareTo(Object o)
Comparable.
compareTo in interface Comparable
public Edge addEdge(Vertex vertex,
String label,
int color,
float weight)
Edge between this
Vertex and the specified one.
vertex - the endpoint of the new Edgelabel - the label for the new Edgecolor - the color for the new Edgeweight - the weight for the new Edge
GraphException - if color is negative,DiGraph and the endpoint
is this Vertex
public Edge addEdge(Vertex vertex,
String label,
int color)
Edge between this
Vertex and the specified one.
vertex - the endpoint of the new Edgelabel - the label for the new Edgecolor - the color for the new Edge
GraphException - if color is negative,DiGraph and the endpoint
is this Vertex
public Edge addEdge(Vertex vertex,
String label)
Edge between this
Vertex and the specified one.
vertex - the endpoint of the new Edgelabel - the label for the new Edge
GraphException - if destination vertex is null,
DiGraph and the endpoint
is this Vertexpublic Edge addEdge(Vertex vertex)
Edge between this
Vertex and the specified one.
vertex - the endpoint of the new Edge
GraphException - if destination vertex is null,
DiGraph and the endpoint
is this Vertex
public Edge addEdge(Vertex vertex,
int color,
float weight)
Edge between this
Vertex and the specified one.
vertex - the endpoint of the new Edgecolor - the color for the new Edgeweight - the weight for the new Edge
GraphException - if color is negative,DiGraph and the endpoint
is this Vertex
public Edge addEdge(Vertex vertex,
int color)
Edge between this
Vertex and the specified one.
vertex - the endpoint of the new Edgecolor - the color for the new Edge
GraphException - if color is negative,DiGraph and the endpoint
is this Vertex
public Edge addEdge(Vertex vertex,
float weight)
Edge between this
Vertex and the specified one.
vertex - the endpoint of the new Edgeweight - the weight for the new Edge
GraphException - if destination vertex is null,
DiGraph and the endpoint
is this Vertexpublic Edge getEdge(Vertex destination)
destination - the Vertex and Edge leading to
which is sought.
public Iterator<Edge> iterator()
Iterator over the Edges attached
to this Vertex.
iterator in interface Iterablepublic Iterator<Edge> edgeIterator()
Iterator over the Edges attached
to this Vertex.
public Iterable<Edge> edges()
Iterable over this Vertex's
Edges that can be used in a foreach construct.
public Iterable<Vertex> neighbors()
Iterable over this Vertex's
neighbors that can be used in a foreach construct.
public Iterator<Vertex> neighborIterator()
Iterator over this Vertex's
neighbors.
public void removeEdges()
public boolean removeEdge(Edge edge)
edge - the Edge to remove
public boolean isAdjacent(Vertex vertex)
vertex - the Vertex to check
public String toString()
toString in class Objectpublic String toString(boolean neighborsToo)
neighborsToo - whether to recursively include the neighbours
and the connecting Edges
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||