Esempio n. 1
0
        public void Replace(TKey key, TRecord record)
        {
            IData ikey = KeyTransformer.ToIData(key);
            IData irec = RecordTransformer.ToIData(record);

            Index.Replace(ikey, irec);
        }
Esempio n. 2
0
        public void Delete(TKey fromKey, TKey toKey)
        {
            IData ifrom = KeyTransformer.ToIData(fromKey);
            IData ito   = KeyTransformer.ToIData(toKey);

            Index.Delete(ifrom, ito);
        }
Esempio n. 3
0
        public void InsertOrIgnore(TKey key, TRecord record)
        {
            IData ikey = KeyTransformer.ToIData(key);
            IData irec = RecordTransformer.ToIData(record);

            Index.InsertOrIgnore(ikey, irec);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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));
            }
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
        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));
        }
Esempio n. 8
0
        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);
        }
Esempio n. 9
0
        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;
            }
        }
Esempio n. 10
0
        public void Delete(TKey key)
        {
            IData ikey = KeyTransformer.ToIData(key);

            Index.Delete(ikey);
        }
Esempio n. 11
0
        public bool Exists(TKey key)
        {
            IData ikey = KeyTransformer.ToIData(key);

            return(Index.Exists(ikey));
        }