summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaven O'Neal <onealj@apache.org>2015-11-30 07:03:09 +0000
committerJaven O'Neal <onealj@apache.org>2015-11-30 07:03:09 +0000
commit5c8162182802997e54adfbda0c524ba2d13c42d2 (patch)
tree1fd2ac4009d35043173e13f9466a034f9dd080a8
parent6422283181da8fe08292639950c46774991f945e (diff)
downloadpoi-5c8162182802997e54adfbda0c524ba2d13c42d2.tar.gz
poi-5c8162182802997e54adfbda0c524ba2d13c42d2.zip
bug 58670: cleanup from r1717192
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1717194 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--.project2
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFRow.java81
2 files changed, 37 insertions, 46 deletions
diff --git a/.project b/.project
index 274051f30a..49241913cd 100644
--- a/.project
+++ b/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>ApachePOI</name>
+ <name>ApachePOI-warnings</name>
<comment></comment>
<projects>
</projects>
diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFRow.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFRow.java
index 2b27b728bd..d815c27bba 100644
--- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFRow.java
+++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFRow.java
@@ -37,15 +37,17 @@ import org.apache.poi.util.Internal;
*/
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 short _style=-1;
- private short _height=-1;
- private boolean _zHeight = false;
+ private short _style = -1; // index of cell style in style table
+ private short _height = -1; // row height in twips (1/20 point)
+ 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
// use Boolean to have a tri-state for on/off/undefined
- private Boolean _hidden;
- private Boolean _collapsed;
+ private Boolean _hidden = UNDEFINED;
+ private Boolean _collapsed = UNDEFINED;
/**
*
@@ -63,9 +65,6 @@ public class SXSSFRow implements Row, Comparable<SXSSFRow>
_sheet=sheet;
}
- /**
- * @deprecated 3.14beta1 (circa 2015-11-30). Use {@link #cellIterator} instead.
- */
public Iterator<Cell> allCellsIterator()
{
return new CellIterator();
@@ -462,61 +461,52 @@ public class SXSSFRow implements Row, Comparable<SXSSFRow>
//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>
{
- int pos=0;
-
- FilledCellIterator(){
- int maxColumn = getLastCellNum(); //last column PLUS ONE
- for (int i = 0; i < maxColumn; i++) {
- if (_cells.get(i) != null) {
- pos = i;
- break;
- }
- }
- }
+ private final Iterator<SXSSFCell> iter = _cells.values().iterator();
+ @Override
public boolean hasNext()
{
- int maxColumn = getLastCellNum(); //last column PLUS ONE
- return pos < maxColumn;
- }
- void advanceToNext()
- {
- int maxColumn = getLastCellNum(); //last column PLUS ONE
- do {
- pos++;
- }
- while (pos<maxColumn && _cells.get(pos)==null);
+ return iter.hasNext();
}
+ @Override
public Cell next() throws NoSuchElementException
{
- if (hasNext())
- {
- Cell retval=_cells.get(pos);
- advanceToNext();
- return retval;
- }
- else
- {
- throw new NoSuchElementException();
- }
+ return iter.next();
}
+ @Override
public void remove()
{
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>
{
- int pos=0;
+ final int maxColumn = getLastCellNum(); //last column PLUS ONE
+ int pos = 0;
+
+ @Override
public boolean hasNext()
{
- int maxColumn = getLastCellNum(); //last column PLUS ONE
return pos < maxColumn;
}
+ @Override
public Cell next() throws NoSuchElementException
{
if (hasNext())
@@ -524,6 +514,7 @@ public class SXSSFRow implements Row, Comparable<SXSSFRow>
else
throw new NoSuchElementException();
}
+ @Override
public void remove()
{
throw new UnsupportedOperationException();
@@ -577,7 +568,7 @@ public class SXSSFRow implements Row, Comparable<SXSSFRow>
@Override
public int hashCode() {
- return (getSheet().hashCode() << 16) + getRowNum();
+ return _cells.hashCode();
}