Package ucar.array

Class IndexFn

  • All Implemented Interfaces:
    Iterable<Integer>

    @Immutable
    public final class IndexFn
    extends Object
    implements Iterable<Integer>
    Public by accident. Translate between multidimensional index and 1-d arrays.
    • Method Detail

      • get

        public int get​(int... index)
        Get the 1-d index indicated by the list of multidimensional indices.
        Parameters:
        index - list of indices, one for each dimension. For vlen, the last is ignored.
      • contains

        public boolean contains​(int... index)
        Check if the given index is valid.
      • getRank

        public int getRank()
        Get the number of dimensions in the array.
      • getSection

        public Section getSection()
        Get the shape: length of array in each dimension.
      • getShape

        public int[] getShape()
        Get the shape: length of array in each dimension.
      • getShape

        public int getShape​(int index)
        Get the length of the ith dimension.
      • iterator

        public Iterator<Integer> iterator​(int start,
                                          long length)
      • length

        public long length()
        Get the total number of elements in the array.
      • toString2

        public String toString2()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • odometer

        public int[] odometer​(long element)
        what is the odometer (n-dim index) for element (1-d index)?