Ejemplo n.º 1
0
        public T this[ulong index]
        {
            get
            {
                if (this.root == null)
                {
                    return(default(T));
                }

                return(this.root.GetValue(index));
            }

            set
            {
                if (this.root == null)
                {
                    this.root = new BigArrayLeafNode <T>(index, this.nodesize);
                }

                this.root = this.root.SetValue(index, value);
            }
        }
Ejemplo n.º 2
0
        public BigArrayNode(ulong index, ushort size, ushort level, IBigArrayNode <T> subnode)
        {
            this.size    = size;
            this.level   = level;
            this.divisor = 1;

            for (ushort k = 0; k < this.level; k++)
            {
                this.divisor *= this.size;
            }

            ulong modulo = this.divisor * this.size;

            if (modulo == 0)
            {
                this.from = 0;
                this.to   = ulong.MaxValue;
            }
            else
            {
                this.from = index - (index % modulo);
                this.to   = this.from + (modulo - 1);
            }

            if (level == 1)
            {
                this.subnodes = new BigArrayLeafNode <T> [size];
            }
            else
            {
                this.subnodes = new BigArrayNode <T> [size];
            }

            if (this.subnodes != null)
            {
                this.subnodes[this.GetSlotNumber(index)] = subnode;
            }
        }