public bool OnGetEnumerator(EntriesInput input, EntriesOutput output) { int count = input.entries.Count; if (i >= count) { i = 0; return(false); // At end; stop. } List <byte[]> net = input.net; List <Entry> entries = input.entries; int KeyLength = input.KeyLength; Entry entry = input.entries[i++]; byte[] keybuf = net[entry.NetIndex]; int keyoffset = entry.NetEntryOffset; int keylength = KeyLength; // Direct from input. byte[] valuebuf = net[entry.NetIndex]; int valueoffset = entry.NetEntryOffset + KeyLength + 4; // Internal storage layout. int valuelength = Entry.BytesToInt(valuebuf, entry.NetEntryOffset + KeyLength); // Internal storage layout. output.Add(keybuf, keyoffset, keylength, valuebuf, valueoffset, valuelength); return(true); // Continue. }
public bool OnGetEnumerator(EntriesInput input, EntriesOutput output) { int count = input.entries.Count; if (i >= count) { i = 0; return(false); // At end; stop. } Entry entry = input.entries[i++]; byte[] keybuf; int keyoffset; int keylength; entry.LocateKey(input, out keybuf, out keyoffset, out keylength); byte[] valuebuf; int valueoffset; int valuelength; entry.LocateValue(input, out valuebuf, out valueoffset, out valuelength); output.Add(keybuf, keyoffset, keylength, valuebuf, valueoffset, valuelength); return(true); // Continue. }
public bool OnGetEnumerator(EntriesInput input, EntriesOutput output) { if (null == raout) { raout = new RandomAccessOutput(output); } if (null == raentries) { raentries = new RandomAccessEntries(); } raentries.SetInput(input); byte[] firstkeybuf, xkeybuf; int firstkeyoffset, xkeyoffset; int firstkeylen, xkeylen; for (; i < input.entries.Count;) { input.entries[i].LocateKey(input, out firstkeybuf, out firstkeyoffset, out firstkeylen); int len = 1; for (int j = i + 1; j < input.entries.Count; j++) { bool nomatch = false; input.entries[j].LocateKey(input, out xkeybuf, out xkeyoffset, out xkeylen); if (firstkeylen != xkeylen) { break; } for (int ki = 0; ki != xkeylen; ki++) { if (xkeybuf[xkeyoffset + ki] != firstkeybuf[firstkeyoffset + ki]) { nomatch = true; break; } } if (nomatch) { break; } len++; } raentries.set(i, len); Reduce(raentries[0].Key, raentries, raout); i += len; return(true); // Continue. } i = 0; return(false); // At end; stop. }
public RandomAccessOutput(EntriesOutput eoutput) { this.eoutput = eoutput; }