Show / Hide Table of Contents

Class SkipList<T, TCompare, TRandom>

SkipList Data structure

Inheritance
System.Object
SkipList<T, TCompare, TRandom>
Implements
IList<T>
IDataStructure<T>
ISteppable<T>
System.Collections.Generic.IEnumerable<T>
DataStructure.IAddable<T>
DataStructure.IRemovable<T>
DataStructure.ICountable
DataStructure.IClearable
DataStructure.IAuditable<T>
DataStructure.IComparing<T, TCompare>
ICloneable<SkipList<T, TCompare, TRandom>>
Namespace: Towel.DataStructures
Assembly: Towel.dll
Syntax
public class SkipList<T, TCompare, TRandom> : object, IList<T>, IDataStructure<T>, ISteppable<T>, System.Collections.Generic.IEnumerable<T>, DataStructure.IAddable<T>, DataStructure.IRemovable<T>, DataStructure.ICountable, DataStructure.IClearable, DataStructure.IAuditable<T>, DataStructure.IComparing<T, TCompare>, ICloneable<SkipList<T, TCompare, TRandom>> where TCompare : struct, IFunc<T, T, CompareResult> where TRandom : struct, IFunc<int, int, int>
Type Parameters
Name Description
T

The type of values.

TCompare

The type for comparing

TRandom

The type for generation algorithm.

Constructors

| Improve this Doc View Source

SkipList(Byte, TCompare, TRandom)

Creates a new SkipList object

Declaration
public SkipList(byte levels, TCompare compare = default(TCompare), TRandom random = default(TRandom))
Parameters
Type Name Description
System.Byte levels

The levels of lists within this list

TCompare compare

The compare type for this list

TRandom random

The type for generation algorithm.

Properties

| Improve this Doc View Source

Compare

Gets the value of the comparer that is comparing T values.

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

Count

Gets the current count of the data structure.

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

Levels

The current number of levels in this SkipList<T, TCompare, TRandom>.

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

Random

Gets the value of the random generation algorithm.

Declaration
public TRandom Random { get; }
Property Value
Type Description
TRandom

Methods

| Improve this Doc View Source

Clear()

Returns the data structure to an empty state.

Declaration
public void Clear()
| Improve this Doc View Source

Clone()

Clones a T.

Declaration
public SkipList<T, TCompare, TRandom> Clone()
Returns
Type Description
SkipList<T, TCompare, TRandom>

A clone of the T.

| Improve this Doc View Source

Contains(T)

Searches for an value in the list

Declaration
public bool Contains(T value)
Parameters
Type Name Description
T value

The value to search

Returns
Type Description
System.Boolean

Returns true if search is successful, otherwise false

| Improve this Doc View Source

GetEnumerator()

Declaration
public System.Collections.Generic.IEnumerator<T> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<T>
| Improve this Doc View Source

RemoveAll<TPredicate>(TPredicate)

Removes all occurences of predicated values from the list.

Declaration
public void RemoveAll<TPredicate>(TPredicate predicate = default(TPredicate))
    where TPredicate : struct, IFunc<T, bool>
Parameters
Type Name Description
TPredicate predicate

The predicate to determine removals.

Type Parameters
Name Description
TPredicate

The type of predicate to determine removals.

| Improve this Doc View Source

StepperBreak<TStep>(TStep)

Traverses values and invokes a function on every T value.

Declaration
public StepStatus StepperBreak<TStep>(TStep step = default(TStep))
    where TStep : struct, IFunc<T, StepStatus>
Parameters
Type Name Description
TStep step

The function to invoke on every T value.

Returns
Type Description
StepStatus

The status of the traversal.

Type Parameters
Name Description
TStep

The type of function to invoke on every T value.

| Improve this Doc View Source

ToArray()

Constructs an array with the values of this data structure.

Declaration
public T[] ToArray()
Returns
Type Description
T[]

An array with the values of this data structure.

| 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)

Searches and removes a value from the list (if found)

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

The value to remove from the list

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

True if value is found and removed, otherwise false

| Improve this Doc View Source

TryRemoveFirst<TPredicate>(out Nullable<Exception>, TPredicate)

Tries to remove the first predicated value if the value exists.

Declaration
public bool TryRemoveFirst<TPredicate>(out Exception? exception, TPredicate predicate = default(TPredicate))
    where TPredicate : struct, IFunc<T, bool>
Parameters
Type Name Description
System.Nullable<Exception> exception

The exception that occurred if the remove failed.

TPredicate predicate

The predicate to determine removal.

Returns
Type Description
System.Boolean

True if the value was removed. False if the value did not exist.

Type Parameters
Name Description
TPredicate

The type of predicate to determine removal.

Implements

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