Class BooleanArrayMatrixView

    • Field Detail

      • m_Data

        protected boolean[] m_Data
        the underlaying array.
      • m_Width

        protected int m_Width
        the width of the matrix.
      • m_Height

        protected int m_Height
        the height of the matrix.
    • Constructor Detail

      • BooleanArrayMatrixView

        public BooleanArrayMatrixView​(int width,
                                      int height)
        Initializes the matrix view with an empty array.
        Parameters:
        width - the width of the matrix
        height - the height of the matrix
      • BooleanArrayMatrixView

        public BooleanArrayMatrixView​(boolean[][] data)
        Initializes the matrix view the provided boolean matrix (gets turned into an array in the process).
        Parameters:
        data - the matrix to use
      • BooleanArrayMatrixView

        public BooleanArrayMatrixView​(boolean[] data,
                                      int width,
                                      int height)
        Initializes the matrix view.
        Parameters:
        data - the 1-dim array data
        width - the width of the matrix
        height - the height of the matrix
    • Method Detail

      • getData

        public boolean[] getData()
        Returns the underlying data.
        Returns:
        the data
      • getWidth

        public int getWidth()
        Returns the width of the matrix.
        Returns:
        the width
      • getHeight

        public int getHeight()
        Returns the height of the matrix.
        Returns:
        the height
      • get

        public boolean get​(int x,
                           int y)
        Returns the value at the specified location.
        Parameters:
        x - the 0-based column
        y - the 0-based row
        Returns:
        the value at the position
      • set

        public void set​(int x,
                        int y,
                        boolean value)
        Sets the value at the specified location.
        Parameters:
        x - the 0-based column
        y - the 0-based row
        value - the value to set
      • toString

        public String toString()
        Returns a short description of the view.
        Overrides:
        toString in class Object
        Returns:
        the description
      • toBufferedImage

        public BufferedImage toBufferedImage​(int type)
        Turns the matrix into an image.
        Parameters:
        type - the BufferedImage type
        Returns:
        the image
      • matrixToArray

        public static boolean[] matrixToArray​(boolean[][] data)
        Turns the matrix into an array.
        Parameters:
        data - the matrix to convert
        Returns:
        the generated array