Class FinderExtensions
Fluid syntax style extension methods for finders.
Namespace: AnyPath.Managed
Assembly: AnyPath.dll
Syntax
public static class FinderExtensions
Methods
AddOption<T, TNode, TOption>(T, TOption, TNode, TNode)
Adds a target with it's location to a TargetFinder
Declaration
public static T AddOption<T, TNode, TOption>(this T finder, TOption option, TNode start, TNode goal) where T : IGetFinderOptions<TOption, TNode> where TNode : unmanaged, IEquatable<TNode>
Parameters
| Type | Name | Description |
|---|---|---|
| T | finder | The finder |
| TOption | option | The target object |
| TNode | start | The starting location in the graph |
| TNode | goal | The goal location in the graph |
Returns
| Type | Description |
|---|---|
| T | The finder |
Type Parameters
| Name | Description |
|---|---|
| T | The finder |
| TNode | Type of node |
| TOption | Type of target |
Remarks
Altough a location has to be provided to a target, the target can be an arbitrary type and can contain arbitrary data.
AddOptions<T, TNode, TOption>(T, IEnumerable<TOption>, TNode, Func<TOption, TNode>)
Adds multiple targets to a TargetFinder
Declaration
public static T AddOptions<T, TNode, TOption>(this T finder, IEnumerable<TOption> options, TNode start, Func<TOption, TNode> optionToLocation) where T : IGetFinderOptions<TOption, TNode> where TNode : unmanaged, IEquatable<TNode>
Parameters
| Type | Name | Description |
|---|---|---|
| T | finder | The finder |
| IEnumerable<TOption> | options | The options |
| TNode | start | The shared starting location in the graph. Each option will start from here. |
| Func<TOption, TNode> | optionToLocation | Function providing a goal location for each option |
Returns
| Type | Description |
|---|---|
| T | The finder |
Type Parameters
| Name | Description |
|---|---|
| T | Type of finder |
| TNode | Type of node |
| TOption | User defined option type. |
AddRange<T, TNode, TOption>(T, IEnumerable<TOption>, TNode, Func<TOption, TNode>)
Adds a range of options to an IOptions
Declaration
public static T AddRange<T, TNode, TOption>(this T finderOptions, IEnumerable<TOption> options, TNode start, Func<TOption, TNode> optionToLocation) where T : IFinderOptions<TOption, TNode> where TNode : unmanaged, IEquatable<TNode>
Parameters
| Type | Name | Description |
|---|---|---|
| T | finderOptions | The options component of the minder |
| IEnumerable<TOption> | options | The options |
| TNode | start | The shared starting location in the graph. Each option will start from here. |
| Func<TOption, TNode> | optionToLocation | Function providing a goal location for each option |
Returns
| Type | Description |
|---|---|
| T | The IFinderOptions the options were added to |
Type Parameters
| Name | Description |
|---|---|
| T | Type of finder |
| TNode | Type of node |
| TOption | User defined option type. |
AddRequest<T, TNode>(T, TNode, TNode)
Adds a request to a MultiFinder
Declaration
public static T AddRequest<T, TNode>(this T finder, TNode start, TNode goal) where T : IGetFinderMultiRequests<TNode> where TNode : unmanaged, IEquatable<TNode>
Parameters
| Type | Name | Description |
|---|---|---|
| T | finder | The multi finder |
| TNode | start | The starting location |
| TNode | goal | The goal location |
Returns
| Type | Description |
|---|---|
| T | The finder |
Type Parameters
| Name | Description |
|---|---|
| T | Type of finder |
| TNode | Type of node |
Remarks
A multifinder evaluates all of the requests that are added in a single job.
AddRequests<T, TNode>(T, IEnumerable<TNode>)
Adds a request with multiple stops to a MultiFinder
Declaration
public static T AddRequests<T, TNode>(this T finder, IEnumerable<TNode> stops) where T : IGetFinderMultiRequests<TNode> where TNode : unmanaged, IEquatable<TNode>
Parameters
| Type | Name | Description |
|---|---|---|
| T | finder | The multi finder |
| IEnumerable<TNode> | stops | The starting location and stops in order |
Returns
| Type | Description |
|---|---|
| T | The finder |
Type Parameters
| Name | Description |
|---|---|
| T | Type of finder |
| TNode | Type of node |
AddStop<T, TNode>(T, TNode)
Adds a stop to the request.
Declaration
public static T AddStop<T, TNode>(this T finder, TNode stop) where T : IGetFinderStops<TNode> where TNode : unmanaged, IEquatable<TNode>
Parameters
| Type | Name | Description |
|---|---|---|
| T | finder | The finder |
| TNode | stop | The location of the stop |
Returns
| Type | Description |
|---|---|
| T | The finder |
Type Parameters
| Name | Description |
|---|---|
| T | Type of finder |
| TNode | Type of node |
Remarks
Stops are processed in the order they are added. If only one stop is added, it functions as a starting position.
AddStops<T, TNode>(T, IEnumerable<TNode>)
Adds multiple stops to the request.
Declaration
public static T AddStops<T, TNode>(this T finder, IEnumerable<TNode> stops) where T : IGetFinderStops<TNode> where TNode : unmanaged, IEquatable<TNode>
Parameters
| Type | Name | Description |
|---|---|---|
| T | finder | The finder |
| IEnumerable<TNode> | stops | Stops to add, in order |
Returns
| Type | Description |
|---|---|
| T | The finder |
Type Parameters
| Name | Description |
|---|---|
| T | Type of finder |
| TNode | Type of node |
SetComparer<T, TOption>(T, IComparer<TOption>)
Sets a comparer to prioritize options for a PriorityOptionFinder.
Declaration
public static T SetComparer<T, TOption>(this T finder, IComparer<TOption> comparer) where T : ISetFinderOptionComparer<TOption>
Parameters
| Type | Name | Description |
|---|---|---|
| T | finder | The priority finder |
| IComparer<TOption> | comparer | Your comparer |
Returns
| Type | Description |
|---|---|
| T | The finder |
Type Parameters
| Name | Description |
|---|---|
| T | Type of finder |
| TOption | Type of option |
SetEdgeMod<T, TMod>(T, TMod)
Sets an edge modifier for a request. This can be used to exclude or modify edge cost's without updating the entire graph.
Declaration
public static T SetEdgeMod<T, TMod>(this T finder, TMod mod) where T : ISetFinderEdgeMod<TMod> where TMod : struct
Parameters
| Type | Name | Description |
|---|---|---|
| T | finder | The finder |
| TMod | mod | The IEdgeMod<TNode> to use. |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T | Type of finder |
| TMod | Type of modifier |
SetGraph<T, TGraph>(T, TGraph)
Sets the graph to perform the request on.
Declaration
public static T SetGraph<T, TGraph>(this T finder, TGraph graph) where T : IFinder<TGraph> where TGraph : IGraph
Parameters
| Type | Name | Description |
|---|---|---|
| T | finder | The finder that performs the request |
| TGraph | graph | The graph to perform the request on |
Returns
| Type | Description |
|---|---|
| T | The finder |
Type Parameters
| Name | Description |
|---|---|
| T | Type of finder |
| TGraph | Type of graph |
SetHeuristicProvider<T, TH>(T, TH)
Sets a heuristic provider for this request.
Declaration
public static T SetHeuristicProvider<T, TH>(this T finder, TH provider) where T : ISetFinderHeuristicProvider<TH> where TH : struct
Parameters
| Type | Name | Description |
|---|---|---|
| T | finder | The finder |
| TH | provider | The heuristic provider |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T | Type of finder |
| TH | Type of heuristic provider |
SetMaxRetries<T>(T, int)
Sets how many times the request may be retried if the validation of an option fails after a path has been found to it. Options that did not pass validation will be removed as a possibility for the next retry.
Declaration
public static T SetMaxRetries<T>(this T finder, int maxRetries) where T : ISetFinderMaxRetries
Parameters
| Type | Name | Description |
|---|---|---|
| T | finder | |
| int | maxRetries |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T |
SetPathProcessor<T, TProc>(T, TProc)
Sets a path processor for a request
Declaration
public static T SetPathProcessor<T, TProc>(this T finder, TProc processor) where T : ISetFinderPathProcessor<TProc> where TProc : struct
Parameters
| Type | Name | Description |
|---|---|---|
| T | finder | The finder |
| TProc | processor | The processor struct IPathProcessor<TNode, TSeg> |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T | Type of finder |
| TProc | Type of processor |
SetReserver<T, TOption>(T, IOptionReserver<TOption>)
Sets a reserver for a TargetFinder. See IOptionReserver<TOption> for details.
Declaration
public static T SetReserver<T, TOption>(this T finder, IOptionReserver<TOption> reserver) where T : ISetFinderOptionReserver<TOption>
Parameters
| Type | Name | Description |
|---|---|---|
| T | finder | The finder |
| IOptionReserver<TOption> | reserver | The reserver |
Returns
| Type | Description |
|---|---|
| T | The finder |
Type Parameters
| Name | Description |
|---|---|
| T | Type of finder |
| TOption | Type of option |
SetStartAndGoal<T, TNode>(T, TNode, TNode)
Sets a single starting node for the requests.
Declaration
public static T SetStartAndGoal<T, TNode>(this T finder, TNode start, TNode goal) where T : IGetFinderStops<TNode> where TNode : unmanaged, IEquatable<TNode>
Parameters
| Type | Name | Description |
|---|---|---|
| T | finder | The finder |
| TNode | start | The starting node of the request |
| TNode | goal | The goal node of the request |
Returns
| Type | Description |
|---|---|
| T | The finder that will perform the request |
Type Parameters
| Name | Description |
|---|---|
| T | Type of finder |
| TNode | Type of node |
Remarks
If stops were added before a call to SetStart, they will be cleared.
This is a convenience method. It is also possible to just use AddStop<T, TNode>(T, TNode), as a single stop will act as a starting node.
SetValidator<T, TOption>(T, IOptionValidator<TOption>)
Sets a validator for a TargetFinder. See IOptionValidator<TOption> for details.
Declaration
public static T SetValidator<T, TOption>(this T finder, IOptionValidator<TOption> validator) where T : ISetFinderOptionValidator<TOption>
Parameters
| Type | Name | Description |
|---|---|---|
| T | finder | The finder |
| IOptionValidator<TOption> | validator | The validator |
Returns
| Type | Description |
|---|---|
| T | The finder |
Type Parameters
| Name | Description |
|---|---|
| T | Type of finder |
| TOption | Type of option |