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


C# Coordinate.Equals方法代码示例

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


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

示例1: different_coordinates_are_not_equal

        public void different_coordinates_are_not_equal()
        {
            var item1 = new Coordinate();
            var item2 = new Coordinate {Position = 1};

            Assert.IsFalse(item1.Equals(item2));
        }
开发者ID:NotMyself,项目名称:GridShapePuzzle,代码行数:7,代码来源:CoordinateTests.cs

示例2: AreEqualIfRowAndColumnMatch

        public void AreEqualIfRowAndColumnMatch()
        {
            var coordinate1 = new Coordinate('c', 2);
            var coordinate2 = new Coordinate('c', 2);

            Assert.IsTrue(coordinate1.Equals(coordinate2));
        }
开发者ID:vcartera81,项目名称:Battle-Sea,代码行数:7,代码来源:CoordinateTest.cs

示例3: equal_coordinates_are_equal

        public void equal_coordinates_are_equal()
        {
            var item1 = new Coordinate();
            var item2 = new Coordinate();

            Assert.IsTrue(item1.Equals(item2));
        }
开发者ID:NotMyself,项目名称:GridShapePuzzle,代码行数:7,代码来源:CoordinateTests.cs

示例4: CanMoveCoordinateToAnyDirection

        public void CanMoveCoordinateToAnyDirection()
        {
            var coordinate = new Coordinate('e', 5);

            coordinate.MoveUp();
            Assert.IsTrue(coordinate.Equals(new Coordinate('e', 4)));

            coordinate.MoveRight();
            Assert.IsTrue(coordinate.Equals(new Coordinate('f', 4)));

            coordinate.MoveDown();
            Assert.IsTrue(coordinate.Equals(new Coordinate('f', 5)));

            coordinate.MoveLeft();
            Assert.IsTrue(coordinate.Equals(new Coordinate('e', 5)));
        }
开发者ID:vcartera81,项目名称:Battle-Sea,代码行数:16,代码来源:CoordinateTest.cs

示例5: CanCopyTwoCoordinates

        public void CanCopyTwoCoordinates()
        {
            var coordinate = new Coordinate('b', 7);
            var copy = Coordinate.Copy(coordinate);

            Assert.IsTrue(coordinate.Equals(copy));
        }
开发者ID:vcartera81,项目名称:Battle-Sea,代码行数:7,代码来源:CoordinateTest.cs

示例6: can_get_cordinate_for_a_given_level_and_position

        public void can_get_cordinate_for_a_given_level_and_position(int value, int level, int position)
        {
            var expected = new Coordinate { Level = level, Position = position, Value = value };
            var actual = item.Find(level, position);

            Assert.IsTrue(expected.Equals(actual));
        }
开发者ID:NotMyself,项目名称:GridShapePuzzle,代码行数:7,代码来源:CoordinateLocatorTests.cs

示例7: ComputeIntersection

 /// <summary>
 ///
 /// </summary>
 /// <param name="p"></param>
 /// <param name="p1"></param>
 /// <param name="p2"></param>
 public override void ComputeIntersection(Coordinate p, Coordinate p1, Coordinate p2)
 {
     IsProper = false;
     // do between check first, since it is faster than the orientation test
     if (Envelope.Intersects(p1, p2, p))
     {
         if ((CgAlgorithms.OrientationIndex(p1, p2, p) == 0) && (CgAlgorithms.OrientationIndex(p2, p1, p) == 0))
         {
             IsProper = true;
             if (p.Equals(p1) || p.Equals(p2))
                 IsProper = false;
             Result = IntersectionType.PointIntersection;
             return;
         }
     }
     Result = IntersectionType.NoIntersection;
 }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:23,代码来源:RobustLineIntersector.cs

示例8: contains

    private bool contains(Coordinate[] arr, Coordinate c)
    {
        foreach(var el in arr) {
            if(c.Equals(el)) {
                return true;
            }
        }

        return false;
    }
开发者ID:jschiff,项目名称:TowerDefense,代码行数:10,代码来源:CubeSpawner.cs

示例9: EqualsTest

        public void EqualsTest()
        {
            var target = new Coordinate(5, 15);
            object obj = new Coordinate(5, 15);
            const bool expected = true;

            bool actual = target.Equals(obj);

            Assert.AreEqual(expected, actual);
        }
开发者ID:Kerbobotat,项目名称:FlagConsole,代码行数:10,代码来源:CoordinateTest.cs

示例10: EqualsNullTest

        public void EqualsNullTest()
        {
            Coordinate target = new Coordinate(5, 15);
            object obj = null;
            bool expected = false;
            bool actual;

            actual = target.Equals(obj);

            Assert.AreEqual(expected, actual);
        }
开发者ID:Kirlu,项目名称:FlagConsole,代码行数:11,代码来源:CoordinateTest.cs

