mirror of https://github.com/apache/poi.git
bug 58670: cleanup from r1717192
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1717194 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6422283181
commit
5c81621828
2
.project
2
.project
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<projectDescription>
|
<projectDescription>
|
||||||
<name>ApachePOI</name>
|
<name>ApachePOI-warnings</name>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
|
|
|
@ -37,15 +37,17 @@ import org.apache.poi.util.Internal;
|
||||||
*/
|
*/
|
||||||
public class SXSSFRow implements Row, Comparable<SXSSFRow>
|
public class SXSSFRow implements Row, Comparable<SXSSFRow>
|
||||||
{
|
{
|
||||||
private final SXSSFSheet _sheet;
|
private static final Boolean UNDEFINED = null;
|
||||||
|
|
||||||
|
private final SXSSFSheet _sheet; // parent sheet
|
||||||
private final SortedMap<Integer, SXSSFCell> _cells = new TreeMap<Integer, SXSSFCell>();
|
private final SortedMap<Integer, SXSSFCell> _cells = new TreeMap<Integer, SXSSFCell>();
|
||||||
private short _style=-1;
|
private short _style = -1; // index of cell style in style table
|
||||||
private short _height=-1;
|
private short _height = -1; // row height in twips (1/20 point)
|
||||||
private boolean _zHeight = false;
|
private boolean _zHeight = false; // row zero-height (this is somehow different than being hidden)
|
||||||
private int _outlineLevel = 0; // Outlining level of the row, when outlining is on
|
private int _outlineLevel = 0; // Outlining level of the row, when outlining is on
|
||||||
// use Boolean to have a tri-state for on/off/undefined
|
// use Boolean to have a tri-state for on/off/undefined
|
||||||
private Boolean _hidden;
|
private Boolean _hidden = UNDEFINED;
|
||||||
private Boolean _collapsed;
|
private Boolean _collapsed = UNDEFINED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -63,9 +65,6 @@ public class SXSSFRow implements Row, Comparable<SXSSFRow>
|
||||||
_sheet=sheet;
|
_sheet=sheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated 3.14beta1 (circa 2015-11-30). Use {@link #cellIterator} instead.
|
|
||||||
*/
|
|
||||||
public Iterator<Cell> allCellsIterator()
|
public Iterator<Cell> allCellsIterator()
|
||||||
{
|
{
|
||||||
return new CellIterator();
|
return new CellIterator();
|
||||||
|
@ -462,61 +461,52 @@ public class SXSSFRow implements Row, Comparable<SXSSFRow>
|
||||||
//end of interface implementation
|
//end of interface implementation
|
||||||
|
|
||||||
|
|
||||||
/** returns all filled cells (created via Row.createCell())*/
|
/**
|
||||||
|
* Create an iterator over the cells from [0, getLastCellNum()).
|
||||||
|
* Includes blank cells, excludes empty cells
|
||||||
|
*
|
||||||
|
* @return an iterator over all filled cells (created via Row.createCell())
|
||||||
|
* @throws ConcurrentModificationException if cells are added, moved, or
|
||||||
|
* removed after the iterator is created.
|
||||||
|
*/
|
||||||
public class FilledCellIterator implements Iterator<Cell>
|
public class FilledCellIterator implements Iterator<Cell>
|
||||||
{
|
{
|
||||||
int pos=0;
|
private final Iterator<SXSSFCell> iter = _cells.values().iterator();
|
||||||
|
|
||||||
FilledCellIterator(){
|
|
||||||
int maxColumn = getLastCellNum(); //last column PLUS ONE
|
|
||||||
for (int i = 0; i < maxColumn; i++) {
|
|
||||||
if (_cells.get(i) != null) {
|
|
||||||
pos = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasNext()
|
public boolean hasNext()
|
||||||
{
|
{
|
||||||
int maxColumn = getLastCellNum(); //last column PLUS ONE
|
return iter.hasNext();
|
||||||
return pos < maxColumn;
|
|
||||||
}
|
|
||||||
void advanceToNext()
|
|
||||||
{
|
|
||||||
int maxColumn = getLastCellNum(); //last column PLUS ONE
|
|
||||||
do {
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
while (pos<maxColumn && _cells.get(pos)==null);
|
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Cell next() throws NoSuchElementException
|
public Cell next() throws NoSuchElementException
|
||||||
{
|
{
|
||||||
if (hasNext())
|
return iter.next();
|
||||||
{
|
|
||||||
Cell retval=_cells.get(pos);
|
|
||||||
advanceToNext();
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new NoSuchElementException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void remove()
|
public void remove()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/** returns all cells including empty cells in which case "null" is returned*/
|
/**
|
||||||
|
* returns all cells including empty cells (<code>null</code> values are returned
|
||||||
|
* for empty cells).
|
||||||
|
* This method is not synchronized. This iterator should not be used after
|
||||||
|
* cells are added, moved, or removed, though a ConcurrentModificationException
|
||||||
|
* is NOT thrown.
|
||||||
|
*/
|
||||||
public class CellIterator implements Iterator<Cell>
|
public class CellIterator implements Iterator<Cell>
|
||||||
{
|
{
|
||||||
|
final int maxColumn = getLastCellNum(); //last column PLUS ONE
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasNext()
|
public boolean hasNext()
|
||||||
{
|
{
|
||||||
int maxColumn = getLastCellNum(); //last column PLUS ONE
|
|
||||||
return pos < maxColumn;
|
return pos < maxColumn;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Cell next() throws NoSuchElementException
|
public Cell next() throws NoSuchElementException
|
||||||
{
|
{
|
||||||
if (hasNext())
|
if (hasNext())
|
||||||
|
@ -524,6 +514,7 @@ public class SXSSFRow implements Row, Comparable<SXSSFRow>
|
||||||
else
|
else
|
||||||
throw new NoSuchElementException();
|
throw new NoSuchElementException();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void remove()
|
public void remove()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
@ -577,7 +568,7 @@ public class SXSSFRow implements Row, Comparable<SXSSFRow>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return (getSheet().hashCode() << 16) + getRowNum();
|
return _cells.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue