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


C# INode.RightEdge方法代码示例

本文整理汇总了C#中INode.RightEdge方法的典型用法代码示例。如果您正苦于以下问题:C# INode.RightEdge方法的具体用法?C# INode.RightEdge怎么用?C# INode.RightEdge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在INode的用法示例。


在下文中一共展示了INode.RightEdge方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Cluster

        /// <summary>
        ///   Clusters Two INodes together, sets new root/parent/left and right edges
        /// </summary>
        /// <param name="left"> Node on the left </param>
        /// <param name="right"> Node on the Right </param>
        /// <param name="match"> Inverted or Not Inverted </param>
        /// <param name="matchData"> Optional MatchData variable, store clustering information </param>
        public Cluster(INode left, INode right, Match match = Match.NonInverted, MatchData matchData = null)
        {
            if (match == Match.Impossible)
            {
                throw new ArgumentException("Match is apparently impossible why are you trying?");
            }

            // Now Build the new nodes
            _left = left;
            _right = right;
            _matchData = matchData;
            _size = left.Size() + right.Size();
            _leftedge = left.LeftEdge();
            _rightedge = right.RightEdge();

            // Set the parents accordingly
            left.Parent(this);
            right.Parent(this);
            _parent = null;

            // change the roots
            _left.Root(this);
            _right.Root(this);

            // Update Count
            Id = _count++;
        }
开发者ID:Algorithmix,项目名称:Papyrus,代码行数:34,代码来源:Cluster.cs

示例2: IsFit

        /// <summary>
        ///   IsFit checks if given a specified side, it can be fit with a shreds's edge
        ///   This Also returns a match object
        /// </summary>
        /// <param name="root"> </param>
        /// <param name="shred"> </param>
        /// <param name="side"> </param>
        /// <returns> </returns>
        private static Tuple<Match, Direction> IsFit(INode root, Shred shred, Side side)
        {
            Side query;
            Match match;

            if (side.Orientation != shred.Orientation)
            {
                query = new Side(shred, Enumeration.Opposite(side.Direction), shred.Orientation);
                match = Match.Inverted;
            }
            else
            {
                query = side;
                match = Match.NonInverted;
            }

            // If Directions match AND The Availablility then return match, otherwise impossible
            if (query.Direction == Direction.FromLeft && root.LeftEdge() == shred.LeftEdge())
            {
                return new Tuple<Match, Direction>(match, Direction.FromLeft);
            }
            if (query.Direction == Direction.FromRight && root.RightEdge() == shred.RightEdge())
            {
                return new Tuple<Match, Direction>(match, Direction.FromRight);
            }
            return new Tuple<Match, Direction>(Match.Impossible, Direction.FromLeft);
        }
开发者ID:Algorithmix,项目名称:Papyrus,代码行数:35,代码来源:MatchData.cs

示例3: ValidateEdges

        private static bool ValidateEdges(INode node)
        {
            if (node.IsLeaf())
            {
                return true;
            }

            // Get the expected
            var actualLeft = node.LeftEdge();
            var actualRight = node.RightEdge();

            INode left = node;
            INode right = node;
            while (!left.IsLeaf())
            {
                left = left.Left();
            }
            while (!right.IsLeaf())
            {
                right = right.Right();
            }

            var expectedLeft = left.LeftEdge();
            var expectedRight = right.RightEdge();

            Assert.IsTrue(actualLeft == expectedLeft);
            Assert.IsTrue(actualRight == expectedRight);

            if (actualLeft != expectedLeft || actualRight != expectedRight)
            {
                return false;
            }

            // Repeat for node children
            return ValidateEdges(node.Left()) && ValidateEdges(node.Right());
        }
开发者ID:Algorithmix,项目名称:Papyrus,代码行数:36,代码来源:NodeTest.cs

示例4: IsEqual

        private static bool IsEqual(INode nodeA, INode nodeB)
        {
            if (nodeA.IsLeaf() ^ nodeB.IsLeaf())
            {
                throw new Exception("Identical nodes should be at the same height");
            }

            Assert.IsTrue(nodeA.LeftEdge().Direction == nodeB.LeftEdge().Direction);
            Assert.IsTrue(nodeA.RightEdge().Direction == nodeB.RightEdge().Direction);
            Assert.IsTrue(nodeA.LeftEdge().Orientation == nodeB.LeftEdge().Orientation);
            Assert.IsTrue(nodeA.RightEdge().Orientation == nodeB.RightEdge().Orientation);

            if (nodeA.IsLeaf() && nodeB.IsLeaf())
            {
                return true;
            }

            return IsEqual(nodeA.Left(), nodeB.Left()) && IsEqual(nodeA.Right(), nodeB.Right());
        }
开发者ID:Algorithmix,项目名称:Papyrus,代码行数:19,代码来源:NodeTest.cs

示例5: IsMirror

        private static bool IsMirror(INode reg, INode rev)
        {
            if (reg.IsLeaf() ^ rev.IsLeaf())
            {
                throw new Exception("Mirrored nodes are not at the same height");
            }

            if (reg.IsLeaf() && rev.IsLeaf())
            {
                Assert.IsTrue(reg.Size() == rev.Size());
                Assert.IsTrue(reg.Leaf().Orientation == Enumeration.Opposite(rev.Leaf().Orientation));
                Assert.IsTrue(reg.LeftEdge().Direction == Enumeration.Opposite(rev.RightEdge().Direction));
                return true;
            }

            return IsMirror(reg.Left(), rev.Right()) && IsMirror(reg.Right(), rev.Left());
        }
开发者ID:Algorithmix,项目名称:Papyrus,代码行数:17,代码来源:NodeTest.cs


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