IGLib  1.5
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
IG.Lib.IndexList Class Reference

Index list, a sorted list of unique integer indices. Used for tasks such as filtering specified element from a list of elements or a general data set. More...

+ Inheritance diagram for IG.Lib.IndexList:
+ Collaboration diagram for IG.Lib.IndexList:

Public Member Functions

 IndexList ()
 Creates an empty index table with the default capacity. More...
 
 IndexList (int initialCapacity)
 Creates an empty index table with the specified initial capacity. More...
 
 IndexList (params int[] items)
 Creates an index table containing all indices from the specified table. More...
 
 IndexList (IList< int > items)
 Creates an index table containing all indices from the specified list. More...
 
 IndexList (ICollection< int > items)
 Creates an index table containing all indices from the specified collection. More...
 
- Public Member Functions inherited from IG.Lib.SortedUniqueItemList< Type >
 SortedUniqueItemList ()
 Creates an empty sorted list of items with the default capacity. More...
 
 SortedUniqueItemList (int initialCapacity)
 Creates an empty sorted list of items with the specified initial capacity. More...
 
 SortedUniqueItemList (params Type[] items)
 Creates a sorted list of items containing all items from the specified table. More...
 
 SortedUniqueItemList (IList< Type > items)
 Creates a sorted list of items containing all items from the specified list. More...
 
 SortedUniqueItemList (ICollection< Type > items)
 Creates a sorted list of items containing all items from the specified collection. More...
 
Type[] ToArray ()
 Creates and returns an array that cotains elements of the current list, in the actual order. More...
 
void Clear ()
 Removes all elements from the current list. More...
 
bool Contains (Type item)
 Returns true if the current list contains the specified item, or false otherwise. More...
 
int IndexOf (Type item)
 Returns index of the specified item on the list, if it exists, otherwise a negative number is returned. NOT thread safe. More...
 
void AddChecked (Type item)
 Adds the specified element to the list if it is not yet contained in it. If the item is already contained in the list then an exception is thrown. NOT thread safe. More...
 
int Add (Type item)
 Adds the specified item to the list if it does not yet exist. NOT thread safe. More...
 
void RemoveChecked (Type item)
 Temoves the item from the list that is equal to the specified item. NOT thread safe. More...
 
int Remove (Type item)
 Removes the specified item from the list if it exists. NOT thread safe. The object is locked when operation is performed. More...
 
void Add (Type[] items)
 Adds the specified table of items to the current list. Items are added one by one, which is not the most efficient. The object is locked when operation is performed. More...
 
void Add (IList< Type > items)
 Adds the specified list of items to the current list. Items are added one by one, which is not the most efficient. More...
 
void Add (ICollection< Type > items)
 Adds the specified collection of items to the current list. Items are added one by one, which is not the most efficient. The object is locked when operation is performed. More...
 
override string ToString ()
 Returns string representation of this sorted list. More...
 

Static Public Member Functions

static IndexList CreateRandomPermutation (int length)
 Creates and returns a random permutation of the specified length. More...
 
static IndexList CreateRandomPermutation (IRandomGenerator rand, int length)
 Creates and returns a random permutation of the specified length by using the specified random generator. More...
 
static void SetRandomPermutation (int length, int upperBound, ref IndexList indices)
 Creates a random permutation of the specified length and stores them it the specified index list. More...
 
static void SetRandomPermutation (IRandomGenerator rand, int length, ref IndexList indices)
 Creates a random permutation of the specified length by using the specified random generator More...
 
static IndexList CreateRandom (int length, int upperBound)
 Creates a prescribed number of unique random indices in the specified range. More...
 
static IndexList CreateRandom (int length, int lowerBound, int upperBound)
 Creates and returns an index list with the specified number of unique random indices in the specified range . More...
 
static IndexList CreateRandom (IRandomGenerator rand, int length, int upperBound)
 Creates and returns an index list with the specified number of unique random indices in the specified range by using the specified random generator. Lower bound of generated indices is 0. More...
 
static IndexList CreateRandom (IRandomGenerator rand, int length, int lowerBound, int upperBound)
 Creates and returns an index list with the specified number of unique random indices in the specified range by using the specified random generator. More...
 
static void SetRandom (int length, int upperBound, ref IndexList indices)
 Creates a prescribed number of unique random indices in the specified range. More...
 
static void SetRandom (int length, int lowerBound, int upperBound, ref IndexList indices)
 Creates a prescribed number of unique random indices in the specified range. More...
 
