2021-12-25 09:46:59 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
2022-01-03 14:00:30 +00:00
|
|
|
|
namespace PettingZoo.Core.Validation
|
2021-12-25 09:46:59 +00:00
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|