qstbak/Questionable.Model/Questionable.Model.Gathering/GatheringPointId.cs
2025-10-09 07:47:19 +10:00

77 lines
1.3 KiB
C#

using System;
using System.Globalization;
namespace Questionable.Model.Gathering;
public class GatheringPointId : IComparable<GatheringPointId>, IEquatable<GatheringPointId>
{
public ushort Value { get; }
public GatheringPointId(ushort value)
{
Value = value;
}
public int CompareTo(GatheringPointId? other)
{
if ((object)this == other)
{
return 0;
}
if ((object)other == null)
{
return 1;
}
return Value.CompareTo(other.Value);
}
public bool Equals(GatheringPointId? other)
{
if ((object)other == null)
{
return false;
}
if ((object)this == other)
{
return true;
}
return Value == other.Value;
}
public override bool Equals(object? obj)
{
if (obj == null)
{
return false;
}
if (this == obj)
{
return true;
}
if (obj.GetType() != GetType())
{
return false;
}
return Equals((GatheringPointId)obj);
}
public override int GetHashCode()
{
return Value.GetHashCode();
}
public static bool operator ==(GatheringPointId? left, GatheringPointId? right)
{
return object.Equals(left, right);
}
public static bool operator !=(GatheringPointId? left, GatheringPointId? right)
{
return !object.Equals(left, right);
}
public static GatheringPointId FromString(string value)
{
return new GatheringPointId(ushort.Parse(value, CultureInfo.InvariantCulture));
}
}