Class Histogram2D_S32


  • public class Histogram2D_S32
    extends java.lang.Object
    2D histogram used to count.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int cols
      Histogram's shape
      int[] data
      Value of each cell in the histogram
      int rows
      Histogram's shape
    • Constructor Summary

      Constructors 
      Constructor Description
      Histogram2D_S32()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int get​(int row, int col)
      Value at the specified coordinate in the histogram
      void increment​(int row, int col)
      Increments the value at the specified coordinate by 1
      int indexOf​(int row, int col)
      Index of the specified coordinate
      int maximumColIdx​(int row)
      Returns the column with the largest value in the specified row
      int maximumRowIdx​(int col)
      Returns the row with the largest value in the specified column
      void print​(java.lang.String format)
      Prints the histogram to stdout
      void reshape​(int rows, int cols)
      Changes the size of the histogram to match the specified shape.
      void set​(int row, int col, int value)
      Value at the specified coordinate in the histogram
      int size()
      Number of elements in the histogram
      int sum()
      Sum of all the elements in the histogram
      int sumCol​(int col)
      Sums up all the elements in the specified column and returns the result
      int sumRow​(int row)
      Sums up all the elements in the specified row and returns the result
      void zero()
      Fills all elements in data that are in use to zero.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • data

        public int[] data
        Value of each cell in the histogram
      • rows

        public int rows
        Histogram's shape
      • cols

        public int cols
        Histogram's shape
    • Constructor Detail

      • Histogram2D_S32

        public Histogram2D_S32()
    • Method Detail

      • reshape

        public void reshape​(int rows,
                            int cols)
        Changes the size of the histogram to match the specified shape. Size of data is changed only when it's too small for the new shape.
      • zero

        public void zero()
        Fills all elements in data that are in use to zero.
      • increment

        public void increment​(int row,
                              int col)
        Increments the value at the specified coordinate by 1
      • sumRow

        public int sumRow​(int row)
        Sums up all the elements in the specified row and returns the result
      • sumCol

        public int sumCol​(int col)
        Sums up all the elements in the specified column and returns the result
      • maximumColIdx

        public int maximumColIdx​(int row)
        Returns the column with the largest value in the specified row
      • maximumRowIdx

        public int maximumRowIdx​(int col)
        Returns the row with the largest value in the specified column
      • sum

        public int sum()
        Sum of all the elements in the histogram
      • get

        public int get​(int row,
                       int col)
        Value at the specified coordinate in the histogram
      • set

        public void set​(int row,
                        int col,
                        int value)
        Value at the specified coordinate in the histogram
      • indexOf

        public int indexOf​(int row,
                           int col)
        Index of the specified coordinate
      • size

        public int size()
        Number of elements in the histogram
      • print

        public void print​(java.lang.String format)
        Prints the histogram to stdout
        Parameters:
        format - Printf format for the value