Exemple #1
0
 /// <summary>
 /// move to last element in IDoubleLinkedList
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="current"></param>
 /// <returns></returns>
 public static IReversibleEnumerator <T> FastForwardToEnd <T>(this IReversibleEnumerator <T> current)
 {
     while (current.MoveNext())
     {
         ;
     }
     return(current);
 }
 public ReversibleEnumeratorBoundariesDecorator(
     IReversibleEnumerator <TPayload> unbounded,
     Predicate <TPayload> isLowerBoundary,
     Predicate <TPayload> isUpperBoundary)
 {
     _unbounded       = unbounded;
     _isUpperBoundary = isUpperBoundary;
     _isLowerBoundary = isLowerBoundary;
     Current          = default;
 }
Exemple #3
0
        /// <inheritdoc />
        public bool MovePrevious()
        {
            if (_inner is null)
            {
                _inner = new ReversibleEnumeratorBoundariesDecorator <TPayload>(
                    new LinkReversibleEnumerator <TPayload>(_segment.End),
                    IsLowerBoundary,
                    IsUpperBoundary);
            }

            return(_inner.MovePrevious());
        }
Exemple #4
0
 /// <inheritdoc />
 public void Reset()
 {
     _inner?.Dispose();
     _inner = null;
 }
Exemple #5
0
 /// <summary>
 /// try moving to realative position
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="current"></param>
 /// <param name="count"></param>
 /// <returns></returns>
 public static IReversibleEnumerator <T> Offset <T>(this IReversibleEnumerator <T> current, int count) =>
 count switch
 {
Exemple #6
0
 /// <summary>
 /// move to last element in cache
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="current"></param>
 /// <returns></returns>
 public static IReversibleEnumerator <T> FastForward <T>(this IReversibleEnumerator <T> current)
 {
     current.MoveCurrent();
     return(current);
 }
Exemple #7
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="current"></param>
 /// <returns></returns>
 public static IReversibleEnumerator <T> Rewind <T>(this IReversibleEnumerator <T> current)
 {
     current.Reset();
     return(current);
 }