1 // Copyright 2016 by Samsung Electronics, Inc.,
3 // This software is the confidential and proprietary information
4 // of Samsung Electronics, Inc. ("Confidential Information"). You
5 // shall not disclose such Confidential Information and shall use
6 // it only in accordance with the terms of the license agreement
7 // you entered into with Samsung.
14 /// Struct defining a 2-D point as a pair of generic type.
16 public struct Point : IEquatable<Point>
19 /// Location along the horizontal axis.
24 /// Location along the vertical axis.
29 /// A human-readable representation of the <see cref="T:Tizen.UI.Point" />.
31 /// <returns>The string is formatted as "{{X={0} Y={1}}}".</returns>
32 public override string ToString()
34 return string.Format("{{X={0} Y={1}}}", X, Y);
38 /// Returns a hash value for the <see cref="T:Tizen.UI.Point" />.
40 /// <returns>A value intended for efficient insertion and lookup in hashtable-based data structures.</returns>
41 public override int GetHashCode()
45 return X.GetHashCode() ^ (Y.GetHashCode() * 397);
50 /// Returns true if the X and Y values of this are exactly equal to those in the argument.
52 /// <param name="obj">Another <see cref="T:Tizen.UI.Point" />.</param>
53 /// <returns>True if the X and Y values are equal to those in <paramref name="obj" />. Returns false if <paramref name="obj" /> is not a <see cref="T:Tizen.UI.Point" />.</returns>
54 public override bool Equals(object obj)
59 return Equals((Point)obj);
63 /// Returns true if the X and Y values of this are exactly equal to those in the argument.
65 /// <param name="other">Another <see cref="T:Tizen.UI.Point" />.</param>
66 /// <returns>True if the X and Y values are equal to those in <paramref name="other" />.</returns>
67 public bool Equals(Point other)
69 return X.Equals(other.X) && Y.Equals(other.Y);
73 /// Whether the two <see cref="T:Tizen.UI.Point" />s are equal.
75 /// <param name="p1">A <see cref="T:Tizen.UI.Point" /> on the left hand side.</param>
76 /// <param name="p2">A <see cref="T:Tizen.UI.Point" /> on the right hand side.</param>
77 /// <returns>True if the two <see cref="T:Tizen.UI.Point" />s have equal values.</returns>
78 public static bool operator ==(Point p1, Point p2)
84 /// Whether two <see cref="T:Tizen.UI.Point" />s are not equal.
86 /// <param name="p1">A <see cref="T:Tizen.UI.Point" /> on the left hand side.</param>
87 /// <param name="p2">A <see cref="T:Tizen.UI.Point" /> on the right hand side.</param>
88 /// <returns>True if the two <see cref="T:Tizen.UI.Point" />s do not have equal values.</returns>
89 public static bool operator !=(Point p1, Point p2)
91 return !p1.Equals(p2);