protected override IToken ResolveRange(RangeToken r) { if(_dependencies != null) { _dependencies.Add(r); return new NullToken(); } return _baseCell.Worksheet[r.Value]; }
protected abstract IToken ResolveRange(RangeToken r);
ResolveRange(RangeToken r);
protected override IToken ResolveRange(RangeToken r) { string key = _spreadSheet.ConvertAddress(_baseCell.Address, r.Value); if(_cells.ContainsKey(key)) { return new VariableToken(_cells[key].Variable); } object range = _spreadSheet.GetCellValue(_baseCell.Address, key); if(range.GetType().IsArray) { throw new ArgumentException(); } if(range.GetType() == typeof(bool)) { return new BooleanToken((bool) range); } else if(range.GetType() == typeof(string)) { return new StringToken((string) range); } else if(range.GetType() == typeof(double)) { return new NumberToken((double) range); } else { throw new ArgumentException(); } }