示例#1
0
        public WorkbookEvaluator(IEvaluationWorkbook workbook, IEvaluationListener evaluationListener, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder)
        {
            _workbook           = workbook;
            _evaluationListener = evaluationListener;
            _cache = new EvaluationCache(evaluationListener);
            _sheetIndexesBySheet = new Dictionary <object, object>();
            _sheetIndexesByName  = new Dictionary <string, int>();
            _collaboratingWorkbookEnvironment = CollaboratingWorkbooksEnvironment.EMPTY;
            _workbookIx          = 0;
            _stabilityClassifier = stabilityClassifier;

            AggregatingUDFFinder defaultToolkit = // workbook can be null in unit tests
                                                  workbook == null ? null : (AggregatingUDFFinder)workbook.GetUDFFinder();

            if (defaultToolkit != null && udfFinder != null)
            {
                defaultToolkit.Add(udfFinder);
            }
            _udfFinder = defaultToolkit;
        }
示例#2
0
        private static void HookNewEnvironment(WorkbookEvaluator[] evaluators, CollaboratingWorkbooksEnvironment env)
        {
            // All evaluators will need To share the same cache.
            // but the cache takes an optional evaluation listener.
            int nItems = evaluators.Length;
            IEvaluationListener evalListener = evaluators[0].GetEvaluationListener();

            // make sure that all evaluators have the same listener
            for (int i = 0; i < nItems; i++)
            {
                if (evalListener != evaluators[i].GetEvaluationListener())
                {
                    // This would be very complex To support
                    throw new Exception("Workbook evaluators must all have the same evaluation listener");
                }
            }
            EvaluationCache cache = new EvaluationCache(evalListener);

            for (int i = 0; i < nItems; i++)
            {
                evaluators[i].AttachToEnvironment(env, cache, i);
            }
        }
示例#3
0
        /* package */

        public void DetachFromEnvironment()
        {
            _collaboratingWorkbookEnvironment = CollaboratingWorkbooksEnvironment.EMPTY;
            _cache      = new EvaluationCache(_evaluationListener);
            _workbookIx = 0;
        }
示例#4
0
        /* package */

        public void AttachToEnvironment(CollaboratingWorkbooksEnvironment collaboratingWorkbooksEnvironment, EvaluationCache cache, int workbookIx)
        {
            _collaboratingWorkbookEnvironment = collaboratingWorkbooksEnvironment;
            _cache      = cache;
            _workbookIx = workbookIx;
        }
示例#5
0
 public EvaluationTracker(EvaluationCache cache)
 {
     _cache                    = cache;
     _evaluationFrames         = new List <object>();
     _currentlyEvaluatingCells = new List <object>();
 }
示例#6
0
 public EvaluationTracker(EvaluationCache cache)
 {
     _cache                    = cache;
     _evaluationFrames         = new ArrayList();
     _currentlyEvaluatingCells = new ArrayList();
 }