示例#1
0
 public CalcRelation AddRelationTo(CalcCell other, CalcChain chain)
 {
     if (_relationsTo.ContainsKey(other.Id)) return _relationsTo[other.Id];
     var rel = new CalcRelation { CalcCellId = other.Id, CalcChainId = chain.Id };
     _relationsTo.Add(other.Id, rel);
     return rel;
 }
示例#2
0
        public CalcRelation AddRelationFrom(CalcCell other, CalcChain chain)
        {
            if (_relationsFrom.ContainsKey(other.Id))
            {
                return(_relationsFrom[other.Id]);
            }
            var rel = new CalcRelation {
                CalcCellId = other.Id, CalcChainId = chain.Id
            };

            _relationsFrom.Add(other.Id, rel);
            return(rel);
        }
示例#3
0
        private CalcCell CreateAndAddNewCell(string address)
        {
            var newCell = CalcCell.Create(address, _context);

            _cells.Add(newCell.Id, newCell);
            var hashCode = GetHashCode(address);

            if (!_addressIndex.ContainsKey(hashCode))
            {
                _addressIndex[hashCode] = new List <object>();
            }
            _addressIndex[hashCode].Add(newCell.Id);
            return(newCell);
        }
示例#4
0
        public virtual CalcCell GetCell(string address)
        {
            CalcCell result         = null;
            var      loweredAddress = address.ToUpperInvariant();
            var      hashCode       = GetHashCode(address);

            if (!_addressIndex.ContainsKey(hashCode))
            {
                return(null);
            }
            foreach (var id in _addressIndex[hashCode])
            {
                var candidate = _cells[id];
                if (candidate.Address.ToUpperInvariant().Equals(loweredAddress))
                {
                    result = candidate;
                    break;
                }
            }
            return(result);
        }
示例#5
0
 public void Add(CalcCell cell)
 {
     Count++;
     Current = cell;
 }
示例#6
0
 public void Add(CalcCell cell)
 {
     Count++;
     Current = cell;
 }