diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2021-04-18 23:15:45 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2021-04-18 23:15:45 +0000 |
commit | 32c2de232594bb423c2b5da4818801c66dca17b9 (patch) | |
tree | b04781d3dbfdc24973353884063b22f7d911f4bb /poi | |
parent | 27e0842bcce8bef7125bfbe0d7ffd049acb27d7b (diff) | |
download | poi-32c2de232594bb423c2b5da4818801c66dca17b9.tar.gz poi-32c2de232594bb423c2b5da4818801c66dca17b9.zip |
Fix Javadocs
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1888939 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
22 files changed, 183 insertions, 182 deletions
diff --git a/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java b/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java index a8d2f2d492..d7363a5e8a 100644 --- a/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java +++ b/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java @@ -56,7 +56,7 @@ public final class ExtractorFactory { /** * Some OPCPackages are packed in side an OLE2 container. * If encrypted, the {@link DirectoryNode} is called {@link Decryptor#DEFAULT_POIFS_ENTRY "EncryptedPackage"}, - * otherwise the node is called "Packge" + * otherwise the node is called "Package" */ public static final String OOXML_PACKAGE = "Package"; diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDataFormatter.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDataFormatter.java index ef3eb93154..9452f5c64b 100644 --- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDataFormatter.java +++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDataFormatter.java @@ -40,26 +40,24 @@ import org.apache.poi.util.LocaleUtil; * prefix or suffix. * </p> * <p> - * For example the Excel pattern <code>"$#,##0.00 "USD"_);($#,##0.00 "USD")" - * </code> will be correctly formatted as "$1,000.00 USD" or "($1,000.00 USD)". - * However the pattern <code>"00-00-00"</code> is incorrectly formatted by + * For example the Excel pattern {@code "$#,##0.00 "USD"_);($#,##0.00 "USD")" + * } will be correctly formatted as "$1,000.00 USD" or "($1,000.00 USD)". + * However the pattern {@code "00-00-00"} is incorrectly formatted by * DecimalFormat as "000000--". For Excel formats that are not compatible with * DecimalFormat, you can provide your own custom {@link Format} implementation - * via <code>HSSFDataFormatter.addFormat(String,Format)</code>. The following + * via {@code HSSFDataFormatter.addFormat(String,Format)}. The following * custom formats are already provided by this class: * </p> - * <pre> * <ul><li>SSN "000-00-0000"</li> * <li>Phone Number "(###) ###-####"</li> * <li>Zip plus 4 "00000-0000"</li> * </ul> - * </pre> * <p> * If the Excel format pattern cannot be parsed successfully, then a default * format will be used. The default number format will mimic the Excel General * format: "#" for whole numbers and "#.##########" for decimal numbers. You - * can override the default format pattern with <code> - * HSSFDataFormatter.setDefaultNumberFormat(Format)</code>. <b>Note:</b> the + * can override the default format pattern with {@code + * HSSFDataFormatter.setDefaultNumberFormat(Format)}. <b>Note:</b> the * default format will only be used when a Format cannot be created from the * cell's data format string. */ diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java index dac56c030b..dc938d2de7 100644 --- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java +++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java @@ -868,7 +868,6 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { * Note that Excel allows sheet names up to 31 chars in length but other applications * (such as OpenOffice) allow more. Some versions of Excel crash with names longer than 31 chars, * others - truncate such names to 31 character. - * </p> * <p> * POI's SpreadsheetAPI silently truncates the input argument to 31 characters. * Example: @@ -878,7 +877,6 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { * assert 31 == sheet.getSheetName().length(); * assert "My very long sheet name which i" == sheet.getSheetName(); * }</pre> - * </p> * <p> * Except the 31-character constraint, Excel applies some other rules: * <p> @@ -895,7 +893,6 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { * <li> closing square bracket (]) </li> * </ul> * The string MUST NOT begin or end with the single quote (') character. - * </p> * * @param sheetname sheetname to set for the sheet. * @return Sheet representing the new sheet. diff --git a/poi/src/main/java/org/apache/poi/ss/formula/FormulaParser.java b/poi/src/main/java/org/apache/poi/ss/formula/FormulaParser.java index a05166e29e..b41e38baaa 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/FormulaParser.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/FormulaParser.java @@ -83,16 +83,16 @@ import org.apache.poi.util.Internal; /** * This class parses a formula string into a List of tokens in RPN order. - * Inspired by - * Lets Build a Compiler, by Jack Crenshaw + * Inspired by "Lets Build a Compiler" by Jack Crenshaw * BNF for the formula expression is : + * <pre>{@code * <expression> ::= <term> [<addop> <term>]* * <term> ::= <factor> [ <mulop> <factor> ]* * <factor> ::= <number> | (<expression>) | <cellRef> | <function> * <function> ::= <functionName> ([expression [, expression]*]) + * }</pre> * <p> * For POI internal use only - * <p> */ @Internal public final class FormulaParser { @@ -158,7 +158,7 @@ public final class FormulaParser { * @param workbook the parent workbook * @param formulaType the type of the formula * @param sheetIndex the 0-based index of the sheet this formula belongs to. - * The sheet index is required to resolve sheet-level names. <code>-1</code> means that + * The sheet index is required to resolve sheet-level names. {@code -1} means that * the scope of the name will be ignored and the parser will match names only by name * @param rowIndex - the related cell's row index in 0-based form (-1 if the formula is not cell related) * used to handle structured references that have the "#This Row" quantifier. @@ -183,7 +183,7 @@ public final class FormulaParser { * @param workbook the parent workbook * @param formulaType the type of the formula * @param sheetIndex the 0-based index of the sheet this formula belongs to. - * The sheet index is required to resolve sheet-level names. <code>-1</code> means that + * The sheet index is required to resolve sheet-level names. {@code -1} means that * the scope of the name will be ignored and the parser will match names only by name * * @return array of parsed tokens @@ -210,10 +210,10 @@ public final class FormulaParser { } return (Area3DPxg) arr[0]; } - + /** Read New Character From Input Stream */ private void GetChar() { - // The intersection operator is a space. We track whether the run of + // The intersection operator is a space. We track whether the run of // whitespace preceding "look" counts as an intersection operator. if (IsWhite(look)) { if (look == ' ') { @@ -223,7 +223,7 @@ public final class FormulaParser { else { _inIntersection = false; } - + // Check to see if we've walked off the end of the string. if (_pointer > _formulaLength) { throw new RuntimeException("Parsed past the end of the formula, pos: " + _pointer + @@ -382,9 +382,6 @@ public final class FormulaParser { } return false; } - if (token instanceof OperandPtg) { - return false; - } return false; } @@ -401,7 +398,7 @@ public final class FormulaParser { } /** - * @return <code>false</code> if sub-expression represented the specified ParseNode definitely + * @return {@code false} if sub-expression represented the specified ParseNode definitely * cannot appear on either side of the range (':') operator */ private static boolean isValidRangeOperand(ParseNode a) { @@ -432,12 +429,8 @@ public final class FormulaParser { } // one special case of ScalarConstantPtg - if (tkn == ErrPtg.REF_INVALID) { - return true; - } - // All other ControlPtgs and ScalarConstantPtgs cannot be used with ':' - return false; + return tkn == ErrPtg.REF_INVALID; } /** @@ -470,7 +463,7 @@ public final class FormulaParser { SkipWhite(); int savePointer = _pointer; SheetIdentifier sheetIden = parseSheetName(); - + if (sheetIden == null) { resetPointer(savePointer); } else { @@ -482,7 +475,7 @@ public final class FormulaParser { if (part1 == null) { if (sheetIden != null) { if(look == '#'){ // error ref like MySheet!#REF! - return new ParseNode(ErrPtg.valueOf(parseErrorLiteral())); + return new ParseNode(ErrPtg.valueOf(parseErrorLiteral())); } else { // Is it a named range? String name = parseAsName(); @@ -587,13 +580,13 @@ public final class FormulaParser { } - + private static final String specHeaders = "Headers"; private static final String specAll = "All"; private static final String specData = "Data"; private static final String specTotals = "Totals"; private static final String specThisRow = "This Row"; - + /** * Parses a structured reference, returns it as area reference. * Examples: @@ -617,11 +610,10 @@ public final class FormulaParser { * Table1[[#This Row], [col1]] * Table1[ [col1]:[col2] ] * </pre> - * @param tableName * @return Area Reference for the given table */ private ParseNode parseStructuredReference(String tableName) { - + if ( ! (_ssVersion.equals(SpreadsheetVersion.EXCEL2007)) ) { throw new FormulaParseException("Structured references work only on XSSF (Excel 2007+)!"); } @@ -630,17 +622,17 @@ public final class FormulaParser { throw new FormulaParseException("Illegal table name: '" + tableName + "'"); } String sheetName = tbl.getSheetName(); - + int startCol = tbl.getStartColIndex(); int endCol = tbl.getEndColIndex(); int startRow = tbl.getStartRowIndex(); int endRow = tbl.getEndRowIndex(); - + // Do NOT return before done reading all the structured reference tokens from the input stream. // Throwing exceptions is okay. int savePtr0 = _pointer; GetChar(); - + boolean isTotalsSpec = false; boolean isThisRowSpec = false; boolean isDataSpec = false; @@ -707,7 +699,7 @@ public final class FormulaParser { } } } - + if(nColQuantifiers == 0 && nSpecQuantifiers == 0){ resetPointer(savePtr0); savePtr0 = _pointer; @@ -757,15 +749,15 @@ public final class FormulaParser { return new ParseNode(ErrPtg.VALUE_INVALID); } else { throw new FormulaParseException( - "Formula contained [#This Row] or [@] structured reference but this row < 0. " + + "Formula contained [#This Row] or [@] structured reference but this row < 0. " + "Row index must be specified for row-referencing structured references."); } } - + int actualStartRow = startRow; int actualEndRow = endRow; int actualStartCol = startCol; - int actualEndCol = endCol; + int actualEndCol = endCol; if (nSpecQuantifiers > 0) { //Selecting rows if (nSpecQuantifiers == 1 && isAllSpec) { @@ -787,14 +779,14 @@ public final class FormulaParser { actualStartRow = actualEndRow; } else if ((nSpecQuantifiers == 1 && isThisRowSpec) || isThisRow) { actualStartRow = _rowIndex; //The rowNum is 0 based - actualEndRow = _rowIndex; + actualEndRow = _rowIndex; } else { throw new FormulaParseException("The formula "+ _formulaString + " is illegal"); } } else { if (isThisRow) { // there is a @ actualStartRow = _rowIndex; //The rowNum is 0 based - actualEndRow = _rowIndex; + actualEndRow = _rowIndex; } else { // Really no special quantifiers actualStartRow++; if (tbl.getTotalsRowCount() > 0) actualEndRow--; @@ -810,11 +802,11 @@ public final class FormulaParser { int startIdx = tbl.findColumnIndex(startColumnName); int endIdx = tbl.findColumnIndex(endColumnName); if (startIdx == -1 || endIdx == -1) { - throw new FormulaParseException("One of the columns "+ startColumnName +", "+ endColumnName +" doesn't exist in table "+ tbl.getName()); - } + throw new FormulaParseException("One of the columns "+ startColumnName +", "+ endColumnName +" doesn't exist in table "+ tbl.getName()); + } actualStartCol = startCol+ startIdx; actualEndCol = startCol + endIdx; - + } else if (nColQuantifiers == 1 && !isThisRow) { if (startColumnName == null) { throw new IllegalStateException("Fatal error"); @@ -832,7 +824,7 @@ public final class FormulaParser { Ptg ptg = _book.get3DReferencePtg(new AreaReference(topLeft, bottomRight, _ssVersion), sheetIden); return new ParseNode(ptg); } - + /** * Tries to parse the next as column - can contain whitespace * Caller should save pointer. @@ -855,7 +847,7 @@ public final class FormulaParser { } Match(']'); return name.toString(); - } + } /** * Tries to parse the next as special quantifier * Caller should save pointer. @@ -899,7 +891,7 @@ public final class FormulaParser { if (look == '"') { return new ParseNode(new StringPtg(parseStringLiteral())); } - + // from now on we can only be dealing with non-quoted identifiers // which will either be named ranges or functions String name = parseAsName(); @@ -929,7 +921,7 @@ public final class FormulaParser { throw new FormulaParseException("Specified name '" + name + "' is not a range as expected."); } - + private String parseAsName() { StringBuilder sb = new StringBuilder(); @@ -948,7 +940,7 @@ public final class FormulaParser { /** * @param ch unicode codepoint - * @return <code>true</code> if the specified character may be used in a defined name + * @return {@code true} if the specified character may be used in a defined name */ private static boolean isValidDefinedNameChar(int ch) { if (Character.isLetterOrDigit(ch)) { @@ -969,12 +961,11 @@ public final class FormulaParser { // includes special non-name control characters like ! $ : , ( ) [ ] and space return false; } - + /** * - * @param sheetIden may be <code>null</code> - * @param part1 - * @param part2 may be <code>null</code> + * @param sheetIden may be {@code null} + * @param part2 may be {@code null} */ private ParseNode createAreaRefParseNode(SheetIdentifier sheetIden, SimpleRangePart part1, SimpleRangePart part2) throws FormulaParseException { @@ -1015,14 +1006,14 @@ public final class FormulaParser { /** * Matches a zero or one letter-runs followed by zero or one digit-runs. * Either or both runs man optionally be prefixed with a single '$'. - * (copied+modified from {@link CellReference#CELL_REF_PATTERN}) + * (copied+modified from CellReference.CELL_REF_PATTERN) */ private static final Pattern CELL_REF_PATTERN = Pattern.compile("(\\$?[A-Za-z]+)?(\\$?[0-9]+)?"); /** * Parses out a potential LHS or RHS of a ':' intended to produce a plain AreaRef. Normally these are * proper cell references but they could also be row or column refs like "$AC" or "10" - * @return <code>null</code> (and leaves {@link #_pointer} unchanged if a proper range part does not parse out + * @return {@code null} (and leaves {@link #_pointer} unchanged if a proper range part does not parse out */ private SimpleRangePart parseSimpleRangePart() { int ptr = _pointer-1; // TODO avoid StringIndexOutOfBounds @@ -1132,9 +1123,9 @@ public final class FormulaParser { } /** - * @return <code>true</code> if the two range parts can be combined in an + * @return {@code true} if the two range parts can be combined in an * {@link AreaPtg} ( Note - the explicit range operator (:) may still be valid - * when this method returns <code>false</code> ) + * when this method returns {@code false} ) */ public boolean isCompatibleForArea(SimpleRangePart part2) { return _type == part2._type; @@ -1145,7 +1136,7 @@ public final class FormulaParser { return getClass().getName() + " [" + _rep + "]"; } } - + private String getBookName() { StringBuilder sb = new StringBuilder(); GetChar(); @@ -1158,8 +1149,8 @@ public final class FormulaParser { } /** - * Note - caller should reset {@link #_pointer} upon <code>null</code> result - * @return The sheet name as an identifier <code>null</code> if '!' is not found in the right place + * Note - caller should reset {@link #_pointer} upon {@code null} result + * @return The sheet name as an identifier {@code null} if '!' is not found in the right place */ private SheetIdentifier parseSheetName() { String bookName; @@ -1171,10 +1162,10 @@ public final class FormulaParser { if (look == '\'') { Match('\''); - + if (look == '[') bookName = getBookName(); - + StringBuilder sb = new StringBuilder(); boolean done = look == '\''; while(!done) { @@ -1228,9 +1219,9 @@ public final class FormulaParser { } return null; } - + /** - * If we have something that looks like [book]Sheet1: or + * If we have something that looks like [book]Sheet1: or * Sheet1, see if it's actually a range eg Sheet1:Sheet2! */ private SheetIdentifier parseSheetRange(String bookname, NameIdentifier sheet1Name) { @@ -1264,7 +1255,7 @@ public final class FormulaParser { } /** - * @return <code>true</code> if the specified name is a valid cell reference + * @return {@code true} if the specified name is a valid cell reference */ private boolean isValidCellReference(String str) { //check range bounds against grid max @@ -1297,7 +1288,7 @@ public final class FormulaParser { * Note - Excel function names are 'case aware but not case sensitive'. This method may end * up creating a defined name record in the workbook if the specified name is not an internal * Excel function, and has not been encountered before. - * + * * Side effect: creates workbook name if name is not recognized (name is probably a UDF) * * @param name case preserved function name (as it was entered/appeared in the formula). @@ -1319,7 +1310,7 @@ public final class FormulaParser { throw new FormulaParseException("Attempt to use name '" + name + "' as a function, but defined name in workbook does not refer to a function"); } - + // calls to user-defined functions within the workbook // get a Name token which points to a defined name record nameToken = hName.createPtg(); @@ -1354,7 +1345,7 @@ public final class FormulaParser { return getFunction(name, nameToken, args); } - + /** * Adds a name (named range or user defined function) to underlying workbook's names table */ @@ -1369,7 +1360,7 @@ public final class FormulaParser { * Generates the variable function ptg for the formula. * <p> * For IF Formulas, additional PTGs are added to the tokens - * @param name a {@link NamePtg} or {@link NameXPtg} or <code>null</code> + * @param name a {@link NamePtg} or {@link NameXPtg} or {@code null} * @return Ptg a null is returned if we're in an IF formula, it needs extreme manipulation and is handled in this function */ private ParseNode getFunction(String name, Ptg namePtg, ParseNode[] args) { @@ -1678,7 +1669,7 @@ public final class FormulaParser { if (!isPositive) { value = -value; } - return Double.valueOf(value); + return value; } private Ptg parseNumber() { @@ -1930,7 +1921,7 @@ public final class FormulaParser { return result; } } - + private ParseNode comparisonExpression() { ParseNode result = concatExpression(); while (true) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/atp/YearFrac.java b/poi/src/main/java/org/apache/poi/ss/formula/atp/YearFrac.java index a4f14b5436..9922654659 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/atp/YearFrac.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/atp/YearFrac.java @@ -40,7 +40,8 @@ import org.apache.poi.ss.util.DateParser; * * The <b>basis</b> optionally specifies the behaviour of YEARFRAC as follows: * - * <table border="0" cellpadding="1" cellspacing="0" summary="basis parameter description"> + * <table> + * <caption>basis parameter description</caption> * <tr><th>Value</th><th>Days per Month</th><th>Days per Year</th></tr> * <tr align='center'><td>0 (default)</td><td>30</td><td>360</td></tr> * <tr align='center'><td>1</td><td>actual</td><td>actual</td></tr> @@ -58,6 +59,7 @@ final class YearFrac implements FreeRefFunction { // enforce singleton } + @Override public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) { int srcCellRow = ec.getRowIndex(); int srcCellCol = ec.getColumnIndex(); @@ -90,7 +92,7 @@ final class YearFrac implements FreeRefFunction { String strVal = ((StringEval) ve).getStringValue(); Double dVal = OperandResolver.parseDouble(strVal); if (dVal != null) { - return dVal.doubleValue(); + return dVal; } LocalDate date = DateParser.parseLocalDate(strVal); return DateUtil.getExcelDate(date, false); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/OperandResolver.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/OperandResolver.java index 2177e9115b..38f43137cc 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/OperandResolver.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/OperandResolver.java @@ -111,7 +111,8 @@ public final class OperandResolver { * area depending on the coordinates of the calling cell. Here is an example demonstrating * both selection from a single row area and a single column area in the same formula. * - * <table border="1" cellpadding="1" cellspacing="1" summary="sample spreadsheet"> + * <table> + * <caption>sample spreadsheet</caption> * <tr><th> </th><th> A </th><th> B </th><th> C </th><th> D </th></tr> * <tr><th>1</th><td>15</td><td>20</td><td>25</td><td> </td></tr> * <tr><th>2</th><td> </td><td> </td><td> </td><td>200</td></tr> @@ -122,7 +123,8 @@ public final class OperandResolver { * If the formula "=1000+A1:B1+D2:D3" is put into the 9 cells from A2 to C4, the spreadsheet * will look like this: * - * <table border="1" cellpadding="1" cellspacing="1" summary="sample spreadsheet"> + * <table> + * <caption>sample spreadsheet</caption> * <tr><th> </th><th> A </th><th> B </th><th> C </th><th> D </th></tr> * <tr><th>1</th><td>15</td><td>20</td><td>25</td><td> </td></tr> * <tr><th>2</th><td>1215</td><td>1220</td><td>#VALUE!</td><td>200</td></tr> diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Countblank.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Countblank.java index 560a776b54..1963071686 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Countblank.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Countblank.java @@ -25,13 +25,15 @@ import org.apache.poi.ss.formula.functions.CountUtils.I_MatchPredicate; * Implementation for the function COUNTBLANK * <p> * Syntax: COUNTBLANK ( range ) - * <table border="0" cellpadding="1" cellspacing="0" summary="Parameter descriptions"> + * <table> + * <caption>Parameter descriptions</caption> * <tr><th>range </th><td>is the range of cells to count blanks</td></tr> * </table> * </p> */ public final class Countblank extends Fixed1ArgFunction { + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0) { double result; @@ -45,14 +47,11 @@ public final class Countblank extends Fixed1ArgFunction { return new NumberEval(result); } - private static final I_MatchPredicate predicate = new I_MatchPredicate() { - - public boolean matches(ValueEval valueEval) { - // Note - only BlankEval counts - return valueEval == BlankEval.instance || - // see https://support.office.com/en-us/article/COUNTBLANK-function-6a92d772-675c-4bee-b346-24af6bd3ac22 - // "Cells with formulas that return "" (empty text) are also counted." - (valueEval instanceof StringEval && ((StringEval)valueEval).getStringValue().isEmpty()); - } + private static final I_MatchPredicate predicate = valueEval -> { + // Note - only BlankEval counts + return valueEval == BlankEval.instance || + // see https://support.office.com/en-us/article/COUNTBLANK-function-6a92d772-675c-4bee-b346-24af6bd3ac22 + // "Cells with formulas that return "" (empty text) are also counted." + (valueEval instanceof StringEval && ((StringEval)valueEval).getStringValue().isEmpty()); }; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Countif.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Countif.java index 1f37d2e433..85444596d5 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Countif.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Countif.java @@ -36,11 +36,11 @@ import org.apache.poi.ss.usermodel.FormulaError; * Implementation for the function COUNTIF * <p> * Syntax: COUNTIF ( range, criteria ) - * <table border="0" cellpadding="1" cellspacing="0" summary="Parameter descriptions"> + * <table> + * <caption>Parameter descriptions</caption> * <tr><th>range </th><td>is the range of cells to be counted based on the criteria</td></tr> * <tr><th>criteria</th><td>is used to determine which cells to count</td></tr> * </table> - * </p> */ public final class Countif extends Fixed2ArgFunction { @@ -138,10 +138,7 @@ public final class Countif extends Fixed2ArgFunction { } @Override public String toString() { - StringBuilder sb = new StringBuilder(64); - sb.append(getClass().getName()); - sb.append(" [").append(_representation).append("]"); - return sb.toString(); + return getClass().getName() + " [" + _representation + "]"; } public String getRepresentation() { return _representation; @@ -208,7 +205,7 @@ public final class Countif extends Fixed2ArgFunction { // x is text that is not a number return false; } - return _value == val.doubleValue(); + return _value == val; } else if((x instanceof NumberEval)) { NumberEval ne = (NumberEval) x; testValue = ne.getNumberValue(); @@ -304,7 +301,7 @@ public final class Countif extends Fixed2ArgFunction { } return false; } - + public int getValue() { return _value; } @@ -377,7 +374,7 @@ public final class Countif extends Fixed2ArgFunction { } /** * Translates Excel countif wildcard strings into java regex strings - * @return <code>null</code> if the specified value contains no special wildcard characters. + * @return {@code null} if the specified value contains no special wildcard characters. */ public static Pattern getWildCardPattern(String value) { int len = value.length(); @@ -458,7 +455,7 @@ public final class Countif extends Fixed2ArgFunction { /** * Creates a criteria predicate object for the supplied criteria arg - * @return <code>null</code> if the arg evaluates to blank. + * @return {@code null} if the arg evaluates to blank. */ /* package */ static I_MatchPredicate createCriteriaPredicate(ValueEval arg, int srcRowIndex, int srcColumnIndex) { @@ -505,12 +502,12 @@ public final class Countif extends Fixed2ArgFunction { Boolean booleanVal = parseBoolean(value); if(booleanVal != null) { - return new BooleanMatcher(booleanVal.booleanValue(), operator); + return new BooleanMatcher(booleanVal, operator); } Double doubleVal = OperandResolver.parseDouble(value); if(doubleVal != null) { - return new NumberMatcher(doubleVal.doubleValue(), operator); + return new NumberMatcher(doubleVal, operator); } ErrorEval ee = parseError(value); if (ee != null) { @@ -550,7 +547,7 @@ public final class Countif extends Fixed2ArgFunction { } /** * Boolean literals ('TRUE', 'FALSE') treated similarly but NOT same as numbers. - * @return <code>null</code> to represent blank values + * @return {@code null} to represent blank values */ /* package */ static Boolean parseBoolean(String strRep) { if (strRep.length() < 1) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Errortype.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Errortype.java index 486465a7b1..43d6d8560e 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Errortype.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Errortype.java @@ -31,7 +31,8 @@ import org.apache.poi.ss.usermodel.FormulaError; * <b>ERROR.TYPE</b>(<b>errorValue</b>)</p> * <p> * Returns a number corresponding to the error type of the supplied argument. - * <table border="1" cellpadding="1" cellspacing="1" summary="Return values for ERROR.TYPE()"> + * <table> + * <caption>Return values for ERROR.TYPE()</caption> * <tr><td>errorValue</td><td>Return Value</td></tr> * <tr><td>#NULL!</td><td>1</td></tr> * <tr><td>#DIV/0!</td><td>2</td></tr> diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Index.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Index.java index 1238f03125..eeac5d7952 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Index.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Index.java @@ -33,7 +33,8 @@ import org.apache.poi.ss.formula.TwoDEval; * Syntax : <p> * INDEX ( reference, row_num[, column_num [, area_num]])<p> * INDEX ( array, row_num[, column_num]) - * <table border="0" cellpadding="1" cellspacing="0" summary="Parameter descriptions"> + * <table> + * <caption>Parameter descriptions</caption> * <tr><th>reference</th><td>typically an area reference, possibly a union of areas</td></tr> * <tr><th>array</th><td>a literal array value (currently not supported)</td></tr> * <tr><th>row_num</th><td>selects the row within the array or area reference</td></tr> @@ -43,6 +44,7 @@ import org.apache.poi.ss.formula.TwoDEval; */ public final class Index implements Function2Arg, Function3Arg, Function4Arg, ArrayMode { + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { TwoDEval reference = convertFirstArg(arg0); @@ -67,6 +69,7 @@ public final class Index implements Function2Arg, Function3Arg, Function4Arg, Ar return e.getErrorEval(); } } + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2) { TwoDEval reference = convertFirstArg(arg0); @@ -79,6 +82,7 @@ public final class Index implements Function2Arg, Function3Arg, Function4Arg, Ar return e.getErrorEval(); } } + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2, ValueEval arg3) { throw new RuntimeException("Incomplete code" @@ -104,6 +108,7 @@ public final class Index implements Function2Arg, Function3Arg, Function4Arg, Ar } + @Override public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) { switch (args.length) { case 2: diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Indirect.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Indirect.java index 0eb2c04afc..2728e0ea25 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Indirect.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Indirect.java @@ -35,7 +35,7 @@ import org.apache.poi.ss.usermodel.Table; * * INDIRECT() returns the cell or area reference denoted by the text argument.<p> * - * <b>Syntax</b>:</br> + * <b>Syntax</b>:<br> * <b>INDIRECT</b>(<b>ref_text</b>,isA1Style)<p> * * <b>ref_text</b> a string representation of the desired reference as it would @@ -51,6 +51,7 @@ public final class Indirect implements FreeRefFunction { // enforce singleton } + @Override public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) { if (args.length < 1) { return ErrorEval.VALUE_INVALID; @@ -88,7 +89,7 @@ public final class Indirect implements FreeRefFunction { } // numeric quantities follow standard boolean conversion rules // for strings, only "TRUE" and "FALSE" (case insensitive) are valid - return OperandResolver.coerceValueToBoolean(ve, false).booleanValue(); + return OperandResolver.coerceValueToBoolean(ve, false); } private static ValueEval evaluateIndirect(final OperationEvaluationContext ec, String text, @@ -116,7 +117,7 @@ public final class Indirect implements FreeRefFunction { if (Table.isStructuredReference.matcher(refText).matches()) { // The argument is structured reference - Area3DPxg areaPtg = null; + Area3DPxg areaPtg; try { areaPtg = FormulaParser.parseStructuredReference(refText, (FormulaParsingWorkbook) ec.getWorkbook(), ec.getRowIndex()); } catch (FormulaParseException e) { @@ -142,7 +143,7 @@ public final class Indirect implements FreeRefFunction { /** * @return array of length 2: {workbookName, sheetName,}. Second element will always be * present. First element may be null if sheetName is unqualified. - * Returns <code>null</code> if text cannot be parsed. + * Returns {@code null} if text cannot be parsed. */ private static String[] parseWorkbookAndSheetName(CharSequence text) { int lastIx = text.length() - 1; @@ -212,7 +213,7 @@ public final class Indirect implements FreeRefFunction { } /** - * @return <code>null</code> if there is a syntax error in any escape sequence + * @return {@code null} if there is a syntax error in any escape sequence * (the typical syntax error is a single quote character not followed by another). */ private static String unescapeString(CharSequence text) { @@ -246,9 +247,6 @@ public final class Indirect implements FreeRefFunction { if (Character.isWhitespace(text.charAt(0))) { return true; } - if (Character.isWhitespace(text.charAt(lastIx))) { - return true; - } - return false; + return Character.isWhitespace(text.charAt(lastIx)); } } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java index 135614d3c7..975781d584 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java @@ -367,7 +367,8 @@ final class LookupUtils { * Processes the third argument to VLOOKUP, or HLOOKUP (<b>col_index_num</b> * or <b>row_index_num</b> respectively).<br> * Sample behaviour: - * <table border="0" cellpadding="1" cellspacing="2" summary="Sample behaviour"> + * <table> + * <caption>Sample behaviour</caption> * <tr><th>Input Return</th><th>Value </th><th>Thrown Error</th></tr> * <tr><td>5</td><td>4</td><td> </td></tr> * <tr><td>2.9</td><td>2</td><td> </td></tr> diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Subtotal.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Subtotal.java index bbdb6c96e3..cc18fa7668 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Subtotal.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Subtotal.java @@ -19,58 +19,57 @@ package org.apache.poi.ss.formula.functions; import static org.apache.poi.ss.formula.functions.AggregateFunction.subtotalInstance; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + import org.apache.poi.ss.formula.LazyRefEval; import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.ss.formula.eval.EvaluationException; -import org.apache.poi.ss.formula.eval.NotImplementedException; import org.apache.poi.ss.formula.eval.NotImplementedFunctionException; import org.apache.poi.ss.formula.eval.OperandResolver; import org.apache.poi.ss.formula.eval.ValueEval; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - /** * Implementation for the Excel function SUBTOTAL<p> * * <b>Syntax :</b> <br> * SUBTOTAL ( <b>functionCode</b>, <b>ref1</b>, ref2 ... ) <br> - * <table border="1" cellpadding="1" cellspacing="0" summary="Parameter descriptions"> + * <table> + * <caption>Parameter descriptions</caption> * <tr><td><b>functionCode</b></td><td>(1-11) Selects the underlying aggregate function to be used (see table below)</td></tr> * <tr><td><b>ref1</b>, ref2 ...</td><td>Arguments to be passed to the underlying aggregate function</td></tr> * </table><br> - * </p> * - * <table border="1" cellpadding="1" cellspacing="0" summary="Parameter descriptions"> + * <table> + * <caption>Parameter descriptions</caption> * <tr><th>functionCode</th><th>Aggregate Function</th></tr> - * <tr align='center'><td>1</td><td>AVERAGE</td></tr> - * <tr align='center'><td>2</td><td>COUNT</td></tr> - * <tr align='center'><td>3</td><td>COUNTA</td></tr> - * <tr align='center'><td>4</td><td>MAX</td></tr> - * <tr align='center'><td>5</td><td>MIN</td></tr> - * <tr align='center'><td>6</td><td>PRODUCT</td></tr> - * <tr align='center'><td>7</td><td>STDEV</td></tr> - * <tr align='center'><td>8</td><td>STDEVP *</td></tr> - * <tr align='center'><td>9</td><td>SUM</td></tr> - * <tr align='center'><td>10</td><td>VAR *</td></tr> - * <tr align='center'><td>11</td><td>VARP *</td></tr> - * <tr align='center'><td>101</td><td>AVERAGE</td></tr> - * <tr align='center'><td>102</td><td>COUNT</td></tr> - * <tr align='center'><td>103</td><td>COUNTA</td></tr> - * <tr align='center'><td>104</td><td>MAX</td></tr> - * <tr align='center'><td>105</td><td>MIN</td></tr> - * <tr align='center'><td>106</td><td>PRODUCT</td></tr> - * <tr align='center'><td>107</td><td>STDEV</td></tr> - * <tr align='center'><td>108</td><td>STDEVP *</td></tr> - * <tr align='center'><td>109</td><td>SUM</td></tr> - * <tr align='center'><td>110</td><td>VAR *</td></tr> - * <tr align='center'><td>111</td><td>VARP *</td></tr> + * <tr><td>1</td><td>AVERAGE</td></tr> + * <tr><td>2</td><td>COUNT</td></tr> + * <tr><td>3</td><td>COUNTA</td></tr> + * <tr><td>4</td><td>MAX</td></tr> + * <tr><td>5</td><td>MIN</td></tr> + * <tr><td>6</td><td>PRODUCT</td></tr> + * <tr><td>7</td><td>STDEV</td></tr> + * <tr><td>8</td><td>STDEVP *</td></tr> + * <tr><td>9</td><td>SUM</td></tr> + * <tr><td>10</td><td>VAR *</td></tr> + * <tr><td>11</td><td>VARP *</td></tr> + * <tr><td>101</td><td>AVERAGE</td></tr> + * <tr><td>102</td><td>COUNT</td></tr> + * <tr><td>103</td><td>COUNTA</td></tr> + * <tr><td>104</td><td>MAX</td></tr> + * <tr><td>105</td><td>MIN</td></tr> + * <tr><td>106</td><td>PRODUCT</td></tr> + * <tr><td>107</td><td>STDEV</td></tr> + * <tr><td>108</td><td>STDEVP *</td></tr> + * <tr><td>109</td><td>SUM</td></tr> + * <tr><td>110</td><td>VAR *</td></tr> + * <tr><td>111</td><td>VARP *</td></tr> * </table><br> * * Not implemented in POI yet. Functions 101-111 are the same as functions 1-11 but with * the option 'ignore hidden values'. - * <p> */ public class Subtotal implements Function { @@ -102,6 +101,7 @@ public class Subtotal implements Function { throw EvaluationException.invalidValue(); } + @Override public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) { int nInnerArgs = args.length-1; // -1: first arg is used to select from a basic aggregate function if (nInnerArgs < 1) { @@ -109,7 +109,7 @@ public class Subtotal implements Function { } final Function innerFunc; - int functionCode = 0; + int functionCode; try { ValueEval ve = OperandResolver.getSingleValue(args[0], srcRowIndex, srcColumnIndex); functionCode = OperandResolver.coerceValueToInt(ve); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumif.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumif.java index 5ae3f1cba1..22431a920a 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumif.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumif.java @@ -30,7 +30,8 @@ import org.apache.poi.ss.formula.functions.CountUtils.I_MatchPredicate; * * Syntax : <br> * SUMIF ( <b>range</b>, <b>criteria</b>, sum_range ) <br> - * <table border="0" cellpadding="1" cellspacing="0" summary="Parameter descriptions"> + * <table> + * <caption>Parameter descriptions</caption> * <tr><th>range</th><td>The range over which criteria is applied. Also used for addend values when the third parameter is not present</td></tr> * <tr><th>criteria</th><td>The value or expression used to filter rows from <b>range</b></td></tr> * <tr><th>sum_range</th><td>Locates the top-left corner of the corresponding range of addends - values to be added (after being selected by the criteria)</td></tr> @@ -38,6 +39,7 @@ import org.apache.poi.ss.formula.functions.CountUtils.I_MatchPredicate; */ public final class Sumif extends Var2or3ArgFunction { + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { AreaEval aeRange; @@ -49,6 +51,7 @@ public final class Sumif extends Var2or3ArgFunction { return eval(srcRowIndex, srcColumnIndex, arg1, aeRange, aeRange); } + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumproduct.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumproduct.java index 481e7f492d..8aca2a6389 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumproduct.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumproduct.java @@ -36,7 +36,8 @@ import org.apache.poi.ss.formula.eval.ValueEval; * * Syntax : <br> * SUMPRODUCT ( array1[, array2[, array3[, ...]]]) - * <table border="0" cellpadding="1" cellspacing="0" summary="Parameter descriptions"> + * <table> + * <caption>Parameter descriptions</caption> * <tr><th>array1, ... arrayN </th><td>typically area references, * possibly cell references or scalar values</td></tr> * </table><br> @@ -54,6 +55,7 @@ import org.apache.poi.ss.formula.eval.ValueEval; public final class Sumproduct implements Function { + @Override public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) { int maxN = args.length; @@ -87,8 +89,8 @@ public final class Sumproduct implements Function { int maxN = evalArgs.length; double term = 1D; - for(int n=0; n<maxN; n++) { - double val = getScalarValue(evalArgs[n]); + for (ValueEval evalArg : evalArgs) { + double val = getScalarValue(evalArg); term *= val; } return new NumberEval(term); @@ -178,13 +180,12 @@ public final class Sumproduct implements Function { } private static boolean areasAllSameSize(TwoDEval[] args, int height, int width) { - for (int i = 0; i < args.length; i++) { - TwoDEval areaEval = args[i]; + for (TwoDEval areaEval : args) { // check that height and width match - if(areaEval.getHeight() != height) { + if (areaEval.getHeight() != height) { return false; } - if(areaEval.getWidth() != width) { + if (areaEval.getWidth() != width) { return false; } } @@ -193,12 +194,12 @@ public final class Sumproduct implements Function { /** - * Determines a <code>double</code> value for the specified <code>ValueEval</code>. - * @param isScalarProduct <code>false</code> for SUMPRODUCTs over area refs. - * @throws EvaluationException if <code>ve</code> represents an error value. + * Determines a {@code double} value for the specified {@code ValueEval}. + * @param isScalarProduct {@code false} for SUMPRODUCTs over area refs. + * @throws EvaluationException if {@code ve} represents an error value. * <p> * Note - string values and empty cells are interpreted differently depending on - * <code>isScalarProduct</code>. For scalar products, if any term is blank or a string, the + * {@code isScalarProduct}. For scalar products, if any term is blank or a string, the * error (#VALUE!) is raised. For area (sum)products, if any term is blank or a string, the * result is zero. */ diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Trend.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Trend.java index 62eb545670..157663d0a1 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Trend.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Trend.java @@ -47,7 +47,8 @@ import org.apache.poi.ss.formula.eval.ValueEval; * * Syntax:<br> * TREND(known_y's, known_x's, new_x's, constant) - * <table border="0" cellpadding="1" cellspacing="0" summary="Parameter descriptions"> + * <table> + * <caption>Parameter descriptions</caption> * <tr><th>known_y's, known_x's, new_x's</th><td>typically area references, possibly cell references or scalar values</td></tr> * <tr><th>constant</th><td><b>TRUE</b> or <b>FALSE</b>: * determines whether the regression line should include an intercept term</td></tr> @@ -56,7 +57,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; * of the same size as <b>known_y's</b>.<br> * If <b>new_x's</b> is not given, it is assumed to be the same as <b>known_x's</b><br> * If <b>constant</b> is omitted, it is assumed to be <b>TRUE</b> - * </p> */ public final class Trend implements Function { @@ -72,6 +72,7 @@ public final class Trend implements Function { } } + @Override public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) { if (args.length < 1 || args.length > 4) { return ErrorEval.VALUE_INVALID; diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/Workbook.java b/poi/src/main/java/org/apache/poi/ss/usermodel/Workbook.java index 156d1b0d7a..484625755d 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/Workbook.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/Workbook.java @@ -164,12 +164,11 @@ public interface Workbook extends Closeable, Iterable<Sheet> { * POI's SpreadsheetAPI silently truncates the input argument to 31 characters. * Example: * - * <pre><code> + * <pre>{@code * Sheet sheet = workbook.createSheet("My very long sheet name which is longer than 31 chars"); // will be truncated * assert 31 == sheet.getSheetName().length(); * assert "My very long sheet name which i" == sheet.getSheetName(); - * </code></pre> - * </p> + * }</pre> * * Except the 31-character constraint, Excel applies some other rules: * <p> @@ -186,7 +185,6 @@ public interface Workbook extends Closeable, Iterable<Sheet> { * <li> closing square bracket (]) </li> * </ul> * The string MUST NOT begin or end with the single quote (') character. - * </p> * * <p> * See {@link org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal)} @@ -237,7 +235,7 @@ public interface Workbook extends Closeable, Iterable<Sheet> { * Get sheet with the given name * * @param name of the sheet - * @return Sheet with the name provided or <code>null</code> if it does not exist + * @return Sheet with the name provided or {@code null} if it does not exist */ Sheet getSheet(String name); @@ -258,7 +256,7 @@ public interface Workbook extends Closeable, Iterable<Sheet> { /** * Finds a font that matches the one with the supplied attributes * - * @return the font with the matched attributes or <code>null</code> + * @return the font with the matched attributes or {@code null} */ Font findFont(boolean bold, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline); @@ -337,7 +335,7 @@ public interface Workbook extends Closeable, Iterable<Sheet> { /** * @param name the name of the defined name - * @return the defined name with the specified name. <code>null</code> if not found. + * @return the defined name with the specified name. {@code null} if not found. */ Name getName(String name); @@ -479,12 +477,12 @@ public interface Workbook extends Closeable, Iterable<Sheet> { CreationHelper getCreationHelper(); /** - * @return <code>false</code> if this workbook is not visible in the GUI + * @return {@code false} if this workbook is not visible in the GUI */ boolean isHidden(); /** - * @param hiddenFlag pass <code>false</code> to make the workbook visible in the GUI + * @param hiddenFlag pass {@code false} to make the workbook visible in the GUI */ void setHidden(boolean hiddenFlag); @@ -495,7 +493,7 @@ public interface Workbook extends Closeable, Iterable<Sheet> { * ({@link #isSheetVeryHidden(int)}) * </p> * @param sheetIx Number - * @return <code>true</code> if sheet is hidden + * @return {@code true} if sheet is hidden * @see #getSheetVisibility(int) */ boolean isSheetHidden(int sheetIx); @@ -507,7 +505,7 @@ public interface Workbook extends Closeable, Iterable<Sheet> { * ({@link #isSheetHidden(int)}) * </p> * @param sheetIx sheet index to check - * @return <code>true</code> if sheet is very hidden + * @return {@code true} if sheet is very hidden * @see #getSheetVisibility(int) */ boolean isSheetVeryHidden(int sheetIx); diff --git a/poi/src/main/java/org/apache/poi/ss/util/AreaReference.java b/poi/src/main/java/org/apache/poi/ss/util/AreaReference.java index 6312673b57..97c2016e7c 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/AreaReference.java +++ b/poi/src/main/java/org/apache/poi/ss/util/AreaReference.java @@ -383,7 +383,8 @@ public class AreaReference { * Returns a text representation of this area reference. * <p> * Example return values: - * <table border="0" cellpadding="1" cellspacing="0" summary="Example return values"> + * <table> + * <caption>Example return values</caption> * <tr><th align='left'>Result</th><th align='left'>Comment</th></tr> * <tr><td>A1:A1</td><td>Single cell area reference without sheet</td></tr> * <tr><td>A1:$C$1</td><td>Multi-cell area reference without sheet</td></tr> diff --git a/poi/src/main/java/org/apache/poi/ss/util/CellReference.java b/poi/src/main/java/org/apache/poi/ss/util/CellReference.java index f1132285ac..75bc7ec7b0 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/CellReference.java +++ b/poi/src/main/java/org/apache/poi/ss/util/CellReference.java @@ -290,13 +290,14 @@ public class CellReference implements GenericRecord { * reference is valid (in range) becomes important. * <p> * Note - that the maximum sheet size varies across Excel versions: - * <blockquote><table border="0" cellpadding="1" cellspacing="0" - * summary="Notable cases."> + * <table> + * <caption>Notable cases.</caption> * <tr><th>Version </th><th>File Format </th> * <th>Last Column </th><th>Last Row</th></tr> * <tr><td>97-2003</td><td>BIFF8</td><td>"IV" (2^8)</td><td>65536 (2^14)</td></tr> * <tr><td>2007</td><td>BIFF12</td><td>"XFD" (2^14)</td><td>1048576 (2^20)</td></tr> - * </table></blockquote> + * </table> + * * POI currently targets BIFF8 (Excel 97-2003), so the following behaviour can be observed for * this method: * <blockquote><table border="0" cellpadding="1" cellspacing="0" @@ -482,7 +483,8 @@ public class CellReference implements GenericRecord { * Returns a text representation of this cell reference. * <p> * Example return values: - * <table border="0" cellpadding="1" cellspacing="0" summary="Example return values"> + * <table> + * <caption>Example return values</caption> * <tr><th align='left'>Result</th><th align='left'>Comment</th></tr> * <tr><td>A1</td><td>Cell reference without sheet</td></tr> * <tr><td>Sheet1!A1</td><td>Standard sheet name</td></tr> diff --git a/poi/src/main/java/org/apache/poi/ss/util/NumberToTextConverter.java b/poi/src/main/java/org/apache/poi/ss/util/NumberToTextConverter.java index c41cc96f67..50787ae832 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/NumberToTextConverter.java +++ b/poi/src/main/java/org/apache/poi/ss/util/NumberToTextConverter.java @@ -31,7 +31,8 @@ package org.apache.poi.ss.util; * </ul> * IEEE 64-bit Double Rendering Comparison * - * <table border="1" cellpadding="2" cellspacing="0" summary="IEEE 64-bit Double Rendering Comparison"> + * <table> + * <caption>IEEE 64-bit Double Rendering Comparison</caption> * <tr><th>Raw bits</th><th>Java</th><th>Excel</th></tr> * * <tr><td>0x0000000000000000L</td><td>0.0</td><td>0</td></tr> diff --git a/poi/src/main/java/org/apache/poi/ss/util/cellwalk/CellWalkContext.java b/poi/src/main/java/org/apache/poi/ss/util/cellwalk/CellWalkContext.java index ecf80895f2..09dfbd176c 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/cellwalk/CellWalkContext.java +++ b/poi/src/main/java/org/apache/poi/ss/util/cellwalk/CellWalkContext.java @@ -24,7 +24,8 @@ public interface CellWalkContext { * from top left cell and ends at bottom right cell. Here is a * brief example (number in cell is it's ordinal number): * - * <table border="1"> + * <table> + * <caption>ordinal number example</caption> * <tbody> * <tr><td>1</td><td>2</td></tr> * <tr><td>3</td><td>4</td></tr> diff --git a/poi/src/main/java/org/apache/poi/util/Removal.java b/poi/src/main/java/org/apache/poi/util/Removal.java index 0b618998ef..f4c19441d6 100644 --- a/poi/src/main/java/org/apache/poi/util/Removal.java +++ b/poi/src/main/java/org/apache/poi/util/Removal.java @@ -38,11 +38,11 @@ import java.lang.annotation.Documented; * removed in the n+2 release, a later version should be specified by this * annotation. The annotation version number should not include beta</p> * - * <p>For example, a feature with a <code>@deprecated POI 3.15 beta 3</code> + * <p>For example, a feature with a {@code @deprecated POI 3.15 beta 3} * is deprecated in POI 3.15 and 3.16 and becomes eligible for deletion during * the POI 3.17 release series, and may be deleted immediately after POI 3.16 is - * released. This would be annotated <code>@Removal(version="3.17")</p>. - * + * released. This would be annotated {@code @Removal(version="3.17")}</p>. + * * @since POI-3.15 beta 3 */ @Documented @@ -50,12 +50,14 @@ import java.lang.annotation.Documented; public @interface Removal { /** * The POI version when this feature may be removed. - * + * * To ensure that the version number can be compared to the current version * and a unit test can generate a warning if a removal-eligible feature has * not been removed yet, the version number should adhere to the following format: + * <pre>{@code * Format: "(?<major>\d+)\.(?<minor>\d+)" * Example: "3.15" + * }</pre> */ String version() default ""; // TODO: Verify that the version syntax is valid by parsing with a version-aware parser like |