• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# NTree类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中NTree的典型用法代码示例。如果您正苦于以下问题:C# NTree类的具体用法?C# NTree怎么用?C# NTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NTree类属于命名空间,在下文中一共展示了NTree类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: NTreeDeletesByIndexIndividualUnique

        public void NTreeDeletesByIndexIndividualUnique()
        {
            var objs = TestResourceFactory.GetMockClassAObjects(50).ToList();

            var seedIndex = new Seed32();
            var seedSegment = new Seed64();

            objs.ForEach(o => o.Id = seedIndex.Increment());

            using (var tree = new NTree<int, MockClassA, long>("Id", true))
            {
                foreach (var o in objs)
                    tree.AddOrUpdate(new Tuple<MockClassA, long>(o, seedSegment.Increment()));

                Assert.AreEqual(50, tree.Length);

                Assert.AreEqual(5, tree.GetFirstByIndex(5));
                Assert.AreEqual(5, tree.GetFirstBySegment(5));
                Assert.AreEqual(1, tree.GetByIndex(5).Count());

                Assert.AreEqual(1, tree.Delete(5).Length);

                Assert.AreEqual(50, tree.Length);

                Assert.AreEqual(0, tree.GetFirstByIndex(5));
            }
        }
开发者ID:thehexgod,项目名称:BESSY-DB,代码行数:27,代码来源:NTreeDeleteTests.cs


示例2: NTreeChecksAllWithLargeCount

        public void NTreeChecksAllWithLargeCount()
        {
            using (var tree = new NTree<int, MockClassA, long>("Id", true))
            {
                var objs = new List<MockClassA>();
                var seedIndex = new Seed32();
                var seedSegment = new Seed64();

                for (var i = 0; i < 5; i++)
                {
                    var additions = TestResourceFactory.GetMockClassAObjects(100000).ToList();

                    additions.ForEach(o => o.Id = seedIndex.Increment());

                    tree.AddOrUpdateRange(additions.Select(o => new Tuple<MockClassA, long>(o, seedSegment.Increment())).ToList());
                }

                Assert.AreEqual(500000, tree.Length);

                Assert.AreEqual(5, tree.GetFirstByIndex(5));
                Assert.AreEqual(5, tree.GetFirstBySegment(5));
                Assert.AreEqual(1, tree.GetByIndex(5).Count());

                tree.AddOrUpdate(new Tuple<MockClassA, long>(TestResourceFactory.CreateRandom().WithId(seedIndex.Increment()), seedSegment.Increment()));

                Assert.AreEqual(500001, tree.Length);

                tree.AddOrUpdateRange(
                    tree.AsEnumerable().First().Take(100)
                    .Select(s => new NTreeItem<int, long>(s.Item2.Index, s.Item2.Segment))
                    .ToList());

                Assert.AreEqual(500001, tree.Length);
            }
        }
开发者ID:thehexgod,项目名称:BESSY-DB,代码行数:35,代码来源:NTreeUniqueTests.cs


示例3: NTreeFetchesByIndexRange

        public void NTreeFetchesByIndexRange()
        {
            var objs = TestResourceFactory.GetMockClassAObjects(5000).ToList();

            var seedIndex = new Seed32();
            var seedSegment = new Seed64();

            objs.ForEach(o => o.Id = seedIndex.Increment());
            var toAdd = objs.Select(o => new Tuple<MockClassA, long>(o, seedSegment.Increment())).ToList();

            using (var tree = new NTree<int, MockClassA, long>("Id"))
            {
                var ids = tree.AddOrUpdateRange(toAdd);

                Assert.AreEqual(5000, tree.Length);

                Assert.AreEqual(5, tree.GetFirstByIndex(5));
                Assert.AreEqual(5, tree.GetFirstBySegment(5));
                Assert.AreEqual(1, tree.GetByIndex(5).Count());

                tree.AddOrUpdate(new Tuple<MockClassA, long>(TestResourceFactory.CreateRandom().WithId(seedIndex.Increment()), seedSegment.Increment()));

                Assert.AreEqual(5001, tree.Length);

                long[] loc;
                var range = tree.GetByIndexRangeInclusive(51, 250, out loc);

                Assert.AreEqual(200, range.Length);
            }
        }
