Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://angel.cs.msu.su/projects/system/toolsdoc/netcdf_java/ucar/multiarray/IndexIterator.html
Дата изменения: Tue Dec 28 20:59:06 2004 Дата индексирования: Sun Apr 10 00:16:37 2016 Кодировка: |
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ucar.multiarray.IndexIterator
An IndexIterator is a helper class used for stepping through the index values of a MultiArray.
This is like an odometer. The number of columns or rings on the odometer is the length of the constructor argument. The number of values on each ring of the odometer is specified in the limits argument of the constructor.
Currently no synchronized methods.
MultiArray
Field Summary | |
protected int[] |
counter
The counter value. |
protected int[] |
limits
(Reference to) the constructor argument which determines counter value variation. |
protected int |
ncycles
A "carry" indicator, the number of times the counter value has rolled over. |
Constructor Summary | |
IndexIterator(int[] theLimits)
Creates a new IndexIterator whose variation is bounded by the component values of the argument. |
|
IndexIterator(int[] initCounter,
int[] theLimits)
Creates a new IndexIterator with initial counter value, whose variation is bounded by the component values of the limits argument. |
Method Summary | |
void |
advance(int nsteps)
Increment the counter value |
static boolean |
equals(int[] lhs,
int[] rhs)
Return true iff the arguments have
same values. |
void |
incr()
Increment the counter value |
static boolean |
isZero(int[] iv)
Return true iff the argument
is the zero index. |
static void |
main(java.lang.String[] args)
Test |
boolean |
notDone()
If the IndexIterator has not yet "rolled over", return true . |
java.lang.String |
toString()
|
int[] |
value()
Return the current counter value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected final int[] counter
protected final int[] limits
for 0 <= ii < limits.length, counter[ii] < limits[ii]
protected int ncycles
Constructor Detail |
public IndexIterator(int[] theLimits)
theLimits
- typically ma.getLengths()
for some MultiArray ma
public IndexIterator(int[] initCounter, int[] theLimits)
limits
argument.initCounter
- the initial value.theLimits
- typically ma.getLengths()
for some MultiArray ma
Method Detail |
public static boolean isZero(int[] iv)
true
iff the argument
is the zero index.public static boolean equals(int[] lhs, int[] rhs)
true
iff the arguments have
same values.public boolean notDone()
true
.
Useful for loop end detection.public int[] value()
public void incr()
public void advance(int nsteps)
nsteps
- the number of times to increment the value.public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |