From 2895f7da2340bffb7166bc556d26ee23ea3f76c0 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no auunknown)@users.sourceforge.net> Date: Thu, 2 Dec 2004 20:50:41 +0000 Subject: [PATCH] This commit was manufactured by cvs2svn to create tag 'alpha_0-5-0-0'. SVN: tags/alpha_0-5-0-0@1113 --- src/Iesi.Collections/.cvsignore | 5 - src/Iesi.Collections/AssemblyInfo.cs | 28 -- src/Iesi.Collections/DictionarySet.cs | 219 ---------- src/Iesi.Collections/HashedSet.cs | 33 -- src/Iesi.Collections/HybridSet.cs | 38 -- src/Iesi.Collections/ISet.cs | 148 ------- .../Iesi.Collections-1.1.csproj | 149 ------- src/Iesi.Collections/Iesi.Collections.build | 71 ---- .../Iesi.Collections.license.txt | 9 - src/Iesi.Collections/ImmutableSet.cs | 244 ------------ src/Iesi.Collections/ListSet.cs | 37 -- src/Iesi.Collections/NamespaceDoc.cs | 188 --------- src/Iesi.Collections/Set.cs | 374 ------------------ src/Iesi.Collections/SortedSet.cs | 55 --- src/Iesi.Collections/SynchronizedSet.cs | 236 ----------- 15 files changed, 1834 deletions(-) delete mode 100644 src/Iesi.Collections/.cvsignore delete mode 100644 src/Iesi.Collections/AssemblyInfo.cs delete mode 100644 src/Iesi.Collections/DictionarySet.cs delete mode 100644 src/Iesi.Collections/HashedSet.cs delete mode 100644 src/Iesi.Collections/HybridSet.cs delete mode 100644 src/Iesi.Collections/ISet.cs delete mode 100644 src/Iesi.Collections/Iesi.Collections-1.1.csproj delete mode 100644 src/Iesi.Collections/Iesi.Collections.build delete mode 100644 src/Iesi.Collections/Iesi.Collections.license.txt delete mode 100644 src/Iesi.Collections/ImmutableSet.cs delete mode 100644 src/Iesi.Collections/ListSet.cs delete mode 100644 src/Iesi.Collections/NamespaceDoc.cs delete mode 100644 src/Iesi.Collections/Set.cs delete mode 100644 src/Iesi.Collections/SortedSet.cs delete mode 100644 src/Iesi.Collections/SynchronizedSet.cs diff --git a/src/Iesi.Collections/.cvsignore b/src/Iesi.Collections/.cvsignore deleted file mode 100644 index 8a2be1fb65a..00000000000 --- a/src/Iesi.Collections/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -bin -obj -.#* -*.user -*.xsx \ No newline at end of file diff --git a/src/Iesi.Collections/AssemblyInfo.cs b/src/Iesi.Collections/AssemblyInfo.cs deleted file mode 100644 index 15bf165426b..00000000000 --- a/src/Iesi.Collections/AssemblyInfo.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.CompilerServices; - -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version: 1.1.4322.573 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -[assembly: CLSCompliantAttribute(true)] -[assembly: AssemblyTitleAttribute("Iesi.Collections for Microsoft .NET Framework 1.1")] -[assembly: AssemblyDescriptionAttribute("Enhanced Collections for .NET. Code was published at http://www.codeproject.com/" + -"csharp/sets.asp")] -[assembly: AssemblyCompanyAttribute("nhibernate.sourceforge.net")] -[assembly: AssemblyProductAttribute("Iesi.Collections")] -[assembly: AssemblyCopyrightAttribute("Declaration of code in public domain can be found in comment by Jason Smith at ht" + -"tp://www.codeproject.com/csharp/sets.asp#xx703510xx. Copyright © 2002-2004 by A" + -"idant Systems, Inc., and by Jason Smith.")] -[assembly: AssemblyVersionAttribute("1.0.0.1")] -[assembly: AssemblyInformationalVersionAttribute("1.0")] -[assembly: AssemblyFileVersionAttribute("1.0.0.1")] -//[assembly: AssemblyKeyFileAttribute("..\\NHibernate.snk")] - diff --git a/src/Iesi.Collections/DictionarySet.cs b/src/Iesi.Collections/DictionarySet.cs deleted file mode 100644 index c8b0b9d71c0..00000000000 --- a/src/Iesi.Collections/DictionarySet.cs +++ /dev/null @@ -1,219 +0,0 @@ -/* Copyright © 2002-2004 by Aidant Systems, Inc., and by Jason Smith. */ -using System; -using System.Collections; -using System.Collections.Specialized; - -namespace Iesi.Collections -{ - /// - ///

DictionarySet is an abstract class that supports the creation of new Set - /// types where the underlying data store is an IDictionary instance.

- /// - ///

You can use any object that implements the IDictionary interface to hold set data. - /// You can define your own, or you can use one of the objects provided in the Framework. - /// The type of IDictionary you choose will affect both the performance and the behavior - /// of the Set using it.

- /// - ///

To make a Set typed based on your own IDictionary, simply derive a - /// new class with a constructor that takes no parameters. Some Set implmentations - /// cannot be defined with a default constructor. If this is the case for your class, - /// you will need to override Clone() as well.

- /// - ///

It is also standard practice that at least one of your constructors takes an ICollection or - /// an ISet as an argument.