开发者ID:thehexgod,项目名称:BESSY-DB,代码行数:30,代码来源:NTreeNonUniqueTests.cs


示例4: AddToFrontier

 private bool AddToFrontier(NTree<PuzzleNode> nodeState)
 {
     if (!ClosedList.Contains(nodeState) || !Frontier.Contains(nodeState))
     {
         Frontier.Enqueue(nodeState);
         return true;
     }
     return false;
 }
开发者ID:joshkoz,项目名称:Searcher,代码行数:9,代码来源:BFSStrategy.cs


示例5: PathToNode

        /// <summary>
        /// Find the path to the partular node in the tree from the root node in the tree.
        /// Returns an array of 'Direction's.
        /// </summary>
        /// <param name="puzzle"></param>
        /// <returns></returns>
        public Direction[] PathToNode(NTree<PuzzleNode> puzzle)
        {
            Direction[] result;

            if (puzzle.Parent == null) //If this is the root node, there is no path!
            {
                result = new Direction[0];
                return result;
            }
            else                //Other wise, path to here is the path to parent
                                // plus parent to here
            {
                Direction[] pathToParent = PathToNode(puzzle.Parent);
                result = new Direction[pathToParent.Length + 1];
                for (int i = 0; i < pathToParent.Length; i++)
                {
                    result[i] = pathToParent[i];
                }
                result[result.Length - 1] = puzzle.Value.PathFromParent;
                return result;
            }
        }
开发者ID:joshkoz,项目名称:Searcher,代码行数:28,代码来源:TreeVisitor.cs


示例6: NTreePushesEntities

        public void NTreePushesEntities()
        {
            var objs = TestResourceFactory.GetMockClassAObjects(50).ToList();

            var seedIndex = new Seed32();
            var seedSegment = new Seed64();

            objs.ForEach(o => o.Id = seedIndex.Increment());
            var toAdd = objs.Select(o => new Tuple<MockClassA, long>(o, seedSegment.Increment())).ToList();

            using (var tree = new NTree<int, MockClassA, long>("Id", true))
            {
                var ids = tree.AddOrUpdateRange(toAdd);
                tree.AddOrUpdate(toAdd.First());

                Assert.AreEqual(50, tree.Length);

                Assert.AreEqual(5L, tree.GetFirstByIndex(5));
                Assert.AreEqual(5, tree.GetFirstBySegment(5));
                Assert.AreEqual(1, tree.GetByIndex(1).Count());
                Assert.AreEqual(5, tree.GetFirstBySegment(5));
            }
        }
开发者ID:thehexgod,项目名称:BESSY-DB,代码行数:23,代码来源:NTreeUniqueTests.cs


示例7: SearchPagesInPortalGroupInternal

        private NTree<ItemDto> SearchPagesInPortalGroupInternal(string treeAsJson, string searchText, int sortOrder)
        {
            var treeNode = new NTree<ItemDto> { Data = new ItemDto { Key = RootKey } };
            var openedNode = Json.Deserialize<NTree<ItemIdDto>>(treeAsJson);
            if (openedNode == null)
            {
                return treeNode;
            }

            var portals = GetPortalGroup(sortOrder);
            treeNode.Children = portals.Select(dto => new NTree<ItemDto> { Data = dto }).ToList();

            if (!openedNode.HasChildren())
            {
                return treeNode;
            }
            foreach (var openedNodeChild in openedNode.Children)
            {
                var portalIdString = openedNodeChild.Data.Id;
                var treeNodeChild = treeNode.Children.Find(child => String.Equals(child.Data.Key, portalIdString, StringComparison.InvariantCultureIgnoreCase));
                if (treeNodeChild == null)
                {
                    continue;
                }
                int portalId;
                if (int.TryParse(treeNodeChild.Data.Key.Replace(PortalPrefix, string.Empty), out portalId))
                {
                    var pageTree = SearchPagesInternal(portalId, searchText, sortOrder);
                    treeNodeChild.Children = pageTree.Children;
                }
            }
            return treeNode;
        }
