forked from Taritsyn/JavaScriptEngineSwitcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoint.cs
More file actions
79 lines (69 loc) · 1.72 KB
/
Point.cs
File metadata and controls
79 lines (69 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#if NETCOREAPP1_0
using System.Globalization;
namespace JavaScriptEngineSwitcher.Tests.Interop.Drawing
{
/// <summary>
/// Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional plane
/// </summary>
public struct Point
{
private int _x;
private int _y;
/// <summary>
/// Represents a <see cref="Point"/> that has X and Y values set to zero
/// </summary>
public static readonly Point Empty;
/// <summary>
/// Gets or sets the x-coordinate of this <see cref="Point"/>
/// </summary>
public int X
{
get { return _x; }
set { _x = value; }
}
/// <summary>
/// Gets or sets the y-coordinate of this <see cref="Point"/>
/// </summary>
public int Y
{
get { return _y; }
set { _y = value; }
}
/// <summary>
/// Gets a value indicating whether this <see cref="Point"/> is empty
/// </summary>
/// <returns>true if both X and Y are 0; otherwise, false</returns>
public bool IsEmpty
{
get
{
if (_x == 0 && _y == 0)
{
return true;
}
return false;
}
}
/// <summary>
/// Constructs an instance of the <see cref="Point"/> class with the specified coordinates
/// </summary>
/// <param name="x">The horizontal position of the point</param>
/// <param name="y">The vertical position of the point</param>
public Point(int x, int y)
{
_x = x;
_y = y;
}
/// <summary>
/// Converts this <see cref="Point"/> to a human-readable string
/// </summary>
/// <returns>A string that represents this <see cref="Point"/></returns>
public override string ToString()
{
return "{X=" + _x.ToString(CultureInfo.CurrentCulture) +
",Y=" + _y.ToString(CultureInfo.CurrentCulture) + "}"
;
}
}
}
#endif