当前位置: 首页>>代码示例>>C#>>正文


C# TreeElement类代码示例

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


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


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