C# Class com.calitha.commons.IntegerList

A type-safe list of integers.
Exibir arquivo Open project: luca-cardelli/KaemikaXM Class Usage Examples

Public Methods

Method Description
Add ( int value ) : int

Adds an integer to a list.

Clear ( ) : void

Removes all elements from the list.

Clone ( ) : object

A shallow copy of the list.

Contains ( int value ) : bool
CopyTo ( Array array ) : void

Copies the entire list to a compatible one-dimensional array, starting at the beginning of the target array.

CopyTo ( Array array, int arrayIndex ) : void

Copies the entire list to a compatible one-dimensional Array, starting at the specified index of the target array.

CopyTo ( int index, Array array, int arrayIndex, int count ) : void

Copies a range of elements from the list to a compatible one-dimensional Array, starting at the specified index of the target array.

Equals ( object obj ) : bool

Determines whether the specified Object is equal to the current Object.

Equals ( object objA, object objB ) : bool

Determines whether the specified Object instances are considered equal.

GetEnumerator ( ) : IEnumerator

Returns an enumerator for the entire list.

GetEnumerator ( int index, int count ) : IEnumerator

Returns an enumerator for a section of the ArrayList.

GetHashCode ( ) : int

Serves as a hash function.

GetRange ( int index, int count ) : IntegerList

Returns an integer list which represents a subset of the elements in the source list.

IndexOf ( int value ) : int

Searches for the specified Object and returns the zero-based index of the first occurrence within the entire list.

IndexOf ( int value, int startIndex ) : int

Searches for the specified Object and returns the zero-based index of the first occurrence within the section of the ArrayList that extends from the specified index to the last element.

IndexOf ( int value, int startIndex, int count ) : int

Searches for the specified Object and returns the zero-based index of the first occurrence within the section of the list that starts at the specified index and contains the specified number of elements.

Insert ( int index, int value ) : void

Inserts an element into the list at the specified index.

InsertRange ( int index, IntegerList other ) : void

Inserts the elements of the other integer list into the list at the specified index.

IntegerList ( ) : System

Creates a new integer list.

LastIndexOf ( int value ) : int

Searches for the specified value and returns the zero-based index of the last occurrence within the entire list.

LastIndexOf ( int value, int startIndex ) : int

Searches for the specified value and returns the zero-based index of the last occurrence within the section of the list that extends from the first element to the specified index

LastIndexOf ( int value, int startIndex, int count ) : int

Searches for the specified value and returns the zero-based index of the last occurrence within the section of the list that contains the specified number of elements and ends at the specified index.

Remove ( int value ) : void

Removes the first occurrence of a specific value from the list.

RemoveAt ( int index ) : void

Removes the element at the specified index of the list.

RemoveRange ( int index, int count ) : void

Removes a range of elements from the list.

Repeat ( int value, int count ) : IntegerList

Returns an IntegerList whose elements are copies of the specified value.

Reverse ( ) : void

Reverses the order of the elements in the entire list.

Reverse ( int index, int count ) : void

Reverses the order of the elements in the specified range.

SetRange ( int index, IntegerList otherList ) : void

Copies the elements of a collection over a range of elements in the list.

Sort ( ) : void

Sorts the elements in the entire list using the IComparable implementation of the Integer.

Sort ( IComparer comparer ) : void

Sorts the elements in the entire ArrayList using the specified comparer.

Sort ( int index, int count, IComparer comparer ) : void

Sorts the elements in a section of the list using the specified comparer.

Synchronized ( IntegerList list ) : IntegerList

Returns an IntegerList wrapper that is synchronized.

ToString ( ) : string

Returns a String that represents the list.

TrimToSize ( ) : void

Sets the capacity to the actual number of elements in the list.

this ( int index ) : int

Gets a value from the list.

Method Details

Add() public method

Adds an integer to a list.
public Add ( int value ) : int
value int The value that will be added.
return int

Clear() public method

Removes all elements from the list.
public Clear ( ) : void
return void

Clone() public method

A shallow copy of the list.
public Clone ( ) : object
return object

Contains() public method

public Contains ( int value ) : bool
value int
return bool

CopyTo() public method

Copies the entire list to a compatible one-dimensional array, starting at the beginning of the target array.
public CopyTo ( Array array ) : void
array Array The one-dimensional Array that is the destination /// of the elements copied from the list. /// The Array must have zero-based indexing.
return void

CopyTo() public method

Copies the entire list to a compatible one-dimensional Array, starting at the specified index of the target array.
public CopyTo ( Array array, int arrayIndex ) : void
array Array The one-dimensional Array that is the destination /// of the elements copied from ArrayList. /// The Array must have zero-based indexing.
arrayIndex int The zero-based index in array at which /// copying begins.
return void

CopyTo() public method

Copies a range of elements from the list to a compatible one-dimensional Array, starting at the specified index of the target array.
public CopyTo ( int index, Array array, int arrayIndex, int count ) : void
index int The zero-based index in the source list at which copying begins.
array Array The one-dimensional Array that is the destination of /// the elements copied from the list. The Array must have zero-based indexing.
arrayIndex int The zero-based index in array at which copying begins.
count int The number of elements to copy.
return void

Equals() public method

Determines whether the specified Object is equal to the current Object.
public Equals ( object obj ) : bool
obj object The Object to compare with the current Object.
return bool

Equals() public static method

