1
0
mirror of synced 2024-11-15 01:33:51 +00:00
PettingZoo/PettingZoo.Core/Validation/TextPosition.cs

44 lines
980 B
C#
Raw Permalink Normal View History

using System;
namespace PettingZoo.Core.Validation
{
public readonly struct TextPosition : IEquatable<TextPosition>
{
public int Row { get; }
public int Column { get; }
public TextPosition(int row, int column)
{
Row = row;
Column = column;
}
public bool Equals(TextPosition other)
{
return Row == other.Row && Column == other.Column;
}
public override bool Equals(object? obj)
{
return obj is TextPosition other && Equals(other);
}
public override int GetHashCode()
{
return HashCode.Combine(Row, Column);
}
public static bool operator ==(TextPosition left, TextPosition right)
{
return left.Equals(right);
}
public static bool operator !=(TextPosition left, TextPosition right)
{
return !(left == right);
}
}
}