C# Класс Tanis.Collections.Heap

Наследование: IList, ICloneable
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
Add ( object O ) : int

IList implementation. Adds the object at the right place.

AddRange ( ICollection C ) : void

The objects will be added at the right place.

Clear ( ) : void

IList implementation. Idem ArrayList

Clone ( ) : object

ICloneable implementation. Idem ArrayList

Contains ( object O ) : bool

IList implementation. Search for a specified object in the list. If the list is sorted, a BinarySearch is performed using IComparer interface. Else the Object.Equals implementation is used.

CopyTo ( Array array, int arrayIndex ) : void

IList.ICollection implementation. Idem ArrayList

Equals ( object Object ) : bool

Object.Equals() override.

GetEnumerator ( ) : IEnumerator

IList.IEnumerable implementation. Idem ArrayList

GetHashCode ( ) : int

Object.GetHashCode() override.

Heap ( ) : System

Default constructor. Since no IComparer is provided here, added objects must implement the IComparer interface.

Heap ( IComparer Comparer ) : System

Constructor.

Heap ( IComparer Comparer, int Capacity ) : System

Constructor.

Heap ( int Capacity ) : System

Constructor. Since no IComparer is provided, added objects must implement the IComparer interface.

IndexOf ( object O ) : int

IList implementation. Returns the index of the specified object in the list. If the list is sorted, a BinarySearch is performed using IComparer interface. Else the Object.Equals implementation of objects is used.

IndexOf ( object Object, Equality AreEqual ) : int

Idem IndexOf(object), but with a specified equality function

IndexOf ( object Object, int Start ) : int

Idem IndexOf(object), but starting at a specified position in the list

IndexOf ( object Object, int Start, Equality AreEqual ) : int

Idem IndexOf(object), but with a start index and a specified equality function

IndexOfMax ( ) : int

Returns the object of the list whose value is maximum

IndexOfMin ( ) : int

Returns the object of the list whose value is minimum

Insert ( int Index, object O ) : void

IList implementation. Cannot be used on a Heap.

InsertRange ( int Index, ICollection C ) : void

Cannot be called on a Heap.

LimitOccurrences ( object Value, int NumberToKeep ) : void

Limits the number of occurrences of a specified value. Same values are equals according to the Equals() method of objects in the list. The first occurrences encountered are kept.

Pop ( ) : object

Returns the topmost object on the list and removes it from the list

Push ( object Object ) : int

Pushes an object on list. It will be inserted at the right spot.

Remove ( object Value ) : void

IList implementation. Idem ArrayList

RemoveAt ( int Index ) : void

IList implementation. Idem ArrayList

RemoveDuplicates ( ) : void

Removes all duplicates in the list. Each value encountered will have only one representant.

ToString ( ) : string

Object.ToString() override. Build a string to represent the list.

getExisting ( object O ) : object
this ( int Index ) : object

IList implementation. Gets object's value at a specified index. The set operation is impossible on a Heap.

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

Метод Описание
InitProperties ( IComparer Comparer, int Capacity ) : void
ObjectIsCompliant ( object Object ) : bool

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

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

IList implementation. Adds the object at the right place.
The Heap is set to use object's IComparable interface, and the specifed object does not implement this interface.
public Add ( object O ) : int
O object The object to add.
Результат int

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

The objects will be added at the right place.
The Heap is set to use object's IComparable interface, and the specifed object does not implement this interface.
public AddRange ( ICollection C ) : void
C ICollection The object to add.
Результат void

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

IList implementation. Idem ArrayList
public Clear ( ) : void
Результат void

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

ICloneable implementation. Idem ArrayList
public Clone ( ) : object
Результат object

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

IList implementation. Search for a specified object in the list. If the list is sorted, a BinarySearch is performed using IComparer interface. Else the Object.Equals implementation is used.
public Contains ( object O ) : bool
O object The object to look for
Результат bool

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

