|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.router.polyline.PathSearchExtension
public abstract class PathSearchExtension
Extensions are added to a PathSearch
to influence the search process.
It contains several callback methods that are used by the PathSearch
to e.g. calculate the costs for
the next possible steps (i.e. entering the next partition cell) and to decide when the target is reached.
The PathSearch
uses the callbacks in the following order:
initialize
initializeEdges
initializeCurrentEdge
appendStartEntrances
calculateStartEntranceCost
calculateCosts
calculateHeuristicCosts
isValidTargetEntrance
finalizePath
finalizeCurrentEdge
or cancelCurrentEdge
finalizeEdges
finalizePathSearchResult
cleanup
PathSearch.addPathSearchExtension(PathSearchExtension)
,
PathSearchContext.getCurrentEdge()
Constructor Summary | |
---|---|
PathSearchExtension()
|
Method Summary | |
---|---|
protected void |
appendStartEntrances(List allStartEntrances)
Appends additional start entrances for the path search of the current edge to the given list of all previously generated entrances. |
protected double |
calculateCosts(CellEntrance currentEntrance,
PartitionCell enteredCell,
OrthogonalInterval enterInterval,
EdgeCellInfo edgeCellInfo,
double maxAllowedCosts)
Calculate the costs for entering the enteredCell via the enterInterval . |
protected double |
calculateHeuristicCosts(CellEntrance entrance)
Calculates the heuristic costs for the given entrance that describe the minimal costs that will arise to finish the path if the given cell entrance is used as next step. |
protected double |
calculateStartEntranceCost(CellEntrance startEntrance)
Returns the cost for starting the path in the given entrance. |
protected void |
cancelCurrentEdge(PathSearchContext context)
This callback notifies the extension when the path search for the current edge is cancelled. |
protected void |
cleanup()
Cleans the extension up from the path searches with the current configuration. |
protected void |
finalizeCurrentEdge(PathSearchContext context)
This callback notifies the extension when enough paths are found for the current edge. |
protected void |
finalizeEdges(PathSearchContext context)
This callback notifies the extension if enough paths have been found for all edges in the context's edge list. |
protected void |
finalizePath(Path path)
After finding a valid target entrance and creating a Path , the extension is notified about the found path. |
protected void |
finalizePathSearchResult(PathSearchResult pathSearchResult)
Callback notifying the extension about the paths chosen for the edges in the current context. |
protected PathSearchConfiguration |
getConfiguration()
Returns the configuration used for the path search. |
protected PathSearchContext |
getContext()
Returns the current context of the path search. |
protected void |
initialize(PathSearchConfiguration configuration)
Initializes this extension for path searches using the given configuration. |
protected void |
initializeCurrentEdge(PathSearchContext context)
Initializes this extension with the current edge set in the given context. |
protected void |
initializeEdges(PathSearchContext context)
Initializes this extension with the context that contains the list of edges for which paths are calculated. |
protected boolean |
isValidTargetEntrance(CellEntrance entrance)
Determines whether this extension considers the given entrance a valid target entrance, i.e. the path may
end with this entrance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PathSearchExtension()
Method Detail |
---|
protected PathSearchConfiguration getConfiguration()
init
method.
protected PathSearchContext getContext()
initEdges
method.
protected void initialize(PathSearchConfiguration configuration)
This method is the first one to be called by the PathSearch
.
configuration
- The configuration to use for the following path searches.protected void initializeEdges(PathSearchContext context)
finalizeEdges(PathSearchContext)
and finalizePathSearchResult(PathSearchResult)
.
context
- The context containing the list of edges, paths shall be found for.PathSearchContext.getEdges()
protected void initializeCurrentEdge(PathSearchContext context)
context's egdes
. Each call will be balanced by a call to either finalizeCurrentEdge(PathSearchContext)
or cancelCurrentEdge(PathSearchContext).
context
- The context containing the current edge.PathSearchContext.getCurrentEdge()
protected void appendStartEntrances(List allStartEntrances)
allStartEntrances
- a list of all previously generated entrancesprotected double calculateStartEntranceCost(CellEntrance startEntrance)
startEntrance
- The start entrance to calculate the cost for.
protected double calculateCosts(CellEntrance currentEntrance, PartitionCell enteredCell, OrthogonalInterval enterInterval, EdgeCellInfo edgeCellInfo, double maxAllowedCosts)
enteredCell
via the enterInterval
.
The given EdgeCellInfo
describes how the partition cell, that has been entered by the current entrance,
would be traversed if this enter interval to the neighbor cell would be chosen.
The maxAllowedCosts
describe the maximum costs the entering of the neighbor cell via this
enter intervals may induce. If the maximum cost is exceeded, calculations that may further increase its cost
may be skipped because this interval won't be chosen anyway.
currentEntrance
- The entrance that was used to enter the current cell.enteredCell
- The neighbor cell that shall be entered.enterInterval
- The interval that shall be used to enter the neighbor cell.edgeCellInfo
- Information about how the current cell would be traversed if the neighbor cell would be
entered by this enter interval.maxAllowedCosts
- The maximum allowed costs for this enter intervals.
protected double calculateHeuristicCosts(CellEntrance entrance)
After evaluating the costs for each enter interval to a neighbor cell, this method is called for each of the
resulting CellEntrance
s.
entrance
- The entrance to calculate the heuristic costs for the rest of the path.
protected boolean isValidTargetEntrance(CellEntrance entrance)
entrance
a valid target entrance, i.e. the path may
end with this entrance.
Each time a CellEntrance
is chosen as next step, all registered extension are asked if this entrance
is a valid target entrance. Only if none of the extensions returns false
, a Path
is created.
entrance
- The entrance to decide if it is a valid target entrance.
true
, if the path may end with this entrance; false
otherwise.protected void finalizePath(Path path)
Path
, the extension is notified about the found path.
If the path search is configured to calculate several possible paths for an edge, the path search proceeds with choosing another unhandled CellEntrance.
path
- The path found for the current edge in the context.PathSearchContext.getCurrentEdge()
protected void cancelCurrentEdge(PathSearchContext context)
After that, the path search will proceed with altering the penalties of the current edge and reinitializing it again.
context
- The context containing the current edge the path search has been finished for.initializeCurrentEdge(y.layout.router.polyline.PathSearchContext)
,
finalizeEdges(PathSearchContext)
protected void finalizeCurrentEdge(PathSearchContext context)
After that, the path search either proceed with initializing the next current edge in the context's edge list or
calls finalizeEdges(PathSearchContext)
if all edges in this list have been handled.
context
- The context containing the current edge the path search has been finished for.initializeCurrentEdge(y.layout.router.polyline.PathSearchContext)
,
finalizeEdges(PathSearchContext)
protected void finalizeEdges(PathSearchContext context)
context
- The context containing the list of edges, paths have been found for.PathSearchContext.getEdges()
protected void finalizePathSearchResult(PathSearchResult pathSearchResult)
After calling finalizeEdges
, the PathSearch decides, which of the found
paths to use for each edge and adds them to the PathSearchResult
.
With this callback the registered extensions are notified about this result before the path search either
initializes the next list of edges to route or ends the path search by calling cleanup()
.
pathSearchResult
- The path search result for the edge in the current context's edge list.initializeEdges(y.layout.router.polyline.PathSearchContext)
,
cleanup()
protected void cleanup()
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |