All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.math.array.Range

java.lang.Object
   |
   +----com.ibm.math.array.Range

public final class Range
extends Object
Range = represents a range of integers, used as an index set to arrays

To extract array sections from arrays, it is necessary to define ranges of indices along axes of arrays. Range objects are used for that purpose.

Ranges are either monotonically increasing or monotonically decreasing. Elements must be nonnegative. Ranges can be empty.


Constructor Index

 o Range(int, int)
Create a range with unit stride (+1 or -1).
 o Range(int, int, int)
Create a range with a specified stride.

Method Index

 o element(int)
Return the i-th element of a range.
 o first()
Return the value of the first element of the range.
 o last()
Return the value of the last element of the range.
 o length()
Return the number of elements in a range.
 o max()
Return the maximum element value in a range.
 o min()
Return the minimum element value in a range.
 o step()
Return the stride of a range.

Constructors

 o Range
 public Range(int first,
              int last) throws InvalidRangeException
Create a range with unit stride (+1 or -1).

Parameters:
first - first value in range
last - last value in range
Throws: InvalidRangeException
elements must be nonnegative
 o Range
 public Range(int first,
              int last,
              int step) throws InvalidRangeException
Create a range with a specified stride.

Parameters:
first - first value in range
last - last value in range
step - stride between consecutive elements (positive or negative)
Throws: InvalidRangeException
elements must be nonnegative

Methods

 o element
 public int element(int i) throws InvalidRangeElementException
Return the i-th element of a range.

Parameters:
i - index of the element
Throws: InvalidRangeElementException
0 <= i < length
 o first
 public int first()
Return the value of the first element of the range.

 o last
 public int last()
Return the value of the last element of the range.

 o length
 public int length()
Return the number of elements in a range.

 o max
 public int max()
Return the maximum element value in a range.

 o min
 public int min()
Return the minimum element value in a range.

 o step
 public int step()
Return the stride of a range.


All Packages  Class Hierarchy  This Package  Previous  Next  Index