示例#1
0
        public ValueEval Evaluate(Eval[] args, EvaluationWorkbook workbook, int srcCellSheet, int srcCellRow,
                int srcCellCol)
        {

            double result;
            try
            {
                int basis = 0; // default
                switch (args.Length)
                {
                    case 3:
                        basis = EvaluateIntArg(args[2], srcCellRow, srcCellCol);
                        break;
                    case 2:
                        basis = EvaluateIntArg(args[2], srcCellRow, srcCellCol);
                        break;
                    default:
                        return ErrorEval.VALUE_INVALID;
                }
                double startDateVal = EvaluateDateArg(args[0], srcCellRow, srcCellCol);
                double endDateVal = EvaluateDateArg(args[1], srcCellRow, srcCellCol);
                result = YearFracCalculator.Calculate(startDateVal, endDateVal, basis);
            }
            catch (EvaluationException e)
            {
                return e.GetErrorEval();
            }

            return new NumberEval(result);
        }
 public SheetRefEvaluator(WorkbookEvaluator bookEvaluator, EvaluationTracker tracker,
         EvaluationWorkbook _workbook, int sheetIndex)
 {
     _bookEvaluator = bookEvaluator;
     _tracker = tracker;
     _sheet = _workbook.GetSheet(sheetIndex);
     _sheetIndex = sheetIndex;
 }
 /* package */
 public WorkbookEvaluator(EvaluationWorkbook workbook, IEvaluationListener evaluationListener)
 {
     _workbook = workbook;
     _evaluationListener = evaluationListener;
     _cache = new EvaluationCache(evaluationListener);
     _sheetIndexesBySheet = new Hashtable();
     _collaboratingWorkbookEnvironment = CollaboratingWorkbooksEnvironment.EMPTY;
     _workbookIx = 0;
 }
 public OperationEvaluationContext(WorkbookEvaluator bookEvaluator, EvaluationWorkbook workbook, int sheetIndex, int srcRowNum,
         int srcColNum, EvaluationTracker tracker)
 {
     _bookEvaluator = bookEvaluator;
     _workbook = workbook;
     _sheetIndex = sheetIndex;
     _rowIndex = srcRowNum;
     _columnIndex = srcColNum;
     _tracker = tracker;
 }
示例#5
0
 public OperationEvaluationContext(WorkbookEvaluator bookEvaluator, EvaluationWorkbook workbook, int sheetIndex, int srcRowNum,
                                   int srcColNum, EvaluationTracker tracker)
 {
     _bookEvaluator = bookEvaluator;
     _workbook      = workbook;
     _sheetIndex    = sheetIndex;
     _rowIndex      = srcRowNum;
     _columnIndex   = srcColNum;
     _tracker       = tracker;
 }
 public WorkbookEvaluator(EvaluationWorkbook workbook, IEvaluationListener evaluationListener, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder)
 {
     _workbook = workbook;
     _evaluationListener = evaluationListener;
     _cache = new EvaluationCache(evaluationListener);
     _sheetIndexesBySheet = new Hashtable();
     _sheetIndexesByName = new Dictionary<string,int>();
     _collaboratingWorkbookEnvironment = CollaboratingWorkbooksEnvironment.EMPTY;
     _workbookIx = 0;
     _stabilityClassifier = stabilityClassifier;
     _udfFinder = udfFinder == null ? UDFFinder.DEFAULT : udfFinder;
 }
 public WorkbookEvaluator(EvaluationWorkbook workbook, IEvaluationListener evaluationListener, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder)
 {
     _workbook           = workbook;
     _evaluationListener = evaluationListener;
     _cache = new EvaluationCache(evaluationListener);
     _sheetIndexesBySheet = new Hashtable();
     _sheetIndexesByName  = new Dictionary <string, int>();
     _collaboratingWorkbookEnvironment = CollaboratingWorkbooksEnvironment.EMPTY;
     _workbookIx          = 0;
     _stabilityClassifier = stabilityClassifier;
     _udfFinder           = udfFinder == null ? UDFFinder.DEFAULT : udfFinder;
 }
示例#8
0
        public ValueEval Evaluate(Eval[] args, EvaluationWorkbook workbook, int srcCellSheet, int srcCellRow,
                int srcCellCol)
        {
            if (args.Length != 1)
            {
                return ErrorEval.VALUE_INVALID;
            }

            int val;
            try
            {
                val = EvaluateArgParity(args[0], srcCellRow, srcCellCol);
            }
            catch (EvaluationException e)
            {
                return e.GetErrorEval();
            }

            return BoolEval.ValueOf(val == _desiredParity);
        }
        public WorkbookEvaluator(EvaluationWorkbook workbook, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder)
            : this (workbook, null, stabilityClassifier, udfFinder)
        {

        }
示例#10
0
 public ValueEval Evaluate(Eval[] args, EvaluationWorkbook workbook, int srcCellSheet, int srcCellRow, int srcCellCol)
 {
     // TODO - implement INDIRECT()
     return ErrorEval.FUNCTION_NOT_IMPLEMENTED;
 }
示例#11
0
 public ValueEval Evaluate(Eval[] args, EvaluationWorkbook workbook, int srcCellSheet,
         int srcCellRow, int srcCellCol)
 {
     return ErrorEval.FUNCTION_NOT_IMPLEMENTED;
 }
示例#12
0
        public WorkbookEvaluator(EvaluationWorkbook workbook)
            : this(workbook, null)
        {

        }
示例#13
0
        private static Eval InvokeOperation(OperationEval operation, Eval[] ops,
                EvaluationWorkbook workbook, int sheetIndex, int srcRowNum, int srcColNum)
        {

            if (operation is FunctionEval)
            {
                FunctionEval fe = (FunctionEval)operation;
                if (fe.IsFreeRefFunction)
                {
                    return fe.FreeRefFunction.Evaluate(ops, workbook, sheetIndex, srcRowNum, srcColNum);
                }
            }
            return operation.Evaluate(ops, srcRowNum, (short)srcColNum);
        }
 public WorkbookEvaluator(EvaluationWorkbook workbook, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder)
     : this(workbook, null, stabilityClassifier, udfFinder)
 {
 }