Show / Hide Table of Contents

Class SetHashLinked<T, TEquate, THash>

An unsorted structure of unique items implemented as a hashed table of linked lists.

Inheritance
System.Object
SetHashLinked<T, TEquate, THash>
Implements
ISet<T>
IDataStructure<T>
ISteppable<T>
System.Collections.Generic.IEnumerable<T>
DataStructure.IAuditable<T>
DataStructure.IAddable<T>
DataStructure.IRemovable<T>
DataStructure.ICountable
DataStructure.IClearable
ICloneable<SetHashLinked<T, TEquate, THash>>
DataStructure.IEquating<T, TEquate>
DataStructure.IHashing<T, THash>
Namespace: Towel.DataStructures
Assembly: Towel.dll
Syntax
public class SetHashLinked<T, TEquate, THash> : object, ISet<T>, IDataStructure<T>, ISteppable<T>, System.Collections.Generic.IEnumerable<T>, DataStructure.IAuditable<T>, DataStructure.IAddable<T>, DataStructure.IRemovable<T>, DataStructure.ICountable, DataStructure.IClearable, ICloneable<SetHashLinked<T, TEquate, THash>>, DataStructure.IEquating<T, TEquate>, DataStructure.IHashing<T, THash> where TEquate : struct, IFunc<T, T, bool> where THash : struct, IFunc<T, int>
Type Parameters
Name Description
T

The type of values stored in this data structure.

TEquate

The type of function for quality checking T values.

THash

The type of function for hashing T values.

Constructors

| Improve this Doc View Source

SetHashLinked(TEquate, THash, Nullable<Int32>)

Constructs a hashed set.

Declaration
public SetHashLinked(TEquate equate = default(TEquate), THash hash = default(THash), int? expectedCount = null)
Parameters
Type Name Description
TEquate equate

The function for quality checking T values.

THash hash

The function for hashing T values.

System.Nullable<System.Int32> expectedCount

The expected count of the set.

Properties

| Improve this Doc View Source

Count

The current number of values in the set.
Runtime: O(1)

Declaration
public int Count { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Equate

Gets the value of the type that is checking T values for equality.

Declaration
public TEquate Equate { get; }
Property Value
Type Description
TEquate
| Improve this Doc View Source

Hash

Gets the value of the type that is hashing T values.

Declaration
public THash Hash { get; }
Property Value
Type Description
THash
| Improve this Doc View Source

TableSize

The current size of the hashed table.
Runtime: O(1)

Declaration
public int TableSize { get; }
Property Value
Type Description
System.Int32

Methods

| Improve this Doc View Source

TryAdd(T)

Tries to add a value to a data structure.

Declaration
public (bool Success, Exception? Exception) TryAdd(T value)
Parameters
Type Name Description
T value

The value to add to the data structure.

Returns
Type Description
System.ValueTuple<System.Boolean, System.Nullable<Exception>>

True if the value was added or false if not.

| Improve this Doc View Source

TryRemove(T)

Tries to remove a value.

Declaration
public (bool Success, Exception? Exception) TryRemove(T value)
Parameters
Type Name Description
T value

The value to remove.

Returns
Type Description
System.ValueTuple<System.Boolean, System.Nullable<Exception>>

True if the value was removed or false if not.

| Improve this Doc View Source

TryRemoveWithoutTrim(T)

Tries to remove a value from the set without shrinking the hash table.

Declaration
public (bool Success, Exception? Exception) TryRemoveWithoutTrim(T value)
Parameters
Type Name Description
T value

The value to remove.

Returns
Type Description
System.ValueTuple<System.Boolean, System.Nullable<Exception>>

True if the remove was successful or false if not.

Implements

ISet<T>
IDataStructure<T>
ISteppable<T>
System.Collections.Generic.IEnumerable<>
DataStructure.IAuditable<T>
DataStructure.IAddable<T>
DataStructure.IRemovable<T>
DataStructure.ICountable
DataStructure.IClearable
ICloneable<T>
DataStructure.IEquating<T, TEquate>
DataStructure.IHashing<T, THash>
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX