public static IEnumerable <TNode> GetNodes <TNode>(this IBidirList <TNode> list, Direction dir) where TNode : class, IBidirListNode <TNode> { if (list.Count == 0) { return(Enumerable.Empty <TNode>()); } return(list.GetFirst(dir).GetNodes(dir)); }
public static TNode GetLast <TNode>(this IBidirList <TNode> list, Direction dir, Func <TNode, bool> filter) where TNode : class, IBidirListNode <TNode> { TNode node = list.GetLast(dir); while (node != null && node != list.GetBegin(dir) && !filter(node)) { node = node.GetPrev(dir); } return(node); }
public static IEnumerable <TNode> GetNodes <TNode>(this IBidirList <TNode> list, TNode first, TNode last, Direction dir) where TNode : class, IBidirListNode <TNode> { return(first.GetNodes(last, dir)); }
public static TNode GetPrev <TNode>(this IBidirList <TNode> list, TNode cur, Direction dir, Func <TNode, bool> filter) where TNode : class, IBidirListNode <TNode> { return(cur.GetPrev(dir, filter)); }
public static TNode GetLast <TNode>(this IBidirList <TNode> list, Func <TNode, bool> filter) where TNode : class, IBidirListNode <TNode> { return(GetLast(list, Direction.LeftToRight, filter)); }