Assigned: Friday, February 13, 1998
Due: 8am, Friday, February 20, 1998
Summary. In this assignment, you will be developing
Matrix class that permits expansion and contraction.
Expectations. You are expected to turn in a working, well-commented, and well-tested version of this assignment. It should be possible to generate readable javadoc from your program and to understand how to use your class by reading only that javadoc. In addition, you should provide a reasonable test stuie.
Develop and test a
Matrix class that supports at least the
Matrix(Object def, int rows, in cols): create an appropriate sized matrix with all the elements set to
set(Object val, int row, int col): set the value at that position to
get(int row, int col): get the value at that position.
rows(): determine the number of rows.
columns(): determine the number of columns.
deleteRow(int row): delete one row.
deleteColumn(int col): delete one column.
insertRow(int row, Vector contents): insert one row.
insertColumn(int col, Vector contents): insert one column.
equals(Object obj): determine if another object is equivalent to this matrix.
toString(): generate a string representation of this matrix.
fillLine(Object obj, int start_row, int start_col, int delta_row, int delta_col, int end_row, int end_col): set a "line" of places in the matrix to
obj. For example,
fillLine("A", 0,2, 1,1, 5,7)would set positions (0,2), (1,3), (2,4), (3,5), (4,6), and (5,7) to "A".
Optionally, develop and test a
Pair class that permits you
to create and use pairs of integers and use that in your
It is likely that
Pair will support at least.
Pair(int x, int y)-- create a new pair.
int first()-- obtain the first element of the pair.
int second()-- obtain the second element of the pair.
int addToFirst(int offset)-- add
offsetto the first element of the pair.
int addToSecond(int offset)-- add
offsetto the second element of the pair.
setFirst(int val)-- set the value of the first element.
setSecond(int val)-- set the value of the second element.
Matrix class, it is likely that you will want
to add variants of at least
should also add a
positionOf(Object obj) method that
returns a position in which
obj appears if it appears
in the Matrix and a
positions(Object obj) that returns all
the positions in which
Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.
Source text last modified Wed Feb 18 07:28:23 1998.
This page generated on Tue Jan 12 11:44:34 1999 by SiteWeaver.
Contact our webmaster at firstname.lastname@example.org