Beispiel #1
0
 /**
  * Should be called whenever there are Changes To input cells in the evaluated workbook.
  */
 public void Clear()
 {
     if (_evaluationListener != null)
     {
         _evaluationListener.OnClearWholeCache();
     }
     _plainCellCache.Clear();
     _formulaCellCache.Clear();
 }
Beispiel #2
0
        public void TestLoc()
        {
            PlainCellCache cache = new PlainCellCache();

            for (int bookIndex = 0; bookIndex < 0x1000; bookIndex += 0x100)
            {
                for (int sheetIndex = 0; sheetIndex < 0x1000; sheetIndex += 0x100)
                {
                    for (int rowIndex = 0; rowIndex < 0x100000; rowIndex += 0x1000)
                    {
                        for (int columnIndex = 0; columnIndex < 0x4000; columnIndex += 0x100)
                        {
                            Loc loc = new Loc(bookIndex, sheetIndex, rowIndex, columnIndex);
                            Assert.AreEqual(bookIndex, loc.BookIndex);
                            Assert.AreEqual(sheetIndex, loc.SheetIndex);
                            Assert.AreEqual(rowIndex, loc.RowIndex);
                            Assert.AreEqual(columnIndex, loc.ColumnIndex);

                            Loc sameLoc = new Loc(bookIndex, sheetIndex, rowIndex, columnIndex);
                            Assert.AreEqual(loc.GetHashCode(), sameLoc.GetHashCode());
                            Assert.IsTrue(loc.Equals(sameLoc));

                            Assert.IsNull(cache.Get(loc));
                            PlainValueCellCacheEntry entry = new PlainValueCellCacheEntry(new NumberEval(0));
                            cache.Put(loc, entry);

                            Assert.AreSame(entry, cache.Get(loc));
                            cache.Remove(loc);
                            Assert.IsNull(cache.Get(loc));

                            cache.Put(loc, entry);
                        }
                        cache.Clear();
                    }
                }
            }
        }