public interface Node
Modifier and Type | Method and Description |
---|---|
void |
addEdge(Edge edge)
Adds an edge to this node, if it doesn't exist yet.
|
default double |
distance(Node other)
Returns the distance between this and the other node.
|
default double |
distanceSquared(Node other)
Returns the squared distance between this and the other node.
|
default java.util.Optional<Edge> |
getEdgeForNeighbor(Node neighbor)
Gets the edge which points to the given neighbor, if it exists.
|
java.util.Collection<Edge> |
getEdges()
Returns all ingoing and outgoing edges of this node.
|
default java.util.List<Edge> |
getIncomingEdges()
Returns all edges which are incoming into this node.
|
<T> java.util.Optional<T> |
getMetaInformation(java.lang.Class<T> clazz)
Gets the meta information contained in this node if it exists.
|
default java.util.List<Node> |
getNeighbors()
Returns all neighbors of this node, i.e.
|
java.util.Optional<Position> |
getOldPosition()
Get the previous position of this node, if any exists.
|
default java.util.List<Edge> |
getOutgoingEdges()
Returns all edges which are outgoing from this node.
|
Position |
getPosition()
Get the current position of this node.
|
default java.util.List<Node> |
getPredecessors()
Returns all nodes which are predecessors of this node, i.e.
|
default java.util.List<Node> |
getSuccessors()
Returns all nodes which are successors of this node, i.e.
|
java.lang.Object |
getValue()
Returns the value stored in this node.
|
default boolean |
hasSuccessor(Node successor)
Returns whether the given node is a successor of this node.
|
void |
removeEdge(Edge edge)
Removes an edge from this node, if it exists.
|
<T> void |
setMetaInformation(T meta)
Set the meta information contained in this node.
|
default void |
setOldPosition()
Set the old position to the current position.
|
void |
setOldPosition(Position oldPosition)
Set the old position to the given position.
|
void |
setPosition(Position position)
Set the position of this node.
|
void |
setValue(java.lang.Object value)
Sets the value stored in this node.
|
java.lang.String |
toString() |
java.lang.Object getValue()
void setValue(java.lang.Object value)
value
- The new value.void addEdge(Edge edge)
edge
- The edge to add.void removeEdge(Edge edge)
edge
- The edge to remove.java.util.Collection<Edge> getEdges()
default java.util.List<Node> getSuccessors()
default java.util.List<Node> getPredecessors()
default java.util.List<Node> getNeighbors()
default boolean hasSuccessor(Node successor)
successor
- The node for which to check succession.default java.util.List<Edge> getOutgoingEdges()
default java.util.List<Edge> getIncomingEdges()
default java.util.Optional<Edge> getEdgeForNeighbor(Node neighbor)
neighbor
- The possible neighbor.java.util.Optional<Position> getOldPosition()
void setOldPosition(Position oldPosition)
oldPosition
- The new old position.default void setOldPosition()
Position getPosition()
void setPosition(Position position)
position
- The new position.default double distance(Node other)
other
- The other node.default double distanceSquared(Node other)
other
- The other node.<T> void setMetaInformation(T meta)
T
- The type of the new piece of meta information.meta
- The new piece of meta information.<T> java.util.Optional<T> getMetaInformation(java.lang.Class<T> clazz)
T
- The type of the meta information object.clazz
- The class of the meta information object.java.lang.String toString()
toString
in class java.lang.Object