Esempio n. 1
0
 public static RangeSeries <TKey, TValue, MapValuesSeries <TKey, TSource, TValue, TCursor> > Range <TKey, TSource, TValue, TCursor>(
     this MapValuesSeries <TKey, TSource, TValue, TCursor> series,
     TKey startKey, TKey endKey, bool startInclusive, bool endInclusive)
     where TCursor : ICursor <TKey, TSource>
 {
     return(new RangeSeries <TKey, TValue, MapValuesSeries <TKey, TSource, TValue, TCursor> >(series,
                                                                                              new Opt <TKey>(startKey), new Opt <TKey>(endKey), startInclusive, endInclusive));
 }
Esempio n. 2
0
        /// <inheritdoc />
        public override MapValuesSeries <TKey, TValue, TResult, TCursor> Create()
        {
            if (State == CursorState.None && ThreadId == Environment.CurrentManagedThreadId)
            {
                State = CursorState.Initialized;
                return(this);
            }
            var clone = new MapValuesSeries <TKey, TValue, TResult, TCursor>(_series, _selector);

            clone.State = CursorState.Initialized;
            return(clone);
        }
Esempio n. 3
0
        /// <inheritdoc />
        public override MapValuesSeries <TKey, TValue, TResult, TCursor> Initialize()
        {
            if (State == CursorState.None && ThreadId == Environment.CurrentManagedThreadId)
            {
                _cursor = GetCursor <TKey, TValue, TCursor>(_series);
                State   = CursorState.Initialized;
                return(this);
            }
            var clone = new MapValuesSeries <TKey, TValue, TResult, TCursor>(_series, _selector);
            // NB recursive call but it should always hit the if case above
            var initialized = clone.Initialize();

            Debug.Assert(ReferenceEquals(clone, initialized));
            return(initialized);
        }
 public static MapValuesSeries <TKey, TSource, TResult, TCursor> Map <TKey, TSource, TValue, TResult, TCursor>(
     this MapValuesSeries <TKey, TSource, TValue, TCursor> series, Func <TValue, TResult> selector)
     where TCursor : ICursor <TKey, TSource>
 {
     return(new MapValuesSeries <TKey, TSource, TResult, TCursor>(series._series, CoreUtils.CombineMaps(series._selector, selector)));
 }