-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathNumberedAxis.cs
More file actions
64 lines (57 loc) · 1.6 KB
/
NumberedAxis.cs
File metadata and controls
64 lines (57 loc) · 1.6 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
// Copyright (c) 2025, Phoenix Contact GmbH & Co. KG
// Licensed under the Apache License, Version 2.0
namespace Moryx.AbstractionLayer.Drivers.Axis
{
/// <summary>
/// A system might have more than one axes of the same name
/// </summary>
public struct NumberedAxis : IEquatable<NumberedAxis>
{
/// <summary>
/// Axis
/// </summary>
public Axes Axis { get; }
/// <summary>
/// Number
/// </summary>
public int Number { get; }
/// <summary>
/// Create a new instance of <see cref="NumberedAxis"/>
/// </summary>
public NumberedAxis(Axes axis, int number)
{
Axis = axis;
Number = number;
}
/// <summary>
/// String representation of the axes
/// </summary>
/// <returns></returns>
public override string ToString()
{
return $"{Axis}{Number}";
}
/// <summary>
/// Compare two <see cref="NumberedAxis"/>
/// </summary>
public bool Equals(NumberedAxis other)
{
return Axis == other.Axis && Number == other.Number;
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
return false;
return obj is NumberedAxis && Equals((NumberedAxis)obj);
}
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
return ((int)Axis * 397) ^ Number;
}
}
}
}