开发者ID:ryanmalone,项目名称:BGDNNWEB,代码行数:33,代码来源:ItemListServiceController.cs


示例8: SortPagesInternal

 private NTree<ItemDto> SortPagesInternal(int portalId, NTree<ItemIdDto> openedNodesTree, int sortOrder)
 {
     var pages = GetPortalPages(portalId);
     var sortedTree = new NTree<ItemDto> { Data = new ItemDto { Key = RootKey } };
     if (pages == null)
     {
         return sortedTree;
     }
     SortPagesRecursevely(pages, sortedTree, openedNodesTree, sortOrder);
     return sortedTree;
 }
开发者ID:ryanmalone,项目名称:BGDNNWEB,代码行数:11,代码来源:ItemListServiceController.cs


示例9: SearchPagesInternal

        private NTree<ItemDto> SearchPagesInternal(int portalId, string searchText, int sortOrder)
        {
            var tree = new NTree<ItemDto> { Data = new ItemDto { Key = RootKey } };

            List<TabInfo> tabs;
            if (portalId == -1)
            {
                portalId = GetActivePortalId();
            }
            else
            {
                if (!IsPortalIdValid(portalId))
                {
                    return tree;
                }
            }

            Func<TabInfo, bool> searchFunc;
            if (String.IsNullOrEmpty(searchText))
            {
                searchFunc = page => true;
            }
            else
            {
                searchFunc = page => page.LocalizedTabName.IndexOf(searchText, StringComparison.InvariantCultureIgnoreCase) > -1;
            }

            var tabController = new TabController();
            var allTabs = tabController.GetAllTabs().ToArray().Select(tab => (TabInfo)tab).ToList();

            if (portalId > -1)
            {
                var includeHiddenTabs = PortalSettings.UserInfo.IsSuperUser || PortalSettings.UserInfo.IsInRole("Administrators");
               
                if (!includeHiddenTabs) allTabs = allTabs.Where(t => t.IsVisible).ToList();
                tabs = allTabs.Where(tab => tab.PortalID == portalId && !tab.DisableLink && searchFunc(tab))
                    .OrderBy(tab => tab.TabOrder)
                    .ToList();
            }
            else
            {
                if (PortalSettings.UserInfo.IsSuperUser)
                {
                    tabs = allTabs.Where(tab => tab.PortalID == -1 && !tab.DisableLink && searchFunc(tab))
                    .OrderBy(tab => tab.TabOrder)
                    .ToList();
                }
                else
                {
                    return tree;
                }
            }

            var pages = tabs.Select(tab => new ItemDto
                {
                    Key = tab.TabID.ToString(CultureInfo.InvariantCulture),
                    Value = tab.LocalizedTabName,
                    HasChildren = false,
                    Selectable = true
                });

            tree.Children = ApplySort(pages, sortOrder).Select(dto => new NTree<ItemDto> { Data = dto }).ToList();
            return tree;
        }
开发者ID:ryanmalone,项目名称:BGDNNWEB,代码行数:64,代码来源:ItemListServiceController.cs


示例10: ExonChaining

 /// <summary>
 /// 
 /// </summary>
 /// <param name="graph"></param>
 /// <param name="k">number of intervals</param>
 /// <returns></returns>
 public IEnumerable<int> ExonChaining(NTree<string> graph, int k) 
 {
     return null;
 }
开发者ID:dancingplatypus,项目名称:GeneticAlgorithms.Net,代码行数:10,代码来源:TestSplicedAlignment.cs