IList.ICollection implementation. Idem ArrayList
public CopyTo ( Array array, int arrayIndex ) : void
array System.Array
arrayIndex int
Результат void

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

Object.Equals() override.
public Equals ( object Object ) : bool
Object object
Результат bool

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

IList.IEnumerable implementation. Idem ArrayList
public GetEnumerator ( ) : IEnumerator
Результат IEnumerator

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

Object.GetHashCode() override.
public GetHashCode ( ) : int
Результат int

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

Default constructor. Since no IComparer is provided here, added objects must implement the IComparer interface.
public Heap ( ) : System
Результат System

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

Constructor.
public Heap ( IComparer Comparer ) : System
Comparer IComparer Will be used to compare added elements for sort and search operations.
Результат System

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

Constructor.
public Heap ( IComparer Comparer, int Capacity ) : System
Comparer IComparer Will be used to compare added elements for sort and search operations.
Capacity int Capacity of the list (ArrayList.Capacity)
Результат System

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

Constructor. Since no IComparer is provided, added objects must implement the IComparer interface.
public Heap ( int Capacity ) : System
Capacity int Capacity of the list (ArrayList.Capacity)
Результат System

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

IList implementation. Returns the index of the specified object in the list. If the list is sorted, a BinarySearch is performed using IComparer interface. Else the Object.Equals implementation of objects is used.
public IndexOf ( object O ) : int
O object The object to locate.
Результат int

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

Idem IndexOf(object), but with a specified equality function
public IndexOf ( object Object, Equality AreEqual ) : int
Object object The object to locate.
AreEqual Equality Equality function to use for the search.
Результат int

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

Idem IndexOf(object), but starting at a specified position in the list
public IndexOf ( object Object, int Start ) : int
Object object The object to locate.
Start int The index for start position.
Результат int

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

Idem IndexOf(object), but with a start index and a specified equality function
public IndexOf ( object Object, int Start, Equality AreEqual ) : int
Object object The object to locate.
Start int The index for start position.
AreEqual Equality Equality function to use for the search.
Результат int

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

Returns the object of the list whose value is maximum
public IndexOfMax ( ) : int
Результат int

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

Returns the object of the list whose value is minimum
public IndexOfMin ( ) : int
Результат int

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

IList implementation. Cannot be used on a Heap.
Insert method cannot be called on a Heap.
public Insert ( int Index, object O ) : void
Index int The index before which the object must be added.
O object The object to add.
Результат void

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

Cannot be called on a Heap.
Insert cannot be called on a Heap.
public InsertRange ( int Index, ICollection C ) : void
Index int The index before which the objects must be added.
C ICollection The object to add.
Результат void

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

Limits the number of occurrences of a specified value. Same values are equals according to the Equals() method of objects in the list. The first occurrences encountered are kept.
public LimitOccurrences ( object Value, int NumberToKeep ) : void
Value object Value whose occurrences number must be limited.
NumberToKeep int Number of occurrences to keep
Результат void

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

Returns the topmost object on the list and removes it from the list
public Pop ( ) : object
Результат object

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

Pushes an object on list. It will be inserted at the right spot.
public Push ( object Object ) : int
Object object Object to add to the list
Результат int

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

IList implementation. Idem ArrayList
public Remove ( object Value ) : void
Value object The object whose value must be removed if found in the list.
Результат void

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

IList implementation. Idem ArrayList
public RemoveAt ( int Index ) : void
Index int Index of object to remove.
Результат void

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

Removes all duplicates in the list. Each value encountered will have only one representant.
public RemoveDuplicates ( ) : void
Результат void

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

Object.ToString() override. Build a string to represent the list.
public ToString ( ) : string
Результат string

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

public getExisting ( object O ) : object
O object
Результат object

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

IList implementation. Gets object's value at a specified index. The set operation is impossible on a Heap.
Index is less than zero or Index is greater than Count. [] operator cannot be used to set a value on a Heap.
public this ( int Index ) : object
Index int
Результат object