Class AccessAnyD.MatrixView<N extends java.lang.Comparable<N>>

    • Field Detail

      • myColumnsCount

        private final long myColumnsCount
      • myCount

        private final long myCount
      • myDelegateAnyD

        private final AccessAnyD<N extends java.lang.Comparable<N>> myDelegateAnyD
      • myLastOffset

        private final long myLastOffset
      • myOffset

        private long myOffset
      • myRowsCount

        private final long myRowsCount
    • Constructor Detail

      • MatrixView

        protected MatrixView​(AccessAnyD<N> access)
      • MatrixView

        MatrixView​(AccessAnyD<N> access,
                   long index)
    • Method Detail

      • compareTo

        public int compareTo​(AccessAnyD.MatrixView<N> other)
        Specified by:
        compareTo in interface java.lang.Comparable<N extends java.lang.Comparable<N>>
      • countColumns

        public long countColumns()
        Description copied from interface: Structure2D
        Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.
        Specified by:
        countColumns in interface Structure2D
        Returns:
        The number of columns
      • countRows

        public long countRows()
        Description copied from interface: Structure2D
        Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.
        Specified by:
        countRows in interface Structure2D
        Returns:
        The number of rows
      • doubleValue

        public double doubleValue​(int row,
                                  int col)
        Description copied from interface: Access2D
        Extracts one element of this matrix as a double.
        Specified by:
        doubleValue in interface Access2D<N extends java.lang.Comparable<N>>
        Parameters:
        row - A row index.
        col - A column index.
        Returns:
        One matrix element
      • doubleValue

        public double doubleValue​(long row,
                                  long col)
        Specified by:
        doubleValue in interface Access2D<N extends java.lang.Comparable<N>>
      • estimateSize

        public long estimateSize()
      • get

        public N get​(long row,
                     long col)
        Specified by:
        get in interface Access2D<N extends java.lang.Comparable<N>>
      • getColDim

        public int getColDim()
        Specified by:
        getColDim in interface Structure2D
        Returns:
        The number of columns
      • getRowDim

        public int getRowDim()
        Specified by:
        getRowDim in interface Structure2D
        Returns:
        The number of rows
      • goToMatrix

        public void goToMatrix​(long index)
        Move the view to a specific matrix. The index specified here should correspond to what is returned by the index() method.
        See Also:
        index()
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<N extends java.lang.Comparable<N>>
      • hasPrevious

        public boolean hasPrevious()
      • index

        public long index()
        If the underlying AccessAnyD data structure was created as 4x5x7x8, it can be viewed as 7x8 4x5 matrices. The dimensions of the MatrixView would be 4x5, and the index returned by this method indicates which of 7x8 matrices the view currently points to. The range of these indices would be 0-55.
        Returns:
        The index of the matrix (which matrix are we currently viewing).
      • iterator

        public AccessAnyD.MatrixView<N> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<N extends java.lang.Comparable<N>>
      • next

        public AccessAnyD.MatrixView<N> next()
        Specified by:
        next in interface java.util.Iterator<N extends java.lang.Comparable<N>>
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<N extends java.lang.Comparable<N>>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getOffset

        long getOffset()