public class KeyedObjects2D extends Object implements Cloneable, Serializable
Constructor and Description |
---|
KeyedObjects2D()
Creates a new instance (initially empty).
|
Modifier and Type | Method and Description |
---|---|
void |
addObject(Object object,
Comparable rowKey,
Comparable columnKey)
Adds an object to the table.
|
void |
clear()
Clears all the data and associated keys.
|
Object |
clone()
Returns a clone.
|
boolean |
equals(Object obj)
Tests this object for equality with an arbitrary object.
|
int |
getColumnCount()
Returns the column count.
|
int |
getColumnIndex(Comparable key)
Returns the column index for a given key, or
-1 if the key
is not recognised. |
Comparable |
getColumnKey(int column)
Returns the key for a given column.
|
List |
getColumnKeys()
Returns the column keys.
|
Object |
getObject(Comparable rowKey,
Comparable columnKey)
Returns the object for the given row and column keys.
|
Object |
getObject(int row,
int column)
Returns the object for a given row and column.
|
int |
getRowCount()
Returns the row count.
|
int |
getRowIndex(Comparable key)
Returns the row index for a given key, or
-1 if the key
is not recognised. |
Comparable |
getRowKey(int row)
Returns the key for a given row.
|
List |
getRowKeys()
Returns the row keys.
|
int |
hashCode()
Returns a hashcode for this object.
|
void |
removeColumn(Comparable columnKey)
Removes an entire column from the table.
|
void |
removeColumn(int columnIndex)
Removes an entire column from the table.
|
void |
removeObject(Comparable rowKey,
Comparable columnKey)
Removes an object from the table by setting it to
null . |
void |
removeRow(Comparable rowKey)
Removes an entire row from the table.
|
void |
removeRow(int rowIndex)
Removes an entire row from the table.
|
void |
setObject(Object object,
Comparable rowKey,
Comparable columnKey)
Adds or updates an object.
|
public int getRowCount()
getColumnCount()
public int getColumnCount()
getRowCount()
public Object getObject(int row, int column)
row
- the row index (in the range 0 to getRowCount() - 1).column
- the column index (in the range 0 to getColumnCount() - 1).null
).getObject(Comparable, Comparable)
public Comparable getRowKey(int row)
row
- the row index (zero based).getRowIndex(Comparable)
public int getRowIndex(Comparable key)
-1
if the key
is not recognised.key
- the key (null
not permitted).getRowKey(int)
public List getRowKeys()
null
).getRowKeys()
public Comparable getColumnKey(int column)
column
- the column.getColumnIndex(Comparable)
public int getColumnIndex(Comparable key)
-1
if the key
is not recognised.key
- the key (null
not permitted).getColumnKey(int)
public List getColumnKeys()
null
).getRowKeys()
public Object getObject(Comparable rowKey, Comparable columnKey)
rowKey
- the row key (null
not permitted).columnKey
- the column key (null
not permitted).null
).IllegalArgumentException
- if rowKey
or
columnKey
is null
.UnknownKeyException
- if rowKey
or
columnKey
is not recognised.public void addObject(Object object, Comparable rowKey, Comparable columnKey)
object
- the object.rowKey
- the row key (null
not permitted).columnKey
- the column key (null
not permitted).public void setObject(Object object, Comparable rowKey, Comparable columnKey)
object
- the object.rowKey
- the row key (null
not permitted).columnKey
- the column key (null
not permitted).public void removeObject(Comparable rowKey, Comparable columnKey)
null
. If
all the objects in the specified row and/or column are now
null
, the row and/or column is removed from the table.rowKey
- the row key (null
not permitted).columnKey
- the column key (null
not permitted).addObject(Object, Comparable, Comparable)
public void removeRow(int rowIndex)
rowIndex
- the row index.removeColumn(int)
public void removeRow(Comparable rowKey)
rowKey
- the row key (null
not permitted).UnknownKeyException
- if rowKey
is not recognised.removeColumn(Comparable)
public void removeColumn(int columnIndex)
columnIndex
- the column index.removeRow(int)
public void removeColumn(Comparable columnKey)
columnKey
- the column key (null
not permitted).UnknownKeyException
- if rowKey
is not recognised.removeRow(Comparable)
public void clear()
public boolean equals(Object obj)
public int hashCode()
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
- this class will not throw this
exception, but subclasses (if any) might.Jas4pp 1.5 © Java Analysis Studio for Particle Physics