/// <summary> /// Constructor for project internal use /// </summary> /// <param name="BTree"></param> internal ThreadSafeBTree(BTree BTree) { this.BTree = BTree; this.Synchronizer = (Synchronizer)BTree.SyncRoot; }
/// <summary> /// Returns the Synchronized version of BTree /// </summary> /// <returns>Synchronized BTree object</returns> public IBTree Synchronized() { return(BTree.Synchronized(this.BTree)); }
/// <summary> /// Returns the Synchronized version of BTree /// </summary> /// <param name="BTree">BTree object to be wrapped in a synchronized btree wrapper</param> /// <returns>Synchronized BTree object</returns> public static ThreadSafeBTree Synchronized(BTree BTree) { return(new ThreadSafeBTree(BTree)); }
/// <summary> /// Copy into an array contents of the btree. /// </summary> /// <param name="DestArray">Destination array that will contain the items.</param> /// <param name="StartIndex">Start index to start copying into</param> /// <remarks> /// On error, throws following Exceptions: /// </remarks> /// <remarks> /// ArgumentNullException - array is a null reference (Nothing in Visual Basic). /// </remarks> /// <remarks> /// ArgumentOutOfRangeException - arrayIndex is less than zero. /// </remarks> /// <remarks> /// ArgumentException - array is multidimensional. /// -or- /// </remarks> /// <remarks> /// arrayIndex is equal to or greater than the length of array. /// -or- /// </remarks> /// <remarks> /// arrayIndex is equal to or greater than the length of array. /// -or- /// </remarks> /// <remarks> /// The number of elements in the source Hashtable is greater than the available space from arrayIndex to the end of the destination array. /// </remarks> public void CopyTo(Array DestArray, int StartIndex) { if (DestArray == null) { throw new ArgumentNullException(BTree.GetStringResource("DestArray"), BTree.GetStringResource("DestArrayIsNull")); } if (StartIndex < 0) #if DEVICE { throw new ArgumentOutOfRangeException(BTree.GetStringResource("DestArray") + " " + StartIndex.ToString() + " " + BTree.GetStringResource("StartIndexIsNegative")); } #else { throw new ArgumentOutOfRangeException(BTree.GetStringResource("DestArray"), (object)StartIndex, BTree.GetStringResource("StartIndexIsNegative")); } #endif if (DestArray.Rank > 1) { throw new ArgumentException(BTree.GetStringResource("DestArrayIsMulti")); } if (StartIndex >= DestArray.Length) { throw new ArgumentException(BTree.GetStringResource("StartIndexIsGreaterThanLength")); } if (this.Count > DestArray.Length - StartIndex) { throw new ArgumentException(BTree.GetStringResource("BTreeHasMoreElems")); } foreach (object o in this) { DestArray.SetValue(o, StartIndex); StartIndex++; } }
/// <summary> /// Constructor. Pass the B-Tree instance you want to enumerate its items/elements on. /// </summary> /// <param name="BTree">BTree instance items will be enumerated</param> public BTreeEnumerator(BTree BTree) { this.BTree = BTree; this.Reset(); }