org.jfree.util
Class ObjectTable

java.lang.Object
  extended byorg.jfree.util.ObjectTable
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
FontTable, NumberTable, PaintTable, ShapeTable, StrokeTable, TextAnchorTable

public class ObjectTable
extends java.lang.Object
implements java.io.Serializable

A lookup table for objects.

Author:
David Gilbert
See Also:
Serialized Form

Constructor Summary
ObjectTable()
          Creates a new table.
 
Method Summary
 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.
protected  java.lang.Object getObject(int row, int column)
          Returns the object from a particular cell in the table.
 int getRowCount()
          Returns the number of rows in the table.
protected  java.lang.Object readSerializedData(java.io.ObjectInputStream stream)
          Handles the deserialization of a single element of the table.
protected  void setObject(int row, int column, java.lang.Object object)
          Sets the object for a cell in the table.
protected  void writeSerializedData(java.io.ObjectOutputStream stream, java.lang.Object o)
          Handles the serialization of an single element of this table.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectTable

public ObjectTable()
Creates a new table.

Method Detail

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.

getObject

protected java.lang.Object getObject(int row,
                                     int column)
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.

setObject

protected void setObject(int row,
                         int column,
                         java.lang.Object 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(java.lang.Object o)
Tests this paint table for equality with another object (typically also an ObjectTable).

Parameters:
o - the other object.
Returns:
A boolean.

writeSerializedData

protected void writeSerializedData(java.io.ObjectOutputStream stream,
                                   java.lang.Object o)
                            throws java.io.IOException
Handles the serialization of an single element of this table.

Parameters:
stream - the stream which should write the object
o - the object that should be serialized
Throws:
java.io.IOException - if an IO error occured

readSerializedData

protected java.lang.Object readSerializedData(java.io.ObjectInputStream stream)
                                       throws java.io.OptionalDataException,
                                              java.lang.ClassNotFoundException,
                                              java.io.IOException
Handles the deserialization of a single element of the table.

Parameters:
stream - the object input stream from which to read the object.
Returns:
the deserialized object
Throws:
java.io.OptionalDataException - Primitive data was found in the stream instead of objects.
java.lang.ClassNotFoundException - if a class cannot be found.
java.io.IOException - Any of the usual Input/Output related exceptions.