From: Javen O'Neal Date: Mon, 30 Nov 2015 07:03:09 +0000 (+0000) Subject: bug 58670: cleanup from r1717192 X-Git-Tag: REL_3_14_BETA1~30 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5c8162182802997e54adfbda0c524ba2d13c42d2;p=poi.git bug 58670: cleanup from r1717192 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1717194 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/.project b/.project index 274051f30a..49241913cd 100644 --- a/.project +++ b/.project @@ -1,6 +1,6 @@ - ApachePOI + ApachePOI-warnings 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 { - private final SXSSFSheet _sheet; + private static final Boolean UNDEFINED = null; + + private final SXSSFSheet _sheet; // parent sheet private final SortedMap _cells = new TreeMap(); - 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 _sheet=sheet; } - /** - * @deprecated 3.14beta1 (circa 2015-11-30). Use {@link #cellIterator} instead. - */ public Iterator allCellsIterator() { return new CellIterator(); @@ -462,61 +461,52 @@ public class SXSSFRow implements Row, Comparable //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 { - 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 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 (posnull 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 { - 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 else throw new NoSuchElementException(); } + @Override public void remove() { throw new UnsupportedOperationException(); @@ -577,7 +568,7 @@ public class SXSSFRow implements Row, Comparable @Override public int hashCode() { - return (getSheet().hashCode() << 16) + getRowNum(); + return _cells.hashCode(); }