- ///
- [Serializable] - public abstract class DictionarySet : Set - { - /// - /// Provides the storage for elements in the Set, stored as the key-set - /// of the IDictionary object. Set this object in the constructor - /// if you create your own Set class. - /// - protected IDictionary InternalDictionary = null; - private readonly static object PlaceholderObject = new object(); - - /// - /// The placeholder object used as the value for the IDictionary instance. - /// - /// - /// There is a single instance of this object globally, used for all Sets. - /// - protected object Placeholder - { - get {return PlaceholderObject;} - } - - - /// - /// Adds the specified element to this set if it is not already present. - /// - /// The object to add to the set. - /// true is the object was added, false if it was already present. - public override bool Add(object o) - { - if(InternalDictionary[o] != null) - return false; - else - { - //The object we are adding is just a placeholder. The thing we are - //really concerned with is 'o', the key. - InternalDictionary.Add(o, PlaceholderObject); - return true; - } - } - - /// - /// Adds all the elements in the specified collection to the set if they are not already present. - /// - /// A collection of objects to add to the set. - /// true is the set changed as a result of this operation, false if not. - public override bool AddAll(ICollection c) - { - bool changed = false; - foreach(object o in c) - changed |= this.Add(o); - return changed; - } - - /// - /// Removes all objects from the set. - /// - public override void Clear() - { - InternalDictionary.Clear(); - } - - /// - /// Returns true if this set contains the specified element. - /// - /// The element to look for. - /// true if this set contains the specified element, false otherwise. - public override bool Contains(object o) - { - return InternalDictionary[o] != null; - } - - /// - /// Returns true if the set contains all the elements in the specified collection. - /// - /// A collection of objects. - /// true if the set contains all the elements in the specified collection, false otherwise. - public override bool ContainsAll(ICollection c) - { - foreach(object o in c) - { - if(!this.Contains(o)) - return false; - } - return true; - } - - /// - /// Returns true if this set contains no elements. - /// - public override bool IsEmpty - { - get{return InternalDictionary.Count == 0;} - } - - /// - /// Removes the specified element from the set. - /// - /// The element to be removed. - /// true if the set contained the specified element, false otherwise. - public override bool Remove(object o) - { - bool contained = this.Contains(o); - if(contained) - { - InternalDictionary.Remove(o); - } - return contained; - } - - /// - /// Remove all the specified elements from this set, if they exist in this set. - /// - /// A collection of elements to remove. - /// true if the set was modified as a result of this operation. - public override bool RemoveAll(ICollection c) - { - bool changed = false; - foreach(object o in c) - changed |= this.Remove(o); - return changed; - } - - /// - /// Retains only the elements in this set that are contained in the specified collection. - /// - /// Collection that defines the set of elements to be retained. - /// true if this set changed as a result of this operation. - public override bool RetainAll(ICollection c) - { - //Put data from C into a set so we can use the Contains() method. - Set cSet = new HybridSet(c); - - //We are going to build a set of elements to remove. - Set removeSet = new HybridSet(); - - foreach(object o in this) - { - //If C does not contain O, then we need to remove O from our - //set. We can't do this while iterating through our set, so - //we put it into RemoveSet for later. - if(!cSet.Contains(o)) - removeSet.Add(o); - } - - return this.RemoveAll(removeSet); - } - - - /// - /// Copies the elements in the Set to an array. The type of array needs - /// to be compatible with the objects in the Set, obviously. - /// - /// An array that will be the target of the copy operation. - /// The zero-based index where copying will start. - public override void CopyTo(Array array, int index) - { - InternalDictionary.Keys.CopyTo(array, index); - } - - /// - /// The number of elements contained in this collection. - /// - public override int Count - { - get{return InternalDictionary.Count;} - } - - /// - /// None of the objects based on DictionarySet are synchronized. Use the - /// SyncRoot property instead. - /// - public override bool IsSynchronized - { - get{return false;} - } - - /// - /// Returns an object that can be used to synchronize the Set between threads. - /// - public override object SyncRoot - { - get{return InternalDictionary.SyncRoot;} - } - - /// - /// Gets an enumerator for the elements in the Set. - /// - /// An IEnumerator over the elements in the Set. - public override IEnumerator GetEnumerator() - { - return InternalDictionary.Keys.GetEnumerator(); - } - } -} diff --git a/src/Iesi.Collections/HashedSet.cs b/src/Iesi.Collections/HashedSet.cs deleted file mode 100644 index b00b03d1b4d..00000000000 --- a/src/Iesi.Collections/HashedSet.cs +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright © 2002-2004 by Aidant Systems, Inc., and by Jason Smith. */ -using System; -using System.Collections; -using System.Collections.Specialized; - -namespace Iesi.Collections -{ - /// - /// Implements a Set based on a hash table. This will give the best lookup, add, and remove - /// performance for very large data-sets, but iteration will occur in no particular order. - /// - [Serializable] - public class HashedSet : DictionarySet - { - /// - /// Creates a new set instance based on a hash table. - /// - public HashedSet() - { - InternalDictionary = new Hashtable(); - } - - /// - /// Creates a new set instance based on a hash table and - /// initializes it based on a collection of elements. - /// - /// A collection of elements that defines the initial set contents. - public HashedSet(ICollection initialValues) : this() - { - this.AddAll(initialValues); - } - } -} diff --git a/src/Iesi.Collections/HybridSet.cs b/src/Iesi.Collections/HybridSet.cs deleted file mode 100644 index 81f0501d77c..00000000000 --- a/src/Iesi.Collections/HybridSet.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright © 2002-2004 by Aidant Systems, Inc., and by Jason Smith. */ -using System; -using System.Collections; -using System.Collections.Specialized; - -namespace Iesi.Collections -{ - /// - /// Implements a Set that automatically changes from a list to a hash table - /// when the size reaches a certain threshold. This is good if you are unsure about - /// whether you data-set will be tiny or huge. Because this uses a dual implementation, - /// iteration order is not guaranteed! - /// - [Serializable] - public class HybridSet : DictionarySet - { - /// - /// Creates a new set instance based on either a list or a hash table, depending on which - /// will be more efficient based on the data-set size. - /// - public HybridSet() - { - InternalDictionary = new HybridDictionary(); - } - - - /// - /// Creates a new set instance based on either a list or a hash table, depending on which - /// will be more efficient based on the data-set size, and - /// initializes it based on a collection of elements. - /// - /// A collection of elements that defines the initial set contents. - public HybridSet(ICollection initialValues) : this() - { - this.AddAll(initialValues); - } - } -} diff --git a/src/Iesi.Collections/ISet.cs b/src/Iesi.Collections/ISet.cs deleted file mode 100644 index ba91725f411..00000000000 --- a/src/Iesi.Collections/ISet.cs +++ /dev/null @@ -1,148 +0,0 @@ -using System; -using System.Collections; - -namespace Iesi.Collections -{ - /// - ///

A collection that contains no duplicate elements. This interface models the mathematical - /// Set abstraction. - /// The order of elements in a set is dependant on (a)the data-structure implementation, and - /// (b)the implementation of the various Set methods, and thus is not guaranteed.

- /// - ///

None of the Set implementations in this library are guranteed to be thread-safe - /// in any way unless wrapped in a SynchronizedSet.

- /// - ///

The following table summarizes the binary operators that are supported by the Set class.

- /// - /// - /// Operation - /// Description - /// Method - /// - /// - /// Union (OR) - /// Element included in result if it exists in either A OR B. - /// Union() - /// - /// - /// Intersection (AND) - /// Element included in result if it exists in both A AND B. - /// InterSect() - /// - /// - /// Exclusive Or (XOR) - /// Element included in result if it exists in one, but not both, of A and B. - /// ExclusiveOr() - /// - /// - /// Minus (n/a) - /// Take all the elements in A. Now, if any of them exist in B, remove - /// them. Note that unlike the other operators, A - B is not the same as B - A. - /// Minus() - /// - /// - ///
- public interface ISet : ICollection, ICloneable - { /// - /// Performs a "union" of the two sets, where all the elements - /// in both sets are present. That is, the element is included if it is in either a or b. - /// Neither this set nor the input set are modified during the operation. The return value - /// is a Clone() of this set with the extra elements added in. - /// - /// A collection of elements. - /// A new Set containing the union of this Set with the specified collection. - /// Neither of the input objects is modified by the union. - ISet Union(ISet a); - - /// - /// Performs an "intersection" of the two sets, where only the elements - /// that are present in both sets remain. That is, the element is included if it exists in - /// both sets. The Intersect() operation does not modify the input sets. It returns - /// a Clone() of this set with the appropriate elements removed. - /// - /// A set of elements. - /// The intersection of this set with a. - ISet Intersect(ISet a); - - /// - /// Performs a "minus" of set b from set a. This returns a set of all - /// the elements in set a, removing the elements that are also in set b. - /// The original sets are not modified during this operation. The result set is a Clone() - /// of this Set containing the elements from the operation. - /// - /// A set of elements. - /// A set containing the elements from this set with the elements in a removed. - ISet Minus(ISet a); - - /// - /// Performs an "exclusive-or" of the two sets, keeping only the elements that - /// are in one of the sets, but not in both. The original sets are not modified - /// during this operation. The result set is a Clone() of this set containing - /// the elements from the exclusive-or operation. - /// - /// A set of elements. - /// A set containing the result of a ^ b. - ISet ExclusiveOr(ISet a); - - /// - /// Returns true if this set contains the specified element. - /// - /// The element to look for. - /// true if this set contains the specified element, false otherwise. - bool Contains(object o); - - /// - /// Returns true if the set contains all the elements in the specified collection. - /// - /// A collection of objects. - /// true if the set contains all the elements in the specified collection, false otherwise. - bool ContainsAll(ICollection c); - - /// - /// Returns true if this set contains no elements. - /// - bool IsEmpty{get;} - - /// - /// Adds the specified element to this set if it is not already present. - /// - /// The object to add to the set. - /// true is the object was added, false if it was already present. - bool Add(object o); - - /// - /// Adds all the elements in the specified collection to the set if they are not already present. - /// - /// A collection of objects to add to the set. - /// true is the set changed as a result of this operation, false if not. - bool AddAll(ICollection c); - - /// - /// Removes the specified element from the set. - /// - /// The element to be removed. - /// true if the set contained the specified element, false otherwise. - bool Remove(object o); - - /// - /// Remove all the specified elements from this set, if they exist in this set. - /// - /// A collection of elements to remove. - /// true if the set was modified as a result of this operation. - bool RemoveAll(ICollection c); - - - /// - /// Retains only the elements in this set that are contained in the specified collection. - /// - /// Collection that defines the set of elements to be retained. - /// true if this set changed as a result of this operation. - bool RetainAll(ICollection c); - - /// - /// Removes all objects from the set. - /// - void Clear(); - - } -} diff --git a/src/Iesi.Collections/Iesi.Collections-1.1.csproj b/src/Iesi.Collections/Iesi.Collections-1.1.csproj deleted file mode 100644 index adcf0c1a02d..00000000000 --- a/src/Iesi.Collections/Iesi.Collections-1.1.csproj +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Iesi.Collections/Iesi.Collections.build b/src/Iesi.Collections/Iesi.Collections.build deleted file mode 100644 index 7bbc0d48066..00000000000 --- a/src/Iesi.Collections/Iesi.Collections.build +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Iesi.Collections/Iesi.Collections.license.txt b/src/Iesi.Collections/Iesi.Collections.license.txt deleted file mode 100644 index 37ee54c84bd..00000000000 --- a/src/Iesi.Collections/Iesi.Collections.license.txt +++ /dev/null @@ -1,9 +0,0 @@ -Copyright © 2002-2004 by Aidant Systems, Inc., and by Jason Smith. - -Copied from http://www.codeproject.com/csharp/sets.asp#xx703510xx that was posted by JasonSmith 12:13 2 Jan '04 - -Feel free to use this code any way you want to. As a favor to me, you can leave the copyright in there. You never know when someone might recognize your name! - -If you do use the code in a commercial product, I would appreciate hearing about it. This message serves as legal notice that I won't be suing you for royalties! The code is in the public domain. - -On the other hand, I don't provide support. The code is actually simple enough that it shouldn't need it. diff --git a/src/Iesi.Collections/ImmutableSet.cs b/src/Iesi.Collections/ImmutableSet.cs deleted file mode 100644 index dc7f993c875..00000000000 --- a/src/Iesi.Collections/ImmutableSet.cs +++ /dev/null @@ -1,244 +0,0 @@ -/* Copyright © 2002-2004 by Aidant Systems, Inc., and by Jason Smith. */ -using System; -using System.Collections; -using System.Collections.Specialized; - -namespace Iesi.Collections -{ - /// - ///

Implements an immutable (read-only) Set wrapper.

- ///

Although this is advertised as immutable, it really isn't. Anyone with access to the - /// basisSet can still change the data-set. So GetHashCode() is not implemented - /// for this Set, as is the case for all Set implementations in this library. - /// This design decision was based on the efficiency of not having to Clone() the - /// basisSet every time you wrap a mutable Set.

- ///
- [Serializable] - public sealed class ImmutableSet : Set - { - private const string ERROR_MESSAGE = "Object is immutable."; - private ISet mBasisSet; - - internal ISet BasisSet - { - get - { - return mBasisSet; - } - } - - /// - /// Constructs an immutable (read-only) Set wrapper. - /// - /// The Set that is wrapped. - public ImmutableSet(ISet basisSet) - { - mBasisSet = basisSet; - } - - /// - /// Adds the specified element to this set if it is not already present. - /// - /// The object to add to the set. - /// true is the object was added, false if it was already present. - public sealed override bool Add(object o) - { - throw new NotSupportedException(ERROR_MESSAGE); - } - - /// - /// Adds all the elements in the specified collection to the set if they are not already present. - /// - /// A collection of objects to add to the set. - /// true is the set changed as a result of this operation, false if not. - public sealed override bool AddAll(ICollection c) - { - throw new NotSupportedException(ERROR_MESSAGE); - } - - /// - /// Removes all objects from the set. - /// - public sealed override void Clear() - { - throw new NotSupportedException(ERROR_MESSAGE); - } - - /// - /// Returns true if this set contains the specified element. - /// - /// The element to look for. - /// true if this set contains the specified element, false otherwise. - public sealed override bool Contains(object o) - { - return mBasisSet.Contains(o); - } - - /// - /// Returns true if the set contains all the elements in the specified collection. - /// - /// A collection of objects. - /// true if the set contains all the elements in the specified collection, false otherwise. - public sealed override bool ContainsAll(ICollection c) - { - return mBasisSet.ContainsAll(c); - } - - /// - /// Returns true if this set contains no elements. - /// - public sealed override bool IsEmpty - { - get{return mBasisSet.IsEmpty;} - } - - - /// - /// Removes the specified element from the set. - /// - /// The element to be removed. - /// true if the set contained the specified element, false otherwise. - public sealed override bool Remove(object o) - { - throw new NotSupportedException(ERROR_MESSAGE); - } - - /// - /// Remove all the specified elements from this set, if they exist in this set. - /// - /// A collection of elements to remove. - /// true if the set was modified as a result of this operation. - public sealed override bool RemoveAll(ICollection c) - { - throw new NotSupportedException(ERROR_MESSAGE); - } - - /// - /// Retains only the elements in this set that are contained in the specified collection. - /// - /// Collection that defines the set of elements to be retained. - /// true if this set changed as a result of this operation. - public sealed override bool RetainAll(ICollection c) - { - throw new NotSupportedException(ERROR_MESSAGE); - } - - /// - /// Copies the elements in the Set to an array. The type of array needs - /// to be compatible with the objects in the Set, obviously. - /// - /// An array that will be the target of the copy operation. - /// The zero-based index where copying will start. - public sealed override void CopyTo(Array array, int index) - { - mBasisSet.CopyTo(array, index); - } - - /// - /// The number of elements contained in this collection. - /// - public sealed override int Count - { - get{return mBasisSet.Count;} - } - - /// - /// Returns an object that can be used to synchronize use of the Set across threads. - /// - public sealed override bool IsSynchronized - { - get{return mBasisSet.IsSynchronized;} - } - - /// - /// Returns an object that can be used to synchronize the Set between threads. - /// - public sealed override object SyncRoot - { - get{return mBasisSet.SyncRoot;} - } - - /// - /// Gets an enumerator for the elements in the Set. - /// - /// An IEnumerator over the elements in the Set. - public sealed override IEnumerator GetEnumerator() - { - return mBasisSet.GetEnumerator(); - } - - /// - /// Returns a clone of the Set instance. - /// - /// A clone of this object. - public sealed override object Clone() - { - return new ImmutableSet(mBasisSet); - } - - /// - /// Performs a "union" of the two sets, where all the elements - /// in both sets are present. That is, the element is included if it is in either a or b. - /// Neither this set nor the input set are modified during the operation. The return value - /// is a Clone() of this set with the extra elements added in. - /// - /// A collection of elements. - /// A new Set containing the union of this Set with the specified collection. - /// Neither of the input objects is modified by the union. - public sealed override ISet Union(ISet a) - { - ISet m = this; - while(m is ImmutableSet) - m = ((ImmutableSet)m).BasisSet; - return new ImmutableSet(m.Union(a)); - } - - /// - /// Performs an "intersection" of the two sets, where only the elements - /// that are present in both sets remain. That is, the element is included if it exists in - /// both sets. The Intersect() operation does not modify the input sets. It returns - /// a Clone() of this set with the appropriate elements removed. - /// - /// A set of elements. - /// The intersection of this set with a. - public sealed override ISet Intersect(ISet a) - { - ISet m = this; - while(m is ImmutableSet) - m = ((ImmutableSet)m).BasisSet; - return new ImmutableSet(m.Intersect(a)); - } - - /// - /// Performs a "minus" of set b from set a. This returns a set of all - /// the elements in set a, removing the elements that are also in set b. - /// The original sets are not modified during this operation. The result set is a Clone() - /// of this Set containing the elements from the operation. - /// - /// A set of elements. - /// A set containing the elements from this set with the elements in a removed. - public sealed override ISet Minus(ISet a) - { - ISet m = this; - while(m is ImmutableSet) - m = ((ImmutableSet)m).BasisSet; - return new ImmutableSet(m.Minus(a)); - } - - /// - /// Performs an "exclusive-or" of the two sets, keeping only the elements that - /// are in one of the sets, but not in both. The original sets are not modified - /// during this operation. The result set is a Clone() of this set containing - /// the elements from the exclusive-or operation. - /// - /// A set of elements. - /// A set containing the result of a ^ b. - public sealed override ISet ExclusiveOr(ISet a) - { - ISet m = this; - while(m is ImmutableSet) - m = ((ImmutableSet)m).BasisSet; - return new ImmutableSet(m.ExclusiveOr(a)); - } - } -} diff --git a/src/Iesi.Collections/ListSet.cs b/src/Iesi.Collections/ListSet.cs deleted file mode 100644 index f6da598a806..00000000000 --- a/src/Iesi.Collections/ListSet.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright © 2002-2004 by Aidant Systems, Inc., and by Jason Smith. */ -using System; -using System.Collections; -using System.Collections.Specialized; - -namespace Iesi.Collections -{ - /// - /// Implements a Set based on a list. Performance is much better for very small lists - /// than either HashedSet or SortedSet. However, performance degrades rapidly as - /// the data-set gets bigger. Use a HybridSet instead if you are not sure your data-set - /// will always remain very small. Iteration produces elements in the order they were added. - /// However, element order is not guaranteed to be maintained by the various Set - /// mathematical operators. - /// - [Serializable] - public class ListSet : DictionarySet - { - /// - /// Creates a new set instance based on a list. - /// - public ListSet() - { - InternalDictionary = new ListDictionary(); - } - - /// - /// Creates a new set instance based on a list and - /// initializes it based on a collection of elements. - /// - /// A collection of elements that defines the initial set contents. - public ListSet(ICollection initialValues) : this() - { - this.AddAll(initialValues); - } - } -} diff --git a/src/Iesi.Collections/NamespaceDoc.cs b/src/Iesi.Collections/NamespaceDoc.cs deleted file mode 100644 index b234cd230c2..00000000000 --- a/src/Iesi.Collections/NamespaceDoc.cs +++ /dev/null @@ -1,188 +0,0 @@ -using System; - -namespace Iesi.Collections -{ - /// - ///

- /// The System.Collections namespace in the .NET Framework provides a number of collection - /// types that are extremely useful for manipulating data in memory. However, there is one - /// type of collection that is conspicuously missing from System.Collections: the - /// Set. - ///

- ///

- /// A Set is a collection that contains no duplicate elements, and where the order of - /// the elements may be arbitrary. It is loosely modelled after - /// the mathematical concept of a "set." This implementation is based on the Java Set - /// interface definition, so if you are also a Java programmer, this may seem familiar. - /// This library provides a number of "standard" Set operators that the Java library - /// neglected to include. - ///

- ///

- /// Sets come in handy when an Array or a List won't quite fit the bill. - /// Arrays in .NET have a fixed length, making it tedious to add and remove elements. - /// Lists allow you add new objects easily, but you can have numerous duplicate - /// elements, which is undesirable for some types of problems. - /// Searching Arrays or Lists for elements is just plain slow for large data sets, - /// requiring a linear search. You could keep the array sorted and use a binary search, - /// but that is often more trouble than it is worth (especially since this library, - /// and the .NET Framework, provide better ways that are already written for you). - ///

- ///

- /// With sets, adding elements, removing elements, and checking for the existence - /// of an element is fast and simple. You can mix and match the elements in different - /// sets using the supported mathematical set operators: union, intersection, - /// exclusive-or, and minus. - ///

- ///

- /// You will see some interesting side effects with different Set - /// implementations in this library, depending on the underlying search algorithm. - /// For example, if you choose a sort-based Set, the elements will come out - /// in sort order when you iterate using foreach. If you use a hash-based - /// Set, the elements will come out in no particular order, but checking - /// for inclusion will fastest when dealing with large data sets. If you use a - /// list-based Set, elements will come out in the order you put them in - /// when you iterate (although the effect of operators on element order in - /// Set instances is not well defined by design). Additionally, list-based - /// sets are fastest for very small data sets (up to about 10 elements), - /// but get slower very quickly as the number of contained elements increases. - /// To get the best of both worlds, the library provides a Set type that - /// uses lists for small data sets and switches to a hash-based algorithm when - /// the data set gets large enough to warrant it. - ///

- ///

- /// The following sample program demonstrates some of the features of sets: - /// - ///using System; - ///using Iesi.Collections; - ///namespace RiverDemo - ///{ - /// class Rivers - /// { - /// [STAThread] - /// static void Main(string[] args) - /// { - /// //Use Arrays (which are ICollection objects) to quickly initialize. - /// Set arizona - /// = new SortedSet(new string[] {"Colorado River"}); - /// Set california - /// = new SortedSet(new string[] {"Colorado River", "Sacramento River"}); - /// Set colorado - /// = new SortedSet(new string[] {"Arkansas River", "Colorado River", "Green River", "Rio Grande"}); - /// Set kansas - /// = new SortedSet(new string[] {"Arkansas River", "Missouri River"}); - /// Set nevada - /// = new SortedSet(new string[] {"Colorado River"}); - /// Set newMexico - /// = new SortedSet(new string[] {"Rio Grande"}); - /// Set utah - /// = new SortedSet(new string[] {"Colorado River", "Green River", "San Juan River"}); - /// //Rivers by region. - /// Set southWest = colorado | newMexico | arizona | utah; - /// Set midWest = kansas; - /// Set west = california | nevada; - /// //All rivers (at least for the demo). - /// Set all = southWest | midWest | west; - /// Print("All rivers:", all); - /// Print("Rivers in the southwest:", southWest); - /// Print("Rivers in the west:", west); - /// Print("Rivers in the midwest:", midWest); - /// Console.WriteLine(); - /// - /// //Use the '-' operator to subtract the rivers in Colorado from - /// //the set of all rivers. - /// Print("Of all rivers, these don't pass through Colorado:", all - colorado); - /// - /// //Use the '&' operator to find rivers that are in Colorado AND in Utah. - /// //A river must be present in both states, not just one. - /// Print("Rivers common to both Colorado and Utah:", colorado & utah); - /// - /// //use the '^' operator to find rivers that are in Colorado OR Utah, - /// //but not in both. - /// Print("Rivers in Colorado and Utah that are not shared by both states:", - /// colorado ^ utah); - /// - /// //Use the '&' operator to discover which rivers are present in Arizona, - /// // California,Colorado, Nevada, and Utah. The river must be present in - /// // all states to be counted. - /// Print("Rivers common to Arizona, California, Colorado, Nevada, and Utah:", - /// arizona & california & colorado & nevada & utah); - /// //Just to prove to you that operators always return like types, let's do a - /// //complex Set operation and look at the type of the result: - /// Console.WriteLine("The type of this complex operation is: " + - /// ((southWest ^ colorado & california) | kansas).GetType().FullName); - /// } - /// private static void Print(string title, Set elements) - /// { - /// Console.WriteLine(title); - /// foreach(object o in elements) - /// { - /// Console.WriteLine("\t" + o); - /// Console.WriteLine(); - /// } - /// } - /// } - /// - ///

- ///

- /// Although there are other kinds of sets available in the library, the example uses - /// SortedSet throughout. This is nice for the example, since everything will - /// print neatly in alphabetical order. But you may be wondering what kind of Set - /// is returned when you "union," "intersect," "exclusive-or," or "minus" two Set - /// instances. The library always returns a Set that is the same type as - /// the Set on the left, unless the left operand is null, in which case it - /// returns the type of the Set on the right. - ///

- ///

- /// Here is the output from running the example: - /// - ///All rivers: - ///Arkansas River - ///Colorado River - ///Green River - ///Missouri River - ///Rio Grande - ///Sacramento River - ///San Juan River - /// - ///Rivers in the southwest: - ///Arkansas River - ///Colorado River - ///Green River - ///Rio Grande - ///San Juan River - /// - ///Rivers in the west: - ///Colorado River - ///Sacramento River - /// - ///Rivers in the midwest: - ///Arkansas River - ///Missouri River - /// - ///Of all rivers, these don't pass through Colorado: - ///Missouri River - ///Sacramento River - ///San Juan River - /// - ///Rivers common to both Colorado and Utah: - ///Colorado River - ///Green River - /// - ///Rivers in Colorado and Utah that are not shared by both states: - ///Arkansas River - ///Rio Grande - ///San Juan River - /// - ///Rivers common to Arizona, California, Colorado, Nevada, and Utah: - ///Colorado River - /// - ///The type of this complex operation is: - ///Iesi.Collections.SortedSet - ///Press any key to continue - /// - ///

- ///
- internal sealed class NamespaceDoc - { - } -} diff --git a/src/Iesi.Collections/Set.cs b/src/Iesi.Collections/Set.cs deleted file mode 100644 index 6438a4b06d9..00000000000 --- a/src/Iesi.Collections/Set.cs +++ /dev/null @@ -1,374 +0,0 @@ -/* Copyright © 2002-2004 by Aidant Systems, Inc., and by Jason Smith. */ -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Reflection; - -namespace Iesi.Collections -{ - ///

A collection that contains no duplicate elements. This class models the mathematical - /// Set abstraction, and is the base class for all other Set implementations. - /// The order of elements in a set is dependant on (a)the data-structure implementation, and - /// (b)the implementation of the various Set methods, and thus is not guaranteed.

- /// - ///

None of the Set implementations in this library are guranteed to be thread-safe - /// in any way unless wrapped in a SynchronizedSet.

- /// - ///

The following table summarizes the binary operators that are supported by the Set class.

- /// - /// - /// Operation - /// Description - /// Method - /// Operator - /// - /// - /// Union (OR) - /// Element included in result if it exists in either A OR B. - /// Union() - /// | - /// - /// - /// Intersection (AND) - /// Element included in result if it exists in both A AND B. - /// InterSect() - /// & - /// - /// - /// Exclusive Or (XOR) - /// Element included in result if it exists in one, but not both, of A and B. - /// ExclusiveOr() - /// ^ - /// - /// - /// Minus (n/a) - /// Take all the elements in A. Now, if any of them exist in B, remove - /// them. Note that unlike the other operators, A - B is not the same as B - A. - /// Minus() - /// - - /// - /// - ///
- [Serializable] - public abstract class Set : ISet - { - /// - /// Performs a "union" of the two sets, where all the elements - /// in both sets are present. That is, the element is included if it is in either a or b. - /// Neither this set nor the input set are modified during the operation. The return value - /// is a Clone() of this set with the extra elements added in. - /// - /// A collection of elements. - /// A new Set containing the union of this Set with the specified collection. - /// Neither of the input objects is modified by the union. - public virtual ISet Union(ISet a) - { - ISet resultSet = (ISet)this.Clone(); - if(a != null) - resultSet.AddAll(a); - return resultSet; - } - - /// - /// Performs a "union" of two sets, where all the elements - /// in both are present. That is, the element is included if it is in either a or b. - /// The return value is a Clone() of one of the sets (a if it is not null) with elements of the other set - /// added in. Neither of the input sets is modified by the operation. - /// - /// A set of elements. - /// A set of elements. - /// A set containing the union of the input sets. null if both sets are null. - public static ISet Union(ISet a, ISet b) - { - if (a == null && b == null) - return null; - else if(a == null) - return (ISet)b.Clone(); - else if(b == null) - return (ISet)a.Clone(); - else - return a.Union(b); - } - - /// - /// Performs a "union" of two sets, where all the elements - /// in both are present. That is, the element is included if it is in either a or b. - /// The return value is a Clone() of one of the sets (a if it is not null) with elements of the other set - /// added in. Neither of the input sets is modified by the operation. - /// - /// A set of elements. - /// A set of elements. - /// A set containing the union of the input sets. null if both sets are null. - public static Set operator | (Set a, Set b) - { - return (Set)Union(a, b); - } - - /// - /// Performs an "intersection" of the two sets, where only the elements - /// that are present in both sets remain. That is, the element is included if it exists in - /// both sets. The Intersect() operation does not modify the input sets. It returns - /// a Clone() of this set with the appropriate elements removed. - /// - /// A set of elements. - /// The intersection of this set with a. - public virtual ISet Intersect(ISet a) - { - ISet resultSet = (ISet)this.Clone(); - if(a != null) - resultSet.RetainAll(a); - else - resultSet.Clear(); - return resultSet; - } - - /// - /// Performs an "intersection" of the two sets, where only the elements - /// that are present in both sets remain. That is, the element is included only if it exists in - /// both a and b. Neither input object is modified by the operation. - /// The result object is a Clone() of one of the input objects (a if it is not null) containing the - /// elements from the intersect operation. - /// - /// A set of elements. - /// A set of elements. - /// The intersection of the two input sets. null if both sets are null. - public static ISet Intersect(ISet a, ISet b) - { - if(a == null && b == null) - return null; - else if(a == null) - { - return b.Intersect(a); - } - else - return a.Intersect(b); - } - - /// - /// Performs an "intersection" of the two sets, where only the elements - /// that are present in both sets remain. That is, the element is included only if it exists in - /// both a and b. Neither input object is modified by the operation. - /// The result object is a Clone() of one of the input objects (a if it is not null) containing the - /// elements from the intersect operation. - /// - /// A set of elements. - /// A set of elements. - /// The intersection of the two input sets. null if both sets are null. - public static Set operator & (Set a, Set b) - { - return (Set)Intersect(a, b); - } - - /// - /// Performs a "minus" of set b from set a. This returns a set of all - /// the elements in set a, removing the elements that are also in set b. - /// The original sets are not modified during this operation. The result set is a Clone() - /// of this Set containing the elements from the operation. - /// - /// A set of elements. - /// A set containing the elements from this set with the elements in a removed. - public virtual ISet Minus(ISet a) - { - ISet resultSet = (ISet)this.Clone(); - if(a != null) - resultSet.RemoveAll(a); - return resultSet; - } - - /// - /// Performs a "minus" of set b from set a. This returns a set of all - /// the elements in set a, removing the elements that are also in set b. - /// The original sets are not modified during this operation. The result set is a Clone() - /// of set a containing the elements from the operation. - /// - /// A set of elements. - /// A set of elements. - /// A set containing A - B elements. null if a is null. - public static ISet Minus(ISet a, ISet b) - { - if(a == null) - return null; - else - return a.Minus(b); - } - - /// - /// Performs a "minus" of set b from set a. This returns a set of all - /// the elements in set a, removing the elements that are also in set b. - /// The original sets are not modified during this operation. The result set is a Clone() - /// of set a containing the elements from the operation. - /// - /// A set of elements. - /// A set of elements. - /// A set containing A - B elements. null if a is null. - public static Set operator - (Set a, Set b) - { - return (Set)Minus(a, b); - } - - - /// - /// Performs an "exclusive-or" of the two sets, keeping only the elements that - /// are in one of the sets, but not in both. The original sets are not modified - /// during this operation. The result set is a Clone() of this set containing - /// the elements from the exclusive-or operation. - /// - /// A set of elements. - /// A set containing the result of a ^ b. - public virtual ISet ExclusiveOr(ISet a) - { - ISet resultSet = (ISet)this.Clone(); - foreach(object element in a) - { - if(resultSet.Contains(element)) - resultSet.Remove(element); - else - resultSet.Add(element); - } - return resultSet; - } - - /// - /// Performs an "exclusive-or" of the two sets, keeping only the elements that - /// are in one of the sets, but not in both. The original sets are not modified - /// during this operation. The result set is a Clone() of one of the sets - /// (a if it is not null) containing - /// the elements from the exclusive-or operation. - /// - /// A set of elements. - /// A set of elements. - /// A set containing the result of a ^ b. null if both sets are null. - public static ISet ExclusiveOr(ISet a, ISet b) - { - if(a == null && b == null) - return null; - else if(a == null) - return (Set)b.Clone(); - else if(b == null) - return (Set)a.Clone(); - else - return a.ExclusiveOr(b); - } - - /// - /// Performs an "exclusive-or" of the two sets, keeping only the elements that - /// are in one of the sets, but not in both. The original sets are not modified - /// during this operation. The result set is a Clone() of one of the sets - /// (a if it is not null) containing - /// the elements from the exclusive-or operation. - /// - /// A set of elements. - /// A set of elements. - /// A set containing the result of a ^ b. null if both sets are null. - public static Set operator ^ (Set a, Set b) - { - return (Set)ExclusiveOr(a, b); - } - - /// - /// Adds the specified element to this set if it is not already present. - /// - /// The object to add to the set. - /// true is the object was added, false if it was already present. - public abstract bool Add(object o); - - /// - /// Adds all the elements in the specified collection to the set if they are not already present. - /// - /// A collection of objects to add to the set. - /// true is the set changed as a result of this operation, false if not. - public abstract bool AddAll(ICollection c); - - /// - /// Removes all objects from the set. - /// - public abstract void Clear(); - - /// - /// Returns true if this set contains the specified element. - /// - /// The element to look for. - /// true if this set contains the specified element, false otherwise. - public abstract bool Contains(object o); - - /// - /// Returns true if the set contains all the elements in the specified collection. - /// - /// A collection of objects. - /// true if the set contains all the elements in the specified collection, false otherwise. - public abstract bool ContainsAll(ICollection c); - - /// - /// Returns true if this set contains no elements. - /// - public abstract bool IsEmpty{get;} - - /// - /// Removes the specified element from the set. - /// - /// The element to be removed. - /// true if the set contained the specified element, false otherwise. - public abstract bool Remove(object o); - - /// - /// Remove all the specified elements from this set, if they exist in this set. - /// - /// A collection of elements to remove. - /// true if the set was modified as a result of this operation. - public abstract bool RemoveAll(ICollection c); - - - /// - /// Retains only the elements in this set that are contained in the specified collection. - /// - /// Collection that defines the set of elements to be retained. - /// true if this set changed as a result of this operation. - public abstract bool RetainAll(ICollection c); - - /// - /// Returns a clone of the Set instance. This will work for derived Set - /// classes if the derived class implements a constructor that takes no arguments. - /// - /// A clone of this object. - public virtual object Clone() - { - Set newSet = (Set)Activator.CreateInstance(this.GetType()); - newSet.AddAll(this); - return newSet; - } - - - /// - /// Copies the elements in the Set to an array. The type of array needs - /// to be compatible with the objects in the Set, obviously. - /// - /// An array that will be the target of the copy operation. - /// The zero-based index where copying will start. - public abstract void CopyTo(Array array, int index); - - /// - /// The number of elements currently contained in this collection. - /// - public abstract int Count{get;} - - /// - /// Returns true if the Set is synchronized across threads. Note that - /// enumeration is inherently not thread-safe. Use the SyncRoot to lock the - /// object during enumeration. - /// - public abstract bool IsSynchronized{get;} - - /// - /// An object that can be used to synchronize this collection to make it thread-safe. - /// When implementing this, if your object uses a base object, like an IDictionary, - /// or anything that has a SyncRoot, return that object instead of "this". - /// - public abstract object SyncRoot{get;} - - /// - /// Gets an enumerator for the elements in the Set. - /// - /// An IEnumerator over the elements in the Set. - public abstract IEnumerator GetEnumerator(); - } -} diff --git a/src/Iesi.Collections/SortedSet.cs b/src/Iesi.Collections/SortedSet.cs deleted file mode 100644 index 6223f1c8ead..00000000000 --- a/src/Iesi.Collections/SortedSet.cs +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright © 2002-2004 by Aidant Systems, Inc., and by Jason Smith. */ -using System; -using System.Collections; -using System.Collections.Specialized; - -namespace Iesi.Collections -{ - /// - /// Implements a Set based on a sorted tree. This gives good performance for operations on very - /// large data-sets, though not as good - asymptotically - as a HashedSet. However, iteration - /// occurs in order. Elements that you put into this type of collection must implement IComparable, - /// and they must actually be comparable. You can't mix string and int values, for example. - /// - [Serializable] - public class SortedSet : DictionarySet - { - /// - /// Creates a new set instance based on a sorted tree. - /// - public SortedSet() - { - InternalDictionary = new SortedList(); - } - - /// - /// Creates a new set instance based on a sorted tree. - /// - /// The to use for sorting. - public SortedSet(IComparer comparer) - { - InternalDictionary = new SortedList( comparer ); - } - - /// - /// Creates a new set instance based on a sorted tree and - /// initializes it based on a collection of elements. - /// - /// A collection of elements that defines the initial set contents. - public SortedSet(ICollection initialValues) : this() - { - this.AddAll(initialValues); - } - - /// - /// Creates a new set instance based on a sorted tree and - /// initializes it based on a collection of elements. - /// - /// A collection of elements that defines the initial set contents. - /// The to use for sorting. - public SortedSet(ICollection initialValues, IComparer comparer) : this( comparer ) - { - this.AddAll(initialValues); - } - } -} diff --git a/src/Iesi.Collections/SynchronizedSet.cs b/src/Iesi.Collections/SynchronizedSet.cs deleted file mode 100644 index d1bc3430d0d..00000000000 --- a/src/Iesi.Collections/SynchronizedSet.cs +++ /dev/null @@ -1,236 +0,0 @@ -/* Copyright © 2002-2004 by Aidant Systems, Inc., and by Jason Smith. */ -using System; -using System.Collections; -using System.Collections.Specialized; - -namespace Iesi.Collections -{ - /// - ///

Implements a thread-safe Set wrapper. The implementation is extremely conservative, - /// serializing critical sections to prevent possible deadlocks, and locking on everything. - /// The one exception is for enumeration, which is inherently not thread-safe. For this, you - /// have to lock the SyncRoot object for the duration of the enumeration.

- ///
- [Serializable] - public sealed class SynchronizedSet : Set - { - private ISet mBasisSet; - private object mSyncRoot; - - /// - /// Constructs a thread-safe Set wrapper. - /// - /// The Set object that this object will wrap. - public SynchronizedSet(ISet basisSet) - { - mBasisSet = basisSet; - mSyncRoot = basisSet.SyncRoot; - if(mSyncRoot == null) - throw new NullReferenceException("The Set you specified returned a null SyncRoot."); - } - - /// - /// Adds the specified element to this set if it is not already present. - /// - /// The object to add to the set. - /// true is the object was added, false if it was already present. - public sealed override bool Add(object o) - { - lock(mSyncRoot) - { - return mBasisSet.Add(o); - } - } - - /// - /// Adds all the elements in the specified collection to the set if they are not already present. - /// - /// A collection of objects to add to the set. - /// true is the set changed as a result of this operation, false if not. - public sealed override bool AddAll(ICollection c) - { - Set temp; - lock(c.SyncRoot) - { - temp = new HybridSet(c); - } - - lock(mSyncRoot) - { - return mBasisSet.AddAll(temp); - } - } - - /// - /// Removes all objects from the set. - /// - public sealed override void Clear() - { - lock(mSyncRoot) - { - mBasisSet.Clear(); - } - } - - /// - /// Returns true if this set contains the specified element. - /// - /// The element to look for. - /// true if this set contains the specified element, false otherwise. - public sealed override bool Contains(object o) - { - lock(mSyncRoot) - { - return mBasisSet.Contains(o); - } - } - - /// - /// Returns true if the set contains all the elements in the specified collection. - /// - /// A collection of objects. - /// true if the set contains all the elements in the specified collection, false otherwise. - public sealed override bool ContainsAll(ICollection c) - { - Set temp; - lock(c.SyncRoot) - { - temp = new HybridSet(c); - } - lock(mSyncRoot) - { - return mBasisSet.ContainsAll(temp); - } - } - - /// - /// Returns true if this set contains no elements. - /// - public sealed override bool IsEmpty - { - get - { - lock(mSyncRoot) - { - return mBasisSet.IsEmpty; - } - } - } - - - /// - /// Removes the specified element from the set. - /// - /// The element to be removed. - /// true if the set contained the specified element, false otherwise. - public sealed override bool Remove(object o) - { - lock(mSyncRoot) - { - return mBasisSet.Remove(o); - } - } - - /// - /// Remove all the specified elements from this set, if they exist in this set. - /// - /// A collection of elements to remove. - /// true if the set was modified as a result of this operation. - public sealed override bool RemoveAll(ICollection c) - { - Set temp; - lock(c.SyncRoot) - { - temp = new HybridSet(c); - } - lock(mSyncRoot) - { - return mBasisSet.RemoveAll(temp); - } - } - - /// - /// Retains only the elements in this set that are contained in the specified collection. - /// - /// Collection that defines the set of elements to be retained. - /// true if this set changed as a result of this operation. - public sealed override bool RetainAll(ICollection c) - { - Set temp; - lock(c.SyncRoot) - { - temp = new HybridSet(c); - } - lock(mSyncRoot) - { - return mBasisSet.RetainAll(temp); - } - } - - /// - /// Copies the elements in the Set to an array. The type of array needs - /// to be compatible with the objects in the Set, obviously. - /// - /// An array that will be the target of the copy operation. - /// The zero-based index where copying will start. - public sealed override void CopyTo(Array array, int index) - { - lock(mSyncRoot) - { - mBasisSet.CopyTo(array, index); - } - } - - /// - /// The number of elements contained in this collection. - /// - public sealed override int Count - { - get - { - lock(mSyncRoot) - { - return mBasisSet.Count; - } - } - } - - /// - /// Returns true, indicating that this object is thread-safe. The exception to this - /// is enumeration, which is inherently not thread-safe. Use the SyncRoot object to - /// lock this object for the entire duration of the enumeration. - /// - public sealed override bool IsSynchronized - { - get{return true;} - } - - /// - /// Returns an object that can be used to synchronize the Set between threads. - /// - public sealed override object SyncRoot - { - get{return mSyncRoot;} - } - - /// - /// Enumeration is, by definition, not thread-safe. Use a lock on the SyncRoot - /// to synchronize the entire enumeration process. - /// - /// - public sealed override IEnumerator GetEnumerator() - { - return mBasisSet.GetEnumerator(); - } - - /// - /// Returns a clone of the Set instance. - /// - /// A clone of this object. - public override object Clone() - { - return new SynchronizedSet((ISet)mBasisSet.Clone()); - } - - } -}