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

C# TreeElement类代码示例

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

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



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

示例1: ArrayTest

        public void ArrayTest()
        {
            var array = new TreeElement<int, string>(new TreeElement<int, string>("A"), new TreeElement<int, string>("B"));

            var arrayChangedHistory = array.ArrayChanged.SubscribeHistory();
            var grandChildrenChangedHistory = array.GrandChildrenChanged.SubscribeHistory();

            array.Type.Is(ElementType.Array);
            AssertEx.Catch<InvalidOperationException>(() => array.LeafValue.ToString());
            AssertEx.Catch<InvalidOperationException>(() => array.NodeChildren.ToString());
            AssertEx.Catch<InvalidOperationException>(() => array.NodeChildrenChanged.ToString());

            array.Array[0].LeafValue.Is("A");
            array.Array[1].LeafValue.Is("B");
            array.Array.Count.Is(2);

            arrayChangedHistory.Count().Is(0);
            grandChildrenChangedHistory.Count().Is(0);

            array.Array.Add(new TreeElement<int, string>("C"));
            array.Array.Clear();

            arrayChangedHistory.Values.Select(x => x.Action).IsSequenceEqual(NotifyCollectionChangedAction.Add, NotifyCollectionChangedAction.Reset);
            grandChildrenChangedHistory.Values.Select(x => x.Value.Action).IsSequenceEqual(NotifyCollectionChangedAction.Add, NotifyCollectionChangedAction.Reset);
        }
开发者ID:syo00,项目名称:ReactiveTree,代码行数:25,代码来源:TreeElementTest.cs


示例2: GetChildRole

        public override short GetChildRole(TreeElement child)
        {
            if (child is ReferenceName)
                return 0x27;

            return base.GetChildRole(child);
        }
开发者ID:willrawls,项目名称:arp,代码行数:7,代码来源:ReferenceNameAttributeValue.cs


示例3: Write

        public void Write(TextWriter writer, IEnumerable<Stack> stacks)
        {
            var root = new TreeElement();

            var filtered = stacks
                .OrderByDescending(s => s.Count);

            foreach (var stack in filtered) {
                AddStacks(root, stack, 0);
            }

            var total = root.Total;
            var normMax = (double)(int.MaxValue / 2);
            var scaleFactor = Math.Min(normMax / total, 1);

            var lowerBound = total * 0.0001;

            RescaleAndTrim(root, scaleFactor, lowerBound);

            using (var jWriter = new JsonTextWriter(writer)) {
                jWriter.Formatting = Formatting.None;
                //jWriter.Formatting = Formatting.Indented;
                WriteTree(root, jWriter);
            }
        }
开发者ID:kogir,项目名称:csharp-stackvis,代码行数:25,代码来源:IcicleWriter.cs


示例4: Run

    public static void Run(TreeElement node, ILexer lexer, ITokenOffsetProvider offsetProvider, bool trimTokens, SeldomInterruptChecker interruptChecker)
    {
      Assertion.Assert(node.parent == null, "node.parent == null");

      var root = node as CompositeElement;
      if (root == null)
      {
        return;
      }

      var inserter = new PsiMissingTokensInserter(lexer, offsetProvider, interruptChecker);
      lexer.Start();

      if (trimTokens)
      {
        using (var container = new DummyContainer(root))
        {
          inserter.Run(container);
        }
      }
      else
      {
        var terminator = new EofToken(lexer.Buffer);
        root.AppendNewChild(terminator);
        inserter.Run(root);
        root.DeleteChildRange(terminator, terminator);
      }
    }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:28,代码来源:PsiMissingsTokenInserter.cs


示例5: GetChildRole

 public override short GetChildRole(TreeElement child)
 {
     if (child.type == L4NElementType.REFERENCE_NAME)
     {
         return REFERENCE_NAME_ROLE;
     }
     return 0;
 }
开发者ID:willrawls,项目名称:arp,代码行数:8,代码来源:ReferenceType.cs


示例6: GetChildRole

        public override short GetChildRole(TreeElement child)
        {
            if (child is IColumnElement && ((XmlTag)child).TagName == "column")
                    return Column_ROLE_ID;
                else

            return base.GetChildRole(child);
        }
开发者ID:willrawls,项目名称:arp,代码行数:8,代码来源:KeyElementImpl.generated.cs


示例7: GetChildRole

        public override short GetChildRole(TreeElement child)
        {
            if (child is IParamElement && ((XmlTag)child).TagName == "param")
                    return Param_ROLE_ID;
                else

            return base.GetChildRole(child);
        }
开发者ID:willrawls,项目名称:arp,代码行数:8,代码来源:TypeElementImpl.generated.cs


示例8: GetChildRole

 public override short GetChildRole(TreeElement child)
 {
     if (child is IIdMappingElement && ((XmlTag)child).TagName == "id")
         return ID_MAPPING_ELEMENT_ROLE;
     else if (child is IPropertyMappingElement && ((XmlTag)child).TagName == "property")
         return PROPTIY_ELEMENT_ROLE;
     else
         return base.GetChildRole(child);
 }
