All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class array.Range

java.lang.Object
   |
   +----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.


Variable Index

 o a
 o d
 o n

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 elementf(int)
Return the i-th element of a range, no check
 o first()
 o last()
 o length()
Return the number of elements in a range.
 o max()
 o min()
 o step()

Variables

 o n
 protected int n
 o a
 protected int a
 o d
 protected int d

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 length
 public int length()
Return the number of elements in a range.

 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 elementf
 protected int elementf(int i)
Return the i-th element of a range, no check

Parameters:
i - index of the element
 o first
 public int first()
 o last
 public int last()
 o step
 public int step()
 o min
 public int min()
 o max
 public int max()

All Packages  Class Hierarchy  This Package  Previous  Next  Index