Package dap4.dap4lib

Class D4Index

  • All Implemented Interfaces:
    Cloneable

    public class D4Index
    extends Index
    • Field Detail

      • SCALAR

        public static final D4Index SCALAR
    • Constructor Detail

      • D4Index

        public D4Index​(int rank)
      • D4Index

        public D4Index​(int[] _shape)
      • D4Index

        public D4Index​(D4Index index)
      • D4Index

        public D4Index​(int[] indices,
                       int[] dimsizes)
    • Method Detail

      • offsetToIndex

        public static Index offsetToIndex​(int offset,
                                          int[] shape)
        Given an offset (single index) and a set of dimensions compute the set of dimension indices that correspond to the offset.
      • indexToSlices

        public static List<Slice> indexToSlices​(Index indices)
                                         throws DapException
        Convert ucar.ma2.Index to list of slices
        Parameters:
        indices - to convert
        Returns:
        list of corresponding slices
        Throws:
        DapException
      • slicesToIndex

        public static D4Index slicesToIndex​(List<Slice> slices)
                                     throws DapException
        If a set of slices refers to a single position, then return the corresponding Index. Otherwise, throw Exception.
        Parameters:
        slices -
        Returns:
        Index corresponding to slices
        Throws:
        DapException
      • index

        public int index()
        Compute the linear index from the current odometer indices. Not quite the same as super.currentElement(), which does not use shape[], but does use the super's "unexpected" notion of stride, although result may be same.
      • getCurrentCounter

        public int getCurrentCounter​(int i)
      • isScalar

        public boolean isScalar()