Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 public SheetRefEvaluator(WorkbookEvaluator bookEvaluator, EvaluationTracker tracker,
         EvaluationWorkbook _workbook, int sheetIndex)
 {
     _bookEvaluator = bookEvaluator;
     _tracker = tracker;
     _sheet = _workbook.GetSheet(sheetIndex);
     _sheetIndex = sheetIndex;
 }
Ejemplo n.º 3
0
 /* 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 6
0
 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;
 }
Ejemplo n.º 7
0
 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;
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 9
0
        public WorkbookEvaluator(EvaluationWorkbook workbook, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder)
            : this (workbook, null, stabilityClassifier, udfFinder)
        {

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

        }
Ejemplo n.º 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);
        }
Ejemplo n.º 14
0
 public WorkbookEvaluator(EvaluationWorkbook workbook, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder)
     : this(workbook, null, stabilityClassifier, udfFinder)
 {
 }