示例11: GetTreePathForFolderInternal

        private NTree<ItemDto> GetTreePathForFolderInternal(string selectedItemId, int sortOrder, string permission)
        {
            var tree = new NTree<ItemDto> { Data = new ItemDto { Key = RootKey } };

            int itemId;
            if (string.IsNullOrEmpty(selectedItemId) || !int.TryParse(selectedItemId, out itemId))
            {
                return tree;
            }

            if (itemId <= 0)
            {
                return tree;
            }

            var folder = FolderManager.Instance.GetFolder(itemId);
            if (folder == null)
            {
                return tree;
            }

            var hasPermission = string.IsNullOrEmpty(permission) ?
                (HasPermission(folder, "BROWSE") || HasPermission(folder, "READ")) :
                HasPermission(folder, permission.ToUpper());
            if (!hasPermission) return new NTree<ItemDto>();

            var selfTree = new NTree<ItemDto> { Data = new ItemDto
                {
                    Key = folder.FolderID.ToString(CultureInfo.InvariantCulture), 
                    Value = folder.FolderName, 
                    HasChildren = HasChildren(folder, permission),
                    Selectable = true
                } };
            var parentId = folder.ParentID;
            var parentFolder = parentId > 0 ? FolderManager.Instance.GetFolder(parentId) : null;

            while (parentFolder != null)
            {
                // load all sibling
                var siblingFolders = GetFolderDescendants(parentFolder, string.Empty, permission)
                    .Select(folderInfo => new ItemDto
                        {
                            Key = folderInfo.FolderID.ToString(CultureInfo.InvariantCulture), 
                            Value = folderInfo.FolderName, 
                            HasChildren = HasChildren(folderInfo, permission),
                            Selectable = true
                        }).ToList();
                siblingFolders = ApplySort(siblingFolders, sortOrder).ToList();

                var siblingFoldersTree = siblingFolders.Select(f => new NTree<ItemDto> { Data = f }).ToList();

                // attach the tree
                if (selfTree.Children != null)
                {
                    foreach (var node in siblingFoldersTree)
                    {
                        if (node.Data.Key == selfTree.Data.Key)
                        {
                            node.Children = selfTree.Children;
                            break;
                        }
                    }
                }

                selfTree = new NTree<ItemDto> { Data = new ItemDto
                    {
                        Key = parentId.ToString(CultureInfo.InvariantCulture),
                        Value = parentFolder.FolderName,
                        HasChildren = true,
                        Selectable = true
                    }, Children = siblingFoldersTree
                };

                parentId = parentFolder.ParentID;
                parentFolder = parentId > 0 ? FolderManager.Instance.GetFolder(parentId) : null;
            }
            selfTree.Data.Value = SharedConstants.RootFolder;

            tree.Children.Add(selfTree);
            return tree;
        }
开发者ID:ryanmalone,项目名称:BGDNNWEB,代码行数:81,代码来源:ItemListServiceController.cs


示例12: NTreePushesLotsOfDuplicateEntities

        public void NTreePushesLotsOfDuplicateEntities()
        {
            var objs = TestResourceFactory.GetMockClassAObjects(20480).ToList();

            var seedIndex = new Seed32();
            var seedSegment = new Seed64();

            objs.ForEach(o => o.Id = seedIndex.Increment());
            var toAdd = objs.Select(o => new Tuple<MockClassA, long>(o, seedSegment.Increment())).ToList();

            using (var tree = new NTree<int, MockClassA, long>("Id", true))
            {
                var ids = tree.AddOrUpdateRange(toAdd);

                Assert.AreEqual(20480, tree.Length);

                Assert.AreEqual(5, tree.GetFirstByIndex(5));
                Assert.AreEqual(5, tree.GetFirstBySegment(5));
                Assert.AreEqual(1, tree.GetByIndex(5).Count());

                tree.AddOrUpdate(new Tuple<MockClassA, long>(TestResourceFactory.CreateRandom().WithId(seedIndex.Increment()), seedSegment.Increment()));

                Assert.AreEqual(20481, tree.Length);

                tree.AddOrUpdateRange(toAdd.Skip(100).Take(100).ToList());

                Assert.AreEqual(20481, tree.Length);
            }
        }
开发者ID:thehexgod,项目名称:BESSY-DB,代码行数:29,代码来源:NTreeUniqueTests.cs


示例13: GetFoldersInternal

 private NTree<ItemDto> GetFoldersInternal(int portalId, int sortOrder, string permissions)
 {
     var tree = new NTree<ItemDto> { Data = new ItemDto { Key = RootKey } };
     var children = ApplySort(GetFolderDescendantsInternal(portalId, -1, sortOrder, string.Empty, permissions), sortOrder).Select(dto => new NTree<ItemDto> { Data = dto }).ToList();
     tree.Children = children;
     foreach (var child in tree.Children)
     {
         children = ApplySort(GetFolderDescendantsInternal(portalId, child.Data.Key, sortOrder, string.Empty, permissions), sortOrder).Select(dto => new NTree<ItemDto> { Data = dto }).ToList();
         child.Children = children;
     }
     return tree;
 }
