Пример #1
0
 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));
 }
Пример #2
0
        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);
        }
Пример #3
0
 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));
 }
Пример #4
0
 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));
 }
Пример #5
0
 public static TNode GetLast <TNode>(this IBidirList <TNode> list, Func <TNode, bool> filter) where TNode : class, IBidirListNode <TNode>
 {
     return(GetLast(list, Direction.LeftToRight, filter));
 }