Class ObjectTable

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    GenericObjectTable

    public class ObjectTable
    extends java.lang.Object
    implements java.io.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
      ObjectTable()
      Creates a new table.
      ObjectTable​(int increment)
      Creates a new table.
      ObjectTable​(int rowIncrement, int colIncrement)
      Creates a new table.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clears the table.
      void clearRow​(int row)
      Clears the row by removing the array that stores the row-data.
      void ensureCapacity​(int row, int column)
      Ensures that there is storage capacity for the specified item.
      boolean equals​(java.lang.Object o)
      Tests this paint table for equality with another object (typically also an ObjectTable).
      int getColumnCount()
      Returns the number of columns in the table.
      int getColumnIncrement()
      Returns the column size increment.
      int getRowCount()
      Returns the number of rows in the table.
      int getRowIncrement()
      Returns the row size increment.
      int hashCode()
      Returns a hash code value for the object.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ObjectTable

        public ObjectTable()
        Creates a new table.
      • ObjectTable

        public ObjectTable​(int increment)
        Creates a new table.
        Parameters:
        increment - the row and column size increment.
      • ObjectTable

        public ObjectTable​(int rowIncrement,
                           int colIncrement)
        Creates a new table.
        Parameters:
        rowIncrement - the row size increment.
        colIncrement - the column size increment.
    • Method Detail

      • getColumnIncrement

        public int getColumnIncrement()
        Returns the column size increment.
        Returns:
        the increment.
      • getRowIncrement

        public int getRowIncrement()
        Returns the row size increment.
        Returns:
        the increment.
      • 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.
      • equals

        public boolean equals​(java.lang.Object o)
        Tests this paint table for equality with another object (typically also an ObjectTable).
        Overrides:
        equals in class java.lang.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 java.lang.Object
        Returns:
        the hashcode
      • clear

        public void clear()
        Clears the table.
      • clearRow

        public void clearRow​(int row)
        Clears the row by removing the array that stores the row-data. This reduces the in-memory size of the table at the cost of possibly having to recreate the row-data-array later.
        Parameters:
        row - the row to be deleted.