Click or drag to resize
OrderedSetT Class
OrderedSet<T> is a collection that contains items of type T. The item are maintained in a sorted order, and duplicate items are not allowed. Each item has an index in the set: the smallest item has index 0, the next smallest item has index 1, and so forth.
Inheritance Hierarchy
SystemObject
  X3Platform.CollectionsCollectionBaseT
    X3Platform.CollectionsOrderedSetT

Namespace: X3Platform.Collections
Assembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntax
[SerializableAttribute]
public class OrderedSet<T> : CollectionBase<T>, 
	ICollection<T>, IEnumerable<T>, IEnumerable, ICloneable

Type Parameters

T

[Missing <typeparam name="T"/> documentation for "T:X3Platform.Collections.OrderedSet`1"]

The OrderedSetT type exposes the following members.

Constructors
  NameDescription
Public methodOrderedSetT
Creates a new OrderedSet. The T must implement IComparable<T> or IComparable. The CompareTo method of this interface will be used to compare items in this set.
Public methodOrderedSetT(IComparerT)
Creates a new OrderedSet. The Compare method of the passed comparison object will be used to compare items in this set.
Public methodOrderedSetT(IEnumerableT)
Creates a new OrderedSet. The T must implement IComparable<T> or IComparable. The CompareTo method of this interface will be used to compare items in this set. The set is initialized with all the items in the given collection.
Public methodOrderedSetT(ComparisonT)
Creates a new OrderedSet. The passed delegate will be used to compare items in this set.
Public methodOrderedSetT(IEnumerableT, IComparerT)
Creates a new OrderedSet. The Compare method of the passed comparison object will be used to compare items in this set. The set is initialized with all the items in the given collection.
Public methodOrderedSetT(IEnumerableT, ComparisonT)
Creates a new OrderedSet. The passed delegate will be used to compare items in this set. The set is initialized with all the items in the given collection.
Top
Methods
  NameDescription
