Merge "Add ThemeOverlay() API in Elementary." into devel/dotnet
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / Point3D.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 ElmSharp
20 {
21     /// <summary>
22     /// Struct defining a 3-D point.
23     /// </summary>
24     public struct Point3D : IEquatable<Point3D>
25     {
26         /// <summary>
27         /// The X coordinate of a 3D point.
28         /// </summary>
29         public int X;
30
31         /// <summary>
32         /// The Y coordinate of a 3D point.
33         /// </summary>
34         public int Y;
35
36         /// <summary>
37         /// The Z coordinate of a 3D point.
38         /// </summary>
39         public int Z;
40
41         /// <summary>
42         /// A human-readable representation of the <see cref="T:Tizen.UI.Point3D" />.
43         /// </summary>
44         /// <returns>The string is formatted as "{{X={0} Y={1} Z={2}}}".</returns>
45         public override string ToString()
46         {
47             return string.Format("{{X={0} Y={1} Z={2}}}", X, Y, Z);
48         }
49
50         /// <summary>
51         /// Returns a hash value for the <see cref="T:Tizen.UI.Point3D" />.
52         /// </summary>
53         /// <returns>A value intended for efficient insertion and lookup in hashtable-based data structures.</returns>
54         public override int GetHashCode()
55         {
56             unchecked
57             {
58                 int hashCode = X.GetHashCode();
59                 hashCode = (hashCode * 397) ^ Y.GetHashCode();
60                 hashCode = (hashCode * 397) ^ Z.GetHashCode();
61                 return hashCode;
62             }
63         }
64
65         /// <summary>
66         /// Returns true if the X, Y and Z values of this are exactly equal to those in the argument.
67         /// </summary>
68         /// <param name="obj">Another <see cref="T:Tizen.UI.Point3D" />.</param>
69         /// <returns>True if the X, Y and Z 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>
70         public override bool Equals(object obj)
71         {
72             if (!(obj is Point3D))
73                 return false;
74
75             return Equals((Point3D)obj);
76         }
77
78         /// <summary>
79         /// Returns true if the X, Y and Z values of this are exactly equal to those in the argument.
80         /// </summary>
81         /// <param name="other">Another <see cref="T:Tizen.UI.Point3D" />.</param>
82         /// <returns>True if the X, Y and Z values are equal to those in <paramref name="other" />.</returns>
83         public bool Equals(Point3D other)
84         {
85             return X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z);
86         }
87
88         /// <summary>
89         /// Whether the two <see cref="T:Tizen.UI.Point3D" />s are equal.
90         /// </summary>
91         /// <param name="p1">A <see cref="T:Tizen.UI.Point3D" /> on the left hand side.</param>
92         /// <param name="p2">A <see cref="T:Tizen.UI.Point3D" /> on the right hand side.</param>
93         /// <returns>True if the two <see cref="T:Tizen.UI.Point3D" />s have equal values.</returns>
94         public static bool operator ==(Point3D p1, Point3D p2)
95         {
96             return p1.Equals(p2);
97         }
98
99         /// <summary>
100         /// Whether two <see cref="T:Tizen.UI.Point3D" />s are not equal.
101         /// </summary>
102         /// <param name="p1">A <see cref="T:Tizen.UI.Point3D" /> on the left hand side.</param>
103         /// <param name="p2">A <see cref="T:Tizen.UI.Point3D" /> on the right hand side.</param>
104         /// <returns>True if the two <see cref="T:Tizen.UI.Point3D" />s do not have equal values.</returns>
105         public static bool operator !=(Point3D p1, Point3D p2)
106         {
107             return !p1.Equals(p2);
108         }
109     }
110 }