示例11: MatchInSameDirection

 /// <summary>
 /// The coordinate pairs match if they define line segments lying in the same direction.
 /// E.g. the segments are parallel and in the same quadrant
 /// (as opposed to parallel and opposite!).
 /// </summary>
 /// <param name="p0"></param>
 /// <param name="p1"></param>
 /// <param name="ep0"></param>
 /// <param name="ep1"></param>
 private static bool MatchInSameDirection(Coordinate p0, Coordinate p1, Coordinate ep0, Coordinate ep1)
 {
     if (!p0.Equals(ep0))
         return false;
     return CgAlgorithms.ComputeOrientation(p0, p1, ep1) == CgAlgorithms.COLLINEAR &&
            QuadrantOp.Quadrant(p0, p1) == QuadrantOp.Quadrant(ep0, ep1);
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:16,代码来源:PlanarGraph.cs

示例12: GenericEqualsReferenceTest

        public void GenericEqualsReferenceTest()
        {
            var target = new Coordinate(5, 15);
            Coordinate position = target;
            const bool expected = true;

            bool actual = target.Equals(position);

            Assert.AreEqual(expected, actual);
        }
开发者ID:Kerbobotat,项目名称:FlagConsole,代码行数:10,代码来源:CoordinateTest.cs

示例13: GameState

 /// <summary>
 /// Creates a new game state with all holes occupied except the one given. 
 /// On a board with 5 rows, row 3 hole 2 is the traditional choice for the
 /// empty hole.
 /// </summary>
 /// <param name="rows"/>
 /// <param name="emptyHole"/>
 public GameState(int rows, Coordinate emptyHole)
 {
     this.rowCount = rows;
     occupiedHoles = new List<Coordinate>();
     for (int row = 1; row <= rows; row++)
     {
         for (int hole = 1; hole <= row; hole++)
         {
             Coordinate peg = new Coordinate(row, hole);
             if (!peg.Equals(emptyHole))
             {
                 occupiedHoles.Add(peg);
             }
         }
     }
 }
开发者ID:wolever,项目名称:peg-performance,代码行数:23,代码来源:GameState.cs

示例14: FindEdge

 /// <summary>
 /// Returns the edge whose first two coordinates are p0 and p1.
 /// </summary>
 /// <param name="p0"></param>
 /// <param name="p1"></param>
 /// <returns> The edge, if found <c>null</c> if the edge was not found.</returns>
 public Edge FindEdge(Coordinate p0, Coordinate p1)
 {
     for (int i = 0; i < _edges.Count; i++) 
     {
         Edge e = _edges[i];
         Coordinate[] eCoord = e.Coordinates;
         if (p0.Equals(eCoord[0]) && p1.Equals(eCoord[1]))
             return e;
     }
     return null;
 }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:17,代码来源:PlanarGraph.cs

示例15: ComputeCollinearIntersection

        /// <summary>
        ///
        /// </summary>
        /// <param name="p1"></param>
        /// <param name="p2"></param>
        /// <param name="q1"></param>
        /// <param name="q2"></param>
        /// <returns></returns>
        private IntersectionType ComputeCollinearIntersection(Coordinate p1, Coordinate p2, Coordinate q1, Coordinate q2)
        {
            bool p1Q1P2 = Envelope.Intersects(p1, p2, q1);
            bool p1Q2P2 = Envelope.Intersects(p1, p2, q2);
            bool q1P1Q2 = Envelope.Intersects(q1, q2, p1);
            bool q1P2Q2 = Envelope.Intersects(q1, q2, p2);

            if (p1Q1P2 && p1Q2P2)
            {
                IntersectionPoints[0] = q1;
                IntersectionPoints[1] = q2;
                return IntersectionType.Collinear;
            }
            if (q1P1Q2 && q1P2Q2)
            {
                IntersectionPoints[0] = p1;
                IntersectionPoints[1] = p2;
                return IntersectionType.Collinear;
            }
            if (p1Q1P2 && q1P1Q2)
            {
                IntersectionPoints[0] = q1;
                IntersectionPoints[1] = p1;
                return q1.Equals(p1) ? IntersectionType.PointIntersection : IntersectionType.Collinear;
            }
            if (p1Q1P2 && q1P2Q2)
            {
                IntersectionPoints[0] = q1;
                IntersectionPoints[1] = p2;
                return q1.Equals(p2) ? IntersectionType.PointIntersection : IntersectionType.Collinear;
            }
            if (p1Q2P2 && q1P1Q2)
            {
                IntersectionPoints[0] = q2;
                IntersectionPoints[1] = p1;
                return q2.Equals(p1) ? IntersectionType.PointIntersection : IntersectionType.Collinear;
            }
            if (p1Q2P2 && q1P2Q2)
            {
                IntersectionPoints[0] = q2;
                IntersectionPoints[1] = p2;
                return q2.Equals(p2) ? IntersectionType.PointIntersection : IntersectionType.Collinear;
            }
            return IntersectionType.NoIntersection;
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:53,代码来源:RobustLineIntersector.cs


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