Example #1
0
 public static GroupedTreeList <T, TId, TSortKey, TGroupKey> Create <TId, TSortKey, TGroupKey>(
     SelectId <T, TId> selectId,
     SelectParentId <T, TId> selectParentId,
     IdComparer <TId> idComparer,
     SelectSortKey <T, TSortKey> selectSortKey,
     SortKeyComparer <TSortKey> sortKeyComparer,
     SelectGroupKey <T, TGroupKey> selectGroupKey,
     GroupKeyComparer <TGroupKey> groupKeyComparer,
     IEnumerable <TGroupKey> groups,
     GroupedTreeSeparator separator) where TId : struct
 {
     return(new GroupedTreeList <T, TId, TSortKey, TGroupKey>(
                selectId, selectParentId, idComparer, selectSortKey, sortKeyComparer, selectGroupKey, groupKeyComparer, groups,
                separator));
 }
Example #2
0
        private GroupedTreeList <Item, int, int, int> GenerateTestTree(GroupedTreeSeparator separator)
        {
            var list = GroupedTreeList <Item> .Create(
                x => x.Id, x => x.ParentId, (x, y) => x == y,
                x => x.SortKey, (lhs, rhs) => lhs - rhs,
                x => x.GroupKey, (lhs, rhs) => lhs == rhs,
                new[] { 0, 1, 2, 3, 4 },
                separator);

            foreach (var item in GenerateTestItems())
            {
                list.Upsert(item);
            }

            return(list);
        }