public abstract class CellRangeAddressBase extends java.lang.Object implements java.lang.Iterable<CellAddress>, Duplicatable, GenericRecord
Common superclass of 8-bit and 16-bit versions
Modifier and Type | Class and Description |
---|---|
static class |
CellRangeAddressBase.CellPosition
Indicates a cell or range is in the given relative position in a range.
|
Modifier | Constructor and Description |
---|---|
protected |
CellRangeAddressBase(int firstRow,
int lastRow,
int firstCol,
int lastCol) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsColumn(int colInd)
Check if the column is in the specified cell range
|
boolean |
containsRow(int rowInd)
Check if the row is in the specified cell range
|
boolean |
equals(java.lang.Object other) |
int |
getFirstColumn() |
int |
getFirstRow() |
java.util.Map<java.lang.String,java.util.function.Supplier<?>> |
getGenericProperties() |
int |
getLastColumn() |
int |
getLastRow() |
protected int |
getMaxColumn() |
protected int |
getMaxRow() |
protected int |
getMinColumn() |
protected int |
getMinRow() |
int |
getNumberOfCells() |
java.util.Set<CellRangeAddressBase.CellPosition> |
getPosition(int rowInd,
int colInd)
Useful for logic like table/range styling, where some elements apply based on relative position in a range.
|
int |
hashCode() |
boolean |
intersects(CellRangeAddressBase other)
Determines whether or not this CellRangeAddress and the specified CellRangeAddress intersect.
|
boolean |
isFullColumnRange() |
boolean |
isFullRowRange() |
boolean |
isInRange(Cell cell)
Determines if the given
Cell lies within the bounds
of this range. |
boolean |
isInRange(CellAddress ref)
Determines if the given
CellAddress lies within the bounds
of this range. |
boolean |
isInRange(CellReference ref)
Determines if the given
CellReference lies within the bounds
of this range. |
boolean |
isInRange(int rowInd,
int colInd)
Determines if the given coordinates lie within the bounds
of this range.
|
java.util.Iterator<CellAddress> |
iterator()
Returns an iterator over the CellAddresses in this cell range in row-major order.
|
void |
setFirstColumn(int firstCol) |
void |
setFirstRow(int firstRow) |
void |
setLastColumn(int lastCol) |
void |
setLastRow(int lastRow) |
java.lang.String |
toString() |
void |
validate(SpreadsheetVersion ssVersion)
Validate the range limits against the supplied version of Excel
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
copy
getGenericChildren, getGenericRecordType
protected CellRangeAddressBase(int firstRow, int lastRow, int firstCol, int lastCol)
public void validate(SpreadsheetVersion ssVersion)
ssVersion
- the version of Excel to validate againstjava.lang.IllegalArgumentException
- if the range limits are outside of the allowed rangepublic final boolean isFullColumnRange()
public final boolean isFullRowRange()
public final int getFirstColumn()
public final int getFirstRow()
public final int getLastColumn()
public final int getLastRow()
public boolean isInRange(int rowInd, int colInd)
rowInd
- The row, 0-based.colInd
- The column, 0-based.for checking if two ranges overlap
public boolean isInRange(CellReference ref)
CellReference
lies within the bounds
of this range.
NOTE: It is up to the caller to ensure the reference is for the correct sheet, since this instance doesn't have a sheet reference.
ref
- the CellReference to checkfor checking if two ranges overlap
public boolean isInRange(CellAddress ref)
CellAddress
lies within the bounds
of this range.
NOTE: It is up to the caller to ensure the reference is for the correct sheet, since this instance doesn't have a sheet reference.
ref
- the CellAddress to checkfor checking if two ranges overlap
public boolean isInRange(Cell cell)
Cell
lies within the bounds
of this range.
NOTE: It is up to the caller to ensure the reference is for the correct sheet, since this instance doesn't have a sheet reference.
cell
- the Cell to checkfor checking if two ranges overlap
public boolean containsRow(int rowInd)
rowInd
- the row to checkpublic boolean containsColumn(int colInd)
colInd
- the column to checkpublic boolean intersects(CellRangeAddressBase other)
other
- a candidate cell range address to check for intersection with this rangefor checking if a single cell intersects
public java.util.Set<CellRangeAddressBase.CellPosition> getPosition(int rowInd, int colInd)
rowInd
- colInd
- CellRangeAddressBase.CellPosition
s occupied by the given coordinates. Empty if the coordinates are not in the range, never null.public final void setFirstColumn(int firstCol)
firstCol
- column number for the upper left hand cornerpublic final void setFirstRow(int firstRow)
firstRow
- row number for the upper left hand cornerpublic final void setLastColumn(int lastCol)
lastCol
- column number for the lower right hand cornerpublic final void setLastRow(int lastRow)
lastRow
- row number for the lower right hand cornerpublic int getNumberOfCells()
public java.util.Iterator<CellAddress> iterator()
iterator
in interface java.lang.Iterable<CellAddress>
public final java.lang.String toString()
toString
in class java.lang.Object
protected int getMinRow()
protected int getMaxRow()
protected int getMinColumn()
protected int getMaxColumn()
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.util.Map<java.lang.String,java.util.function.Supplier<?>> getGenericProperties()
getGenericProperties
in interface GenericRecord
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.