Package dap4.dap4lib

Class D4Index

  • All Implemented Interfaces:
    Cloneable

    public class D4Index
    extends ucar.ma2.Index
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static D4Index SCALAR  
      • Fields inherited from class ucar.ma2.Index

        current, hasvlen, offset, rank, scalarIndexImmutable, shape, size, stride
    • Constructor Summary

      Constructors 
      Constructor Description
      D4Index​(int rank)  
      D4Index​(int[] _shape)  
      D4Index​(int[] indices, int[] dimsizes)  
      D4Index​(D4Index index)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getCurrentCounter​(int i)  
      int index()
      Compute the linear index from the current odometer indices.
      static List<Slice> indexToSlices​(ucar.ma2.Index indices)
      Convert ucar.ma2.Index to list of slices
      boolean isScalar()  
      static ucar.ma2.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.
      static D4Index slicesToIndex​(List<Slice> slices)
      If a set of slices refers to a single position, then return the corresponding Index.
      String toString()  
      • Methods inherited from class ucar.ma2.Index

        clone, computeSize, currentElement, factory, getCurrentCounter, getRank, getShape, getShape, getSize, incr, precalc, set, set, set, set, set, set, set, set, set0, set1, set2, set3, set4, set5, set6, setCurrentCounter, setDim, toStringDebug
    • 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 ucar.ma2.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​(ucar.ma2.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
      • toString

        public String toString()
        Overrides:
        toString in class ucar.ma2.Index
      • 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()