public IEnumerable <KeyValuePair <TKey, TRecord> > Backward() { foreach (var kv in Index.Backward()) { TKey key = KeyTransformer.FromIData(kv.Key); TRecord rec = RecordTransformer.FromIData(kv.Value); yield return(new KeyValuePair <TKey, TRecord>(key, rec)); } }
public IEnumerable <KeyValuePair <TKey, TRecord> > Backward(TKey to, bool hasTo, TKey from, bool hasFrom) { IData ito = hasTo ? KeyTransformer.ToIData(to) : null; IData ifrom = hasFrom ? KeyTransformer.ToIData(from) : null; foreach (var kv in Index.Backward(ito, hasTo, ifrom, hasFrom)) { TKey key = KeyTransformer.FromIData(kv.Key); TRecord rec = RecordTransformer.FromIData(kv.Value); yield return(new KeyValuePair <TKey, TRecord>(key, rec)); } }
public KeyValuePair <TKey, TRecord>?FindBefore(TKey key) { IData ikey = KeyTransformer.ToIData(key); KeyValuePair <IData, IData>?kv = Index.FindBefore(ikey); if (!kv.HasValue) { return(null); } TKey k = KeyTransformer.FromIData(kv.Value.Key); TRecord r = RecordTransformer.FromIData(kv.Value.Value); return(new KeyValuePair <TKey, TRecord>(k, r)); }