コード例 #1
0
        /**
         * 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);
            }
        }
コード例 #2
0
ファイル: CellRange.cs プロジェクト: babywzazy/Server
        /**
         * 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;
            }
        }