N
- The type of Node stored in this Edgepublic class DefaultGraphEdge<N> extends java.lang.Object implements GraphEdge<N>
Constructor and Description |
---|
DefaultGraphEdge(N node1,
N node2)
Creates a new DefaultGraphEdge which is connected to the given Nodes.
|
Modifier and Type | Method and Description |
---|---|
DefaultGraphEdge<N> |
createReplacementEdge(N node1,
N node2)
Creates a replacement DefaultGraphEdge for this DefaultGraphEdge, with
the replacement connected to the two given Nodes.
|
int |
getAdjacentNodeCount()
Returns 2: the number of Nodes to which this DefaultGraphEdge is
connected.
|
java.util.List<N> |
getAdjacentNodes()
Returns the List of Adjacent (connected) Nodes to this DefaultGraphEdge.
|
N |
getNodeAt(int index)
Returns the node at the given index.
|
N |
getOppositeNode(N node)
Returns the Node attached to this DefaultGraphEdge opposite of the given
Node.
|
boolean |
isAdjacentNode(N node)
Returns true if the given Node is adjacent (connected) to this
DefaultGraphEdge; false otherwise.
|
public N getNodeAt(int index)
getNodeAt
in interface Edge<N>
index
- The index of the Node to be returnedEdge.getNodeAt(int)
public N getOppositeNode(N node)
getOppositeNode
in interface GraphEdge<N>
node
- The Node for which the opposite Node should be returned.GraphEdge.getOppositeNode(java.lang.Object)
public DefaultGraphEdge<N> createReplacementEdge(N node1, N node2)
createReplacementEdge
in interface GraphEdge<N>
node1
- The first Node to be connected to the replacement GraphEdge.node2
- The second Node to be connected to the replacement GraphEdge.GraphEdge.createReplacementEdge(java.lang.Object,
java.lang.Object)
public java.util.List<N> getAdjacentNodes()
getAdjacentNodes
in interface Edge<N>
Edge.getAdjacentNodes()
public boolean isAdjacentNode(N node)
isAdjacentNode
in interface Edge<N>
node
- The Node to be testedEdge.isAdjacentNode(java.lang.Object)
public int getAdjacentNodeCount()
getAdjacentNodeCount
in interface Edge<N>
Edge.getAdjacentNodeCount()