V - the vertexpublic class Vertex<V>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
REMOVED |
| Constructor and Description |
|---|
Vertex(Graph<V,?> graph,
V vertex)
Get a Vertex linked with the graph
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(V child,
java.lang.Number weight)
Add a child to this vertex.
The added child must be in the graph or it will return an exception. |
void |
addIfAbsent()
Add the vertex to the graph only if it's not already in the graph.
|
boolean |
equals(java.lang.Object obj) |
java.util.Collection<V> |
getAncestors()
Get all the vertex ancestor of this vertex.
The ancestors are all the vertices that have as destination this vertex. |
java.util.Collection<Vertex<V>> |
getAncestorsAsVertex()
Get all the ancestors of this vertex like
getAncestors(), but as Vertex.In this way they are linked to the graph as this one. This method allocate a new object for each vertex, so it is more heavy. |
java.util.Collection<V> |
getChildren()
Get all the vertex children of the current vertex
|
java.util.Collection<Vertex<V>> |
getChildrenAsVertex()
Get all the children of this vertex like
getChildren(), but as Vertex.In this way they are linked to the graph as this one. * This method allocate a new object for each vertex, so it is more heavy. |
java.util.Collection<Edge<V,java.lang.Number>> |
getEdgesIn()
Get all the edge that goes INTO this vertex
|
java.util.Collection<Edge<V,java.lang.Number>> |
getEdgesOut()
Get all the edge that goes OUT of this vertex
|
java.util.Collection<java.lang.Object> |
getMarks()
Get all the marks that are associated with this vertex
|
V |
getValue()
Get the vertex
|
int |
hashCode() |
boolean |
isStillContained()
This call tell if the current vertex is still contained in the graph linked.
While this function return false all the other methods will throw an exception. |
void |
mark(java.lang.Object mark)
Mark the vertex with the associated string
|
void |
remove()
Remove the vertex from the graph.
After this call all the other methods will throw an exception |
void |
removeChild(V child)
Removes a child of this vertex.
|
java.lang.String |
toString() |
void |
unMark()
Remove all the marker from the vertex
|
void |
unMark(java.lang.Object mark)
Remove the specified mark from this vertex
|
VisitInfo<V> |
visit(VisitStrategy strategy,
java.util.function.Consumer<V> visit)
Visit the graph from this current vertex with the strategy assigned
|
public static final java.lang.String REMOVED
public V getValue()
public void mark(java.lang.Object mark)
throws java.lang.NullPointerException,
java.lang.UnsupportedOperationException
mark - the markerjava.lang.NullPointerException - if the marker is nulljava.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic void unMark(java.lang.Object mark)
throws java.lang.UnsupportedOperationException
mark - the markerjava.lang.NullPointerException - if the mark is nulljava.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic void unMark()
throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic java.util.Collection<java.lang.Object> getMarks()
throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic java.util.Collection<V> getChildren() throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic java.util.Collection<Vertex<V>> getChildrenAsVertex() throws java.lang.UnsupportedOperationException
getChildren(), but as Vertex.java.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic java.util.Collection<V> getAncestors() throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic java.util.Collection<Vertex<V>> getAncestorsAsVertex() throws java.lang.UnsupportedOperationException
getAncestors(), but as Vertex.java.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic java.util.Collection<Edge<V,java.lang.Number>> getEdgesOut() throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic java.util.Collection<Edge<V,java.lang.Number>> getEdgesIn() throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic void addChild(V child, java.lang.Number weight) throws java.lang.NullPointerException, java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
child - the destination vertex of this edgeweight - the weight of the edgejava.lang.NullPointerException - if the param is nulljava.lang.IllegalArgumentException - if the child vertex is not contained in the graphjava.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic void removeChild(V child) throws java.lang.NullPointerException, java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
child - the child of the current vertexjava.lang.NullPointerException - if the param is nulljava.lang.IllegalArgumentException - if the child vertex is not contained in the graphjava.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic boolean isStillContained()
public void addIfAbsent()
public void remove()
public VisitInfo<V> visit(VisitStrategy strategy, java.util.function.Consumer<V> visit) throws java.lang.NullPointerException, java.lang.UnsupportedOperationException
strategy - the strategy of the visitvisit - the function to apply at each vertex (can be null)java.lang.NullPointerException - if the strategy is nulljava.lang.UnsupportedOperationException - if the vertex is not in the graph anymorepublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object