Back to index

wims  3.65+svn20090927
CellRange.java
Go to the documentation of this file.
00001 /*
00002  * @(#)CellRange.java
00003  *
00004  * $Id: CellRange.java,v 1.13 2000/12/02 21:44:51 rkc10 Exp $
00005  *
00006  * Created on November 5, 2000, 1:19 AM
00007  */
00008 package SharpTools; 
00018 public class CellRange {
00019     
00021     CellPoint minCorner;
00022 
00024     CellPoint maxCorner;
00025 
00033     public CellRange(int[] rows, int[] cols) {
00034         //rows selected are in ascending order
00035         int minRow = rows[0];
00036         int maxRow = rows[rows.length - 1];
00037         
00038         //columns selected are in ascending order
00039         int minCol = cols[0];
00040         int maxCol = cols[cols.length - 1];
00041               
00042          minCorner = new CellPoint(minRow, minCol);
00043          maxCorner = new CellPoint(maxRow, maxCol);
00044        }
00045     
00054     public CellRange(int minRow, int maxRow, int minCol, int maxCol) {
00055        
00056        minCorner = new CellPoint(minRow, minCol);
00057        maxCorner = new CellPoint(maxRow, maxCol);
00058     }
00059 
00066     public CellRange(CellPoint ULHCorner, CellPoint LRHCorner) {
00067             minCorner = ULHCorner;
00068             maxCorner = LRHCorner;
00069     }
00070     
00076     public int getStartRow() {
00077         return minCorner.getRow();
00078     }
00079     
00085     public int getEndRow() {
00086         return maxCorner.getRow();
00087     }
00088     
00094     public int getStartCol() {
00095         return minCorner.getCol();
00096     }
00097     
00103     public int getEndCol() {
00104         return maxCorner.getCol();
00105     }
00106     
00112     public int getWidth() {
00113         return getEndCol() - getStartCol() + 1;
00114     }
00115     
00121     public int getHeight() {
00122         return getEndRow() - getStartRow() + 1;
00123     }
00124 
00128     public CellPoint getminCorner() {
00129         return minCorner;
00130     }
00134     public CellPoint getmaxCorner() {
00135         return maxCorner;
00136     }
00137 
00144     public String toString() {
00145        return minCorner.toString()+':'+maxCorner.toString();
00146     }
00147 }