-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatrixable.java
More file actions
19 lines (18 loc) · 1.2 KB
/
Matrixable.java
File metadata and controls
19 lines (18 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public interface Matrixable<anyType> // implements Cloneable
{
public anyType get(int r, int c); //returns the element at row r, col c
public anyType set(int r, int c, anyType x); //changes element at (r,c), returns old value
public void add(int r, int c, anyType x); //adds obj at row r, col c
public anyType remove(int r, int c);
public int size(); //returns # actual elements stored
public int numRows(); //returns # rows set in constructor
public int numColumns(); //returns # cols set in constructor
public Object[][] toArray(); //returns equivalent structure in 2-D array form
public boolean contains(anyType x); //true if x exists in list
public int[] getLocation(anyType x); //returns location [r,c] of where x exists in list, null otherwise
public boolean isEmpty(); //returns true if there are no actual elements stored
public void clear(); //clears all elements out of the list
public void setBlank(char blank); //allows the client to set the character that a blank spot in the array is
//represented by in String toString()
public Matrixable<anyType> clone(); //clone a Matrixable
}