IPathfinder <TDefinitionNodeNetwork, TThreadNodeNetwork, TPath> IPathfindaxManager.CreatePathfinder <TDefinitionNodeNetwork, TThreadNodeNetwork, TPath>( TDefinitionNodeNetwork definitionNodeNetwork, IPathFindAlgorithm <TThreadNodeNetwork, TPath> pathFindAlgorithm, Func <TDefinitionNodeNetwork, IPathFindAlgorithm <TThreadNodeNetwork, TPath>, ICache <IPathRequest, TPath>, PathRequestProcesser <TThreadNodeNetwork, TPath> > processerConstructor, ICache <IPathRequest, TPath> pathCache, int threads) { return(CreatePathfinder(definitionNodeNetwork, pathFindAlgorithm, processerConstructor, pathCache, threads)); }
/// <summary> /// Creates a new <see cref="Pathfinder{TSourceNodeNetwork,TThreadNodeNetwork, TPath}"/> /// </summary> /// <param name="definitionNodeNetwork"></param> /// <param name="pathFindAlgorithm"></param> /// <param name="processerConstructor">Used to construct the processers for each thread</param> /// <param name="threads">The amount of threads that will be used</param> public Pathfinder(TDefinitionNodeNetwork definitionNodeNetwork, IPathFindAlgorithm <TThreadNodeNetwork, TPath> pathFindAlgorithm, Func <TDefinitionNodeNetwork, IPathFindAlgorithm <TThreadNodeNetwork, TPath>, PathRequestProcesser <TThreadNodeNetwork, TPath> > processerConstructor, int threads = 1) { if (threads < 1) { throw new ArgumentException("There is a minimum of 1 thread"); } PathFindAlgorithm = pathFindAlgorithm; DefinitionNodeNetwork = definitionNodeNetwork; _multithreadedWorkerQueue = new MultithreadedWorkerQueue <PathRequest <TPath> >(() => { var processer = processerConstructor.Invoke(DefinitionNodeNetwork, pathFindAlgorithm); _pathfindNodeNetworks.Add(processer.NodeNetwork); return(processer); }, threads); }
public Pathfinder <TDefinitionNodeNetwork, TThreadNodeNetwork, TPath> CreatePathfinder <TDefinitionNodeNetwork, TThreadNodeNetwork, TPath>( TDefinitionNodeNetwork definitionNodeNetwork, IPathFindAlgorithm <TThreadNodeNetwork, TPath> pathFindAlgorithm, Func <TDefinitionNodeNetwork, IPathFindAlgorithm <TThreadNodeNetwork, TPath>, ICache <IPathRequest, TPath>, PathRequestProcesser <TThreadNodeNetwork, TPath> > processerConstructor, ICache <IPathRequest, TPath> pathCache, int threads = 1) where TDefinitionNodeNetwork : IDefinitionNodeNetwork where TThreadNodeNetwork : IPathfindNodeNetwork where TPath : class, IPath { if (threads < 1) { throw new ArgumentException("There is a minimum of 1 thread"); } return(new Pathfinder <TDefinitionNodeNetwork, TThreadNodeNetwork, TPath>(_synchronizationContext, definitionNodeNetwork, pathFindAlgorithm, processerConstructor, pathCache, threads)); }
/// <summary> /// Initialises a new <see cref="PathRequestProcesser{TThreadNodeNetwork, TPath}"/> with a <see cref="IPathFindAlgorithm{TThreadNodeNetwork, TPath}"/> and optional post processing steps. /// </summary> /// <param name="nodeNetwork">The <typeparamref name="TThreadNodeNetwork"/> that will be used to solve paths</param> /// <param name="pathFindAlgorithm">The <see cref="IPathFindAlgorithm{TThreadNodeNetwork, TPath}"/> that will be used to solve paths</param> public PathRequestProcesser(TThreadNodeNetwork nodeNetwork, IPathFindAlgorithm <TThreadNodeNetwork, TPath> pathFindAlgorithm) { _algorithm = pathFindAlgorithm; NodeNetwork = nodeNetwork; }
public static PathRequestProcesser <TThreadNodeNetwork, TPath> CreateRequestProcesser <TThreadNodeNetwork, TPath>(TThreadNodeNetwork nodeNetwork, IPathFindAlgorithm <TThreadNodeNetwork, TPath> pathFindAlgorithm, ICache <IPathRequest, TPath> cache) where TThreadNodeNetwork : IPathfindNodeNetwork where TPath : class, IPath { return(new PathRequestProcesser <TThreadNodeNetwork, TPath>(nodeNetwork, pathFindAlgorithm, cache)); }
/// <summary> /// Initialises a new <see cref="PathRequestProcesser{TThreadNodeNetwork, TPath}"/> with a <see cref="IPathFindAlgorithm{TThreadNodeNetwork, TPath}"/> and optional post processing steps. /// </summary> /// <param name="nodeNetwork">The <typeparamref name="TThreadNodeNetwork"/> that will be used to solve paths</param> /// <param name="pathFindAlgorithm">The <see cref="IPathFindAlgorithm{TThreadNodeNetwork, TPath}"/> that will be used to solve paths</param> /// <param name="pathCache"></param> public PathRequestProcesser(TThreadNodeNetwork nodeNetwork, IPathFindAlgorithm <TThreadNodeNetwork, TPath> pathFindAlgorithm, ICache <IPathRequest, TPath> pathCache) { _algorithm = pathFindAlgorithm; NodeNetwork = nodeNetwork; _pathCache = pathCache; }
public Pathfinder <TSourceNodeNetwork, TThreadNodeNetwork, TPath> CreatePathfinder <TSourceNodeNetwork, TThreadNodeNetwork, TPath>(TSourceNodeNetwork definitionNodeNetwork, IPathFindAlgorithm <TThreadNodeNetwork, TPath> pathFindAlgorithm, Func <TSourceNodeNetwork, IPathFindAlgorithm <TThreadNodeNetwork, TPath>, PathRequestProcesser <TThreadNodeNetwork, TPath> > processerConstructor, int threads = 1) where TSourceNodeNetwork : IDefinitionNodeNetwork where TThreadNodeNetwork : IPathfindNodeNetwork where TPath : class, IPath { if (threads < 1) { throw new ArgumentException("There is a minimum of 1 thread"); } var pathfinder = new Pathfinder <TSourceNodeNetwork, TThreadNodeNetwork, TPath>(definitionNodeNetwork, pathFindAlgorithm, processerConstructor, threads); _pathfinders.Add(pathfinder); pathfinder.Disposed += o => _pathfinders.Remove(o); return(pathfinder); }
IPathfinder <TDefinitionNodeNetwork, TThreadNodeNetwork, TPath> IPathfindaxManager.CreatePathfinder <TDefinitionNodeNetwork, TThreadNodeNetwork, TPath>(TDefinitionNodeNetwork definitionNodeNetwork, IPathFindAlgorithm <TThreadNodeNetwork, TPath> pathFindAlgorithm, Func <TDefinitionNodeNetwork, IPathFindAlgorithm <TThreadNodeNetwork, TPath>, PathRequestProcesser <TThreadNodeNetwork, TPath> > processerConstructor, int threads = 1) => CreatePathfinder(definitionNodeNetwork, pathFindAlgorithm, processerConstructor, threads);