Class ByteTable

  • All Implemented Interfaces:
    Serializable

    public class ByteTable
    extends Object
    implements Serializable
    A lookup table for objects. This implementation is not synchronized, it is up to the caller to synchronize it properly.
    Author:
    Thomas Morgner
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ByteTable​(int rows, int cols)
      Creates a new table.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear​(byte value)
      Clears the table.
      void ensureCapacity​(int row, int column)
      Ensures that there is storage capacity for the specified item.
      boolean equals​(Object o)
      Tests this paint table for equality with another object (typically also an ObjectTable).
      byte getByte​(int row, int column, byte defaultValue)
      Returns the object from a particular cell in the table.
      int getColumnCount()
      Returns the number of columns in the table.
      protected byte[][] getData()  
      int getRowCount()
      Returns the number of rows in the table.
      int hashCode()
      Returns a hash code value for the object.
      void setByte​(int row, int column, byte object)
      Sets the object for a cell in the table.
    • Constructor Detail

      • ByteTable

        public ByteTable​(int rows,
                         int cols)
        Creates a new table.
        Parameters:
        rows - the inital number of rows.
        cols - the initial number of columns.
    • Method Detail

      • ensureCapacity

        public void ensureCapacity​(int row,
                                   int column)
        Ensures that there is storage capacity for the specified item.
        Parameters:
        row - the row index.
        column - the column index.
      • getRowCount

        public int getRowCount()
        Returns the number of rows in the table.
        Returns:
        The row count.
      • getColumnCount

        public int getColumnCount()
        Returns the number of columns in the table.
        Returns:
        The column count.
      • getByte

        public byte getByte​(int row,
                            int column,
                            byte defaultValue)
        Returns the object from a particular cell in the table. Returns null, if there is no object at the given position.

        Note: throws IndexOutOfBoundsException if row or column is negative.

        Parameters:
        row - the row index (zero-based).
        column - the column index (zero-based).
        Returns:
        The object.
      • setByte

        public void setByte​(int row,
                            int column,
                            byte object)
        Sets the object for a cell in the table. The table is expanded if necessary.
        Parameters:
        row - the row index (zero-based).
        column - the column index (zero-based).
        object - the object.
      • equals

        public boolean equals​(Object o)
        Tests this paint table for equality with another object (typically also an ObjectTable).
        Overrides:
        equals in class Object
        Parameters:
        o - the other object.
        Returns:
        A boolean.
      • hashCode

        public int hashCode()
        Returns a hash code value for the object.
        Overrides:
        hashCode in class Object
        Returns:
        the hashcode
      • clear

        public void clear​(byte value)
        Clears the table.
      • getData

        protected byte[][] getData()