public void EqualsTest(int row, int column)
 {
     var first = new CellAddress(row, column);
     var second = new CellAddress(row, column);
     Assert.IsFalse(first.Equals(null), "Equals null check");
     Assert.IsTrue(first.Equals(second), "first equals second");
     Assert.IsTrue(second.Equals(first), "second equals first");
     Assert.AreEqual(first.GetHashCode(), second.GetHashCode(), "hash code comparison");
 }
        public static string GetString(CellAddress address)
        {
            //transformation of zero based row index to char index
            var index = address.Column + 1;
            var result = new StringBuilder();
            while (index / SpesialCharactersSettings.LettersUsedForColumnNumber > 1)
            {
                result.Append((char)(SpesialCharactersSettings.ColumnStartLetter + index % SpesialCharactersSettings.LettersUsedForColumnNumber - 1));
                index = index / SpesialCharactersSettings.LettersUsedForColumnNumber;
            }
            result.Append((char)(SpesialCharactersSettings.ColumnStartLetter + index - 1));
            var column = new string(result.ToString().Reverse().ToArray());

            return $"{column}{address.Row + 1}";
        }
 public bool Equals(CellAddress other)
 {
     return(Row == other.Row && Column == other.Column);
 }
 public object GetCellValue(CellAddress address)
 {
     return GetCellValue(_spreadsheet[address]);
 }
Exemple #5
0
 internal Cell(CellAddress address, IExpression expression)
 {
     Address           = address;
     Expression        = expression;
     IsCashingRequered = !(Expression is ConstantExpression);
 }
 public bool Equals(CellAddress other)
 {
     return Row == other.Row && Column == other.Column;
 }
 public Token(CellAddress value)
     : this(TokenType.CellReference)
 {
     Address = value;
 }