(multiIndex: MultiIndex, providers : ProposalProvider[], vars : Variable[], prefix: any[] = [], options: JoinOptions = {})
| 864 | // to determine how may rounds of generic join we need to do. Since we solve |
| 865 | // for one variable each round, it's the number of vars in the query. |
| 866 | export function join(multiIndex: MultiIndex, providers : ProposalProvider[], vars : Variable[], prefix: any[] = [], options: JoinOptions = {}) { |
| 867 | let rows = options.rows || []; |
| 868 | let {presolved, accepted} = preJoinAccept(multiIndex, providers, vars, prefix); |
| 869 | if(!accepted) return rows; |
| 870 | let rounds = 0; |
| 871 | for(let variable of vars) { |
| 872 | if(variable !== undefined) rounds++; |
| 873 | } |
| 874 | rounds = rounds - presolved; |
| 875 | if(presolved > 0 && rounds === 0) { |
| 876 | rows.push(prefix.slice()); |
| 877 | } else if(rounds === 0) { |
| 878 | for(let provider of providers) { |
| 879 | if(!provider.accept(multiIndex, prefix, null, true)) { |
| 880 | return rows; |
| 881 | } |
| 882 | } |
| 883 | rows.push(prefix.slice()); |
| 884 | } else { |
| 885 | joinRound(multiIndex, providers, prefix, rounds, rows, options); |
| 886 | } |
| 887 | return rows; |
| 888 | } |
| 889 | |
| 890 | |
| 891 |
no test coverage detected