示例#1
0
        public IBigArrayNode <T> SetValue(ulong index, T value)
        {
            if (this.from <= index && index <= this.to)
            {
                ushort position = this.GetSlotNumber(index);

                if (this.subnodes[position] == null)
                {
                    if (this.level == 1)
                    {
                        this.subnodes[position] = new BigArrayLeafNode <T>(index, this.size);
                    }
                    else
                    {
                        this.subnodes[position] = new BigArrayNode <T>(index, this.size, (ushort)(this.level - 1), null);
                    }
                }

                this.subnodes[position].SetValue(index, value);

                return(this);
            }

            BigArrayNode <T> parent = new BigArrayNode <T>(this.from, this.size, (ushort)(this.level + 1), this);

            return(parent.SetValue(index, value));
        }
示例#2
0
        public IBigArrayNode <T> SetValue(ulong index, T value)
        {
            if (this.from <= index && index <= this.from + (ulong)(this.size - 1))
            {
                this.values[index - this.from] = value;
                return(this);
            }

            BigArrayNode <T> parent = new BigArrayNode <T>(this.from, this.size, 1, this);

            return(parent.SetValue(index, value));
        }