## org.apache.poi.hssf.record.cf
Class CellRangeUtil

    java.lang.Object
      org.apache.poi.hssf.record.cf.CellRangeUtil

    public final class CellRangeUtil

extends java.lang.Object

Author:
  Dmitriy Kumshayev

Field Summary
`static int` `ENCLOSES` first range encloses or is equal to the second
`static int` `INSIDE` first range is within the second range
`static int` `NO_INTERSECTION`
`static int` `OVERLAP`

Method Summary
`static boolean` `contains(CellRangeAddress crA, CellRangeAddress crB)` Check if the specified range is located inside of this cell range.
`static CellRangeAddress` `createEnclosingCellRange(CellRangeAddress crA, CellRangeAddress crB)` Create an enclosing CellRange for the two cell ranges.
`static boolean` `hasExactSharedBorder(CellRangeAddress crA, CellRangeAddress crB)` Check if the specified cell range has a shared border with the current range.
`static int` `intersect(CellRangeAddress crA, CellRangeAddress crB)` Intersect this range with the specified range.
`static CellRangeAddress[]` `mergeCellRanges(CellRangeAddress[] cellRanges)` Do all possible cell merges between cells of the list so that: if a cell range is completely inside of another cell range, it gets removed from the list if two cells have a shared border, merge them into one bigger cell range

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### NO_INTERSECTION

    public static final int NO_INTERSECTION

See Also:
  Constant Field Values

### OVERLAP

    public static final int OVERLAP

See Also:
  Constant Field Values

### INSIDE

    public static final int INSIDE

  first range is within the second range

  See Also:
    Constant Field Values

### ENCLOSES

    public static final int ENCLOSES

  first range encloses or is equal to the second

  See Also:
    Constant Field Values

Method Detail

### intersect

    public static int intersect(CellRangeAddress crA,
                                CellRangeAddress crB)

  Intersect this range with the specified range.

  Parameters:
    `crB` - - the specified range
  Returns:
    code which reflects how the specified range is related to this range.
    Possible return codes are: NO_INTERSECTION - the specified range is outside of this range;
    OVERLAP - both ranges partially overlap;
    INSIDE - the specified range is inside of this one
    ENCLOSES - the specified range encloses (possibly exactly the same as) this range

### mergeCellRanges

    public static CellRangeAddress[] mergeCellRanges(CellRangeAddress[] cellRanges)

  Do all possible cell merges between cells of the list so that:
  - if a cell range is completely inside of another cell range, it gets removed from the list
  - if two cells have a shared border, merge them into one bigger cell range

  Parameters:
    `cellRanges` -
  Returns:
    updated List of cell ranges

### contains

    public static boolean contains(CellRangeAddress crA,
                                   CellRangeAddress crB)

  Check if the specified range is located inside of this cell range.

  Parameters:
    `crB` -
  Returns:
    true if this cell range contains the argument range inside if it's area

### hasExactSharedBorder

    public static boolean hasExactSharedBorder(CellRangeAddress crA,
                                               CellRangeAddress crB)

  Check if the specified cell range has a shared border with the current range.

  Returns:
    `true` if the ranges have a complete shared border (i.e. the two ranges together make a simple rectangular region.

### createEnclosingCellRange

    public static CellRangeAddress createEnclosingCellRange(CellRangeAddress crA,
                                                            CellRangeAddress crB)

  Create an enclosing CellRange for the two cell ranges.

  Returns:
    enclosing CellRange

Copyright 2012 The Apache Software Foundation or its licensors, as applicable.