Click or drag to resize

IndexCollection Class

Represents a collection of integers for zero-based matrix indexing.
Inheritance Hierarchy
SystemObject
  Novacta.AnalyticsIndexCollection

Namespace:  Novacta.Analytics
Assembly:  Novacta.Analytics (in Novacta.Analytics.dll) Version: 2.0.0
Syntax
public class IndexCollection : IList<int>, 
	ICollection<int>, IEnumerable<int>, IEnumerable, IReadOnlyList<int>, 
	IReadOnlyCollection<int>, IEquatable<IndexCollection>, IComparable<IndexCollection>, 
	IComparable

The IndexCollection type exposes the following members.

Properties
  NameDescription
Public propertyCount
Gets the number of elements in this instance.
Public propertyIsReadOnly
Gets a value indicating whether this instance is read-only.
Public propertyItemIndexCollection
Gets the indexes in the IndexCollection corresponding to the specified positions.
Public propertyItemInt32
Gets or sets the index in the IndexCollection corresponding the specified position.
Public propertyMax
Gets the maximum index in the IndexCollection.
Top
Methods
  NameDescription
Public methodCompareTo(IndexCollection)
Compares the current object with another object of the same type.
Public methodCompareTo(Object)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
Public methodContains
Public methodCopyTo
Public methodStatic memberDefault
Creates an IndexCollection which ranges from zero to the specified last index.
Public methodEquals(IndexCollection)
Indicates whether the current object is equal to another object of the same type.
Public methodEquals(Object)
Determines whether the specified Object is equal to the current Object.
(Overrides ObjectEquals(Object).)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodStatic memberFromArray(Int32)
Initializes a new instance of the IndexCollection class that contains elements copied from the specified array.
Public methodStatic memberFromArray(Int32, Boolean)
Initializes a new instance of the IndexCollection class whose elements are stored in the specified array.
Public methodGetEnumerator
Returns an enumerator that iterates through the collection.
Public methodGetHashCode
Returns a hash code for this instance.
(Overrides ObjectGetHashCode.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIndexOf
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodStatic memberRange
Creates an IndexCollection which ranges from the specified first index to the specified last index.
Public methodStatic memberSequence
Initializes a new instance of the IndexCollection class that contains a sequence of evenly spaced elements.
Public methodSort
Sorts the IndexCollection in ascending order.
Public methodToString
Returns a String that represents this instance.
(Overrides ObjectToString.)
Top
Operators
  NameDescription
Public operatorStatic memberEquality
Returns a value that indicates whether an IndexCollection instance is equal to another IndexCollection instance.
Public operatorStatic memberGreaterThan
Returns a value that indicates whether an IndexCollection instance is greater than another IndexCollection instance.
Public operatorStatic memberGreaterThanOrEqual
Returns a value that indicates whether an IndexCollection instance is greater than or equal to another IndexCollection instance.
Public operatorStatic memberInequality
Returns a value that indicates whether an IndexCollection instance is not equal to another IndexCollection instance.
Public operatorStatic memberLessThan
Returns a value that indicates whether an IndexCollection instance is less than another IndexCollection instance.
Public operatorStatic memberLessThanOrEqual
Returns a value that indicates whether an IndexCollection instance is less than or equal to another IndexCollection instance.
Top
Explicit Interface Implementations
  NameDescription
Explicit interface implementationPrivate methodICollectionInt32Add
Explicit interface implementationPrivate methodICollectionInt32Clear
Explicit interface implementationPrivate methodICollectionInt32Remove
Explicit interface implementationPrivate methodIEnumerableGetEnumerator
Returns an enumerator that iterates through a collection.
Explicit interface implementationPrivate methodIListInt32Insert
Explicit interface implementationPrivate methodIListInt32RemoveAt
Top
Remarks

Instantiation

IndexCollection instances can be created using several methods. Indexes ranging in a given interval are returned by Range(Int32, Int32). A collection of evenly spaced indexes can be initialized by Sequence(Int32, Int32, Int32). A collection ranging from zero to a specified last index is instead returned by Default(Int32). A collection can also be defined to contain elements copied from a specified array by calling FromArray(Int32), or, eventually to prevent copying operations, by calling FromArray(Int32, Boolean).

Matrix Indexing

The DoubleMatrix class defines zero-based indexers to get or set individual matrix entries, or entire sub matrices. Usually, a given datum is accessed by specifying a pair of row and column indexes, but indexers are overloaded to accept also a linear index, i.e. an index to which an matrix element corresponds provided that matrix entries have been interpreted as well ordered following a column major ordering. All such indexers accept IndexCollection instances as arguments, enabling the simultaneous specification of multiple linear, row, or column indexes.

Comparison

IndexCollection instances are quasi-lexicographically ordered. This means that instances are firstly ordered by their Count, and then, within collections having the same length, by lexicographic order.

This also means that when tested for equality, IndexCollection instances are considered equal if and only if they have the same Count and, for each index position, indexes corresponding to such position are equal, too.

See Also