dataStructures
Class Matrix

java.lang.Object
  |
  +--dataStructures.Matrix

public class Matrix
extends java.lang.Object
implements CloneableObject


Constructor Summary
Matrix(int theRows, int theColumns)
           
 
Method Summary
 Matrix add(Matrix m)
           
 java.lang.Object clone()
           
 void copy(Matrix m)
          copy the references in m into this
 java.lang.Object get(int i, int j)
           
 void increment(java.lang.Object x)
          increment all elements of this by x
static void main(java.lang.String[] args)
          test program
 Matrix multiply(Matrix m)
           
 void set(int i, int j, java.lang.Object newValue)
          set this(i,j) = newValue
 Matrix subtract(Matrix m)
           
 java.lang.String toString()
          convert the matrix into a string so it can be output
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Matrix

public Matrix(int theRows,
              int theColumns)
Method Detail

clone

public java.lang.Object clone()
Specified by:
clone in interface CloneableObject
Returns:
a clone of the matrix
Overrides:
clone in class java.lang.Object

copy

public void copy(Matrix m)
copy the references in m into this

get

public java.lang.Object get(int i,
                            int j)
Returns:
the element this(i,j)
Throws:
IndexOutOfBoundsException - when i or j invalid

set

public void set(int i,
                int j,
                java.lang.Object newValue)
set this(i,j) = newValue
Throws:
IndexOutOfBoundsException - when i or j invalid

add

public Matrix add(Matrix m)
Returns:
this + m
Throws:
java.lang.IllegalArgumentException - when matrices are incompatible

subtract

public Matrix subtract(Matrix m)
Returns:
this - m
Throws:
java.lang.IllegalArgumentException - when matrices are incompatible

multiply

public Matrix multiply(Matrix m)
Returns:
this * m
Throws:
java.lang.IllegalArgumentException - when matrices are incompatible

increment

public void increment(java.lang.Object x)
increment all elements of this by x

toString

public java.lang.String toString()
convert the matrix into a string so it can be output
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)
test program