|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.opensha.commons.data.Window2D
public class Window2D
Title: Window2D
Description: This class represents the sub indices of a window into a two dimensional matrix. A two dimensional matrix is usually specified by x and y coordinates, i.e. rows and columns. So a two dimensional matrix will have a max number of rows and a max number of columns. This window will have a start row and start column, end row and end column which determines the number of rows and columns that you are peering into.
This class is the data model ( javabean ) used by ContainerSubset2D to provide the indices as a window into the main Container2D matrix referenced within the ContainerSubset2D.
| Field Summary | |
|---|---|
protected static String |
C
Class name used for debugging. |
protected static boolean |
D
If true debugging statements are printed. |
protected int |
endCol
The last column of the window. |
protected int |
endRow
The last row of the window. |
protected int |
maxNumCols
The full number of columns in the full matrix. |
protected int |
maxNumRows
The number of rows in the full matrix. |
protected int |
numCols
The number of columns in this window. |
protected int |
numRows
The number of rows in this window. |
protected int |
startCol
The first column of the window. |
protected int |
startRow
The first row of the window. |
| Constructor Summary | |
|---|---|
Window2D()
No-arg Constructor - does nothing. |
|
| Method Summary | |
|---|---|
void |
calcUpperBounds()
This function calculates the end row and column based on the user input of start row column and num rows and columns. |
void |
checkLowerBounds(String S)
Checks that the specified row and column are valid indices into the 2D array. |
void |
checkUpperBounds(String S)
Checks that the specified row and column are valid indices into the 2D array. |
Object |
clone()
Returns an exact copy of this window. |
Window2D |
cloneWindow()
Returns an exact copy of this window. |
boolean |
equals(Object obj)
This function returns true if the input window has the same variables values as this window. |
boolean |
equalsWindow(Window2D window)
This function returns true if the input window has the same variables values as this window. |
int |
getEndCol()
Gets the endCol - javabean method |
int |
getEndRow()
Gets the endRow - javabean method |
int |
getMaxNumCols()
Gets the maxNumCols - javabean method |
int |
getMaxNumRows()
Gets the maxNumRows - javabean method |
int |
getNumCols()
Gets the numCols - javabean method |
int |
getNumRows()
Gets the numRows - javabean method |
int |
getStartCol()
Gets the startCol - javabean method |
int |
getStartRow()
Returns the first row of the window. |
int |
getTranslatedCol(int col)
Takes an input col of the window subset and translates it back to the original larger matrix.In other words adds the start col to the input col. |
int |
getTranslatedRow(int row)
Takes an input row of the window subset and translates it back to the original larger matrix. |
boolean |
isValidCol(int col)
This function determines if the specified input col fits within the window. |
boolean |
isValidRow(int row)
This function determines if the specified row fits within the window. |
void |
setEndCol(int endCol)
Sets the endCol - javabean method |
void |
setEndRow(int endRow)
Sets the endRow - javabean method |
void |
setNumCols(int numCols)
Sets the numCols - javabean method |
void |
setNumRows(int numRows)
Sets the numRows - javabean method |
void |
setStartCol(int startCol)
Sets the startCol - javabean method |
void |
setStartRow(int startRow)
Sets the startRow - javabean method |
void |
shiftCols(int delta)
Shift the start col of your window by delta. |
void |
shiftRows(int delta)
Shift the start row of your window by delta. |
String |
toString()
Helper function used for debugging. |
int |
windowSize()
Returns the number of rows times the num of columns in this window. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final String C
protected static final boolean D
protected int startRow
protected int endRow
protected int numRows
protected int maxNumRows
protected int startCol
protected int endCol
protected int numCols
protected int maxNumCols
| Constructor Detail |
|---|
public Window2D()
| Method Detail |
|---|
public boolean isValidRow(int row)
row - The row you wish to return from the window subset
public int getStartRow()
public boolean isValidCol(int col)
col - The col you wish to return of the window subset
public int getTranslatedRow(int row)
row - Input row you wish to translate to the original matrix row.
public int getTranslatedCol(int col)
col - Input col you wish to translate to the original matrix col.
public int windowSize()
public void shiftRows(int delta)
throws ArrayIndexOutOfBoundsException
delta - The amount you wish to shift
the window in index units.
ArrayIndexOutOfBoundsException - This exception is thrown if
the shift moves the windows either into negative values or outside
the range of the original matrix.
public void shiftCols(int delta)
throws ArrayIndexOutOfBoundsException
delta - The amount you wish to shift
the window in index units.
ArrayIndexOutOfBoundsException - This exception is thrown if
the shift moves the windows either into negative values or outside
the range of the original matrix.public void calcUpperBounds()
public void checkLowerBounds(String S)
throws ArrayIndexOutOfBoundsException
S - Debugging string used for
error messaging.
ArrayIndexOutOfBoundsException - Thrown if any of the window
index information is less than zero.
public void checkUpperBounds(String S)
throws ArrayIndexOutOfBoundsException
S - Debugging string used for
error messaging.
ArrayIndexOutOfBoundsException - Thrown if any index of the
window ie. start and end row and col fall beyond the maximum number
of rows and columns in the original matrix.public Object clone()
clone in class Objectpublic Window2D cloneWindow()
public boolean equalsWindow(Window2D window)
window - The input window to compare to this object.
public boolean equals(Object obj)
equals in class Objectobj - The input window to compare to this object.
public String toString()
toString in class Objectpublic void setStartRow(int startRow)
public void setStartCol(int startCol)
public int getStartCol()
public int getNumRows()
public int getNumCols()
public int getMaxNumRows()
public int getMaxNumCols()
public int getEndRow()
public int getEndCol()
public void setNumRows(int numRows)
public void setNumCols(int numCols)
public void setEndRow(int endRow)
public void setEndCol(int endCol)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||