开发者ID:willrawls,项目名称:arp,代码行数:9,代码来源:ClassMappingElementImpl.generated.cs


示例9: FileTree

        public FileTree(Screen screen, Rectangle bound, Sprite background, string root, string extensionFilter = "")
            : base(screen)
        {
            Bound = bound;
            Background = background;
            elements = new Dictionary<TextBlock, TreeElement>();
            font = screen.Manager.Game.Content.Load<SpriteFont>("Fonts/Hud");

            Root = new TreeElement() { Path = root, isDirectory = true };
            AddToTreeAllChilds(Root, extensionFilter);
        }
开发者ID:BlaisePascalSi,项目名称:PokeSi,代码行数:11,代码来源:FileTree.cs


示例10: LeafTest

        public void LeafTest()
        {
            var leaf = new TreeElement<int, string>("1");

            AssertEx.Catch<InvalidOperationException>(() => leaf.Array.ToString());
            AssertEx.Catch<InvalidOperationException>(() => leaf.ArrayChanged.Subscribe());
            AssertEx.Catch<InvalidOperationException>(() => leaf.NodeChildren.ToString());
            AssertEx.Catch<InvalidOperationException>(() => leaf.NodeChildrenChanged.Subscribe());
            leaf.GrandChildrenChanged.Subscribe(); // throws no exception
            leaf.LeafValue.Is("1");
            leaf.Type.Is(ElementType.Leaf);
        }
开发者ID:syo00,项目名称:ReactiveTree,代码行数:12,代码来源:TreeElementTest.cs


示例11: GetChildRole

        public override short GetChildRole(TreeElement child)
        {
            if (child is IReturnDiscriminatorElement && ((XmlTag)child).TagName == "return-discriminator")
                    return ReturnDiscriminator_ROLE_ID;
                else

                if (child is IReturnPropertyElement && ((XmlTag)child).TagName == "return-property")
                    return ReturnProperty_ROLE_ID;
                else

            return base.GetChildRole(child);
        }
开发者ID:willrawls,项目名称:arp,代码行数:12,代码来源:ReturnElementImpl.generated.cs


示例12: GetChildRole

        public override short GetChildRole(TreeElement child)
        {
            if (child is IKeyPropertyElement && ((XmlTag)child).TagName == "key-property")
                    return KeyPropertys_ROLE_ID;
                else

                if (child is IKeyManyToOneElement && ((XmlTag)child).TagName == "key-many-to-one")
                    return KeyManyToOnes_ROLE_ID;
                else

            return base.GetChildRole(child);
        }
开发者ID:willrawls,项目名称:arp,代码行数:12,代码来源:CompositeIndexElementImpl.generated.cs


示例13: EqualsAndHashCodeTest

        public void EqualsAndHashCodeTest()
        {
            var te_a1 = new TreeElement<string, string>("a");
            var te_a2 = new TreeElement<string, string>("a");
            var te_b = new TreeElement<string, string>("b");
            var te_node = new TreeElement<string, string>();

            te_a1.Is(te_a1);
            te_a1.GetHashCode().Is(te_a1.GetHashCode());
            te_a1.Is(te_a2);
            te_a1.GetHashCode().Is(te_a2.GetHashCode());
            te_a1.IsNot(te_b);
            te_a1.IsNot(te_node);
        }
开发者ID:syo00,项目名称:ReactiveTree,代码行数:14,代码来源:TreeElementTest.cs


示例14: AddStacks

        private void AddStacks(TreeElement root, Stack stack, int depth)
        {
            root.Total += stack.Count;

            var limit = stack.Stacks.Length;
            //var limit = Math.Min(stack.Stacks.Length, 4);
            if (depth < limit) {
                var frame = stack.Stacks[depth];
                if (!root.Children.ContainsKey(frame)) {
                    root.Children.Add(frame, new TreeElement());
                }

                AddStacks(root.Children[frame], stack, depth + 1);
            }
        }
开发者ID:kogir,项目名称:csharp-stackvis,代码行数:15,代码来源:IcicleWriter.cs


示例15: GetChildRole

        public override short GetChildRole(TreeElement child)
        {
            if (child is ICreateElement && ((XmlTag)child).TagName == "create")
                    return Create_ROLE_ID;
                else

                if (child is IDropElement && ((XmlTag)child).TagName == "drop")
                    return Drop_ROLE_ID;
                else

                if (child is IDialectScopeElement && ((XmlTag)child).TagName == "dialect-scope")
                    return DialectScope_ROLE_ID;
                else

            return base.GetChildRole(child);
        }
开发者ID:willrawls,项目名称:arp,代码行数:16,代码来源:DatabaseObjectElementImpl.generated.cs


