Package org.goplanit.algorithms.shortest
Class MinMaxPathResultImpl
- java.lang.Object
-
- org.goplanit.algorithms.shortest.MinMaxPathResultImpl
-
- All Implemented Interfaces:
MinMaxPathResult
,ShortestPathResult
,ShortestResult
public class MinMaxPathResultImpl extends Object implements MinMaxPathResult
Implementation of the MinMaxPathResult interface- Author:
- markr
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
MinMaxPathResultImpl(double[] minVertexCost, EdgeSegment[] minCostBackwardEdgeSegments, double[] maxVertexCost, EdgeSegment[] maxCostBackwardEdgeSegments)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends SimpleDirectedPath>
TcreatePath(DirectedPathFactory<T> pathFactory, DirectedVertex origin, DirectedVertex destination)
Create the path from the provided origin to a specified destination vertex, using the results available.double
getCostOf(Vertex vertex)
Collect the cost to reach the given vertex from the reference starting pointEdgeSegment
getNextEdgeSegmentForVertex(Vertex vertex)
Find the next edge segment for a given vertex, depending on the underlying search this can be either in upstream or downstream directionDirectedVertex
getNextVertexForEdgeSegment(EdgeSegment edgeSegment)
Find the next vertex on the given edge segment extremity based on the underlying search this can be either in upstream or downstream directionShortestSearchType
getSearchType()
Provide the search type that was used to obtain this resultvoid
setMinPathState(boolean flag)
Switch state to minimum path results-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.algorithms.shortest.ShortestPathResult
forEachNextEdgeSegment
-
Methods inherited from interface org.goplanit.algorithms.shortest.ShortestResult
isInverted
-
-
-
-
Constructor Detail
-
MinMaxPathResultImpl
protected MinMaxPathResultImpl(double[] minVertexCost, EdgeSegment[] minCostBackwardEdgeSegments, double[] maxVertexCost, EdgeSegment[] maxCostBackwardEdgeSegments)
Constructor- Parameters:
minVertexCost
- foundminCostBackwardEdgeSegments
- foundmaxVertexCost
- foundmaxCostBackwardEdgeSegments
- found
-
-
Method Detail
-
setMinPathState
public void setMinPathState(boolean flag)
Switch state to minimum path results- Specified by:
setMinPathState
in interfaceMinMaxPathResult
- Parameters:
flag
- when true switch to minimum paths, otherwise switch to maximum paths. Default is minimum paths
-
createPath
public <T extends SimpleDirectedPath> T createPath(DirectedPathFactory<T> pathFactory, DirectedVertex origin, DirectedVertex destination)
Create the path from the provided origin to a specified destination vertex, using the results available. The path builder is used to create the instance of the path.- Specified by:
createPath
in interfaceShortestPathResult
- Type Parameters:
T
- type of path- Parameters:
pathFactory
- to use for creating path instancesorigin
- the specified origin vertexdestination
- the specified destination vertex- Returns:
- the path that is created, when no path could be extracted null is returned
-
getNextEdgeSegmentForVertex
public EdgeSegment getNextEdgeSegmentForVertex(Vertex vertex)
Find the next edge segment for a given vertex, depending on the underlying search this can be either in upstream or downstream direction- Specified by:
getNextEdgeSegmentForVertex
in interfaceShortestPathResult
- Parameters:
vertex
- to get next segment for- Returns:
- next edge segment
-
getNextVertexForEdgeSegment
public DirectedVertex getNextVertexForEdgeSegment(EdgeSegment edgeSegment)
Description copied from interface:ShortestResult
Find the next vertex on the given edge segment extremity based on the underlying search this can be either in upstream or downstream direction- Specified by:
getNextVertexForEdgeSegment
in interfaceShortestResult
- Parameters:
edgeSegment
- to get next vertex for- Returns:
- next vertex
-
getCostOf
public double getCostOf(Vertex vertex)
Collect the cost to reach the given vertex from the reference starting point- Specified by:
getCostOf
in interfaceShortestResult
- Parameters:
vertex
- to collect cost for- Returns:
- cost found
-
getSearchType
public ShortestSearchType getSearchType()
Provide the search type that was used to obtain this result- Specified by:
getSearchType
in interfaceShortestResult
- Returns:
- shortest path search type used to obtain result
-
-