Determines whether the specified Object instances are considered equal.
public static Equals ( object objA, object objB ) : bool
objA object The first Object to compare.
objB object The second Object to compare.
return bool

GetEnumerator() public method

Returns an enumerator for the entire list.
public GetEnumerator ( ) : IEnumerator
return IEnumerator

GetEnumerator() public method

Returns an enumerator for a section of the ArrayList.
public GetEnumerator ( int index, int count ) : IEnumerator
index int The zero-based starting index of the ArrayList section /// that the enumerator should refer to.
count int The number of elements in the ArrayList section that /// the enumerator should refer to
return IEnumerator

GetHashCode() public method

Serves as a hash function.
public GetHashCode ( ) : int
return int

GetRange() public method

Returns an integer list which represents a subset of the elements in the source list.
public GetRange ( int index, int count ) : IntegerList
index int The zero-based list index at which the range starts.
count int The number of elements in the range.
return IntegerList

IndexOf() public method

Searches for the specified Object and returns the zero-based index of the first occurrence within the entire list.
public IndexOf ( int value ) : int
value int The value to locate in the list.
return int

IndexOf() public method

Searches for the specified Object and returns the zero-based index of the first occurrence within the section of the ArrayList that extends from the specified index to the last element.
public IndexOf ( int value, int startIndex ) : int
value int The value to locate in the list.
startIndex int The zero-based starting index of the search.
return int

IndexOf() public method

Searches for the specified Object and returns the zero-based index of the first occurrence within the section of the list that starts at the specified index and contains the specified number of elements.
public IndexOf ( int value, int startIndex, int count ) : int
value int The value to locate in the list.
startIndex int The zero-based starting index of the search.
count int The number of elements in the section to search.
return int

Insert() public method

Inserts an element into the list at the specified index.
public Insert ( int index, int value ) : void
index int The zero-based index at which value should be inserted.
value int The value to insert.
return void

InsertRange() public method

Inserts the elements of the other integer list into the list at the specified index.
public InsertRange ( int index, IntegerList other ) : void
index int The zero-based index at which the new elements should be inserted.
other IntegerList The other list whose elements should be inserted into the list.
return void

IntegerList() public method

Creates a new integer list.
public IntegerList ( ) : System
return System

LastIndexOf() public method

Searches for the specified value and returns the zero-based index of the last occurrence within the entire list.
public LastIndexOf ( int value ) : int
value int The value to locate in the list.
return int

LastIndexOf() public method

Searches for the specified value and returns the zero-based index of the last occurrence within the section of the list that extends from the first element to the specified index
public LastIndexOf ( int value, int startIndex ) : int
value int The value to search for.
startIndex int The zero-based starting index of the backward search.
return int

LastIndexOf() public method

Searches for the specified value and returns the zero-based index of the last occurrence within the section of the list that contains the specified number of elements and ends at the specified index.
public LastIndexOf ( int value, int startIndex, int count ) : int
value int The value to locate in the list.
startIndex int The zero-based starting index of the backward search.
count int The number of elements in the section to search.
return int

Remove() public method

Removes the first occurrence of a specific value from the list.
public Remove ( int value ) : void
value int The value to remove from the list.
return void

RemoveAt() public method

Removes the element at the specified index of the list.
public RemoveAt ( int index ) : void
index int The zero-based index of the element to remove.
return void

RemoveRange() public method

Removes a range of elements from the list.
public RemoveRange ( int index, int count ) : void
index int The zero-based starting index of the range of elements to remove.
count int The number of elements to remove.
return void

Repeat() public static method

Returns an IntegerList whose elements are copies of the specified value.
public static Repeat ( int value, int count ) : IntegerList
value int The value to copy multiple times in the list.
count int The number of times value should be copied.
return IntegerList

Reverse() public method

Reverses the order of the elements in the entire list.
public Reverse ( ) : void
return void

Reverse() public method

Reverses the order of the elements in the specified range.
public Reverse ( int index, int count ) : void
index int The zero-based starting index of the range to reverse.
count int The number of elements in the range to reverse.
return void

SetRange() public method

Copies the elements of a collection over a range of elements in the list.
public SetRange ( int index, IntegerList otherList ) : void
index int The zero-based index at which to start copying the elements /// of otherList
otherList IntegerList The other list whose elements to copy to the list.
return void

Sort() public method

Sorts the elements in the entire list using the IComparable implementation of the Integer.
public Sort ( ) : void
return void

Sort() public method

Sorts the elements in the entire ArrayList using the specified comparer.
public Sort ( IComparer comparer ) : void
comparer IComparer The IComparer implementation to use when comparing elements.
return void

Sort() public method

Sorts the elements in a section of the list using the specified comparer.
public Sort ( int index, int count, IComparer comparer ) : void
index int The zero-based starting index of the range to sort.
count int The length of the range to sort.
comparer IComparer The IComparer implementation to use when comparing elements.
return void

Synchronized() public static method

Returns an IntegerList wrapper that is synchronized.
public static Synchronized ( IntegerList list ) : IntegerList
list IntegerList The list to synchronize.
return IntegerList

ToString() public method

Returns a String that represents the list.
public ToString ( ) : string
return string

TrimToSize() public method

Sets the capacity to the actual number of elements in the list.
public TrimToSize ( ) : void
return void

this() public method

Gets a value from the list.
public this ( int index ) : int
index int
return int