MCPcopy Create free account
hub / github.com/witheve/Eve / getProposal

Method getProposal

src/runtime/join.ts:646–680  ·  view source on GitHub ↗
(multiIndex: MultiIndex, proposed, proposedIx, prefix)

Source from the content-addressed store, hash-verified

644 }
645
646 getProposal(multiIndex: MultiIndex, proposed, proposedIx, prefix) {
647 let proposalValues = [];
648 let cardinality = 0;
649 let resolvedOutputs = this.resolveOutputs(prefix);
650 let projection = {};
651 for(let branch of this.branches) {
652 let branchPrefix = branch.resolve(prefix);
653 let result = [branchPrefix];
654 result = branch.execute(multiIndex, result);
655 if(result.length) {
656 for(let row of result) {
657 let outputRow = [];
658 for(let output of branch.outputs) {
659 let value = toValue(output, row);
660 outputRow.push(value);
661 }
662 if(!this.checkOutputs(resolvedOutputs, outputRow)) {
663 continue;
664 }
665 let key = outputRow.join("|");
666 if(projection[key] === undefined) {
667 projection[key] = true;
668 proposalValues.push(outputRow);
669 cardinality++;
670 }
671 }
672 if(this.exclusive) break;
673 }
674 }
675 let proposal = this.proposalObject;
676 proposal.providing = this.outputs;
677 proposal.index = proposalValues;
678 proposal.cardinality = cardinality;
679 return proposal;
680 }
681
682 propose(multiIndex: MultiIndex, prefix) {
683 // if either our inputs aren't resolved or our outputs are all filled

Callers 1

proposeMethod · 0.95

Calls 5

resolveOutputsMethod · 0.95
checkOutputsMethod · 0.95
toValueFunction · 0.85
resolveMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected