internal void Validate <TPrefix>(Pair <TPrefix, TValue[]>[] extensions, int length, Func <TPrefix, int> keyFunc, VertexOutputBufferPerTime <Pair <TPrefix, TValue[]>, Epoch> output) { for (int i = 0; i < length; i++) { var localName = keyFunc(extensions[i].First) / this.Parts; if (localName < this.Offsets.Length - 1) { // reports number of intersections, written back in to the second array. var counter = IntersectSortedArrays(localName, extensions[i].Second); if (counter > 0) { if (counter == extensions[i].Second.Length) { output.Send(extensions[i]); } else { var resultArray = new TValue[counter]; Array.Copy(extensions[i].Second, resultArray, counter); output.Send(extensions[i].First.PairWith(resultArray)); } } } } }
internal void Improve <TPrefix>(ExtensionProposal <TPrefix>[] proposals, int length, Func <TPrefix, int> key, VertexOutputBufferPerTime <ExtensionProposal <TPrefix>, Epoch> output, int identifier) { for (int i = 0; i < length; i++) { var localName = key(proposals[i].Record) / this.Parts; if (localName < this.Offsets.Length - 1) { var count = this.Offsets[localName + 1] - this.Offsets[localName]; if (count < proposals[i].Count) { output.Send(new ExtensionProposal <TPrefix>(identifier, proposals[i].Record, count)); } else { output.Send(proposals[i]); } } } }
internal void Extend <TPrefix>(TPrefix[] prefixes, int length, Func <TPrefix, int> keyFunc, VertexOutputBufferPerTime <Pair <TPrefix, TValue[]>, Epoch> output) { for (int i = 0; i < length; i++) { var localName = keyFunc(prefixes[i]) / this.Parts; if (localName < this.Offsets.Length - 1) { var result = new TValue[this.Offsets[localName + 1] - this.Offsets[localName]]; Array.Copy(this.Values, this.Offsets[localName], result, 0, result.Length); output.Send(prefixes[i].PairWith(result)); } } }
internal void Count <TPrefix>(TPrefix[] prefixes, int length, Func <TPrefix, int> keyFunc, VertexOutputBufferPerTime <ExtensionProposal <TPrefix>, Epoch> output, int identifier) { for (int i = 0; i < length; i++) { var localName = keyFunc(prefixes[i]) / this.Parts; if (localName < this.Offsets.Length - 1) { output.Send(new ExtensionProposal <TPrefix>(identifier, prefixes[i], this.Offsets[localName + 1] - this.Offsets[localName])); } } }