static void SetRandom (IRandomGenerator rand, int length, int upperBound, ref IndexList indices)
 Creates a prescribed number of unique random indices in the specified range by using the specified random generator and stores them in the specified index list. Lower bound of generated indices is 0. More...
 
static void SetRandom (IRandomGenerator rand, int length, int lowerBound, int upperBound, ref IndexList indices)
 Creates a prescribed number of unique random indices in the specified range by using the specified random generator and stores them in the specified index list. More...
 

Additional Inherited Members

- Protected Member Functions inherited from IG.Lib.SortedUniqueItemList< Type >
void Sort ()
 Sorts the internal list of items. NOT thread safe. More...
 
- Properties inherited from IG.Lib.SortedUniqueItemList< Type >
object Lock [get]
 This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock. More...
 
Type this[int index] [get]
 Gets the specified element. More...
 
int Length [get]
 Gets the current number of elements in the list. More...
 
int Capacity [get, protected set]
 Gets the current number of elements in the list. More...
 
int CapacityOverhead [get, set]
 Overhead in capacity. If differnt than 0 then when current capacity is filled, adding operations will perform resizing in such a way that this number of elements are unoccupied. In this way, the frequency of resizes is reduced. Also, removing operations can perform downsizing if the number of free elements after removal is greater than CapacityOverhead (dependent on value of the PerformDownSizing flag). More...
 
bool PerformDownSizing [get, protected set]
 Flag specifying whether capacity can be reduced on removal operations which would generate large excess of list capacity with respect to the number of actual elements contained in the list. More...
 
IComparer< Type > Comparer [get, set]
 Gets or sets the comparer. If a new comparer is set then re-sorting of the list is performed. Setter is thread safe, but getter is not. More...
 
- Properties inherited from IG.Lib.ILockable
object Lock [get]
 

Detailed Description

Index list, a sorted list of unique integer indices. Used for tasks such as filtering specified element from a list of elements or a general data set.

$A Igor Dec08;

Constructor & Destructor Documentation

IG.Lib.IndexList.IndexList ( )
inline

Creates an empty index table with the default capacity.

IG.Lib.IndexList.IndexList ( int  initialCapacity)
inline

Creates an empty index table with the specified initial capacity.

Parameters
initialCapacityInitial capacity of the list.
IG.Lib.IndexList.IndexList ( params int[]  items)
inline

Creates an index table containing all indices from the specified table.

Parameters
itemsTable fo indices that are added to the created index table.
IG.Lib.IndexList.IndexList ( IList< int >  items)
inline

Creates an index table containing all indices from the specified list.

Parameters
itemsList fo indices that are added to the created index table.
IG.Lib.IndexList.IndexList ( ICollection< int >  items)
inline

Creates an index table containing all indices from the specified collection.

Parameters
itemsCollection fo indices that are added to the created index table.

Member Function Documentation

static IndexList IG.Lib.IndexList.CreateRandomPermutation ( int  length)
inlinestatic

Creates and returns a random permutation of the specified length.

Parameters
lengthLength of permutation, i.e. number of random indices contained in the generated list of indices.

References IG.Num.RandomGenerator.Global.

static IndexList IG.Lib.IndexList.CreateRandomPermutation ( IRandomGenerator  rand,
int  length 
)
inlinestatic

Creates and returns a random permutation of the specified length by using the specified random generator.

Parameters
randRandom numbers generator used to generate indices randomly. There is a version of the method without this argument, which uses the global random generator.
lengthLength of permutation, i.e. number of random indices contained in the generated list of indices.
static void IG.Lib.IndexList.SetRandomPermutation ( int  length,
int  upperBound,
ref IndexList  indices 
)
inlinestatic

Creates a random permutation of the specified length and stores them it the specified index list.

Parameters
lengthNumber of random indices contained in the generated list of indices.
upperBoundUpper bound.
indicesIndex list to which the generated indices are stored.

References IG.Num.RandomGenerator.Global.

static void IG.Lib.IndexList.SetRandomPermutation ( IRandomGenerator  rand,
int  length,
ref IndexList  indices 
)
inlinestatic

Creates a random permutation of the specified length by using the specified random generator

Parameters
randRandom numbers generator used to generate indices randomly. There is a version of the method without this argument, which uses the global random generator.
lengthNumber of random indices contained in the generated list of indices.
indicesIndex list to which the generated indices are stored.
static IndexList IG.Lib.IndexList.CreateRandom ( int  length,
int  upperBound 
)
inlinestatic

