/// <summary> /// Constructor to use if you want to provide number of slots per node and your comparer object /// </summary> /// <param name="SlotLen">Number of slots per node</param> /// <param name="Comparer">compare object defining how records will be sorted</param> public BTreeAlgorithm(ValidSlotLengths SlotLen, IComparer Comparer) { Initialize(SlotLen); if (Comparer == null) { Comparer = new SystemDefaultComparer(); } this.Comparer = Comparer; }
// Call this after the default constructor was invoked. private bool Initialize(ValidSlotLengths bySlotLen) { #if (!DEBUG && TRIALWARE) const string ExpireMsg = "BTreeGold trial period has expired.\nVisit 4A site(http://www.4atech.net) to get details in getting a license."; if (!System.IO.File.Exists("Trialware.dll") || Trialware.ExpirationManager.Instance == null || Trialware.ExpirationManager.Instance.IsExpired()) { throw new InvalidOperationException(ExpireMsg); } #endif this.SlotLength = (byte)bySlotLen; Root = new TreeRootNode(this); SetCurrentItemAddress(Root, 0); TempSlots = new object[SlotLength + 1]; TempChildren = new TreeNode[SlotLength + 2]; return(true); // successful }
/// <summary> /// Constructor to use if you want to provide the number of slots per node of the tree /// </summary> /// <param name="SlotLen">number of slots per node</param> public BTreeAlgorithm(ValidSlotLengths SlotLen) { Initialize(SlotLen); this.Comparer = new SystemDefaultComparer(); }
/// <summary> /// Use this constructor if you want to:<br/> /// - provide your number of slots per node<br/> /// - your Comparer object<br/> /// - your sort order type /// </summary> /// <param name="SlotLen">Number of slots per node</param> /// <param name="Comparer">Comparer object</param> /// <param name="SortOrder">Sort Order Type</param> public BTree(ValidSlotLengths SlotLen, IComparer Comparer, SortOrderType SortOrder) { this.SortOrder = SortOrder; btree = new BTreeAlgorithm((ValidSlotLengths)SlotLen, Comparer); }
/// <summary> /// Use this constructor if you want to:<br/> /// - provide number of slots per node <br/> /// - provide your comparer object<br/> /// - use default sort order (ascending) /// </summary> /// <param name="SlotLen">Number of slots per node</param> /// <param name="Comparer">compare object defining how records will be sorted</param> public BTree(ValidSlotLengths SlotLen, IComparer Comparer) { btree = new BTreeAlgorithm((ValidSlotLengths)SlotLen, Comparer); }
/// <summary> /// Use this constructor if:<br/> /// - you want to provide number of slots per node of the tree. <br/> /// </summary> /// <param name="SlotLen">Number of slots per node</param> /// <example>BTree b3(BTree.ValidSlotLengths.SixSlots);</example> public BTree(ValidSlotLengths SlotLen) { btree = new BTreeAlgorithm((ValidSlotLengths)SlotLen); }