From: Andreas Beeker
Date: Sun, 18 Apr 2021 23:15:45 +0000 (+0000)
Subject: Fix Javadocs
X-Git-Tag: REL_5_1_0~243
X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=32c2de232594bb423c2b5da4818801c66dca17b9;p=poi.git
Fix Javadocs
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1888939 13f79535-47bb-0310-9956-ffa450edef68
---
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/DeferredSXSSFWorkbook.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/DeferredSXSSFWorkbook.java
index fb21c779c8..6483a33bbd 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/DeferredSXSSFWorkbook.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/DeferredSXSSFWorkbook.java
@@ -85,10 +85,12 @@ public class DeferredSXSSFWorkbook extends SXSSFWorkbook {
return sxSheet;
}
+ @Override
public DeferredSXSSFSheet createSheet() {
return (DeferredSXSSFSheet) super.createSheet();
}
+ @Override
public DeferredSXSSFSheet createSheet(String sheetname) {
return (DeferredSXSSFSheet) super.createSheet(sheetname);
}
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/types/PAPAbstractType.java b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/types/PAPAbstractType.java
index ce5499b3f7..78d8c29d68 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/types/PAPAbstractType.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/types/PAPAbstractType.java
@@ -427,11 +427,12 @@ public abstract class PAPAbstractType {
/**
* Border line style.
*
- * @return One of
+ * @return One of
* - {@link #BRCL_SINGLE}
*
- {@link #BRCL_THICK}
*
- {@link #BRCL_DOUBLE}
*
- {@link #BRCL_SHADOW}
+ *
*/
@Internal
public byte getBrcl()
@@ -442,12 +443,12 @@ public abstract class PAPAbstractType {
/**
* Border line style.
*
- * @param field_6_brcl
- * One of
+ * @param field_6_brcl One of
* - {@link #BRCL_SINGLE}
*
- {@link #BRCL_THICK}
*
- {@link #BRCL_DOUBLE}
*
- {@link #BRCL_SHADOW}
+ *
*/
@Internal
public void setBrcl( byte field_6_brcl )
@@ -458,12 +459,13 @@ public abstract class PAPAbstractType {
/**
* Rectangle border codes.
*
- * @return One of
+ * @return One of
* - {@link #BRCP_NONE}
*
- {@link #BRCP_BORDER_ABOVE}
*
- {@link #BRCP_BORDER_BELOW}
*
- {@link #BRCP_BOX_AROUND}
*
- {@link #BRCP_BAR_TO_LEFT_OF_PARAGRAPH}
+ *
*/
@Internal
public byte getBrcp()
@@ -474,13 +476,13 @@ public abstract class PAPAbstractType {
/**
* Rectangle border codes.
*
- * @param field_7_brcp
- * One of
+ * @param field_7_brcp One of
* - {@link #BRCP_NONE}
*
- {@link #BRCP_BORDER_ABOVE}
*
- {@link #BRCP_BORDER_BELOW}
*
- {@link #BRCP_BOX_AROUND}
*
- {@link #BRCP_BAR_TO_LEFT_OF_PARAGRAPH}
+ *
*/
@Internal
public void setBrcp( byte field_7_brcp )
@@ -870,9 +872,10 @@ public abstract class PAPAbstractType {
/**
* Minimum height is exact or auto.
*
- * @return One of
+ * @return One of
* - {@link #FMINHEIGHT_EXACT}
*
- {@link #FMINHEIGHT_AT_LEAST}
+ *
*/
@Internal
public boolean getFMinHeight()
@@ -883,10 +886,10 @@ public abstract class PAPAbstractType {
/**
* Minimum height is exact or auto.
*
- * @param field_27_fMinHeight
- * One of
+ * @param field_27_fMinHeight One of
* - {@link #FMINHEIGHT_EXACT}
*
- {@link #FMINHEIGHT_AT_LEAST}
+ *
*/
@Internal
public void setFMinHeight( boolean field_27_fMinHeight )
@@ -1095,12 +1098,13 @@ public abstract class PAPAbstractType {
/**
* Get the wAlignFont field for the PAP record.
*
- * @return One of
+ * @return One of
* - {@link #WALIGNFONT_HANGING}
*
- {@link #WALIGNFONT_CENTERED}
*
- {@link #WALIGNFONT_ROMAN}
*
- {@link #WALIGNFONT_VARIABLE}
*
- {@link #WALIGNFONT_AUTO}
+ *
*/
@Internal
public int getWAlignFont()
@@ -1111,13 +1115,13 @@ public abstract class PAPAbstractType {
/**
* Set the wAlignFont field for the PAP record.
*
- * @param field_39_wAlignFont
- * One of
+ * @param field_39_wAlignFont One of
* - {@link #WALIGNFONT_HANGING}
*
- {@link #WALIGNFONT_CENTERED}
*
- {@link #WALIGNFONT_ROMAN}
*
- {@link #WALIGNFONT_VARIABLE}
*
- {@link #WALIGNFONT_AUTO}
+ *
*/
@Internal
public void setWAlignFont( int field_39_wAlignFont )
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/types/SEPAbstractType.java b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/types/SEPAbstractType.java
index f74a1afab4..3ac0e41fbe 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/types/SEPAbstractType.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/types/SEPAbstractType.java
@@ -202,140 +202,80 @@ public abstract class SEPAbstractType {
public String toString()
{
- StringBuilder builder = new StringBuilder();
- builder.append("[SEP]\n");
- builder.append(" .bkc = ");
- builder.append(" (").append(getBkc()).append(" )\n");
- builder.append(" .fTitlePage = ");
- builder.append(" (").append(getFTitlePage()).append(" )\n");
- builder.append(" .fAutoPgn = ");
- builder.append(" (").append(getFAutoPgn()).append(" )\n");
- builder.append(" .nfcPgn = ");
- builder.append(" (").append(getNfcPgn()).append(" )\n");
- builder.append(" .fUnlocked = ");
- builder.append(" (").append(getFUnlocked()).append(" )\n");
- builder.append(" .cnsPgn = ");
- builder.append(" (").append(getCnsPgn()).append(" )\n");
- builder.append(" .fPgnRestart = ");
- builder.append(" (").append(getFPgnRestart()).append(" )\n");
- builder.append(" .fEndNote = ");
- builder.append(" (").append(getFEndNote()).append(" )\n");
- builder.append(" .lnc = ");
- builder.append(" (").append(getLnc()).append(" )\n");
- builder.append(" .grpfIhdt = ");
- builder.append(" (").append(getGrpfIhdt()).append(" )\n");
- builder.append(" .nLnnMod = ");
- builder.append(" (").append(getNLnnMod()).append(" )\n");
- builder.append(" .dxaLnn = ");
- builder.append(" (").append(getDxaLnn()).append(" )\n");
- builder.append(" .dxaPgn = ");
- builder.append(" (").append(getDxaPgn()).append(" )\n");
- builder.append(" .dyaPgn = ");
- builder.append(" (").append(getDyaPgn()).append(" )\n");
- builder.append(" .fLBetween = ");
- builder.append(" (").append(getFLBetween()).append(" )\n");
- builder.append(" .vjc = ");
- builder.append(" (").append(getVjc()).append(" )\n");
- builder.append(" .dmBinFirst = ");
- builder.append(" (").append(getDmBinFirst()).append(" )\n");
- builder.append(" .dmBinOther = ");
- builder.append(" (").append(getDmBinOther()).append(" )\n");
- builder.append(" .dmPaperReq = ");
- builder.append(" (").append(getDmPaperReq()).append(" )\n");
- builder.append(" .brcTop = ");
- builder.append(" (").append(getBrcTop()).append(" )\n");
- builder.append(" .brcLeft = ");
- builder.append(" (").append(getBrcLeft()).append(" )\n");
- builder.append(" .brcBottom = ");
- builder.append(" (").append(getBrcBottom()).append(" )\n");
- builder.append(" .brcRight = ");
- builder.append(" (").append(getBrcRight()).append(" )\n");
- builder.append(" .fPropMark = ");
- builder.append(" (").append(getFPropMark()).append(" )\n");
- builder.append(" .ibstPropRMark = ");
- builder.append(" (").append(getIbstPropRMark()).append(" )\n");
- builder.append(" .dttmPropRMark = ");
- builder.append(" (").append(getDttmPropRMark()).append(" )\n");
- builder.append(" .dxtCharSpace = ");
- builder.append(" (").append(getDxtCharSpace()).append(" )\n");
- builder.append(" .dyaLinePitch = ");
- builder.append(" (").append(getDyaLinePitch()).append(" )\n");
- builder.append(" .clm = ");
- builder.append(" (").append(getClm()).append(" )\n");
- builder.append(" .unused2 = ");
- builder.append(" (").append(getUnused2()).append(" )\n");
- builder.append(" .dmOrientPage = ");
- builder.append(" (").append(getDmOrientPage()).append(" )\n");
- builder.append(" .iHeadingPgn = ");
- builder.append(" (").append(getIHeadingPgn()).append(" )\n");
- builder.append(" .pgnStart = ");
- builder.append(" (").append(getPgnStart()).append(" )\n");
- builder.append(" .lnnMin = ");
- builder.append(" (").append(getLnnMin()).append(" )\n");
- builder.append(" .wTextFlow = ");
- builder.append(" (").append(getWTextFlow()).append(" )\n");
- builder.append(" .unused3 = ");
- builder.append(" (").append(getUnused3()).append(" )\n");
- builder.append(" .pgbProp = ");
- builder.append(" (").append(getPgbProp()).append(" )\n");
- builder.append(" .unused4 = ");
- builder.append(" (").append(getUnused4()).append(" )\n");
- builder.append(" .xaPage = ");
- builder.append(" (").append(getXaPage()).append(" )\n");
- builder.append(" .yaPage = ");
- builder.append(" (").append(getYaPage()).append(" )\n");
- builder.append(" .xaPageNUp = ");
- builder.append(" (").append(getXaPageNUp()).append(" )\n");
- builder.append(" .yaPageNUp = ");
- builder.append(" (").append(getYaPageNUp()).append(" )\n");
- builder.append(" .dxaLeft = ");
- builder.append(" (").append(getDxaLeft()).append(" )\n");
- builder.append(" .dxaRight = ");
- builder.append(" (").append(getDxaRight()).append(" )\n");
- builder.append(" .dyaTop = ");
- builder.append(" (").append(getDyaTop()).append(" )\n");
- builder.append(" .dyaBottom = ");
- builder.append(" (").append(getDyaBottom()).append(" )\n");
- builder.append(" .dzaGutter = ");
- builder.append(" (").append(getDzaGutter()).append(" )\n");
- builder.append(" .dyaHdrTop = ");
- builder.append(" (").append(getDyaHdrTop()).append(" )\n");
- builder.append(" .dyaHdrBottom = ");
- builder.append(" (").append(getDyaHdrBottom()).append(" )\n");
- builder.append(" .ccolM1 = ");
- builder.append(" (").append(getCcolM1()).append(" )\n");
- builder.append(" .fEvenlySpaced = ");
- builder.append(" (").append(getFEvenlySpaced()).append(" )\n");
- builder.append(" .unused5 = ");
- builder.append(" (").append(getUnused5()).append(" )\n");
- builder.append(" .dxaColumns = ");
- builder.append(" (").append(getDxaColumns()).append(" )\n");
- builder.append(" .rgdxaColumn = ");
- builder.append(" (").append(Arrays.toString(getRgdxaColumn())).append(" )\n");
- builder.append(" .dxaColumnWidth = ");
- builder.append(" (").append(getDxaColumnWidth()).append(" )\n");
- builder.append(" .dmOrientFirst = ");
- builder.append(" (").append(getDmOrientFirst()).append(" )\n");
- builder.append(" .fLayout = ");
- builder.append(" (").append(getFLayout()).append(" )\n");
- builder.append(" .unused6 = ");
- builder.append(" (").append(getUnused6()).append(" )\n");
- builder.append(" .olstAnm = ");
- builder.append(" (").append(Arrays.toString(getOlstAnm())).append(" )\n");
-
- builder.append("[/SEP]\n");
- return builder.toString();
+
+ return "[SEP]\n" +
+ " .bkc = (" + getBkc() + " )\n" +
+ " .fTitlePage = (" + getFTitlePage() + " )\n" +
+ " .fAutoPgn = (" + getFAutoPgn() + " )\n" +
+ " .nfcPgn = (" + getNfcPgn() + " )\n" +
+ " .fUnlocked = (" + getFUnlocked() + " )\n" +
+ " .cnsPgn = (" + getCnsPgn() + " )\n" +
+ " .fPgnRestart = (" + getFPgnRestart() + " )\n" +
+ " .fEndNote = (" + getFEndNote() + " )\n" +
+ " .lnc = (" + getLnc() + " )\n" +
+ " .grpfIhdt = (" + getGrpfIhdt() + " )\n" +
+ " .nLnnMod = (" + getNLnnMod() + " )\n" +
+ " .dxaLnn = (" + getDxaLnn() + " )\n" +
+ " .dxaPgn = (" + getDxaPgn() + " )\n" +
+ " .dyaPgn = (" + getDyaPgn() + " )\n" +
+ " .fLBetween = (" + getFLBetween() + " )\n" +
+ " .vjc = (" + getVjc() + " )\n" +
+ " .dmBinFirst = (" + getDmBinFirst() + " )\n" +
+ " .dmBinOther = (" + getDmBinOther() + " )\n" +
+ " .dmPaperReq = (" + getDmPaperReq() + " )\n" +
+ " .brcTop = (" + getBrcTop() + " )\n" +
+ " .brcLeft = (" + getBrcLeft() + " )\n" +
+ " .brcBottom = (" + getBrcBottom() + " )\n" +
+ " .brcRight = (" + getBrcRight() + " )\n" +
+ " .fPropMark = (" + getFPropMark() + " )\n" +
+ " .ibstPropRMark = (" + getIbstPropRMark() + " )\n" +
+ " .dttmPropRMark = (" + getDttmPropRMark() + " )\n" +
+ " .dxtCharSpace = (" + getDxtCharSpace() + " )\n" +
+ " .dyaLinePitch = (" + getDyaLinePitch() + " )\n" +
+ " .clm = (" + getClm() + " )\n" +
+ " .unused2 = (" + getUnused2() + " )\n" +
+ " .dmOrientPage = (" + getDmOrientPage() + " )\n" +
+ " .iHeadingPgn = (" + getIHeadingPgn() + " )\n" +
+ " .pgnStart = (" + getPgnStart() + " )\n" +
+ " .lnnMin = (" + getLnnMin() + " )\n" +
+ " .wTextFlow = (" + getWTextFlow() + " )\n" +
+ " .unused3 = (" + getUnused3() + " )\n" +
+ " .pgbProp = (" + getPgbProp() + " )\n" +
+ " .unused4 = (" + getUnused4() + " )\n" +
+ " .xaPage = (" + getXaPage() + " )\n" +
+ " .yaPage = (" + getYaPage() + " )\n" +
+ " .xaPageNUp = (" + getXaPageNUp() + " )\n" +
+ " .yaPageNUp = (" + getYaPageNUp() + " )\n" +
+ " .dxaLeft = (" + getDxaLeft() + " )\n" +
+ " .dxaRight = (" + getDxaRight() + " )\n" +
+ " .dyaTop = (" + getDyaTop() + " )\n" +
+ " .dyaBottom = (" + getDyaBottom() + " )\n" +
+ " .dzaGutter = (" + getDzaGutter() + " )\n" +
+ " .dyaHdrTop = (" + getDyaHdrTop() + " )\n" +
+ " .dyaHdrBottom = (" + getDyaHdrBottom() + " )\n" +
+ " .ccolM1 = (" + getCcolM1() + " )\n" +
+ " .fEvenlySpaced = (" + getFEvenlySpaced() + " )\n" +
+ " .unused5 = (" + getUnused5() + " )\n" +
+ " .dxaColumns = (" + getDxaColumns() + " )\n" +
+ " .rgdxaColumn = (" + Arrays.toString(getRgdxaColumn()) + " )\n" +
+ " .dxaColumnWidth = (" + getDxaColumnWidth() + " )\n" +
+ " .dmOrientFirst = (" + getDmOrientFirst() + " )\n" +
+ " .fLayout = (" + getFLayout() + " )\n" +
+ " .unused6 = (" + getUnused6() + " )\n" +
+ " .olstAnm = (" + Arrays.toString(getOlstAnm()) + " )\n" +
+ "[/SEP]\n";
}
/**
* Break code.
*
- * @return One of
+ * @return One of
* - {@link #BKC_NO_BREAK}
*
- {@link #BKC_NEW_COLUMN}
*
- {@link #BKC_NEW_PAGE}
*
- {@link #BKC_EVEN_PAGE}
*
- {@link #BKC_ODD_PAGE}
+ *
*/
public byte getBkc()
{
@@ -345,13 +285,13 @@ public abstract class SEPAbstractType {
/**
* Break code.
*
- * @param field_1_bkc
- * One of
+ * @param field_1_bkc One of
* - {@link #BKC_NO_BREAK}
*
- {@link #BKC_NEW_COLUMN}
*
- {@link #BKC_NEW_PAGE}
*
- {@link #BKC_EVEN_PAGE}
*
- {@link #BKC_ODD_PAGE}
+ *
*/
public void setBkc(byte field_1_bkc)
{
@@ -393,12 +333,13 @@ public abstract class SEPAbstractType {
/**
* Page number format code.
*
- * @return One of
+ * @return One of
* - {@link #NFCPGN_ARABIC}
*
- {@link #NFCPGN_ROMAN_UPPER_CASE}
*
- {@link #NFCPGN_ROMAN_LOWER_CASE}
*
- {@link #NFCPGN_LETTER_UPPER_CASE}
*
- {@link #NFCPGN_LETTER_LOWER_CASE}
+ *
*/
public byte getNfcPgn()
{
@@ -408,13 +349,13 @@ public abstract class SEPAbstractType {
/**
* Page number format code.
*
- * @param field_4_nfcPgn
- * One of
+ * @param field_4_nfcPgn One of
* - {@link #NFCPGN_ARABIC}
*
- {@link #NFCPGN_ROMAN_UPPER_CASE}
*
- {@link #NFCPGN_ROMAN_LOWER_CASE}
*
- {@link #NFCPGN_LETTER_UPPER_CASE}
*
- {@link #NFCPGN_LETTER_LOWER_CASE}
+ *
*/
public void setNfcPgn(byte field_4_nfcPgn)
{
@@ -840,9 +781,10 @@ public abstract class SEPAbstractType {
/**
* Get the dmOrientPage field for the SEP record.
*
- * @return One of
+ * @return One of
* - {@link #DMORIENTPAGE_LANDSCAPE}
*
- {@link #DMORIENTPAGE_PORTRAIT}
+ *
*/
public boolean getDmOrientPage()
{
@@ -852,10 +794,10 @@ public abstract class SEPAbstractType {
/**
* Set the dmOrientPage field for the SEP record.
*
- * @param field_31_dmOrientPage
- * One of
+ * @param field_31_dmOrientPage One of
* - {@link #DMORIENTPAGE_LANDSCAPE}
*
- {@link #DMORIENTPAGE_PORTRAIT}
+ *
*/
public void setDmOrientPage(boolean field_31_dmOrientPage)
{
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.
*
*
- * For example the Excel pattern "$#,##0.00 "USD"_);($#,##0.00 "USD")"
- *
will be correctly formatted as "$1,000.00 USD" or "($1,000.00 USD)".
- * However the pattern "00-00-00"
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 HSSFDataFormatter.addFormat(String,Format)
. The following
+ * via {@code HSSFDataFormatter.addFormat(String,Format)}. The following
* custom formats are already provided by this class:
*
- *
*
- SSN "000-00-0000"
* - Phone Number "(###) ###-####"
* - Zip plus 4 "00000-0000"
*
- *
*
* 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
- * HSSFDataFormatter.setDefaultNumberFormat(Format)
. Note: the
+ * can override the default format pattern with {@code
+ * HSSFDataFormatter.setDefaultNumberFormat(Format)}. Note: 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.
- *
*
* 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();
* }
- *
*
* Except the 31-character constraint, Excel applies some other rules:
*
@@ -895,7 +893,6 @@ public final class HSSFWorkbook extends POIDocument implements Workbook {
*
closing square bracket (])
*
* The string MUST NOT begin or end with the single quote (') character.
- *
*
* @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 :
+ * {@code
* ::= [ ]*
* ::= [ ]*
* ::= | () | |
* ::= ([expression [, expression]*])
+ * }
*
* For POI internal use only
- *
*/
@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. -1
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. -1
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 false
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] ]
*
- * @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 true
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 null
- * @param part1
- * @param part2 may be null
+ * @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 null
(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 true
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 false
)
+ * 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 null
result
- * @return The sheet name as an identifier null
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 true
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.
*
* For IF Formulas, additional PTGs are added to the tokens
- * @param name a {@link NamePtg} or {@link NameXPtg} or null
+ * @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 basis optionally specifies the behaviour of YEARFRAC as follows:
*
- *
+ *
+ * basis parameter description
* Value | Days per Month | Days per Year |
* 0 (default) | 30 | 360 |
* 1 | actual | actual |
@@ -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.
*
- *
+ *
+ * sample spreadsheet
* | A | B | C | D |
* 1 | 15 | 20 | 25 | |
* 2 | | | | 200 |
@@ -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:
*
- *
+ *
+ * sample spreadsheet
* | A | B | C | D |
* 1 | 15 | 20 | 25 | |
* 2 | 1215 | 1220 | #VALUE! | 200 |
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
*
* Syntax: COUNTBLANK ( range )
- *
+ *
+ * Parameter descriptions
* range | is the range of cells to count blanks |
*
*
*/
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
*
* Syntax: COUNTIF ( range, criteria )
- *
+ *
+ * Parameter descriptions
* range | is the range of cells to be counted based on the criteria |
* criteria | is used to determine which cells to count |
*
- *
*/
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 null
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 null
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 null
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;
* ERROR.TYPE(errorValue)
*
* Returns a number corresponding to the error type of the supplied argument.
- *
+ *
+ * Return values for ERROR.TYPE()
* errorValue | Return Value |
* #NULL! | 1 |
* #DIV/0! | 2 |
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 :
* INDEX ( reference, row_num[, column_num [, area_num]])
* INDEX ( array, row_num[, column_num])
- *
+ *
+ * Parameter descriptions
* reference | typically an area reference, possibly a union of areas |
* array | a literal array value (currently not supported) |
* row_num | selects the row within the array or area reference |
@@ -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.
*
- * Syntax:
+ * Syntax:
* INDIRECT(ref_text,isA1Style)
*
* ref_text 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 null
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 null
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 (col_index_num
* or row_index_num respectively).
* Sample behaviour:
- *
+ *
+ * Sample behaviour
* Input Return | Value | Thrown Error |
* 5 | 4 | |
* 2.9 | 2 | |
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
*
* Syntax :
* SUBTOTAL ( functionCode, ref1, ref2 ... )
- *
+ *
+ * Parameter descriptions
* functionCode | (1-11) Selects the underlying aggregate function to be used (see table below) |
* ref1, ref2 ... | Arguments to be passed to the underlying aggregate function |
*
- *
*
- *
+ *
+ * Parameter descriptions
* functionCode | Aggregate Function |
- * 1 | AVERAGE |
- * 2 | COUNT |
- * 3 | COUNTA |
- * 4 | MAX |
- * 5 | MIN |
- * 6 | PRODUCT |
- * 7 | STDEV |
- * 8 | STDEVP * |
- * 9 | SUM |
- * 10 | VAR * |
- * 11 | VARP * |
- * 101 | AVERAGE |
- * 102 | COUNT |
- * 103 | COUNTA |
- * 104 | MAX |
- * 105 | MIN |
- * 106 | PRODUCT |
- * 107 | STDEV |
- * 108 | STDEVP * |
- * 109 | SUM |
- * 110 | VAR * |
- * 111 | VARP * |
+ * 1 | AVERAGE |
+ * 2 | COUNT |
+ * 3 | COUNTA |
+ * 4 | MAX |
+ * 5 | MIN |
+ * 6 | PRODUCT |
+ * 7 | STDEV |
+ * 8 | STDEVP * |
+ * 9 | SUM |
+ * 10 | VAR * |
+ * 11 | VARP * |
+ * 101 | AVERAGE |
+ * 102 | COUNT |
+ * 103 | COUNTA |
+ * 104 | MAX |
+ * 105 | MIN |
+ * 106 | PRODUCT |
+ * 107 | STDEV |
+ * 108 | STDEVP * |
+ * 109 | SUM |
+ * 110 | VAR * |
+ * 111 | VARP * |
*
* * Not implemented in POI yet. Functions 101-111 are the same as functions 1-11 but with
* the option 'ignore hidden values'.
- *
*/
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 :
* SUMIF ( range, criteria, sum_range )
- *
+ *
+ * Parameter descriptions
* range | The range over which criteria is applied. Also used for addend values when the third parameter is not present |
* criteria | The value or expression used to filter rows from range |
* sum_range | Locates the top-left corner of the corresponding range of addends - values to be added (after being selected by the criteria) |
@@ -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 :
* SUMPRODUCT ( array1[, array2[, array3[, ...]]])
- *
+ *
+ * Parameter descriptions
* array1, ... arrayN | typically area references,
* possibly cell references or scalar values |
*
@@ -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; ndouble value for the specified ValueEval
.
- * @param isScalarProduct false
for SUMPRODUCTs over area refs.
- * @throws EvaluationException if ve
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.
*
* Note - string values and empty cells are interpreted differently depending on
- * isScalarProduct
. 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:
* TREND(known_y's, known_x's, new_x's, constant)
- *
+ *
+ * Parameter descriptions
* known_y's, known_x's, new_x's | typically area references, possibly cell references or scalar values |
* constant | TRUE or FALSE:
* determines whether the regression line should include an intercept term |
@@ -56,7 +57,6 @@ import org.apache.poi.ss.formula.eval.ValueEval;
* of the same size as known_y's.
* If new_x's is not given, it is assumed to be the same as known_x's
* If constant is omitted, it is assumed to be TRUE
- *
*/
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 {
* POI's SpreadsheetAPI silently truncates the input argument to 31 characters.
* Example:
*
- *
+ * {@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();
- *
- *
+ * }
*
* Except the 31-character constraint, Excel applies some other rules:
*
@@ -186,7 +185,6 @@ public interface Workbook extends Closeable, Iterable {
* closing square bracket (])
*
* The string MUST NOT begin or end with the single quote (') character.
- *
*
*
* See {@link org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal)}
@@ -237,7 +235,7 @@ public interface Workbook extends Closeable, Iterable {
* Get sheet with the given name
*
* @param name of the sheet
- * @return Sheet with the name provided or null
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 {
/**
* Finds a font that matches the one with the supplied attributes
*
- * @return the font with the matched attributes or null
+ * @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 {
/**
* @param name the name of the defined name
- * @return the defined name with the specified name. null
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 {
CreationHelper getCreationHelper();
/**
- * @return false
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 false
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 {
* ({@link #isSheetVeryHidden(int)})
*
* @param sheetIx Number
- * @return true
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 {
* ({@link #isSheetHidden(int)})
*
* @param sheetIx sheet index to check
- * @return true
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.
*
* Example return values:
- *
+ *
+ * Example return values
* Result | Comment |
* A1:A1 | Single cell area reference without sheet |
* A1:$C$1 | Multi-cell area reference without sheet |
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.
*
* Note - that the maximum sheet size varies across Excel versions:
- *
+ *
+ * Notable cases.
* Version | File Format |
* Last Column | Last Row |
* 97-2003 | BIFF8 | "IV" (2^8) | 65536 (2^14) |
* 2007 | BIFF12 | "XFD" (2^14) | 1048576 (2^20) |
- *
+ *
+ *
* POI currently targets BIFF8 (Excel 97-2003), so the following behaviour can be observed for
* this method:
*
* Example return values:
- *
+ *
+ * Example return values
* Result | Comment |
* A1 | Cell reference without sheet |
* Sheet1!A1 | Standard sheet name |
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;
*
* IEEE 64-bit Double Rendering Comparison
*
- *
+ *
+ * IEEE 64-bit Double Rendering Comparison
* Raw bits | Java | Excel |
*
* 0x0000000000000000L | 0.0 | 0 |
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):
*
- *
+ *
+ * ordinal number example
*
* 1 | 2 |
* 3 | 4 |
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
*
- * For example, a feature with a @deprecated POI 3.15 beta 3
+ *
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 @Removal(version="3.17")
.
- *
+ * released. This would be annotated {@code @Removal(version="3.17")}.
+ *
* @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:
+ * {@code
* Format: "(?\d+)\.(?\d+)"
* Example: "3.15"
+ * }
*/
String version() default "";
// TODO: Verify that the version syntax is valid by parsing with a version-aware parser like