Wintellect.PowerCollections Namespace
Algorithms Class
GhostDoc Pro Sample Help File

OrderedBag<(Of <(<'T>)>)> Methods

The OrderedBag<(Of <(<'T>)>)> type exposes the following members.

Methods


  Name Description
Public method Add
Adds a new item to the bag. Since bags can contain duplicate items, the item is added even if the bag already contains an item equal to item. In this case, the new item is placed after all equal items already present in the bag.
Public method AddMany
Adds all the items in collection to the bag.
Public method AsList
Get a read-only list view of the items in this ordered bag. 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 OrderedBag.
Public method Clear
Removes all items from the bag.
Public method Clone
Makes a shallow clone of this bag; i.e., if items of the bag 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 method CloneContents
Makes a deep clone of this bag. A new bag is created with a clone of each element of this bag, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment.
Public method Contains
Determines if this bag contains an item equal to item. The bag is not changed.
Public method Difference
Computes the difference of this bag with another bag. The difference of these two bags is all items that appear in this bag, but not in otherBag. If an item appears X times in this bag, and Y times in the other bag, the difference contains the item X - Y times (zero times if Y >= X). A new bag is created with the difference of the bags and is returned. This bag and the other bag are unchanged.
Public method DifferenceWith
Computes the difference of this bag with another bag. The difference of these two bags is all items that appear in this bag, but not in otherBag. If an item appears X times in this bag, and Y times in the other bag, the difference contains the item X - Y times (zero times if Y >= X). This bag receives the difference of the two bags; the other bag is unchanged.
Public method DistinctItems
Enumerates all the items in the bag, but enumerates equal items just once, even if they occur multiple times in the bag.
Public method GetEnumerator
Returns an enumerator that enumerates all the items in the bag. The items are enumerated in sorted order.
Public method GetEqualItems

Enumerates all of the items in this bag that are equal to item, according to the comparison mechanism that was used when the bag was created. The bag is not changed.

If the bag does contain an item equal to item, then the enumeration contains no items.

Public method GetFirst
Returns the first item in the bag: the item that would appear first if the bag was enumerated. This is also the smallest item in the bag.
Public method GetLast
Returns the last item in the bag: the item that would appear last if the bag was enumerated. This is also the largest item in the bag.
Public method IndexOf
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. If multiple equal items exist, the smallest index of the equal items is returned.
Public method Intersection
Computes the intersection of this bag with another bag. The intersection of two bags is all items that appear in both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item Minimum(X,Y) times. A new bag is created with the intersection of the bags and is returned. This bag and the other bag are unchanged.
Public method IntersectionWith
Computes the intersection of this bag with another bag. The intersection of two bags is all items that appear in both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item Minimum(X,Y) times. This bag receives the intersection of the two bags, the other bag is unchanged.
Public method IsDisjointFrom
Determines if this bag is disjoint from another bag. Two bags are disjoint if no item from one set is equal to any item in the other bag.
Public method IsEqualTo
Determines if this bag is equal to another bag. This bag is equal to otherBag if they contain the same items, each the same number of times.
Public method IsProperSubsetOf
Determines if this bag is a proper subset of another bag. Neither bag is modified. This bag is a subset of otherBag if every element in this bag is also in otherBag, at least the same number of times. Additional, this bag must have strictly fewer items than otherBag.
Public method IsProperSupersetOf
Determines if this bag is a proper superset of another bag. Neither bag is modified. This bag is a proper superset of otherBag if every element in otherBag is also in this bag, at least the same number of times. Additional, this bag must have strictly more items than otherBag.
Public method IsSubsetOf
Determines if this bag is a subset of another bag. Neither bag is modified. This bag is a subset of otherBag if every element in this bag is also in otherBag, at least the same number of times.
Public method IsSupersetOf
Determines if this bag is a superset of another bag. Neither bag is modified. This bag is a superset of otherBag if every element in otherBag is also in this bag, at least the same number of times.
Public method LastIndexOf
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. If multiple equal items exist, the largest index of the equal items is returned.
Public method NumberOfCopies
Returns the number of copies of item in the bag. More precisely, returns the number of items in the bag that compare equal to item.
Public method Range
Returns a View collection that can be used for enumerating a range of the items in the bag. 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 method RangeFrom
Returns a View collection that can be used for enumerating a range of the items in the bag. 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 method RangeTo
Returns a View collection that can be used for enumerating a range of the items in the bag. 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 method Remove
Searches the bag for one item equal to item, and if found, removes it from the bag. If not found, the bag is unchanged. If more than one item equal to item, the item that was last inserted is removed.
Public method RemoveAllCopies
Searches the bag for all items equal to item, and removes all of them from the bag. If not found, the bag is unchanged.
Public method RemoveFirst
Removes the first item in the bag. This is also the smallest item in the bag.
Public method RemoveLast
Removes the last item in the bag. This is also the largest item in the bag.
Public method RemoveMany
Removes all the items in collection from the bag. Items not present in the bag are ignored.
Public method Reversed
Returns a View collection that can be used for enumerating the items in the bag in reversed order.
Public method Sum
Computes the sum of this bag with another bag. he sum of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item (X+Y) times. A new bag is created with the sum of the bags and is returned. This bag and the other bag are unchanged.
Public method SumWith
Computes the sum of this bag with another bag. The sum of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item (X+Y) times. This bag receives the sum of the two bags, the other bag is unchanged.
Public method SymmetricDifference
Computes the symmetric difference of this bag with another bag. The symmetric difference of two bags is all items that appear in either of the bags, but not both. If an item appears X times in one bag, and Y times in the other bag, the symmetric difference contains the item AbsoluteValue(X - Y times). A new bag is created with the symmetric difference of the bags and is returned. This bag and the other bag are unchanged.
Public method SymmetricDifferenceWith
Computes the symmetric difference of this bag with another bag. The symmetric difference of two bags is all items that appear in either of the bags, but not both. If an item appears X times in one bag, and Y times in the other bag, the symmetric difference contains the item AbsoluteValue(X - Y times). This bag receives the symmetric difference of the two bags; the other bag is unchanged.
Public method Union
Computes the union of this bag with another bag. The union of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the union contains the item Maximum(X,Y) times. A new bag is created with the union of the bags and is returned. This bag and the other bag are unchanged.
Public method UnionWith
Computes the union of this bag with another bag. The union of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the union contains the item Maximum(X,Y) times. This bag receives the union of the two bags, the other bag is unchanged.