Creates a prescribed number of unique random indices in the specified range.

Parameters
lengthNumber of random indices contained in the generated list of indices.
upperBoundUpper bound for generated indices (contained indices are lesser or equal to this value).

References IG.Num.RandomGenerator.Global.

Referenced by IG.Neural.NeuralTadej.ExampleCasting(), IG.Neural.NeuralTadej.ExampleQuadratic(), IG.Num.NeuralApproximatorBase.ExampleQuadratic(), and IG.Neural.NeuralTadej.ExampleStore().

static IndexList IG.Lib.IndexList.CreateRandom ( int  length,
int  lowerBound,
int  upperBound 
)
inlinestatic

Creates and returns an index list with the specified number of unique random indices in the specified range .

Parameters
lengthNumber of random indices contained in the generated list of indices.
lowerBoundLower bound for generated indices (contained indices are greater or equal to this value).
upperBoundUpper bound for generated indices (contained indices are lesser or equal to this value).

References IG.Num.RandomGenerator.Global.

static IndexList IG.Lib.IndexList.CreateRandom ( IRandomGenerator  rand,
int  length,
int  upperBound 
)
inlinestatic

Creates and returns an index list with the specified number of unique random indices in the specified range by using the specified random generator. Lower bound of generated indices is 0.

Parameters
randRandom numbers generator used to generate indices randomly. There is a version of the method without this argument, which uses the global random generator.
lengthNumber of random indices contained in the generated list of indices.
upperBoundUpper bound for generated indices (contained indices are lesser or equal to this value).
static IndexList IG.Lib.IndexList.CreateRandom ( IRandomGenerator  rand,
int  length,
int  lowerBound,
int  upperBound 
)
inlinestatic

Creates and returns an index list with the specified number of unique random indices in the specified range by using the specified random generator.

Parameters
randRandom numbers generator used to generate indices randomly. There is a version of the method without this argument, which uses the global random generator.
lengthNumber of random indices contained in the generated list of indices.
lowerBoundLower bound for generated indices (contained indices are greater or equal to this value).
upperBoundUpper bound for generated indices (contained indices are lesser or equal to this value).
static void IG.Lib.IndexList.SetRandom ( int  length,
int  upperBound,
ref IndexList  indices 
)
inlinestatic

Creates a prescribed number of unique random indices in the specified range.

Parameters
lengthNumber of random indices contained in the generated list of indices.
upperBoundUpper bound for generated indices (contained indices are lesser or equal to this value).
indicesIndex list to which the generated indices are stored.

References IG.Num.RandomGenerator.Global.

static void IG.Lib.IndexList.SetRandom ( int  length,
int  lowerBound,
int  upperBound,
ref IndexList  indices 
)
inlinestatic

Creates a prescribed number of unique random indices in the specified range.

Parameters
lengthNumber of random indices contained in the generated list of indices.
lowerBoundLower bound for generated indices (contained indices are greater or equal to this value).
upperBoundUpper bound for generated indices (contained indices are lesser or equal to this value).
indicesIndex list to which the generated indices are stored.

References IG.Num.RandomGenerator.Global.

static void IG.Lib.IndexList.SetRandom ( IRandomGenerator  rand,
int  length,
int  upperBound,
ref IndexList  indices 
)
inlinestatic

Creates a prescribed number of unique random indices in the specified range by using the specified random generator and stores them in the specified index list. Lower bound of generated indices is 0.

Parameters
randRandom numbers generator used to generate indices randomly. There is a version of the method without this argument, which uses the global random generator.
lengthNumber of random indices contained in the generated list of indices.
upperBoundUpper bound for generated indices (contained indices are lesser or equal to this value).
indicesIndex list to which the generated indices are stored.
static void IG.Lib.IndexList.SetRandom ( IRandomGenerator  rand,
int  length,
int  lowerBound,
int  upperBound,
ref IndexList  indices 
)
inlinestatic

Creates a prescribed number of unique random indices in the specified range by using the specified random generator and stores them in the specified index list.

Parameters
randRandom numbers generator used to generate indices randomly. There is a version of the method without this argument, which uses the global random generator.
lengthNumber of random indices contained in the generated list of indices.
lowerBoundLower bound for generated indices (contained indices are greater or equal to this value).
upperBoundUpper bound for generated indices (contained indices are lesser or equal to this value).
indicesIndex list to which the generated indices are stored.

References IG.Num.IRandomGenerator.NextInclusive().


The documentation for this class was generated from the following file: