/// <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; }
/// <inheritdoc /> public bool MovePrevious() { if (_inner is null) { _inner = new ReversibleEnumeratorBoundariesDecorator <TPayload>( new LinkReversibleEnumerator <TPayload>(_segment.End), IsLowerBoundary, IsUpperBoundary); } return(_inner.MovePrevious()); }
/// <inheritdoc /> public void Reset() { _inner?.Dispose(); _inner = null; }
/// <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 {
/// <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); }
/// <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); }