| | 1 | | // -------------------------------------------------------------------------------- |
| | 2 | | // Copyright (C) 2025 Eugene Eremeev (also known as Yevhenii Yeriemeieiv). |
| | 3 | | // All Rights Reserved. |
| | 4 | | // -------------------------------------------------------------------------------- |
| | 5 | | // This software is the confidential and proprietary information of Eugene Eremeev |
| | 6 | | // (also known as Yevhenii Yeriemeieiv) ("Confidential Information"). You shall not |
| | 7 | | // disclose such Confidential Information and shall use it only in accordance with |
| | 8 | | // the terms of the license agreement you entered into with Eugene Eremeev (also |
| | 9 | | // known as Yevhenii Yeriemeieiv). |
| | 10 | | // -------------------------------------------------------------------------------- |
| | 11 | |
|
| | 12 | | namespace LeetCode.Algorithms.RomanToInteger.Iterative; |
| | 13 | |
|
| 19 | 14 | | internal class RomanSymbol(char @char) |
| | 15 | | { |
| 118 | 16 | | public char Char { get; } = @char; |
| | 17 | |
|
| 3 | 18 | | public static RomanSymbol I => new(RomanChars.I); |
| 2 | 19 | | public static RomanSymbol V => new(RomanChars.V); |
| 4 | 20 | | public static RomanSymbol X => new(RomanChars.X); |
| 2 | 21 | | public static RomanSymbol L => new(RomanChars.L); |
| 4 | 22 | | public static RomanSymbol C => new(RomanChars.C); |
| 2 | 23 | | public static RomanSymbol D => new(RomanChars.D); |
| 2 | 24 | | public static RomanSymbol M => new(RomanChars.M); |
| | 25 | |
|
| | 26 | | public override string ToString() |
| 0 | 27 | | { |
| 0 | 28 | | return Char.ToString(); |
| 0 | 29 | | } |
| | 30 | |
|
| | 31 | | public override bool Equals(object? @object) |
| 0 | 32 | | { |
| 0 | 33 | | if (@object is RomanSymbol romanSymbol) |
| 0 | 34 | | { |
| 0 | 35 | | return Equals(romanSymbol); |
| | 36 | | } |
| | 37 | |
|
| 0 | 38 | | return Equals(this, @object); |
| 0 | 39 | | } |
| | 40 | |
|
| | 41 | | protected bool Equals(RomanSymbol romanSymbol) |
| 0 | 42 | | { |
| 0 | 43 | | return Char == romanSymbol.Char; |
| 0 | 44 | | } |
| | 45 | |
|
| | 46 | | public override int GetHashCode() |
| 0 | 47 | | { |
| 0 | 48 | | return Char.GetHashCode(); |
| 0 | 49 | | } |
| | 50 | | } |