开发者ID:ryanmalone,项目名称:BGDNNWEB,代码行数:12,代码来源:ItemListServiceController.cs


示例14: GetTreePathForPageInternal

 private NTree<ItemDto> GetTreePathForPageInternal(string itemId, int sortOrder, bool includePortalTree = false)
 {
     var tree = new NTree<ItemDto> { Data = new ItemDto { Key = RootKey } };
     int itemIdAsInt;
     if (string.IsNullOrEmpty(itemId) || !int.TryParse(itemId, out itemIdAsInt))
     {
         return tree;
     }
     var portals = PortalController.GetPortalDictionary();
     int portalId;
     if (portals.ContainsKey(itemIdAsInt))
     {
         portalId = portals[itemIdAsInt];
     }
     else
     {
         return tree;
     }
     return GetTreePathForPageInternal(portalId, itemIdAsInt, sortOrder, includePortalTree);
 }
开发者ID:ryanmalone,项目名称:BGDNNWEB,代码行数:20,代码来源:ItemListServiceController.cs


示例15: SearchPagesInternal

        private NTree<ItemDto> SearchPagesInternal(int portalId, string searchText, int sortOrder, bool includeDisabled = false, bool includeAllTypes = false, bool includeActive = true, bool includeHostPages = false)
        {
            var tree = new NTree<ItemDto> { Data = new ItemDto { Key = RootKey } };

            List<TabInfo> tabs;
            if (portalId == -1)
            {
                portalId = GetActivePortalId();
            }
            else
            {
                if (!IsPortalIdValid(portalId))
                {
                    return tree;
                }
            }

            Func<TabInfo, bool> searchFunc;
            if (String.IsNullOrEmpty(searchText))
            {
                searchFunc = page => true;
            }
            else
            {
                searchFunc = page => page.LocalizedTabName.IndexOf(searchText, StringComparison.InvariantCultureIgnoreCase) > -1;
            }

            if (portalId > -1)
            {
                var includeHiddenTabs = PortalSettings.UserInfo.IsSuperUser || PortalSettings.UserInfo.IsInRole("Administrators");

                tabs = TabController.Instance.GetTabsByPortal(portalId).Where(tab =>
                                        (includeActive || tab.Value.TabID != PortalSettings.ActiveTab.TabID)
                                        && (includeHiddenTabs || tab.Value.IsVisible)
                                        && (includeDisabled || !tab.Value.DisableLink) 
                                        && (includeAllTypes || tab.Value.TabType == TabType.Normal) 
                                        && searchFunc(tab.Value))
                    .OrderBy(tab => tab.Value.TabOrder)
                    .Select(tab => tab.Value)
                    .ToList();

                if (PortalSettings.UserInfo.IsSuperUser && includeHostPages)
                {
                    tabs.AddRange(TabController.Instance.GetTabsByPortal(-1).Where(tab => !tab.Value.DisableLink && searchFunc(tab.Value))
                    .OrderBy(tab => tab.Value.TabOrder)
                    .Select(tab => tab.Value)
                    .ToList());
                }
            }
            else
            {
                if (PortalSettings.UserInfo.IsSuperUser)
                {
                    tabs = TabController.Instance.GetTabsByPortal(-1).Where(tab => !tab.Value.DisableLink && searchFunc(tab.Value))
                    .OrderBy(tab => tab.Value.TabOrder)
                    .Select(tab => tab.Value)
                    .ToList();
                }
                else
                {
                    return tree;
                }
            }

            var pages = tabs.Select(tab => new ItemDto
            {
                Key = tab.TabID.ToString(CultureInfo.InvariantCulture),
                Value = tab.LocalizedTabName,
                HasChildren = false,
                Selectable = true
            });

            tree.Children = ApplySort(pages, sortOrder).Select(dto => new NTree<ItemDto> { Data = dto }).ToList();
            return tree;
        }
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:75,代码来源:ItemListServiceController.cs


