Exemplo n.º 1
0
        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));
            }
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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));
            }
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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));
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
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;
            }
        }