beowulf.model
Class VectorMatrix

java.lang.Object
  extended bybeowulf.model.Matrix
      extended bybeowulf.model.VectorMatrix
All Implemented Interfaces:
Collection, Serializable

public class VectorMatrix
extends Matrix

This class is an extension to the Matrix class. This VectorMatrix contains a two dimensional grid of java.util.Vector objects. Some of the methods have been overridden for casting convenience, and the default value of an element of this matrix is a 0-element java.util.Vector

Version:
1.0 11/7/2003
Author:
Andy Scukanec (ags at cs dot cornell dot edu)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class beowulf.model.Matrix
data, numCols, numRows
 
Constructor Summary
VectorMatrix()
          Creates a new 1x1 vector matrix.
VectorMatrix(int size)
          Creates a new sizexsize vector matrix.
VectorMatrix(int rows, int cols)
          Creates a new rowsxcols vector matrix.
 
Method Summary
 Object getDefaultValue()
          The default value for a VectorMatrix is a new java.util.Vector.
 Vector getVector(int row, int col)
          This method returns the object at the specified position.
 boolean isEmpty()
          
 
Methods inherited from class beowulf.model.Matrix
add, add, addAll, clear, contains, containsAll, expandBy, expandBy, expandTo, expandTo, get, getCols, getRows, iterator, put, remove, remove, remove, removeAll, removeCol, removeRow, retainAll, size, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

VectorMatrix

public VectorMatrix()
Creates a new 1x1 vector matrix.


VectorMatrix

public VectorMatrix(int size)
Creates a new sizexsize vector matrix.

Parameters:
size - The size of the new vector matrix.

VectorMatrix

public VectorMatrix(int rows,
                    int cols)
Creates a new rowsxcols vector matrix.

Parameters:
rows - The number of rows in the new vector matrix.
cols - The number of columns in the new vector matrix.
Method Detail

getVector

public Vector getVector(int row,
                        int col)
This method returns the object at the specified position. If either row or col are out of bounds, an exception is thrown. The return value will never be null, and the cast to java.util.Vector is performed for tha calling function. A ClassCastException could be thrown if something other than a java.util.Vector has been stored in the matrix.

Parameters:
row - The row index of the value.
col - The column index of the value.
Returns:
The value at the indicated location.

getDefaultValue

public Object getDefaultValue()
The default value for a VectorMatrix is a new java.util.Vector.

Overrides:
getDefaultValue in class Matrix
Returns:
A new java.util.Vector.

isEmpty

public boolean isEmpty()

Specified by:
isEmpty in interface Collection
Overrides:
isEmpty in class Matrix
Returns:
True if and only if the only elements are 0-element java.util.Vectors.