public final class Path
extends java.lang.Object
Constructor and Description |
---|
Path(java.util.List<Node> nodes,
java.util.List<Edge> edges)
Parametrized constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
Node |
firstNode()
Returns the first node in the path.
|
Edge |
getEdge(int index)
Returns an edge with specified index in the path.
|
java.util.List<Edge> |
getEdges()
Returns the edges of the path.
|
Node |
getNode(int index)
Returns a node with specified index in the path.
|
java.util.List<Node> |
getNodes()
Returns the nodes of the path.
|
int |
hashCode() |
Node |
lastNode()
Returns the last node in the path.
|
int |
length()
Returns the length of the path - number of edges.
|
int |
nodeCount()
Return the number of nodes in the path.
|
java.lang.String |
toString() |
public java.util.List<Node> getNodes()
public java.util.List<Edge> getEdges()
public int length()
public int nodeCount()
public Node firstNode()
java.lang.IndexOutOfBoundsException
- if the path is empty.public Node lastNode()
java.lang.IndexOutOfBoundsException
- if the path is empty.public Node getNode(int index)
java.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= nodesCount()
)public Edge getEdge(int index)
java.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= length()
)public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2023. All rights reserved.