Esempio n. 1
0
        public void AddValue(int Row, int Col, string Value)
        {
            if (Col > FColCount)
            {
                FColCount = Col;
            }
            if (Data == null)
            {
                Data = new List <SparseRow>();
            }
            SparseRow SpRow = new SparseRow(Row);
            int       Idx   = Data.BinarySearch(SpRow);

            if (Idx < 0)
            {
                SpRow.CreateData();
                Data.Insert(~Idx, SpRow);
            }
            else
            {
                SpRow = Data[Idx];
            }

            SparseCell SpCell = new SparseCell(Col, Value);

            Idx = SpRow.Data.BinarySearch(SpCell);
            if (Idx < 0)
            {
                SpRow.Data.Insert(~Idx, SpCell);
            }
            else
            {
                SpRow.Data[Idx] = SpCell;
            }
        }
Esempio n. 2
0
        public string GetValue(int Row, int Col)
        {
            if (Data == null)
            {
                return(null);
            }

            SparseRow SpRow = new SparseRow(Row);
            int       Idx   = Data.BinarySearch(SpRow);

            if (Idx < 0)
            {
                return(null);
            }
            SpRow = Data[Idx];
            SparseCell SpCell = new SparseCell(Col, null);

            Idx = SpRow.Data.BinarySearch(SpCell);
            if (Idx < 0)
            {
                return(null);
            }
            return(SpRow.Data[Idx].Value);
        }