public class Path extends Object
Path
represents the result of a path search as a list of consecutive CellEntrance
s.
A path starts with a CellEntrance
for a PartitionCell
of the source node and ends with one for a PartitionCell
of the target node.
PathSearch
,
PathSearchResult
Constructor and Description |
---|
Path(Edge edge,
List<Object> entrances,
double cost)
Creates a new instance of
Path for the given edge, cell entrances and cost. |
Modifier and Type | Method and Description |
---|---|
double |
getCost()
Gets the overall cost of this path.
|
Edge |
getEdge()
Gets the edge for which this path was calculated.
|
CellEntrance |
getEntrance(int position)
Returns the
CellEntrance at the given position of this path. |
int |
length()
Returns the number of
CellEntrance objects in this path. |
int |
positionOf(CellEntrance entrance)
Returns the position of the first occurrence of the given
CellEntrance in this path, or -1 if this path
does not contain this CellEntrance . |
void |
setEntrance(int position,
CellEntrance entrance)
Replaces the
CellEntrance at the given position of this path with the given CellEntrance . |
public Path(Edge edge, List<Object> entrances, double cost)
Path
for the given edge, cell entrances
and cost.edge
- the edge for which the path was calculatedentrances
- the list of CellEntrance
objects describing the edge path from source node to target nodecost
- the overall cost of this pathpublic double getCost()
public Edge getEdge()
public CellEntrance getEntrance(int position)
CellEntrance
at the given position of this path.position
- the position of the CellEntrance
to returnCellEntrance
at the given position of this pathsetEntrance(int, CellEntrance)
public int length()
CellEntrance
objects in this path.CellEntrance
objects in this pathpublic int positionOf(CellEntrance entrance)
CellEntrance
in this path, or -1
if this path
does not contain this CellEntrance
.entrance
- the CellEntrance
for which the position is retrievedCellEntrance
in this path, or -1
if this path does not
contain this CellEntrance
public void setEntrance(int position, CellEntrance entrance)
CellEntrance
at the given position of this path with the given CellEntrance
.position
- the position of the CellEntrance
to replaceentrance
- the CellEntrance
to be stored at the given positiongetEntrance(int)