Public methodAdd
Adds a new item to the set. If the set already contains an item equal to item, that item is replaced with item.
Public methodAddMany
Adds all the items in collection to the set. If the set already contains an item equal to one of the items in collection, that item will be replaced.
Public methodAsList
Get a read-only list view of the items in this ordered set. The items in the list are in sorted order, with the smallest item at index 0. This view does not copy any data, and reflects any changes to the underlying OrderedSet.
Public methodAsReadOnly
Provides a read-only view of this collection. The returned ICollection<T> provides a view of the collection that prevents modifications to the collection. Use the method to provide access to the collection without allowing changes. Since the returned object is just a view, changes to the collection will be reflected in the view.
(Inherited from CollectionBaseT.)
Public methodClear
Removes all items from the set.
(Overrides CollectionBaseTClear.)
Public methodClone
Makes a shallow clone of this set; i.e., if items of the set are reference types, then they are not cloned. If T is a value type, then each element is copied as if by simple assignment.
Public methodCloneContents
Makes a deep clone of this set. A new set is created with a clone of each element of this set, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment.
Public methodContains
Determines if this set contains an item equal to item. The set is not changed.
(Overrides CollectionBaseTContains(T).)
Public methodConvertAllTOutput
Convert this collection of items by applying a delegate to each item in the collection. The resulting enumeration contains the result of applying converter to each item in this collection, in order.
(Inherited from CollectionBaseT.)
Public methodCopyTo
Copies all the items in the collection into an array. Implemented by using the enumerator returned from GetEnumerator to get all the items and copy them to the provided array.
(Inherited from CollectionBaseT.)
Public methodCountWhere
Counts the number of items in the collection that satisfy the condition defined by predicate.
(Inherited from CollectionBaseT.)
Public methodDifference
Computes the difference of this set with another set. The difference of these two sets is all items that appear in this set, but not in otherSet. A new set is created with the difference of the sets and is returned. This set and the other set are unchanged.
Public methodDifferenceWith
Computes the difference of this set with another set. The difference of these two sets is all items that appear in this set, but not in otherSet. This set receives the difference of the two sets; the other set is unchanged.
Public methodEquals (Inherited from Object.)
Public methodExists
Determines if the collection contains any item that satisfies the condition defined by predicate.
(Inherited from CollectionBaseT.)
Protected methodFinalize (Inherited from Object.)
Public methodFindAll
Enumerates the items in the collection that satisfy the condition defined by predicate.
(Inherited from CollectionBaseT.)
Public methodForEach
Performs the specified action on each item in this collection.
(Inherited from CollectionBaseT.)
Public methodGetEnumerator
Returns an enumerator that enumerates all the items in the set. The items are enumerated in sorted order.
(Overrides CollectionBaseTGetEnumerator.)
Public methodGetFirst
Returns the first item in the set: the item that would appear first if the set was enumerated. This is also the smallest item in the set.
Public methodGetHashCode (Inherited from Object.)
Public methodGetLast
Returns the lastl item in the set: the item that would appear last if the set was enumerated. This is also the largest item in the set.
Public methodGetType (Inherited from Object.)
Public methodIndexOf
Get the index of the given item in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1.
Public methodIntersection
Computes the intersection of this set with another set. The intersection of two sets is all items that appear in both of the sets. A new set is created with the intersection of the sets and is returned. This set and the other set are unchanged.
Public methodIntersectionWith
Computes the intersection of this set with another set. The intersection of two sets is all items that appear in both of the sets. This set receives the intersection of the two sets, the other set is unchanged.
Public methodIsDisjointFrom
Determines if this set is disjoint from another set. Two sets are disjoint if no item from one set is equal to any item in the other set.
Public methodIsEqualTo
Determines if this set is equal to another set. This set is equal to otherSet if they contain the same items.
Public methodIsProperSubsetOf
Determines if this set is a proper subset of another set. Neither set is modified. This set is a subset of otherSet if every element in this set is also in otherSet. Additionally, this set must have strictly fewer items than otherSet.
Public methodIsProperSupersetOf
Determines if this set is a proper superset of another set. Neither set is modified. This set is a proper superset of otherSet if every element in otherSet is also in this set. Additionally, this set must have strictly more items than otherSet.
Public methodIsSubsetOf
Determines if this set is a subset of another set. Neither set is modified. This set is a subset of otherSet if every element in this set is also in otherSet.
Public methodIsSupersetOf
Determines if this set is a superset of another set. Neither set is modified. This set is a superset of otherSet if every element in otherSet is also in this set.
Remarks
IsSupersetOf is computed in time O(M log N), where M is the size of the otherSet, and N is the size of the this set.
Protected methodMemberwiseClone (Inherited from Object.)
Public methodRange
Returns a View collection that can be used for enumerating a range of the items in the set.. Only items that are greater than from and less than to are included. The items are enumerated in sorted order. Items equal to the end points of the range can be included or excluded depending on the fromInclusive and toInclusive parameters.
Public methodRangeFrom
Returns a View collection that can be used for enumerating a range of the items in the set.. Only items that are greater than (and optionally, equal to) from are included. The items are enumerated in sorted order. Items equal to from can be included or excluded depending on the fromInclusive parameter.
Public methodRangeTo
Returns a View collection that can be used for enumerating a range of the items in the set.. Only items that are less than (and optionally, equal to) to are included. The items are enumerated in sorted order. Items equal to to can be included or excluded depending on the toInclusive parameter.
Public methodRemove
Searches the set for an item equal to item, and if found, removes it from the set. If not found, the set is unchanged.
(Overrides CollectionBaseTRemove(T).)
Public methodRemoveAll
Removes all the items in the collection that satisfy the condition defined by predicate.
(Inherited from CollectionBaseT.)
Public methodRemoveFirst
Removes the first item in the set. This is also the smallest item in the set.
Public methodRemoveLast
Removes the last item in the set. This is also the largest item in the set.
Public methodRemoveMany
Removes all the items in collection from the set. Items not present in the set are ignored.
Public methodReversed
Returns a View collection that can be used for enumerating the items in the set in reversed order.
Public methodSymmetricDifference
Computes the symmetric difference of this set with another set. The symmetric difference of two sets is all items that appear in either of the sets, but not both. A new set is created with the symmetric difference of the sets and is returned. This set and the other set are unchanged.
Public methodSymmetricDifferenceWith
Computes the symmetric difference of this set with another set. The symmetric difference of two sets is all items that appear in either of the sets, but not both. This set receives the symmetric difference of the two sets; the other set is unchanged.
Public methodToArray
Creates an array of the correct size, and copies all the items in the collection into the array, by calling CopyTo.
(Inherited from CollectionBaseT.)
Public methodToString
Shows the string representation of the collection. The string representation contains a list of the items in the collection. Contained collections (except string) are expanded recursively.
(Inherited from CollectionBaseT.)
Public methodTrueForAll
Determines if all of the items in the collection satisfy the condition defined by predicate.
(Inherited from CollectionBaseT.)
Public methodCode exampleTryGetItem

Determines if this set contains an item equal to item, according to the comparison mechanism that was used when the set was created. The set is not changed.

If the set does contain an item equal to item, then the item from the set is returned.

Public methodUnion
Computes the union of this set with another set. The union of two sets is all items that appear in either or both of the sets. A new set is created with the union of the sets and is returned. This set and the other set are unchanged.
Public methodUnionWith
Computes the union of this set with another set. The union of two sets is all items that appear in either or both of the sets. This set receives the union of the two sets, the other set is unchanged.
Top
Properties
  NameDescription
Public propertyComparer
Returns the IComparer<T> used to compare items in this set.
Public propertyCount
Returns the number of items in the set.
(Overrides CollectionBaseTCount.)
Public propertyItem
Get the item by its index in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1.
Top
Remarks

The items are compared in one of three ways. If T implements IComparable<TKey> or IComparable, then the CompareTo method of that interface will be used to compare items. Alternatively, a comparison function can be passed in either as a delegate, or as an instance of IComparer<TKey>.

OrderedSet is implemented as a balanced binary tree. Inserting, deleting, and looking up an an element all are done in log(N) type, where N is the number of keys in the tree.

SetT is similar, but uses hashing instead of comparison, and does not maintain the items in sorted order.

See Also