public void Replace(TKey key, TRecord record) { IData ikey = KeyTransformer.ToIData(key); IData irec = RecordTransformer.ToIData(record); Index.Replace(ikey, irec); }
public void Delete(TKey fromKey, TKey toKey) { IData ifrom = KeyTransformer.ToIData(fromKey); IData ito = KeyTransformer.ToIData(toKey); Index.Delete(ifrom, ito); }
public void InsertOrIgnore(TKey key, TRecord record) { IData ikey = KeyTransformer.ToIData(key); IData irec = RecordTransformer.ToIData(record); Index.InsertOrIgnore(ikey, irec); }
public TRecord TryGetOrDefault(TKey key, TRecord defaultRecord) { IData ikey = KeyTransformer.ToIData(key); IData idefaultRec = RecordTransformer.ToIData(defaultRecord); IData irec = Index.TryGetOrDefault(ikey, idefaultRec); TRecord record = RecordTransformer.FromIData(irec); return(record); }
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 TRecord Find(TKey key) { IData ikey = KeyTransformer.ToIData(key); IData irec = Index.Find(ikey); if (irec == null) { return(default(TRecord)); } TRecord record = RecordTransformer.FromIData(irec); return(record); }
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)); }
public bool TryGet(TKey key, out TRecord record) { IData ikey = KeyTransformer.ToIData(key); IData irec; if (!Index.TryGet(ikey, out irec)) { record = default(TRecord); return(false); } record = RecordTransformer.FromIData(irec); return(true); }
public TRecord this[TKey key] { get { IData ikey = KeyTransformer.ToIData(key); IData irec = Index[ikey]; return(RecordTransformer.FromIData(irec)); } set { IData ikey = KeyTransformer.ToIData(key); IData irec = RecordTransformer.ToIData(value); Index[ikey] = irec; } }
public void Delete(TKey key) { IData ikey = KeyTransformer.ToIData(key); Index.Delete(ikey); }
public bool Exists(TKey key) { IData ikey = KeyTransformer.ToIData(key); return(Index.Exists(ikey)); }