示例16: SortFilesInternal

 private NTree<ItemDto> SortFilesInternal(int portalId, int parentId, string filter, int sortOrder, string permissions)
 {
     var sortedTree = new NTree<ItemDto> { Data = new ItemDto { Key = RootKey } };
     var children = GetFileItemsDto(portalId, parentId, filter, string.Empty, permissions, sortOrder).Select(dto => new NTree<ItemDto> { Data = dto }).ToList();
     sortedTree.Children = children;
     return sortedTree;
 }
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:7,代码来源:ItemListServiceController.cs


示例17: Start

        /// <summary>
        /// Starts the arbitrage
        /// </summary>
        /// <param name="originalAmount"></param>
        /// <param name="targetCurrency"></param>
        /// <param name="frequencyInSec"></param>
        /// <param name="profitThreshold"></param>
        /// <param name="realTrading"></param>
        /// <param name="allowedPairs"></param>
        public void Start(decimal originalAmount, string targetCurrency, int frequencyInSec, decimal profitThreshold, bool realTrading, BtcePair[] allowedPairs)
        {
            realTrading = false; //!!!DO not use real trading

            _allowedPairs = allowedPairs;
            _pairsAsString = _allowedPairs.Select(p => BtcePairHelper.ToString(p)).ToArray();

            _mustStop = false;
            OnReportProgress("Starting Arbitrage - Monitoring opportunities...");
            while (!_mustStop)
            {
                Dictionary<BtcePair, Ticker> tickers;
                try
                {
                    tickers = BtceApiV3.GetTicker(_allowedPairs);
                }
                catch (Exception ex)
                {
                    Logger.Log(ex);
                    OnReportProgress("Error: " + ex.ToString());
                    System.Threading.Thread.Sleep(1000 * frequencyInSec);
                    continue;
                }

                var pairs = _allowedPairs.Where(p => p.HasCurrency(targetCurrency));

                var ac = new MyAction
                {
                    UnitsCurrency1 = 0,
                    UnitsCurrency2 = originalAmount,
                    Pair = BtcePair.Unknown

                };
                NTree<MyAction> tree = new NTree<MyAction>(ac);

                foreach (var p in pairs)
                {
                    BuildArbitrageTree(tickers, p, tree, originalAmount, p.Item1() == targetCurrency, targetCurrency);
                }

                var leaves = new List<NTree<MyAction>>();
                tree.Traverse(n =>
                {
                    if (n.Data.IsFinalAction)
                    {
                        leaves.Add(n);
                    }
                });

                decimal maxProfit = 0;
                List<NTree<MyAction>> bestChain = null;
                int bestIndex = 0;

                for (var lIndex = 0; lIndex < leaves.Count; lIndex++)
                {
                    //  System.Diagnostics.Debug.WriteLine("Option " + (lIndex + 1));
                    var l = leaves[lIndex];
                    var t = l.GetTree();
                    for (var nIndex = 1; nIndex < t.Count; nIndex++)
                    {
                        var c = t[nIndex].Data;
                        //System.Diagnostics.Debug.WriteLine(string.Format("Converting {0:0.00###} {1:0.00###} to {2:0.00###} {3:0.00###}", c.UnitsCurrency1, c.Currency1, c.UnitsCurrency2, c.Currency2));
                    }
                    decimal profit = l.Data.UnitsCurrency2 - originalAmount;
                    // System.Diagnostics.Debug.WriteLine("Profit " + profit.ToString("0.00###"));
                    if (profit > maxProfit)
                    {
                        maxProfit = l.Data.UnitsCurrency2 - originalAmount;
                        bestChain = t;
                        bestIndex = lIndex;
                    }
                }

                if (bestChain != null)
                {
                    //System.Diagnostics.Debug.WriteLine("Best Option: " + (bestIndex + 1));
                    OnReportProgress("Max profit: " + maxProfit.ToString("0.00###"));

                    for (var nIndex = 1; nIndex < bestChain.Count; nIndex++)
                    {
                        var c = bestChain[nIndex].Data;
                        OnReportProgress(c.Description);
                    }

                    _currentChain = bestChain;
                    var percentage = maxProfit / originalAmount * 100;
                    OnReportProgress(string.Format("Percentage {0:0.00}", percentage));
                    if (percentage > profitThreshold)
                    {

                        FollowChain(bestChain, realTrading);
//.........这里部分代码省略.........
开发者ID:CryptoRepairCrew,项目名称:CoinTNet,代码行数:101,代码来源:ArbitrageManager.cs


示例18: SortPagesInPortalGroupInternal

 private NTree<ItemDto> SortPagesInPortalGroupInternal(NTree<ItemIdDto> openedNode, int sortOrder)
 {
     var treeNode = new NTree<ItemDto> { Data = new ItemDto { Key = RootKey } };
     if (openedNode == null)
     {
         return treeNode;
     }
     var portals = GetPortalGroup(sortOrder);
     treeNode.Children = portals.Select(dto => new NTree<ItemDto> { Data = dto }).ToList();
     if (openedNode.HasChildren())
     {
         foreach (var openedNodeChild in openedNode.Children)
         {
             var portalIdString = openedNodeChild.Data.Id;
             var treeNodeChild = treeNode.Children.Find(child => String.Equals(child.Data.Key, portalIdString, StringComparison.InvariantCultureIgnoreCase));
             if (treeNodeChild == null)
             {
                 continue;
             }
             int portalId;
             if (!int.TryParse(portalIdString.Replace(PortalPrefix, string.Empty), out portalId))
             {
                 portalId = -1;
             }
             var treeOfPages = SortPagesInternal(portalId, openedNodeChild, sortOrder);
             treeNodeChild.Children = treeOfPages.Children;
         }
     }
     return treeNode;
 }
开发者ID:ryanmalone,项目名称:BGDNNWEB,代码行数:30,代码来源:ItemListServiceController.cs


示例19: SortFoldersRecursevely

 private void SortFoldersRecursevely(int portalId, NTree<ItemDto> treeNode, NTree<ItemIdDto> openedNode, int sortOrder, string permissions)
 {
     if (openedNode == null)
     {
         return;
     }
     var children = ApplySort(GetFolderDescendantsInternal(portalId, openedNode.Data.Id, sortOrder, string.Empty, permissions), sortOrder).Select(dto => new NTree<ItemDto> { Data = dto }).ToList();
     treeNode.Children = children;
     if (openedNode.HasChildren())
     {
         foreach (var openedNodeChild in openedNode.Children)
         {
             var treeNodeChild = treeNode.Children.Find(child => String.Equals(child.Data.Key, openedNodeChild.Data.Id, StringComparison.InvariantCultureIgnoreCase));
             if (treeNodeChild == null)
             {
                 continue;
             }
             SortFoldersRecursevely(portalId, treeNodeChild, openedNodeChild, sortOrder, permissions);
         }
     }
 }
开发者ID:ryanmalone,项目名称:BGDNNWEB,代码行数:21,代码来源:ItemListServiceController.cs


示例20: SortPagesRecursevely

 private static void SortPagesRecursevely(IList<TabInfo> tabs, NTree<ItemDto> treeNode, NTree<ItemIdDto> openedNode, int sortOrder)
 {
     if (openedNode == null)
     {
         return;
     }
     var children = ApplySort(GetChildrenOf(tabs, openedNode.Data.Id), sortOrder).Select(dto => new NTree<ItemDto> { Data = dto }).ToList();
     treeNode.Children = children;
     if (openedNode.HasChildren())
     {
         foreach (var openedNodeChild in openedNode.Children)
         {
             var treeNodeChild = treeNode.Children.Find(child => String.Equals(child.Data.Key, openedNodeChild.Data.Id, StringComparison.InvariantCultureIgnoreCase));
             if (treeNodeChild == null)
             {
                 continue;
             }
             SortPagesRecursevely(tabs, treeNodeChild, openedNodeChild, sortOrder);
         }
     }
 }
开发者ID:ryanmalone,项目名称:BGDNNWEB,代码行数:21,代码来源:ItemListServiceController.cs



注:本文中的NTree类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NUnit类代码示例发布时间:2022-05-24
下一篇:
C# NSUrlSession类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap