Package org.jblas.ranges
Interface Range
- All Known Implementing Classes:
AllRange
,IndicesRange
,IntervalRange
,PointRange
public interface Range
The Range interface represents basically a set of indices. Before using a range you have to call init() with the actually available lower and upper bounds, such that you can also have an "AllRange" which contains all possible indices.
Further operations include:
- length() - returns total number of elements.
- next() - increase counter (use value()) to retrieve the value.
- index() - get the index of the current value.
- value() - get the current value.
- hasMore() - more indices available.
Typical uses look like this:
for (r.init(lower, upper); r.hasMore(); r.next()) { System.out.printf("Value number %d is %d%n", index(), value()); }
-
Method Summary
-
Method Details
-
init
void init(int lower, int upper) Initialize Range to available indices -
length
int length()Total number of indices. -
next
void next()Increase counter. -
index
int index()Consecutive numbering of current index. -
value
int value()Get current index. -
hasMore
boolean hasMore()More indices available?
-