All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class array.Index

java.lang.Object
   |
   +----array.Index

public final class Index
extends Object
Index = represents an index set to arrays

Ranges provide the support to extract and operate on regular array sections. Indexes provide similar support for irregular sections. It is not possible to define an array section using Indexes, but one can use them in gather/scatter-like operations.

The only restriction is that elements in an Index must be nonnegative. The same value can appear multiple times in an Index. Indexes can be empty.


Variable Index

 o elements
 o theMax
 o theMin

Constructor Index

 o Index(int[])
Create an Index from a vector of ints.
 o Index(Range)
Create and Index from a Range.

Method Index

 o element(int)
Return the i-th element of an Index.
 o elementf(int)
Return the i-th element of an Index, no check.
 o length()
Return the number of elements in an Index.
 o max()
Return the largest element in an Index.
 o min()
Return the smallest element in an Index.
 o toJava()
Return an int[] with the elements of this Index.

Variables

 o elements
 protected int elements[]
 o theMin
 protected int theMin
 o theMax
 protected int theMax

Constructors

 o Index
 public Index(int list[]) throws InvalidIndexException
Create an Index from a vector of ints.

Parameters:
list - vector of int with list of elements
Throws: InvalidIndexException
elements must be nonnegative
 o Index
 public Index(Range range)
Create and Index from a Range. Note that a Range cannot have negative elements.

Parameters:
range - Range describing elements

Methods

 o length
 public int length()
Return the number of elements in an Index.

 o element
 public int element(int i) throws InvalidIndexElementException
Return the i-th element of an Index.

Parameters:
i - index of the element
Throws: InvalidIndexElementException
0 <= i < Index.length()
 o elementf
 protected int elementf(int i)
Return the i-th element of an Index, no check.

Parameters:
i - index of the element
 o min
 public int min()
Return the smallest element in an Index.

 o max
 public int max()
Return the largest element in an Index.

 o toJava
 public int[] toJava()
Return an int[] with the elements of this Index.


All Packages  Class Hierarchy  This Package  Previous  Next  Index