Exemple #1
0
        public Nodo[] Split()
        {
            if (Valores.Count != 2)
            {
                throw new InvalidOperationException(string.Format("This node has {0} Valores, can only split a 2 Valores node", Valores.Count));
            }


            Nodo newRight = new Nodo(Valores[1]);


            for (int x = 2; x < Hijos.Count; x++)
            {
                newRight.Hijos.Add(this.Hijos[x]);
            }


            for (int x = Hijos.Count - 1; x >= 2; x--)
            {
                this.Hijos.RemoveAt(x);
            }


            for (int x = 1; x < Valores.Count; x++)
            {
                Valores.RemoveAt(x);
            }


            return(new Nodo[] { this, newRight });
        }
Exemple #2
0
        public string Pop(int position)
        {
            if (Valores.Count == 1)
            {
                throw new InvalidOperationException("Cannot pop value from a 1 key node");
            }


            if (position < Valores.Count)
            {
                string k = Valores[position];
                Valores.RemoveAt(position);


                return(k);
            }


            return(null);
        }
Exemple #3
0
 private void EliminarPrimero()
 {
     Valores.RemoveAt(0);
 }