C# Класс LSCollections.SkipList

Represents a collection of key-and-value pairs.
The SkipList class is an implementation of the IDictionary interface. It is based on the data structure created by William Pugh.
Наследование: IDictionary
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Add ( object key, object value ) : void

Adds an element with the provided key and value to the SkipList.

Clear ( ) : void

Removes all elements from the SkipList.

Contains ( object key ) : bool

Determines whether the SkipList contains an element with the specified key.

CopyTo ( Array array, int index ) : void

Copies the elements of the SkipList to an Array, starting at a particular Array index.

GetEnumerator ( ) : IDictionaryEnumerator

Returns an IDictionaryEnumerator for the SkipList.

Remove ( object key ) : void

Removes the element with the specified key from the SkipList.

SkipList ( ) : System

Initializes a new instance of the SkipList class that is empty and is sorted according to the IComparable interface implemented by each key added to the SkipList.

Each key must implement the IComparable interface to be capable of comparisons with every other key in the SortedList. The elements are sorted according to the IComparable implementation of each key added to the SkipList.

SkipList ( IComparer comparer ) : System

Initializes a new instance of the SkipList class that is empty and is sorted according to the specified IComparer interface.

The elements are sorted according to the specified IComparer implementation. If comparer is a null reference, the IComparable implementation of each key is used; therefore, each key must implement the IComparable interface to be capable of comparisons with every other key in the SkipList.

this ( object key ) : object

Gets or sets the element with the specified key. This is the indexer for the SkipList.

Приватные методы

Метод Описание
GetNewLevel ( ) : int

Returns a level value for a new SkipList node.

Initialize ( ) : void

Initializes the SkipList.

Insert ( object key, object val, Node update ) : void

Inserts a key/value pair into the SkipList.

Search ( object key ) : bool

Searches for the specified key.

Search ( object key, Node &curr ) : bool

Searches for the specified key.

Search ( object key, Node &curr, Node update ) : bool

Searches for the specified key.

SearchWithComparable ( object key, Node &curr, Node update ) : bool

Search for the specified key using the IComparable interface implemented by each key.

Assumes each key inserted into the SkipList implements the IComparable interface. If the specified key is in the SkipList, the curr parameter will reference the node with the key. If the specified key is not in the SkipList, the curr paramater will either hold the node with the first key value greater than the specified key or null indicating that the search reached the end of the SkipList.

SearchWithComparer ( object key, Node &curr, Node update ) : bool

Search for the specified key using a comparer.

System ( ) : IEnumerator

Returns an enumerator that can iterate through the SkipList.

Описание методов

Add() публичный Метод

Adds an element with the provided key and value to the SkipList.
public Add ( object key, object value ) : void
key object /// The Object to use as the key of the element to add. ///
value object /// The Object to use as the value of the element to add. ///
Результат void

Clear() публичный Метод

Removes all elements from the SkipList.
public Clear ( ) : void
Результат void

Contains() публичный Метод

Determines whether the SkipList contains an element with the specified key.
public Contains ( object key ) : bool
key object /// The key to locate in the SkipList. ///
Результат bool

CopyTo() публичный Метод

Copies the elements of the SkipList to an Array, starting at a particular Array index.
public CopyTo ( Array array, int index ) : void
array System.Array /// The one-dimensional Array that is the destination of the elements /// copied from SkipList. ///
index int /// The zero-based index in array at which copying begins. ///
Результат void

GetEnumerator() публичный Метод

Returns an IDictionaryEnumerator for the SkipList.
public GetEnumerator ( ) : IDictionaryEnumerator
Результат IDictionaryEnumerator

Remove() публичный Метод

Removes the element with the specified key from the SkipList.
public Remove ( object key ) : void
key object /// The key of the element to remove. ///
Результат void

SkipList() публичный Метод

Initializes a new instance of the SkipList class that is empty and is sorted according to the IComparable interface implemented by each key added to the SkipList.
Each key must implement the IComparable interface to be capable of comparisons with every other key in the SortedList. The elements are sorted according to the IComparable implementation of each key added to the SkipList.
public SkipList ( ) : System
Результат System

SkipList() публичный Метод

Initializes a new instance of the SkipList class that is empty and is sorted according to the specified IComparer interface.
The elements are sorted according to the specified IComparer implementation. If comparer is a null reference, the IComparable implementation of each key is used; therefore, each key must implement the IComparable interface to be capable of comparisons with every other key in the SkipList.
public SkipList ( IComparer comparer ) : System
comparer IComparer /// The IComparer implementation to use when comparing keys. ///
Результат System

this() публичный Метод

Gets or sets the element with the specified key. This is the indexer for the SkipList.
public this ( object key ) : object
key object
Результат object