com.tagtraum.perf.datastructures
Class AbstractMatrix

java.lang.Object
  |
  +--com.tagtraum.perf.datastructures.AbstractMatrix
All Implemented Interfaces:
Matrix
Direct Known Subclasses:
ArrayMatrix, CRSMatrix, HashMatrix

public abstract class AbstractMatrix
extends java.lang.Object
implements Matrix

Base class for Matrix implementations.

Version:
$Id: $
Author:
Hendrik Schreiber

Constructor Summary
AbstractMatrix(int cols, int rows)
          Creates a matrix.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 int columns()
          The number of columns this matrix has.
 boolean equals(java.lang.Object obj)
          Dummy, better than nothing implementation for hashcode.
 int hashCode()
          Dummy, better than nothing implementation for hashcode.
 boolean isGrowable()
          Indicates whether this matrix can grow or has a fixed size.
protected  void rangeCheck(int col, int row)
          To be called by subclasses to check whether col and row are in range.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 int rows()
          The number of rows this matrix has.
protected  void setColumns(int cols)
           
protected  void setGrowable(boolean growable)
           
protected  void setRows(int rows)
           
 java.lang.String toString()
          Creates a string representation of this matrix.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.tagtraum.perf.datastructures.Matrix
get, remove, set
 

Constructor Detail

AbstractMatrix

public AbstractMatrix(int cols,
                      int rows)
Creates a matrix.

Parameters:
cols - number of cols this matrix should have.
rows - number of rows this matrix should have.
Throws:
java.lang.IllegalArgumentException - if cols or rows is less than zero
See Also:
rows(), columns()
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

isGrowable

public boolean isGrowable()
Description copied from interface: Matrix
Indicates whether this matrix can grow or has a fixed size.

Specified by:
isGrowable in interface Matrix

setGrowable

protected void setGrowable(boolean growable)

columns

public int columns()
Description copied from interface: Matrix
The number of columns this matrix has.

Specified by:
columns in interface Matrix
Returns:
the number of columns

rows

public int rows()
Description copied from interface: Matrix
The number of rows this matrix has.

Specified by:
rows in interface Matrix
Returns:
the number of rows

setColumns

protected void setColumns(int cols)

setRows

protected void setRows(int rows)

rangeCheck

protected void rangeCheck(int col,
                          int row)
To be called by subclasses to check whether col and row are in range.

Parameters:
col - column
row - row
Throws:
java.lang.IndexOutOfBoundsException - if col or row are less than zero or greater than the size of this matrix
See Also:
rows(), columns()

hashCode

public int hashCode()
Dummy, better than nothing implementation for hashcode. Needs to be overwritten for an efficient solution.

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Dummy, better than nothing implementation for hashcode. Needs to be overwritten for an efficient solution.

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Creates a string representation of this matrix.

Overrides:
toString in class java.lang.Object


Copyright © 2002 Hendrik Schreiber
http://www.tagtraum.com/performance/
This software can be distributed under LGPL