-
Notifications
You must be signed in to change notification settings - Fork 10
/
IQueryRunner.ts
46 lines (43 loc) · 3.17 KB
/
IQueryRunner.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { AsyncIterator } from "asynciterator";
import IPath from "../interfaces/IPath";
import IQuery from "../interfaces/IQuery";
/*
,-----------. ,-----------. ,----------------------.
|QueryRunner| |RoadPlanner| |PublicTransportPlanner|
`-----+-----' `-----+-----' `----------+-----------'
run(query) | | |
--------------------------> | |
| | |
,----------------------!. | |
|Resolve ids to objects|_\ | |
`------------------------' | |
|----. |
| | resolveQuery(query) |
|<---' |
| | |
| | |
___________________________________________________________________________________________
! OPT / resolved_query.roadNetworkOnly | | !
!_____/ | | | !
! | plan(resolved_query) | | !
! | -----------------------> | !
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
! | | | !
! | plan(resolved_query) | !
! | ---------------------------------------------------> !
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
| | |
,---------------------!. | | |
|Post-processing |_\| | |
|of the path || | |
|is left to the caller || | |
`-----------------------'| | |
| | |
*/
/**
* A query runner has a `run` method that turns an [[IQuery]] into an AsyncIterator of [[IPath]] instances.
* It does this by executing one or more algorithms on the query, depending on the implementation.
*/
export default interface IQueryRunner {
run(query: IQuery): Promise<AsyncIterator<IPath>>;
}