private void ClearNode(ICreateFixedSizeText <T> createFixedSizeText) { Children = new List <int>(); Data = new List <T>(); if (Father.Equals(Util.NullPointer)) { int max = (4 * (Order - 1)) / 3; for (int i = 0; i < max + 1; i++) { Children.Add(Util.NullPointer); } for (int i = 0; i < max; i++) { Data.Add(createFixedSizeText.CreateNull()); } } else { for (int i = 0; i < Order; i++) { Children.Add(Util.NullPointer); } for (int i = 0; i < Order - 1; i++) { Data.Add(createFixedSizeText.CreateNull()); } } }
private string ChildrensFormat(int Order) { string Children = ""; int max = (4 * (Order - 1)) / 3; if (Father.Equals(Util.NullPointer)) { for (int i = 0; i < max + 1; i++) { Children = Children + $"{this.Children[i].ToString("0000000000;-000000000")}" + Util.Separator.ToString(); // 10 caracteres + 1 } } else { for (int i = 0; i < Order; i++) { Children = Children + $"{this.Children[i].ToString("0000000000;-000000000")}" + Util.Separator.ToString(); // 10 caracteres + 1 } } return(Children); }
private string DataFormat(int Order) { string values = null; int max = (4 * (Order - 1)) / 3; if (Father.Equals(Util.NullPointer)) { for (int i = 0; i < max; i++) { values = values + $"{Data[i].ToFixedSizeString()}" + Util.Separator.ToString(); // FixedSize del T + 1 } } else { for (int i = 0; i < Order - 1; i++) { values = values + $"{Data[i].ToFixedSizeString()}" + Util.Separator.ToString(); // FixedSize del T + 1 } } return(values); }
internal void SplitNode(T data, int Right, Node <T> Node, T ToUpData, ICreateFixedSizeText <T> createFixedSizeText) { int Middle = 0; if (Father.Equals(Util.NullPointer)) { // Incrementar en una posición Data.Add(data); Children.Add(Util.NullPointer); // Agregarlos en orden InsertData(data, Right, false); // Dato a subir Middle = Data.Count / 2; ToUpData = Data[Middle]; Data[Middle] = createFixedSizeText.CreateNull(); // Llenar datos que suben int j = 0; for (int i = Middle + 1; i < Data.Count; i++) { Node.Data[j] = Data[i]; Data[i] = createFixedSizeText.CreateNull(); j++; } // Llenar hijos que suben j = 0; for (int i = Middle + 1; i < Children.Count; i++) { Node.Children[j] = Children[i]; Children[i] = Util.NullPointer; j++; } Data.RemoveAt(Data.Count - 1); Children.RemoveAt(Children.Count - 1); } else { Data.Add(data); Children.Add(Util.NullPointer); // Agregarlos en orden InsertData(data, Right, false); // Dato a subir Middle = Data.Count / 2; ToUpData = Data[Middle]; Data[Middle] = createFixedSizeText.CreateNull(); // Llenar datos que suben int j = 0; for (int i = Middle + 1; i < Data.Count; i++) { Node.Data[j] = Data[i]; Data[i] = createFixedSizeText.CreateNull(); j++; } // Llenar hijos que suben j = 0; for (int i = Middle + 1; i < Children.Count; i++) { Node.Children[j] = Children[i]; Children[i] = Util.NullPointer; j++; } Data.RemoveAt(Data.Count - 1); Children.RemoveAt(Children.Count - 1); } }