示例16: GetChildRole

        public override short GetChildRole(TreeElement child)
        {
            if (child is IParentElement && ((XmlTag)child).TagName == "parent")
                    return Parent_ROLE_ID;
                else

                if (child is IPropertyElement && ((XmlTag)child).TagName == "property")
                    return Properties_ROLE_ID;
                else

                if (child is IManyToOneElement && ((XmlTag)child).TagName == "many-to-one")
                    return ManyToOnes_ROLE_ID;
                else

                if (child is INestedCompositeElementElement && ((XmlTag)child).TagName == "nested-composite-element")
                    return NestedCompositeElements_ROLE_ID;
                else

            return base.GetChildRole(child);
        }
开发者ID:willrawls,项目名称:arp,代码行数:20,代码来源:CompositeElementElementImpl.generated.cs


示例17: ProcessLeafElement

    protected override void ProcessLeafElement(TreeElement element)
    {
      int leafOffset = GetLeafOffset(element).Offset;

      // Check if some tokens are missed before this leaf
      if (myLexer.TokenType != null && myLexer.TokenStart < leafOffset)
      {
        // Find out the right place to insert tokens to
        TreeElement anchor = element;
        CompositeElement parent = anchor.parent;
        while (anchor == parent.firstChild && parent.parent != null)
        {
          anchor = parent;
          parent = parent.parent;
        }

        // proceed with inserting tokens
        while (myLexer.TokenType != null && myLexer.TokenStart < leafOffset)
        {
          LeafElementBase token = CreateMissingToken();

          parent.AddChildBefore(token, anchor);

          myLexer.Advance();
        }
      }

      // skip all tokens which lie inside given leaf element
      int leafEndOffset = leafOffset + element.GetTextLength();
      if ((element is IClosedChameleonBody) && (myLexer is CachingLexer))
      {
        ((CachingLexer)myLexer).FindTokenAt(leafEndOffset);
      }
      else
      {
        while (myLexer.TokenType != null && myLexer.TokenStart < leafEndOffset)
        {
          myLexer.Advance();
        }
      }
    }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:41,代码来源:PsiMissingsTokenInserter.cs


示例18: Add

 /// <summary>
 /// добавление элемента в дерево
 /// </summary>
 /// <param name="value"></param>
 public void Add(int value)
 {
     if (head == null)
     {
         head = new TreeElement(value);
     }
     else
     {
         TreeElement tmpHead = head;
         while (true)
         {
             if (tmpHead.GetValue() == value)
                 return;
             if (tmpHead.GetValue() > value)
             {
                 if (tmpHead.GetLeft() == null)
                 {
                     tmpHead.SetLeft(new TreeElement(value));
                     return;
                 }
                 else
                 {
                     tmpHead = tmpHead.GetLeft();
                 }
             }
             if (tmpHead.GetValue() < value)
             {
                 if (tmpHead.GetRight() == null)
                 {
                     tmpHead.SetRight(new TreeElement(value));
                     return;
                 }
                 else
                 {
                     tmpHead = tmpHead.GetRight();
                 }
             }
         }
     }
 }
开发者ID:elenazab,项目名称:Homework,代码行数:44,代码来源:Tree.cs


示例19: RescaleAndTrim

        private void RescaleAndTrim(TreeElement root, double scaleFactor, double lowerBound)
        {
            root.Total = (long)(root.Total * scaleFactor);

            if (root.Total == 0) {
                Console.WriteLine("Zero encountered.");
                root.Total = 1;
            }

            var toRemove = root.Children
                .Where(c => c.Value.Total < lowerBound)
                .Select(c => c.Key)
                .ToArray();

            foreach (var remove in toRemove) {
                root.Children.Remove(remove);
            }

            foreach (var child in root.Children) {
                RescaleAndTrim(child.Value, scaleFactor, lowerBound);
            }
        }
开发者ID:kogir,项目名称:csharp-stackvis,代码行数:22,代码来源:IcicleWriter.cs


示例20: AddToTreeAllChilds

 private void AddToTreeAllChilds(TreeElement parent, string extensionFilter)
 {
     string root = parent.Path;
     foreach (string dir in Directory.GetDirectories(root))
     {
         TreeElement child = new TreeElement() { Path = dir, isDirectory = true, Parent = parent };
         elements.Add(new TextBlock(Screen, nextPos, dir.Split('\\').Last()) { Parent = this }, child);
         nextPos.X += 20;
         nextPos.Y += 30;
         AddToTreeAllChilds(child, extensionFilter);
         parent.Childs.Add(child);
     }
     foreach (string file in Directory.GetFiles(root))
     {
         if (file.EndsWith(extensionFilter))
         {
             TreeElement child = new TreeElement() { Path = file, isDirectory = false, Parent = parent };
             parent.Childs.Add(child);
             elements.Add(new TextBlock(Screen, nextPos, file.Split('\\').Last()) { Parent = this }, child);
             nextPos.Y += 30;
         }
     }
     nextPos.X -= 20;
 }
开发者ID:BlaisePascalSi,项目名称:PokeSi,代码行数:24,代码来源:FileTree.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# TreeGridNode类代码示例发布时间:2022-05-24
下一篇:
C# Tree类代码示例发布时间: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