Class OSQLFunctionAstar
java.lang.Object
com.orientechnologies.orient.core.sql.functions.OSQLFunctionAbstract
com.orientechnologies.orient.core.sql.functions.OSQLFunctionConfigurableAbstract
com.orientechnologies.orient.core.sql.functions.math.OSQLFunctionMathAbstract
com.orientechnologies.orient.core.sql.functions.graph.OSQLFunctionHeuristicPathFinderAbstract
com.orientechnologies.orient.core.sql.functions.graph.OSQLFunctionAstar
- All Implemented Interfaces:
OSQLFunction
A*'s algorithm describes how to find the cheapest path from one node to another node in a
directed weighted graph with husrestic function.
The first parameter is source record. The second parameter is destination record. The third parameter is a name of property that represents 'weight' and fourth represnts the map of options.
If property is not defined in edge or is null, distance between vertexes are 0 .
- Author:
- Saeed Tabrizi (saeed a_t nowcando.com)
-
Field Summary
FieldsFields inherited from class com.orientechnologies.orient.core.sql.functions.graph.OSQLFunctionHeuristicPathFinderAbstract
context, MIN, PARAM_CUSTOM_HEURISTIC_FORMULA, PARAM_D_FACTOR, PARAM_DIRECTION, PARAM_EDGE_TYPE_NAMES, PARAM_EMPTY_IF_MAX_DEPTH, PARAM_HEURISTIC_FORMULA, PARAM_MAX_DEPTH, PARAM_PARALLEL, PARAM_TIE_BREAKER, PARAM_VERTEX_AXIS_NAMES, paramCustomHeuristicFormula, paramDestinationVertex, paramDFactor, paramDirection, paramEdgeTypeNames, paramEmptyIfMaxDepth, paramHeuristicFormula, paramMaxDepth, paramParallel, paramSourceVertex, paramTieBreaker, paramVertexAxisNames, rnd, routeFields inherited from class com.orientechnologies.orient.core.sql.functions.OSQLFunctionConfigurableAbstract
configuredParametersFields inherited from class com.orientechnologies.orient.core.sql.functions.OSQLFunctionAbstract
maxParams, minParams, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanA function can make calculation on several records before returning a result.execute(Object iThis, OIdentifiable iCurrentRecord, Object iCurrentResult, Object[] iParams, OCommandContext iContext) Process a record.protected doublegetDistance(OEdge edge) protected doublegetDistance(OVertex node, OVertex parent, OVertex target) protected doublegetHeuristicCost(OVertex node, OVertex parent, OVertex target, OCommandContext iContext) getNeighborEdges(OVertex node) Only called when function aggregates results after all records have been passed to the function.Returns a convenient SQL String representation of the function.protected booleanMethods inherited from class com.orientechnologies.orient.core.sql.functions.graph.OSQLFunctionHeuristicPathFinderAbstract
booleanOrDefault, doubleOrDefault, getCustomHeuristicCost, getDiagonalHeuristicCost, getDiagonalHeuristicCost, getEuclideanHeuristicCost, getEuclideanHeuristicCost, getEuclideanNoSQRHeuristicCost, getEuclideanNoSQRHeuristicCost, getManhatanHeuristicCost, getManhatanHeuristicCost, getMaxAxisHeuristicCost, getMaxAxisHeuristicCost, getNeighbors, getPath, getSimpleHeuristicCost, getTieBreakingHeuristicCost, getTieBreakingHeuristicCost, getTieBreakingRandomHeuristicCost, integerOrDefault, longOrDefault, stringArray, stringOrDefaultMethods inherited from class com.orientechnologies.orient.core.sql.functions.math.OSQLFunctionMathAbstract
getClassWithMorePrecision, getContextValue, shouldMergeDistributedResultMethods inherited from class com.orientechnologies.orient.core.sql.functions.OSQLFunctionConfigurableAbstract
config, toStringMethods inherited from class com.orientechnologies.orient.core.sql.functions.OSQLFunctionAbstract
filterResult, getDistributedStorageId, getMaxParams, getMinParams, getName, getSingleItem, getSingleProperty, mergeDistributedResult, returnDistributedResult, setResult
-
Field Details
-
NAME
- See Also:
-
closedSet
-
cameFrom
-
gScore
-
fScore
-
open
-
-
Constructor Details
-
OSQLFunctionAstar
public OSQLFunctionAstar()
-
-
Method Details
-
execute
public LinkedList<OVertex> execute(Object iThis, OIdentifiable iCurrentRecord, Object iCurrentResult, Object[] iParams, OCommandContext iContext) Description copied from interface:OSQLFunctionProcess a record.iCurrentRecord- : current recordiCurrentResult- TODOiParams- : function parameters, number is ensured to be within minParams and maxParams.iContext- : object calling this function- Returns:
- function result, can be null. Special cases : can be null if function aggregate results, can be null if function filter results : this mean result is excluded
-
getNeighborEdges
-
getSyntax
Description copied from interface:OSQLFunctionReturns a convenient SQL String representation of the function.Example :
myFunction( param1, param2, [optionalParam3])
This text will be used in exception messages.
- Returns:
- String , never null.
-
getResult
Description copied from interface:OSQLFunctionOnly called when function aggregates results after all records have been passed to the function.- Specified by:
getResultin interfaceOSQLFunction- Overrides:
getResultin classOSQLFunctionAbstract- Returns:
- Aggregation result
-
getDistance
- Specified by:
getDistancein classOSQLFunctionHeuristicPathFinderAbstract
-
getDistance
-
aggregateResults
public boolean aggregateResults()Description copied from interface:OSQLFunctionA function can make calculation on several records before returning a result.Example of such function : sum, count, max, min ...
The final result of the aggregation is obtain by calling
OSQLFunction.getResult()- Specified by:
aggregateResultsin interfaceOSQLFunction- Overrides:
aggregateResultsin classOSQLFunctionMathAbstract- Returns:
- true if function aggregate results
-
getHeuristicCost
protected double getHeuristicCost(OVertex node, OVertex parent, OVertex target, OCommandContext iContext) - Specified by:
getHeuristicCostin classOSQLFunctionHeuristicPathFinderAbstract
-
isVariableEdgeWeight
protected boolean isVariableEdgeWeight()- Overrides:
isVariableEdgeWeightin classOSQLFunctionHeuristicPathFinderAbstract
-