Merge "[WiFi] GetConnectedAP() Returns null if there is no connected AP"
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia / Common / Point.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System;
18
19 namespace Tizen.Multimedia
20 {
21     /// <summary>
22     /// Represents a point in the 2D space.
23     /// </summary>
24     /// <since_tizen> 3 </since_tizen>
25     public struct Point
26     {
27
28         /// <summary>
29         /// Initializes a new instance of the Point with the specified coordinates.
30         /// </summary>
31         /// <param name="x">X-axis coordinate of the point in the 2D space.</param>
32         /// <param name="y">Y-axis coordinate of the point in the 2D space.</param>
33         /// <since_tizen> 3 </since_tizen>
34         public Point(int x, int y)
35         {
36             X = x;
37             Y = y;
38         }
39
40         /// <summary>
41         /// Gets or sets the X-axis coordinate of the point in the 2D space.
42         /// </summary>
43         /// <since_tizen> 3 </since_tizen>
44         public int X
45         {
46             get;
47             set;
48         }
49
50         /// <summary>
51         /// Gets or sets the Y-axis coordinate of the point in the 2D space.
52         /// </summary>
53         /// <since_tizen> 3 </since_tizen>
54         public int Y
55         {
56             get;
57             set;
58         }
59
60         /// <summary>
61         /// Returns a string that represents the current object.
62         /// </summary>
63         /// <returns>A string that represents the current object.</returns>
64         /// <since_tizen> 3 </since_tizen>
65         public override string ToString() => $"X={X.ToString()}, Y={Y.ToString()}";
66
67         /// <summary>
68         /// Gets the hash code for this instance of <see cref="Point"/>.
69         /// </summary>
70         /// <returns>The hash code for this instance of <see cref="Point"/>.</returns>
71         /// <since_tizen> 3 </since_tizen>
72         public override int GetHashCode()
73         {
74             return new { X, Y }.GetHashCode();
75         }
76
77         /// <summary>
78         /// Compares an object to an instance of <see cref="Point"/> for equality.
79         /// </summary>
80         /// <param name="obj">A <see cref="Object"/> to compare.</param>
81         /// <returns>true if the points are equal; otherwise, false.</returns>
82         /// <since_tizen> 3 </since_tizen>
83         public override bool Equals(object obj)
84         {
85             return obj is Point && this == (Point)obj;
86         }
87
88         /// <summary>
89         /// Compares two instances of <see cref="Point"/> for equality.
90         /// </summary>
91         /// <param name="point1">A <see cref="Point"/> to compare.</param>
92         /// <param name="point2">A <see cref="Point"/> to compare.</param>
93         /// <returns>true if the two instances of <see cref="Point"/> are equal; otherwise false.</returns>
94         /// <since_tizen> 3 </since_tizen>
95         public static bool operator ==(Point point1, Point point2)
96         {
97             return point1.X == point2.X && point1.Y == point2.Y;
98         }
99
100         /// <summary>
101         /// Compares two instances of <see cref="Point"/> for inequality.
102         /// </summary>
103         /// <param name="point1">A <see cref="Point"/> to compare.</param>
104         /// <param name="point2">A <see cref="Point"/> to compare.</param>
105         /// <returns>true if the two instances of <see cref="Point"/> are not equal; otherwise false.</returns>
106         /// <since_tizen> 3 </since_tizen>
107         public static bool operator !=(Point point1, Point point2)
108         {
109             return !(point1 == point2);
110         }
111     }
112 }