Click or drag to resize

VelocityDbHashSetT Class

A hash code based set
Inheritance Hierarchy
SystemObject
  VelocityDbOptimizedPersistable
    VelocityDb.CollectionVelocityDbHashSetT

Namespace:  VelocityDb.Collection
Assembly:  VelocityDb (in VelocityDb.dll) Version: 11.1.0.0 (11.1)
Syntax
[SerializableAttribute]
public class VelocityDbHashSet<T> : OptimizedPersistable, 
	ICollection<T>, IEnumerable<T>, IEnumerable

Type Parameters

T
The object type of objects in the hashset

The VelocityDbHashSetT type exposes the following members.

Constructors
  NameDescription
Public methodVelocityDbHashSetT
Creates a hashset using a default equality comparer
Public methodVelocityDbHashSetT(IEnumerableT)
Creates a new hashset using the default equlaity comparer
Public methodVelocityDbHashSetT(IEqualityComparerT)
Creates hashset with a given equality comparer
Public methodVelocityDbHashSetT(IEnumerableT, IEqualityComparerT)
Implementation Notes: Since resizes are relatively expensive (require rehashing), this attempts to minimize the need to resize by setting the initial capacity based on size of collection.
Top
Properties
  NameDescription
Public propertyComparer
Gets the IEqualityComparer that is used to determine equality of keys for the VelocityDbHashSet.
Public propertyCount
Number of elements in this hashset
Public propertyObjectsPerPage
Limit to 1000 per page (instead of default 40000)
(Overrides OptimizedPersistableObjectsPerPage.)
Top
Methods
  NameDescription
Public methodAdd
Add item to this VelocityDbHashSet. Returns bool indicating whether item was added (won't be added if already present)
Public methodClear
Remove all items from this set. This clears the elements but not the underlying buckets and slots array. Follow this call by TrimExcess to release these.
Public methodContains
Checks if this hashset contains the item
Public methodCopyTo(T)
Copies the entire List to a compatible one-dimensional array, starting at the beginning of the target array.
Public methodCopyTo(T, Int32)
Copy items in this hashset to array, starting at arrayIndex
Public methodCopyTo(T, Int32, Int32)
Copies a range of elements from the List(Of T) to a compatible one-dimensional array, starting at the specified index of the target array.
Public methodStatic memberCreateSetComparer
Used for deep equality of VelocityDbHashSet testing
Public methodExceptWith
Remove items in other from this set. Modifies this set.
Public methodGetEnumerator
Returns an enumerator that iterates through a collection
Public methodGetObjectData
Serialization usage other than VelocityDb serialization
Public methodIntersectWith
Takes the intersection of this set with other. Modifies this set. Implementation Notes: We get better perf if other is a hashset using same equality comparer, because we get constant contains check in other. Resulting cost is O(n1) to iterate over this. If we can't go above route, iterate over the other and mark intersection by checking contains in this. Then loop over and delete any unmarked elements. Total cost is n2+n1. Attempts to return early based on counts alone, using the property that the intersection of anything with the empty set is the empty set.
Public methodIsProperSubsetOf
Checks if this is a proper subset of other (i.e. strictly contained in) Implementation Notes: The following properties are used up-front to avoid element-wise checks: 1. If this is the empty set, then it's a proper subset of a set that contains at least one element, but it's not a proper subset of the empty set. 2. If other has unique elements according to this equality comparer, and this has >= the number of elements in other, then this can't be a proper subset. Furthermore, if other is a hashset using the same equality comparer, we can use a faster element-wise check.
Public methodIsProperSupersetOf
Checks if this is a proper superset of other (i.e. other strictly contained in this) Implementation Notes: This is slightly more complicated than above because we have to keep track if there was at least one element not contained in other. The following properties are used up-front to avoid element-wise checks: 1. If this is the empty set, then it can't be a proper superset of any set, even if other is the empty set. 2. If other is an empty set and this contains at least 1 element, then this is a proper superset. 3. If other has unique elements according to this equality comparer, and other's count is greater than or equal to this count, then this can't be a proper superset Furthermore, if other has unique elements according to this equality comparer, we can use a faster element-wise check.
Public methodIsSubsetOf
Checks if this is a subset of other. Implementation Notes: The following properties are used up-front to avoid element-wise checks: 1. If this is the empty set, then it's a subset of anything, including the empty set 2. If other has unique elements according to this equality comparer, and this has more elements than other, then it can't be a subset. Furthermore, if other is a hashset using the same equality comparer, we can use a faster element-wise check.
Public methodIsSupersetOf
Checks if this is a superset of other Implementation Notes: The following properties are used up-front to avoid element-wise checks: 1. If other has no elements (it's the empty set), then this is a superset, even if this is also the empty set. 2. If other has unique elements according to this equality comparer, and this has less than the number of elements in other, then this can't be a superset
Public methodOverlaps
Checks if this set overlaps other (i.e. they share at least one item)
Public methodRemove
Remove item from this hashset
Public methodRemoveWhere
Remove elements that match specified predicate. Returns the number of elements removed
Public methodSetEquals
Checks if this and other contain the same elements. This is set equality: duplicates and order are ignored
Public methodSymmetricExceptWith
Takes symmetric difference (XOR) with other and this set. Modifies this set.
Public methodTrimExcess
Sets the capacity of this list to the size of the list (rounded up to nearest prime), unless count is 0, in which case we release references. This method can be used to minimize a list's memory overhead once it is known that no new elements will be added to the list. To completely clear a list and release all memory referenced by the list, execute the following statements: list.Clear(); list.TrimExcess();
Public methodUnionWith
Take the union of this VelocityDbHashSet with other. Modifies this set. Implementation note: GetSuggestedCapacity (to increase capacity in advance avoiding multiple resizes ended up not being useful in practice; quickly gets to the point where it's a wasteful check.
Top
Extension Methods
  NameDescription
Public Extension MethodToStringDetails(SessionBase, Boolean)Overloaded.
Object details as a string
(Defined by Utilities.)
Public Extension MethodToStringDetails(Schema, TypeVersion, Boolean)Overloaded.
Currently only used by Database Manager
(Defined by Utilities.)
Top
See Also