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.
-
Range(int, int)
- Create a range with unit stride (+1 or -1).
-
Range(int, int, int)
- Create a range with a specified stride.
-
element(int)
- Return the i-th element of a range.
-
first()
- Return the value of the first element of the range.
-
last()
- Return the value of the last element of the range.
-
length()
- Return the number of elements in a range.
-
max()
- Return the maximum element value in a range.
-
min()
- Return the minimum element value in a range.
-
step()
- Return the stride of a range.
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
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
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
first
public int first()
- Return the value of the first element of the range.
last
public int last()
- Return the value of the last element of the range.
length
public int length()
- Return the number of elements in a range.
max
public int max()
- Return the maximum element value in a range.
min
public int min()
- Return the minimum element value in a range.
step
public int step()
- Return the stride of a range.
All Packages Class Hierarchy This Package Previous Next Index