/** * Intersect this range with the specified range. * * @param another - the specified range * @return code which reflects how the specified range Is related to this range.<br/> * Possible return codes are: * NO_INTERSECTION - the specified range Is outside of this range;<br/> * OVERLAP - both ranges partially overlap;<br/> * INSIDE - the specified range Is inside of this one<br/> * ENCLOSES - the specified range encloses (possibly exactly the same as) this range<br/> */ public int intersect(CellRange another) { int firstRow = another.FirstRow; int lastRow = another.LastRow; int firstCol = another.FirstColumn; int lastCol = another.LastColumn; if ( gt(FirstRow, lastRow) || lt(LastRow, firstRow) || gt(FirstColumn, lastCol) || lt(LastColumn, firstCol) ) { return(NO_INTERSECTION); } else if (Contains(another)) { return(INSIDE); } else if (another.Contains(this)) { return(ENCLOSES); } else { return(OVERLAP); } }
/** * Intersect this range with the specified range. * * @param another - the specified range * @return code which reflects how the specified range Is related to this range.<br/> * Possible return codes are: * NO_INTERSECTION - the specified range Is outside of this range;<br/> * OVERLAP - both ranges partially overlap;<br/> * INSIDE - the specified range Is inside of this one<br/> * ENCLOSES - the specified range encloses (possibly exactly the same as) this range<br/> */ public int intersect(CellRange another) { int firstRow = another.FirstRow; int lastRow = another.LastRow; int firstCol = another.FirstColumn; int lastCol = another.LastColumn; if ( gt(FirstRow, lastRow) || lt(LastRow, firstRow) || gt(FirstColumn, lastCol) || lt(LastColumn, firstCol) ) { return NO_INTERSECTION; } else if (Contains(another)) { return INSIDE; } else if (another.Contains(this)) { return ENCLOSES; } else { return OVERLAP; } }