MCPcopy Index your code
hub / github.com/witheve/Eve / Scan

Class Scan

src/runtime/join.ts:117–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115// You specify a triple that they should look for which can have variables
116// or constant values for e, a, or v that we'll attempt to solve for.
117export class Scan {
118 id: string;
119 // array representation of the eav
120 eav: any[];
121 // a "bitmap" for what variables this scan is solving for
122 // we use index as the key and the variable as the value
123 vars: Variable[];
124 // blown out eav for convenience
125 e: any;
126 a: any;
127 v: any;
128 node: any;
129 proposalObject: Proposal;
130 resolved: any[];
131 scopes: string[];
132
133 constructor(id: string, e,a,v,node?,scopes?) {
134 this.id = id;
135 this.resolved = [];
136 this.eav = [e,a,v,node];
137 this.e = e;
138 this.a = a;
139 this.v = v;
140 this.node = node;
141 this.proposalObject = {providing: null, index: [], cardinality: 0};
142 this.scopes = scopes || ["session"];
143
144 // check if any of the supplied params are variables and store them
145 this.vars = [];
146 for(let register of this.eav) {
147 if(isVariable(register)) {
148 this.vars[register.id] = register;
149 }
150 }
151 }
152
153 // Return an array of the current values for all the registers
154 resolve(prefix) {
155 let resolved = this.resolved;
156 resolved[0] = toValue(this.e, prefix);
157 resolved[1] = toValue(this.a, prefix);
158 resolved[2] = toValue(this.v, prefix);
159 resolved[3] = toValue(this.node, prefix);
160 return resolved;
161 }
162
163
164 _fullScanLookup(index, solving, results, resolved, solvingIx, ix, maxDepth) {
165 if(index === undefined) return;
166 if(ix === maxDepth) {
167 return results.push(solving.slice());
168 }
169 let value = resolved[ix];
170 if(value === undefined) {
171 let curIndex = index.index;
172 for(let key of Object.keys(curIndex)) {
173 let v = curIndex[key];
174 solving[solvingIx] = v.value !== undefined ? v.value : v;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected