uk.ac.starlink.table
Class ShapeIterator

java.lang.Object
  |
  +--uk.ac.starlink.table.ShapeIterator
All Implemented Interfaces:
Iterator

public class ShapeIterator
extends Object
implements Iterator

Iterates over a shape array, as got from ValueInfo.getShape(). Will only work for a finite-valued array, not for one with a variable last dimension (negative dimension value). The object returned by the next method is an array with the same number of dimensions as the shape itself, giving the current position (the first returned value is an N-element array of zeros).

Since:
2 Mar 2005

Constructor Summary
ShapeIterator(int[] shape)
          Constructs a new ShapeIterator.
 
Method Summary
 boolean hasNext()
           
 Object next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapeIterator

public ShapeIterator(int[] shape)
Constructs a new ShapeIterator.

Parameters:
shape - array of dimensions
Throws:
IllegalArgumentException - if shape has negative or zero elements
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator

next

public Object next()
Specified by:
next in interface Iterator

remove

public void remove()
Specified by:
remove in interface Iterator

Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved.