diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2021-04-14 22:53:33 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2021-04-14 22:53:33 +0000 |
commit | bb5d321b79193b98051f435621f5044842716c4e (patch) | |
tree | bec508518798239131c7cdf3825d4328a7d0e831 /poi | |
parent | 7c67bba960e46433d8bf11674ef862153403cfdc (diff) | |
download | poi-bb5d321b79193b98051f435621f5044842716c4e.tar.gz poi-bb5d321b79193b98051f435621f5044842716c4e.zip |
fix javadocs - remove @author tags (http://apache-poi.1045710.n5.nabble.com/Javadocs-clean-up-remove-author-tags-tp5737663.html)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1888780 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
389 files changed, 1299 insertions, 1808 deletions
diff --git a/poi/src/main/java/org/apache/poi/ddf/EscherContainerRecord.java b/poi/src/main/java/org/apache/poi/ddf/EscherContainerRecord.java index bbe7efac65..e525d50333 100644 --- a/poi/src/main/java/org/apache/poi/ddf/EscherContainerRecord.java +++ b/poi/src/main/java/org/apache/poi/ddf/EscherContainerRecord.java @@ -172,7 +172,7 @@ public final class EscherContainerRecord extends EscherRecord implements Iterabl /** - * replaces the internal child list with the contents of the supplied <tt>childRecords</tt> + * replaces the internal child list with the contents of the supplied {@code childRecords} */ @Override public void setChildRecords(List<EscherRecord> childRecords) { diff --git a/poi/src/main/java/org/apache/poi/ddf/EscherPropertyMetaData.java b/poi/src/main/java/org/apache/poi/ddf/EscherPropertyMetaData.java index 99f5f6cb34..bf61e00027 100644 --- a/poi/src/main/java/org/apache/poi/ddf/EscherPropertyMetaData.java +++ b/poi/src/main/java/org/apache/poi/ddf/EscherPropertyMetaData.java @@ -20,8 +20,6 @@ package org.apache.poi.ddf; /** * This class stores the type and description of an escher property. - * - * @author Glen Stampoultzis (glens at apache.org) */ public class EscherPropertyMetaData { diff --git a/poi/src/main/java/org/apache/poi/hpsf/IllegalPropertySetDataException.java b/poi/src/main/java/org/apache/poi/hpsf/IllegalPropertySetDataException.java index 3217af9580..2b673f381b 100644 --- a/poi/src/main/java/org/apache/poi/hpsf/IllegalPropertySetDataException.java +++ b/poi/src/main/java/org/apache/poi/hpsf/IllegalPropertySetDataException.java @@ -23,9 +23,7 @@ package org.apache.poi.hpsf; * have a value of <code>-1 (true)</code> or <code>0 (false)</code>. * Any other value would trigger this exception. It supports a nested * "reason" throwable, i.e. an exception that caused this one to be - * thrown.</p> - * - * @author Drew Varner(Drew.Varner atDomain sc.edu) + * thrown. */ public class IllegalPropertySetDataException extends HPSFRuntimeException { @@ -42,7 +40,7 @@ public class IllegalPropertySetDataException extends HPSFRuntimeException /** * <p>Constructor</p> - * + * * @param msg The exception's message string */ public IllegalPropertySetDataException(final String msg) @@ -54,7 +52,7 @@ public class IllegalPropertySetDataException extends HPSFRuntimeException /** * <p>Constructor</p> - * + * * @param reason This exception's underlying reason */ public IllegalPropertySetDataException(final Throwable reason) @@ -66,7 +64,7 @@ public class IllegalPropertySetDataException extends HPSFRuntimeException /** * <p>Constructor</p> - * + * * @param msg The exception's message string * @param reason This exception's underlying reason */ diff --git a/poi/src/main/java/org/apache/poi/hssf/dev/EFBiffViewer.java b/poi/src/main/java/org/apache/poi/hssf/dev/EFBiffViewer.java index 6e01e09f7b..8fe58a11c4 100644 --- a/poi/src/main/java/org/apache/poi/hssf/dev/EFBiffViewer.java +++ b/poi/src/main/java/org/apache/poi/hssf/dev/EFBiffViewer.java @@ -25,11 +25,6 @@ import org.apache.poi.hssf.eventusermodel.HSSFEventFactory; import org.apache.poi.hssf.eventusermodel.HSSFRequest; import org.apache.poi.poifs.filesystem.POIFSFileSystem; -/** - * - * @author andy - */ - public class EFBiffViewer { String file; diff --git a/poi/src/main/java/org/apache/poi/hssf/dev/FormulaViewer.java b/poi/src/main/java/org/apache/poi/hssf/dev/FormulaViewer.java index bc7cc9cc84..2301330343 100644 --- a/poi/src/main/java/org/apache/poi/hssf/dev/FormulaViewer.java +++ b/poi/src/main/java/org/apache/poi/hssf/dev/FormulaViewer.java @@ -33,10 +33,7 @@ import org.apache.poi.ss.formula.ptg.Ptg; /** * FormulaViewer - finds formulas in a BIFF8 file and attempts to read them/display * data from them. Only works if Formulas are enabled in "RecordFactory" - * @author andy - * @author Avik */ - public class FormulaViewer { private String file; diff --git a/poi/src/main/java/org/apache/poi/hssf/model/InternalSheet.java b/poi/src/main/java/org/apache/poi/hssf/model/InternalSheet.java index e1a96e15ce..2ec71a52fa 100644 --- a/poi/src/main/java/org/apache/poi/hssf/model/InternalSheet.java +++ b/poi/src/main/java/org/apache/poi/hssf/model/InternalSheet.java @@ -358,6 +358,7 @@ public final class InternalSheet { public RecordCloner(List<Record> destList) { _destList = destList; } + @Override public void visitRecord(Record r) { _destList.add(r.copy()); } diff --git a/poi/src/main/java/org/apache/poi/hssf/model/RecordStream.java b/poi/src/main/java/org/apache/poi/hssf/model/RecordStream.java index 02d85fda6a..1c548a02d1 100644 --- a/poi/src/main/java/org/apache/poi/hssf/model/RecordStream.java +++ b/poi/src/main/java/org/apache/poi/hssf/model/RecordStream.java @@ -21,7 +21,7 @@ import java.util.List; import org.apache.poi.hssf.record.Record; /** - * Simplifies iteration over a sequence of <tt>Record</tt> objects. + * Simplifies iteration over a sequence of {@code Record} objects. */ public final class RecordStream { @@ -61,7 +61,7 @@ public final class RecordStream { } /** - * @return the {@link Class} of the next Record. <code>null</code> if this stream is exhausted. + * @return the {@link Class} of the next Record. {@code null} if this stream is exhausted. */ public Class<? extends Record> peekNextClass() { if(!hasNext()) { @@ -71,7 +71,7 @@ public final class RecordStream { } /** - * @return the next Record. <code>null</code> if this stream is exhausted. + * @return the next Record. {@code null} if this stream is exhausted. */ public Record peekNextRecord() { return (hasNext()) ? _list.get(_nextIndex) : null; diff --git a/poi/src/main/java/org/apache/poi/hssf/model/RowBlocksReader.java b/poi/src/main/java/org/apache/poi/hssf/model/RowBlocksReader.java index efad9d5a86..b25b8fac2c 100644 --- a/poi/src/main/java/org/apache/poi/hssf/model/RowBlocksReader.java +++ b/poi/src/main/java/org/apache/poi/hssf/model/RowBlocksReader.java @@ -43,7 +43,7 @@ public final class RowBlocksReader { /** * Also collects any loose MergeCellRecords and puts them in the supplied * mergedCellsTable - * + * * @param rs the record stream */ public RowBlocksReader(RecordStream rs) { @@ -100,7 +100,7 @@ public final class RowBlocksReader { /** * Some unconventional apps place {@link MergeCellsRecord}s within the row block. They * actually should be in the {@link MergedCellsTable} which is much later (see bug 45699). - * @return any loose <tt>MergeCellsRecord</tt>s found + * @return any loose {@code MergeCellsRecord}s found */ public MergeCellsRecord[] getLooseMergedCells() { return _mergedCellsRecords; diff --git a/poi/src/main/java/org/apache/poi/hssf/record/CFRuleBase.java b/poi/src/main/java/org/apache/poi/hssf/record/CFRuleBase.java index 22ee40f54a..34a7340aaa 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/CFRuleBase.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/CFRuleBase.java @@ -420,7 +420,7 @@ public abstract class CFRuleBase extends StandardRecord { /** * get the stack of the 2nd expression as a list * - * @return array of {@link Ptg}s, possibly <code>null</code> + * @return array of {@link Ptg}s, possibly {@code null} */ public Ptg[] getParsedExpression2() { return Formula.getTokens(formula2); @@ -436,7 +436,7 @@ public abstract class CFRuleBase extends StandardRecord { } /** - * @param formula must not be <code>null</code> + * @param formula must not be {@code null} * @return encoded size of the formula tokens (does not include 2 bytes for ushort length) */ protected static int getFormulaSize(Formula formula) { @@ -451,7 +451,7 @@ public abstract class CFRuleBase extends StandardRecord { * * @param formula The formula to parse, excluding the leading equals sign. * @param sheet The sheet that the formula is on. - * @return <code>null</code> if <tt>formula</tt> was null. + * @return {@code null} if {@code formula} was null. */ public static Ptg[] parseFormula(String formula, HSSFSheet sheet) { if(formula == null) { diff --git a/poi/src/main/java/org/apache/poi/hssf/record/CellValueRecordInterface.java b/poi/src/main/java/org/apache/poi/hssf/record/CellValueRecordInterface.java index c91a400d6a..7f19a2215f 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/CellValueRecordInterface.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/CellValueRecordInterface.java @@ -22,9 +22,6 @@ package org.apache.poi.hssf.record; * contain cell values. It allows the containing sheet to move through them and compare * them. * - * @author Andrew C. Oliver (acoliver at apache dot org) - * @author Jason Height (jheight at chariot dot net dot au) - * * @see org.apache.poi.hssf.record.Record * @see org.apache.poi.hssf.record.RecordFactory */ diff --git a/poi/src/main/java/org/apache/poi/hssf/record/FormulaSpecialCachedValue.java b/poi/src/main/java/org/apache/poi/hssf/record/FormulaSpecialCachedValue.java index 9eadacea83..fe4cd5a48a 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/FormulaSpecialCachedValue.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/FormulaSpecialCachedValue.java @@ -64,7 +64,7 @@ public final class FormulaSpecialCachedValue implements GenericRecord { } /** - * @return <code>null</code> if the double value encoded by <tt>valueLongBits</tt> + * @return {@code null} if the double value encoded by {@code valueLongBits} * is a normal (non NaN) double value. */ public static FormulaSpecialCachedValue create(long valueLongBits) { diff --git a/poi/src/main/java/org/apache/poi/hssf/record/SSTDeserializer.java b/poi/src/main/java/org/apache/poi/hssf/record/SSTDeserializer.java index 6b3bce351d..c2d7e7d8c3 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/SSTDeserializer.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/SSTDeserializer.java @@ -28,9 +28,6 @@ import static org.apache.logging.log4j.util.Unbox.box; /** * Handles the task of deserializing a SST string. The two main entry points are - * - * @author Glen Stampoultzis (glens at apache.org) - * @author Jason Height (jheight at apache.org) */ class SSTDeserializer { diff --git a/poi/src/main/java/org/apache/poi/hssf/record/SSTSerializer.java b/poi/src/main/java/org/apache/poi/hssf/record/SSTSerializer.java index c15c7ad1ff..c5ef2933d6 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/SSTSerializer.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/SSTSerializer.java @@ -24,8 +24,6 @@ import org.apache.poi.util.IntMapper; /** * This class handles serialization of SST records. It utilizes the record processor * class write individual records. This has been refactored from the SSTRecord class. - * - * @author Glen Stampoultzis (glens at apache.org) */ final class SSTSerializer { diff --git a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/CFRecordsAggregate.java b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/CFRecordsAggregate.java index cd513e8683..bcf80e6189 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/CFRecordsAggregate.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/CFRecordsAggregate.java @@ -209,6 +209,7 @@ public final class CFRecordsAggregate extends RecordAggregate implements Generic return GenericRecordJsonWriter.marshal(this); } + @Override public void visitContainedRecords(RecordVisitor rv) { rv.visitRecord(header); for (CFRuleBase rule : rules) { diff --git a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ChartSubstreamRecordAggregate.java b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ChartSubstreamRecordAggregate.java index 795a66389e..79820aae71 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ChartSubstreamRecordAggregate.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ChartSubstreamRecordAggregate.java @@ -63,7 +63,8 @@ public final class ChartSubstreamRecordAggregate extends RecordAggregate { } } - public void visitContainedRecords(RecordVisitor rv) { + @Override + public void visitContainedRecords(RecordVisitor rv) { if (_recs.isEmpty()) { return; } diff --git a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java index ab14e35e34..e7b85625fa 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java @@ -75,7 +75,7 @@ public final class ColumnInfoRecordsAggregate extends RecordAggregate implements /** * Inserts a column into the aggregate (at the position specified by - * <code>idx</code>. + * {@code idx}. */ private void insertColumn(int idx, ColumnInfoRecord col) { records.add(idx, col); @@ -85,6 +85,7 @@ public final class ColumnInfoRecordsAggregate extends RecordAggregate implements return records.size(); } + @Override public void visitContainedRecords(RecordVisitor rv) { int nItems = records.size(); if (nItems < 1) { @@ -147,7 +148,6 @@ public final class ColumnInfoRecordsAggregate extends RecordAggregate implements /** * 'Collapsed' state is stored in a single column col info record immediately after the outline group - * @param idx * @return true, if the column is collapsed, false otherwise. */ private boolean isColumnGroupCollapsed(int idx) { @@ -362,7 +362,7 @@ public final class ColumnInfoRecordsAggregate extends RecordAggregate implements } /** - * Sets all non null fields into the <code>ci</code> parameter. + * Sets all non null fields into the {@code ci} parameter. */ private static void setColumnInfoFields(ColumnInfoRecord ci, Short xfStyle, Integer width, Integer level, Boolean hidden, Boolean collapsed) { @@ -428,7 +428,7 @@ public final class ColumnInfoRecordsAggregate extends RecordAggregate implements } /** * merges two column info records (if they are adjacent and have the same formatting, etc) - * @return <code>false</code> if the two column records could not be merged + * @return {@code false} if the two column records could not be merged */ private static boolean mergeColInfoRecords(ColumnInfoRecord ciA, ColumnInfoRecord ciB) { if (ciA.isAdjacentBefore(ciB) && ciA.formatMatches(ciB)) { @@ -447,8 +447,8 @@ public final class ColumnInfoRecordsAggregate extends RecordAggregate implements * @param toColumnIx * group to this column (inclusive) * @param indent - * if <code>true</code> the group will be indented by one - * level, if <code>false</code> indenting will be decreased by + * if {@code true} the group will be indented by one + * level, if {@code false} indenting will be decreased by * one level. */ public void groupColumnRange(int fromColumnIx, int toColumnIx, boolean indent) { @@ -473,9 +473,9 @@ public final class ColumnInfoRecordsAggregate extends RecordAggregate implements } /** - * Finds the <tt>ColumnInfoRecord</tt> which contains the specified columnIndex + * Finds the {@code ColumnInfoRecord} which contains the specified columnIndex * @param columnIndex index of the column (not the index of the ColumnInfoRecord) - * @return <code>null</code> if no column info found for the specified column + * @return {@code null} if no column info found for the specified column */ public ColumnInfoRecord findColumnInfo(int columnIndex) { int nInfos = records.size(); diff --git a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ConditionalFormattingTable.java b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ConditionalFormattingTable.java index 2afbb3813d..466243c75c 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ConditionalFormattingTable.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ConditionalFormattingTable.java @@ -43,7 +43,8 @@ public final class ConditionalFormattingTable extends RecordAggregate { } } - public void visitContainedRecords(RecordVisitor rv) { + @Override + public void visitContainedRecords(RecordVisitor rv) { for (CFRecordsAggregate subAgg : _cfHeaders) { subAgg.visitContainedRecords(rv); } diff --git a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/CustomViewSettingsRecordAggregate.java b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/CustomViewSettingsRecordAggregate.java index 40fe4dfc17..7aa5bd8e25 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/CustomViewSettingsRecordAggregate.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/CustomViewSettingsRecordAggregate.java @@ -67,7 +67,8 @@ public final class CustomViewSettingsRecordAggregate extends RecordAggregate { } } - public void visitContainedRecords(RecordVisitor rv) { + @Override + public void visitContainedRecords(RecordVisitor rv) { if (_recs.isEmpty()) { return; } @@ -88,6 +89,6 @@ public final class CustomViewSettingsRecordAggregate extends RecordAggregate { } public void append(RecordBase r){ - _recs.add(r); + _recs.add(r); } } diff --git a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/DataValidityTable.java b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/DataValidityTable.java index e6ad8bb29d..d533a7bc91 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/DataValidityTable.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/DataValidityTable.java @@ -51,7 +51,8 @@ public final class DataValidityTable extends RecordAggregate { _validationList = new ArrayList<>(); } - public void visitContainedRecords(RecordVisitor rv) { + @Override + public void visitContainedRecords(RecordVisitor rv) { if (_validationList.isEmpty()) { return; } diff --git a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/FormulaRecordAggregate.java b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/FormulaRecordAggregate.java index 62c3df3a05..200365ee43 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/FormulaRecordAggregate.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/FormulaRecordAggregate.java @@ -140,7 +140,8 @@ public final class FormulaRecordAggregate extends RecordAggregate implements Cel return _formulaRecord.toString(); } - public void visitContainedRecords(RecordVisitor rv) { + @Override + public void visitContainedRecords(RecordVisitor rv) { rv.visitRecord(_formulaRecord); Record sharedFormulaRecord = _sharedValueManager.getRecordForFirstCell(this); if (sharedFormulaRecord != null) { diff --git a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/MergedCellsTable.java b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/MergedCellsTable.java index c698cb0d27..667f736c6c 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/MergedCellsTable.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/MergedCellsTable.java @@ -53,6 +53,7 @@ public final class MergedCellsTable extends RecordAggregate { } } + @Override public int getRecordSize() { // a bit cheaper than the default impl int nRegions = _mergedRegions.size(); @@ -68,7 +69,8 @@ public final class MergedCellsTable extends RecordAggregate { + CellRangeAddressList.getEncodedSize(nLeftoverMergedRegions); } - public void visitContainedRecords(RecordVisitor rv) { + @Override + public void visitContainedRecords(RecordVisitor rv) { int nRegions = _mergedRegions.size(); if (nRegions < 1) { // no need to write a single empty MergeCellsRecord diff --git a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/RecordAggregate.java b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/RecordAggregate.java index c8103501ed..79148c175e 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/RecordAggregate.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/RecordAggregate.java @@ -21,14 +21,14 @@ import org.apache.poi.hssf.record.Record; import org.apache.poi.hssf.record.RecordBase; /** - * <tt>RecordAggregate</tt>s are groups of of BIFF <tt>Record</tt>s that are typically stored + * {@code RecordAggregate}s are groups of of BIFF {@code Record}s that are typically stored * together and/or updated together. Workbook / Sheet records are typically stored in a sequential * list, which does not provide much structure to coordinate updates. */ public abstract class RecordAggregate extends RecordBase { /** - * Visit each of the atomic BIFF records contained in this {@link RecordAggregate} in the order + * Visit each of the atomic BIFF records contained in this RecordAggregate in the order * that they should be written to file. Implementors may or may not return the actual * {@link Record}s being used to manage POI's internal implementation. Callers should not * assume either way, and therefore only attempt to modify those {@link Record}s after cloning @@ -37,11 +37,13 @@ public abstract class RecordAggregate extends RecordBase { */ public abstract void visitContainedRecords(RecordVisitor rv); + @Override public final int serialize(int offset, byte[] data) { SerializingRecordVisitor srv = new SerializingRecordVisitor(data, offset); visitContainedRecords(srv); return srv.countBytesWritten(); } + @Override public int getRecordSize() { RecordSizingVisitor rsv = new RecordSizingVisitor(); visitContainedRecords(rsv); @@ -51,7 +53,7 @@ public abstract class RecordAggregate extends RecordBase { public interface RecordVisitor { /** * Implementors may call non-mutating methods on Record r. - * @param r must not be <code>null</code> + * @param r must not be {@code null} */ void visitRecord(org.apache.poi.hssf.record.Record r); } @@ -70,6 +72,7 @@ public abstract class RecordAggregate extends RecordBase { public int countBytesWritten() { return _countBytesWritten; } + @Override public void visitRecord(org.apache.poi.hssf.record.Record r) { int currentOffset = _startOffset + _countBytesWritten; _countBytesWritten += r.serialize(currentOffset, _data); @@ -85,6 +88,7 @@ public abstract class RecordAggregate extends RecordBase { public int getTotalSize() { return _totalSize; } + @Override public void visitRecord(org.apache.poi.hssf.record.Record r) { _totalSize += r.getRecordSize(); } @@ -101,6 +105,7 @@ public abstract class RecordAggregate extends RecordBase { _rv = rv; _position = initialPosition; } + @Override public void visitRecord(org.apache.poi.hssf.record.Record r) { _position += r.getRecordSize(); _rv.visitRecord(r); diff --git a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java index 738d1d9b13..172ce0e7ea 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java @@ -42,11 +42,6 @@ import org.apache.poi.hssf.record.UnknownRecord; import org.apache.poi.ss.SpreadsheetVersion; import org.apache.poi.ss.formula.FormulaShifter; -/** - * - * @author andy - * @author Jason Height (jheight at chariot dot net dot au) - */ public final class RowRecordsAggregate extends RecordAggregate { private int _firstrow = -1; private int _lastrow = -1; diff --git a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/SharedValueManager.java b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/SharedValueManager.java index 03de03ebbd..9a635b566a 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/SharedValueManager.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/SharedValueManager.java @@ -40,9 +40,6 @@ import org.apache.poi.ss.util.CellReference; * <li>{@link ArrayRecord}s</li> * <li>{@link TableRecord}s</li> * </ul> - * - * @author Josh Micich - * @author Vladimirs Abramovs(Vladimirs.Abramovs at exigenservices.com) - handling of ArrayRecords */ public final class SharedValueManager { @@ -100,7 +97,7 @@ public final class SharedValueManager { } /** - * @return a new empty {@link SharedValueManager}. + * @return a new empty SharedValueManager. */ public static SharedValueManager createEmpty() { // Note - must create distinct instances because they are assumed to be mutable. @@ -151,7 +148,7 @@ public final class SharedValueManager { /** * @param firstCell as extracted from the {@link ExpPtg} from the cell's formula. - * @return never <code>null</code> + * @return never {@code null} */ public SharedFormulaRecord linkSharedFormulaRecord(CellReference firstCell, FormulaRecordAggregate agg) { SharedFormulaGroup result = findFormulaGroupForCell(firstCell); @@ -186,7 +183,7 @@ public final class SharedValueManager { * top left cell. * * @return the SHRFMLA, TABLE or ARRAY record for the formula cell, if it is the first cell of - * a table or array region. <code>null</code> if the formula cell is not shared/array/table, + * a table or array region. {@code null} if the formula cell is not shared/array/table, * or if the specified formula is not the the first in the group. */ public SharedValueRecordBase getRecordForFirstCell(FormulaRecordAggregate agg) { @@ -231,7 +228,7 @@ public final class SharedValueManager { } /** - * Converts all {@link FormulaRecord}s handled by <tt>sharedFormulaRecord</tt> + * Converts all {@link FormulaRecord}s handled by {@code sharedFormulaRecord} * to plain unshared formulas */ public void unlink(SharedFormulaRecord sharedFormulaRecord) { @@ -254,7 +251,7 @@ public final class SharedValueManager { /** * Removes the {@link ArrayRecord} for the cell group containing the specified cell. * The caller should clear (set blank) all cells in the returned range. - * @return the range of the array formula which was just removed. Never <code>null</code>. + * @return the range of the array formula which was just removed. Never {@code null}. */ public CellRangeAddress8Bit removeArrayFormula(int rowIndex, int columnIndex) { for (ArrayRecord ar : _arrayRecords) { @@ -269,7 +266,7 @@ public final class SharedValueManager { } /** - * @return the shared ArrayRecord identified by (firstRow, firstColumn). never <code>null</code>. + * @return the shared ArrayRecord identified by (firstRow, firstColumn). never {@code null}. */ public ArrayRecord getArrayRecord(int firstRow, int firstColumn) { for(ArrayRecord ar : _arrayRecords) { diff --git a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java index fff9cc9b37..573dd2e54f 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java @@ -37,10 +37,6 @@ import org.apache.poi.util.Removal; /** * * Aggregate value records together. Things are easier to handle that way. - * - * @author andy - * @author Glen Stampoultzis (glens at apache.org) - * @author Jason Height (jheight at chariot dot net dot au) */ public final class ValueRecordsAggregate implements Iterable<CellValueRecordInterface> { private static final int MAX_ROW_INDEX = 0XFFFF; diff --git a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/WorksheetProtectionBlock.java b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/WorksheetProtectionBlock.java index 9a1a6418db..995b6466ba 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/aggregates/WorksheetProtectionBlock.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/aggregates/WorksheetProtectionBlock.java @@ -21,7 +21,6 @@ import org.apache.poi.hssf.model.RecordStream; import org.apache.poi.hssf.record.ObjectProtectRecord; import org.apache.poi.hssf.record.PasswordRecord; import org.apache.poi.hssf.record.ProtectRecord; -import org.apache.poi.hssf.record.Record; import org.apache.poi.hssf.record.ScenarioProtectRecord; import org.apache.poi.poifs.crypt.CryptoFunctions; import org.apache.poi.util.RecordFormatException; @@ -32,8 +31,6 @@ import org.apache.poi.util.RecordFormatException; * * See OOO excelfileformat.pdf sec 4.18.2 'Sheet Protection in a Workbook * (BIFF5-BIFF8)' - * - * @author Josh Micich */ public final class WorksheetProtectionBlock extends RecordAggregate { // Every one of these component records is optional @@ -51,7 +48,7 @@ public final class WorksheetProtectionBlock extends RecordAggregate { } /** - * @return <code>true</code> if the specified Record sid is one belonging to + * @return {@code true} if the specified Record sid is one belonging to * the 'Page Settings Block'. */ public static boolean isComponentRecord(int sid) { @@ -97,7 +94,8 @@ public final class WorksheetProtectionBlock extends RecordAggregate { } } - public void visitContainedRecords(RecordVisitor rv) { + @Override + public void visitContainedRecords(RecordVisitor rv) { // Replicates record order from Excel 2007, though this is not critical visitIfPresent(_protectRecord, rv); @@ -121,7 +119,7 @@ public final class WorksheetProtectionBlock extends RecordAggregate { } /** - * This method reads {@link WorksheetProtectionBlock} records from the supplied RecordStream + * This method reads WorksheetProtectionBlock records from the supplied RecordStream * until the first non-WorksheetProtectionBlock record is encountered. As each record is read, * it is incorporated into this WorksheetProtectionBlock. * <p> @@ -170,7 +168,7 @@ public final class WorksheetProtectionBlock extends RecordAggregate { * protect a spreadsheet with a password (not encrypted, just sets protect * flags and the password. * - * @param password to set. Pass <code>null</code> to remove all protection + * @param password to set. Pass {@code null} to remove all protection * @param shouldProtectObjects are protected * @param shouldProtectScenarios are protected */ diff --git a/poi/src/main/java/org/apache/poi/hssf/record/cont/ContinuableRecordOutput.java b/poi/src/main/java/org/apache/poi/hssf/record/cont/ContinuableRecordOutput.java index a39f1393e0..274ffe96d1 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/cont/ContinuableRecordOutput.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/cont/ContinuableRecordOutput.java @@ -92,7 +92,7 @@ public final class ContinuableRecordOutput implements LittleEndianOutput { * Notes: * <ul> * <li>The value of the 'is16bitEncoded' flag is determined by the actual character data - * of <tt>text</tt></li> + * of {@code text}</li> * <li>The string options flag is never separated (by a {@link ContinueRecord}) from the * first chunk of character data it refers to.</li> * <li>The 'ushort length' field is assumed to have been explicitly written earlier. Hence, @@ -132,7 +132,7 @@ public final class ContinuableRecordOutput implements LittleEndianOutput { * Notes: * <ul> * <li>The value of the 'is16bitEncoded' flag is determined by the actual character data - * of <tt>text</tt></li> + * of {@code text}</li> * <li>The string header fields are never separated (by a {@link ContinueRecord}) from the * first chunk of character data (i.e. the first character is always encoded in the same * record as the string header).</li> @@ -185,7 +185,7 @@ public final class ContinuableRecordOutput implements LittleEndianOutput { } } else { while(true) { - int nWritableChars = Math.min(nChars-i, _ulrOutput.getAvailableSpace() / 1); + int nWritableChars = Math.min(nChars-i, _ulrOutput.getAvailableSpace()); for ( ; nWritableChars > 0; nWritableChars--) { _ulrOutput.writeByte(text.charAt(i++)); } @@ -198,16 +198,18 @@ public final class ContinuableRecordOutput implements LittleEndianOutput { } } + @Override public void write(byte[] b) { writeContinueIfRequired(b.length); _ulrOutput.write(b); } + @Override public void write(byte[] b, int offset, int len) { int i=0; while(true) { - int nWritableChars = Math.min(len - i, _ulrOutput.getAvailableSpace() / 1); + int nWritableChars = Math.min(len - i, _ulrOutput.getAvailableSpace()); for ( ; nWritableChars > 0; nWritableChars--) { _ulrOutput.writeByte(b[offset + i++]); } @@ -218,22 +220,27 @@ public final class ContinuableRecordOutput implements LittleEndianOutput { } } + @Override public void writeByte(int v) { writeContinueIfRequired(1); _ulrOutput.writeByte(v); } + @Override public void writeDouble(double v) { writeContinueIfRequired(8); _ulrOutput.writeDouble(v); } + @Override public void writeInt(int v) { writeContinueIfRequired(4); _ulrOutput.writeInt(v); } + @Override public void writeLong(long v) { writeContinueIfRequired(8); _ulrOutput.writeLong(v); } + @Override public void writeShort(int v) { writeContinueIfRequired(2); _ulrOutput.writeShort(v); @@ -244,27 +251,35 @@ public final class ContinuableRecordOutput implements LittleEndianOutput { */ private static final LittleEndianOutput NOPOutput = new DelayableLittleEndianOutput() { + @Override public LittleEndianOutput createDelayedOutput(int size) { return this; } + @Override public void write(byte[] b) { // does nothing } + @Override public void write(byte[] b, int offset, int len) { // does nothing } + @Override public void writeByte(int v) { // does nothing } + @Override public void writeDouble(double v) { // does nothing } + @Override public void writeInt(int v) { // does nothing } + @Override public void writeLong(long v) { // does nothing } + @Override public void writeShort(int v) { // does nothing } diff --git a/poi/src/main/java/org/apache/poi/hssf/record/crypto/Biff8DecryptingStream.java b/poi/src/main/java/org/apache/poi/hssf/record/crypto/Biff8DecryptingStream.java index b9a7638789..e04870b943 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/crypto/Biff8DecryptingStream.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/crypto/Biff8DecryptingStream.java @@ -40,7 +40,7 @@ public final class Biff8DecryptingStream implements BiffHeaderInput, LittleEndia //arbitrarily selected; may need to increase private static final int MAX_RECORD_LENGTH = 100_000; - private ChunkedCipherInputStream ccis; + private final ChunkedCipherInputStream ccis; private final byte[] buffer = new byte[LittleEndianConsts.LONG_SIZE]; private boolean shouldSkipEncryptionOnCurrentRecord; @@ -58,7 +58,7 @@ public final class Biff8DecryptingStream implements BiffHeaderInput, LittleEndia Decryptor dec = info.getDecryptor(); dec.setChunkSize(RC4_REKEYING_INTERVAL); ccis = (ChunkedCipherInputStream)dec.getDataStream(stream, Integer.MAX_VALUE, 0); - + if (initialOffset > 0) { ccis.readFully(initialBuf); } @@ -124,7 +124,7 @@ public final class Biff8DecryptingStream implements BiffHeaderInput, LittleEndia public int readUByte() { return readByte() & 0xFF; } - + @Override public byte readByte() { if (shouldSkipEncryptionOnCurrentRecord) { @@ -139,7 +139,7 @@ public final class Biff8DecryptingStream implements BiffHeaderInput, LittleEndia public int readUShort() { return readShort() & 0xFFFF; } - + @Override public short readShort() { if (shouldSkipEncryptionOnCurrentRecord) { @@ -176,11 +176,11 @@ public final class Biff8DecryptingStream implements BiffHeaderInput, LittleEndia public long getPosition() { return ccis.getPos(); } - + /** * TODO: Additionally, the lbPlyPos (position_of_BOF) field of the BoundSheet8 record MUST NOT be encrypted. * - * @return <code>true</code> if record type specified by <tt>sid</tt> is never encrypted + * @return {@code true} if record type specified by {@code sid} is never encrypted */ public static boolean isNeverEncryptedRecord(int sid) { switch (sid) { diff --git a/poi/src/main/java/org/apache/poi/hssf/record/pivottable/ViewFieldsRecord.java b/poi/src/main/java/org/apache/poi/hssf/record/pivottable/ViewFieldsRecord.java index 7bbfbb68fb..2f5a6da67a 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/pivottable/ViewFieldsRecord.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/pivottable/ViewFieldsRecord.java @@ -33,15 +33,15 @@ import org.apache.poi.util.StringUtil; public final class ViewFieldsRecord extends StandardRecord { public static final short sid = 0x00B1; - /** the value of the <tt>cchName</tt> field when the {@link #_name} is not present */ + /** the value of the {@code cchName} field when the {@link #_name} is not present */ private static final int STRING_NOT_PRESENT_LEN = 0xFFFF; /** 5 shorts */ private static final int BASE_SIZE = 10; - private int _sxaxis; - private int _cSub; - private int _grbitSub; - private int _cItm; + private final int _sxaxis; + private final int _cSub; + private final int _grbitSub; + private final int _cItm; private String _name; @@ -54,7 +54,7 @@ public final class ViewFieldsRecord extends StandardRecord { COLUMN(2), PAGE(4), DATA(8); - int id; + final int id; Axis(int id) { this.id = id; } diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/DVConstraint.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/DVConstraint.java index 5317969278..a7fa156dbc 100644 --- a/poi/src/main/java/org/apache/poi/hssf/usermodel/DVConstraint.java +++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/DVConstraint.java @@ -53,19 +53,19 @@ public class DVConstraint implements DataValidationConstraint { public Ptg[] getFormula2() { return _formula2; } - + } - + private final int _validationType; private int _operator; private String[] _explicitListValues; - + private String _formula1; private String _formula2; private Double _value1; private Double _value2; - + private DVConstraint(int validationType, int comparisonOperator, String formulaA, String formulaB, Double value1, Double value2, String[] explicitListValues) { _validationType = validationType; @@ -76,8 +76,8 @@ public class DVConstraint implements DataValidationConstraint { _value2 = value2; _explicitListValues = (explicitListValues == null) ? null : explicitListValues.clone(); } - - + + /** * Creates a list constraint */ @@ -88,9 +88,9 @@ public class DVConstraint implements DataValidationConstraint { /** * Creates a number based data validation constraint. The text values entered for expr1 and expr2 - * can be either standard Excel formulas or formatted number values. If the expression starts - * with '=' it is parsed as a formula, otherwise it is parsed as a formatted number. - * + * can be either standard Excel formulas or formatted number values. If the expression starts + * with '=' it is parsed as a formula, otherwise it is parsed as a formatted number. + * * @param validationType one of {@link org.apache.poi.ss.usermodel.DataValidationConstraint.ValidationType#ANY}, * {@link org.apache.poi.ss.usermodel.DataValidationConstraint.ValidationType#DECIMAL}, * {@link org.apache.poi.ss.usermodel.DataValidationConstraint.ValidationType#INTEGER}, @@ -99,7 +99,7 @@ public class DVConstraint implements DataValidationConstraint { * @param expr1 date formula (when first char is '=') or formatted number value * @param expr2 date formula (when first char is '=') or formatted number value */ - public static DVConstraint createNumericConstraint(int validationType, int comparisonOperator, + public static DVConstraint createNumericConstraint(int validationType, int comparisonOperator, String expr1, String expr2) { switch (validationType) { case ValidationType.ANY: @@ -134,15 +134,15 @@ public class DVConstraint implements DataValidationConstraint { public static DVConstraint createExplicitListConstraint(String[] explicitListValues) { return new DVConstraint(null, explicitListValues); } - - + + /** * Creates a time based data validation constraint. The text values entered for expr1 and expr2 - * can be either standard Excel formulas or formatted time values. If the expression starts - * with '=' it is parsed as a formula, otherwise it is parsed as a formatted time. To parse - * formatted times, two formats are supported: "HH:MM" or "HH:MM:SS". This is contrary to + * can be either standard Excel formulas or formatted time values. If the expression starts + * with '=' it is parsed as a formula, otherwise it is parsed as a formatted time. To parse + * formatted times, two formats are supported: "HH:MM" or "HH:MM:SS". This is contrary to * Excel which uses the default time format from the OS. - * + * * @param comparisonOperator constant from {@link org.apache.poi.ss.usermodel.DataValidationConstraint.OperatorType} enum * @param expr1 date formula (when first char is '=') or formatted time value * @param expr2 date formula (when first char is '=') or formatted time value @@ -152,7 +152,7 @@ public class DVConstraint implements DataValidationConstraint { throw new IllegalArgumentException("expr1 must be supplied"); } OperatorType.validateSecondArg(comparisonOperator, expr1); - + // formula1 and value1 are mutually exclusive String formula1 = getFormulaFromTextExpression(expr1); Double value1 = formula1 == null ? convertTime(expr1) : null; @@ -161,19 +161,19 @@ public class DVConstraint implements DataValidationConstraint { Double value2 = formula2 == null ? convertTime(expr2) : null; return new DVConstraint(ValidationType.TIME, comparisonOperator, formula1, formula2, value1, value2, null); } - + /** * Creates a date based data validation constraint. The text values entered for expr1 and expr2 - * can be either standard Excel formulas or formatted date values. If the expression starts - * with '=' it is parsed as a formula, otherwise it is parsed as a formatted date (Excel uses + * can be either standard Excel formulas or formatted date values. If the expression starts + * with '=' it is parsed as a formula, otherwise it is parsed as a formatted date (Excel uses * the same convention). To parse formatted dates, a date format needs to be specified. This * is contrary to Excel which uses the default short date format from the OS. - * + * * @param comparisonOperator constant from {@link org.apache.poi.ss.usermodel.DataValidationConstraint.OperatorType} enum * @param expr1 date formula (when first char is '=') or formatted date value * @param expr2 date formula (when first char is '=') or formatted date value * @param dateFormat ignored if both expr1 and expr2 are formulas. Default value is "YYYY/MM/DD" - * otherwise any other valid argument for <tt>SimpleDateFormat</tt> can be used + * otherwise any other valid argument for {@code SimpleDateFormat} can be used * @see <a href='http://java.sun.com/j2se/1.5.0/docs/api/java/text/DateFormat.html'>SimpleDateFormat</a> */ public static DVConstraint createDateConstraint(int comparisonOperator, String expr1, String expr2, String dateFormat) { @@ -186,7 +186,7 @@ public class DVConstraint implements DataValidationConstraint { df = new SimpleDateFormat(dateFormat, LocaleUtil.getUserLocale()); df.setTimeZone(LocaleUtil.getUserTimeZone()); } - + // formula1 and value1 are mutually exclusive String formula1 = getFormulaFromTextExpression(expr1); Double value1 = formula1 == null ? convertDate(expr1, df) : null; @@ -195,17 +195,17 @@ public class DVConstraint implements DataValidationConstraint { Double value2 = formula2 == null ? convertDate(expr2, df) : null; return new DVConstraint(ValidationType.DATE, comparisonOperator, formula1, formula2, value1, value2, null); } - + /** - * Distinguishes formula expressions from simple value expressions. This logic is only + * Distinguishes formula expressions from simple value expressions. This logic is only * required by a few factory methods in this class that create data validation constraints * from more or less the same parameters that would have been entered in the Excel UI. The * data validation dialog box uses the convention that formulas begin with '='. Other methods - * in this class follow the POI convention (formulas and values are distinct), so the '=' + * in this class follow the POI convention (formulas and values are distinct), so the '=' * convention is not used there. - * + * * @param textExpr a formula or value expression - * @return all text after '=' if textExpr begins with '='. Otherwise <code>null</code> if textExpr does not begin with '=' + * @return all text after '=' if textExpr begins with '='. Otherwise {@code null} if textExpr does not begin with '=' */ private static String getFormulaFromTextExpression(String textExpr) { if (textExpr == null) { @@ -222,7 +222,7 @@ public class DVConstraint implements DataValidationConstraint { /** - * @return <code>null</code> if numberStr is <code>null</code> + * @return {@code null} if numberStr is {@code null} */ private static Double convertNumber(String numberStr) { if (numberStr == null) { @@ -231,40 +231,40 @@ public class DVConstraint implements DataValidationConstraint { try { return Double.valueOf(numberStr); } catch (NumberFormatException e) { - throw new RuntimeException("The supplied text '" + numberStr + throw new RuntimeException("The supplied text '" + numberStr + "' could not be parsed as a number"); } } /** - * @return <code>null</code> if timeStr is <code>null</code> + * @return {@code null} if timeStr is {@code null} */ private static Double convertTime(String timeStr) { if (timeStr == null) { return null; } - return Double.valueOf(DateUtil.convertTime(timeStr)); + return DateUtil.convertTime(timeStr); } /** - * @param dateFormat pass <code>null</code> for default YYYYMMDD - * @return <code>null</code> if timeStr is <code>null</code> + * @param dateFormat pass {@code null} for default YYYYMMDD + * @return {@code null} if timeStr is {@code null} */ private static Double convertDate(String dateStr, SimpleDateFormat dateFormat) { if (dateStr == null) { return null; } - Date dateVal; + Date dateVal; if (dateFormat == null) { dateVal = DateUtil.parseYYYYMMDDDate(dateStr); } else { try { dateVal = dateFormat.parse(dateStr); } catch (ParseException e) { - throw new RuntimeException("Failed to parse date '" + dateStr + throw new RuntimeException("Failed to parse date '" + dateStr + "' using specified format '" + dateFormat + "'", e); } } - return Double.valueOf(DateUtil.getExcelDate(dateVal)); + return DateUtil.getExcelDate(dateVal); } public static DVConstraint createCustomFormulaConstraint(String formula) { @@ -273,23 +273,24 @@ public class DVConstraint implements DataValidationConstraint { } return new DVConstraint(ValidationType.FORMULA, OperatorType.IGNORED, formula, null, null, null, null); } - + /* (non-Javadoc) * @see org.apache.poi.hssf.usermodel.DataValidationConstraint#getValidationType() */ + @Override public int getValidationType() { return _validationType; } /** * Convenience method - * @return <code>true</code> if this constraint is a 'list' validation + * @return {@code true} if this constraint is a 'list' validation */ public boolean isListValidationType() { return _validationType == ValidationType.LIST; } /** * Convenience method - * @return <code>true</code> if this constraint is a 'list' validation with explicit values + * @return {@code true} if this constraint is a 'list' validation with explicit values */ public boolean isExplicitList() { return _validationType == ValidationType.LIST && _explicitListValues != null; @@ -297,25 +298,29 @@ public class DVConstraint implements DataValidationConstraint { /* (non-Javadoc) * @see org.apache.poi.hssf.usermodel.DataValidationConstraint#getOperator() */ + @Override public int getOperator() { return _operator; } /* (non-Javadoc) * @see org.apache.poi.hssf.usermodel.DataValidationConstraint#setOperator(int) */ + @Override public void setOperator(int operator) { _operator = operator; } - + /* (non-Javadoc) * @see org.apache.poi.hssf.usermodel.DataValidationConstraint#getExplicitListValues() */ + @Override public String[] getExplicitListValues() { return _explicitListValues; } /* (non-Javadoc) * @see org.apache.poi.hssf.usermodel.DataValidationConstraint#setExplicitListValues(java.lang.String[]) */ + @Override public void setExplicitListValues(String[] explicitListValues) { if (_validationType != ValidationType.LIST) { throw new RuntimeException("Cannot setExplicitListValues on non-list constraint"); @@ -327,12 +332,14 @@ public class DVConstraint implements DataValidationConstraint { /* (non-Javadoc) * @see org.apache.poi.hssf.usermodel.DataValidationConstraint#getFormula1() */ + @Override public String getFormula1() { return _formula1; } /* (non-Javadoc) * @see org.apache.poi.hssf.usermodel.DataValidationConstraint#setFormula1(java.lang.String) */ + @Override public void setFormula1(String formula1) { _value1 = null; _explicitListValues = null; @@ -342,19 +349,21 @@ public class DVConstraint implements DataValidationConstraint { /* (non-Javadoc) * @see org.apache.poi.hssf.usermodel.DataValidationConstraint#getFormula2() */ + @Override public String getFormula2() { return _formula2; } /* (non-Javadoc) * @see org.apache.poi.hssf.usermodel.DataValidationConstraint#setFormula2(java.lang.String) */ + @Override public void setFormula2(String formula2) { _value2 = null; _formula2 = formula2; } /** - * @return the numeric value for expression 1. May be <code>null</code> + * @return the numeric value for expression 1. May be {@code null} */ public Double getValue1() { return _value1; @@ -364,11 +373,11 @@ public class DVConstraint implements DataValidationConstraint { */ public void setValue1(double value1) { _formula1 = null; - _value1 = Double.valueOf(value1); + _value1 = value1; } /** - * @return the numeric value for expression 2. May be <code>null</code> + * @return the numeric value for expression 2. May be {@code null} */ public Double getValue2() { return _value2; @@ -378,11 +387,11 @@ public class DVConstraint implements DataValidationConstraint { */ public void setValue2(double value2) { _formula2 = null; - _value2 = Double.valueOf(value2); + _value2 = value2; } - + /** - * @return both parsed formulas (for expression 1 and 2). + * @return both parsed formulas (for expression 1 and 2). */ /* package */ FormulaPair createFormulas(HSSFSheet sheet) { Ptg[] formula1; @@ -414,14 +423,14 @@ public class DVConstraint implements DataValidationConstraint { sb.append('\0'); // list delimiter is the nul char } sb.append(_explicitListValues[i]); - + } return new Ptg[] { new StringPtg(sb.toString()), }; } /** - * @return The parsed token array representing the formula or value specified. - * Empty array if both formula and value are <code>null</code> + * @return The parsed token array representing the formula or value specified. + * Empty array if both formula and value are {@code null} */ @SuppressWarnings("resource") private static Ptg[] convertDoubleFormula(String formula, Double value, HSSFSheet sheet) { @@ -429,14 +438,14 @@ public class DVConstraint implements DataValidationConstraint { if (value == null) { return Ptg.EMPTY_PTG_ARRAY; } - return new Ptg[] { new NumberPtg(value.doubleValue()), }; + return new Ptg[] { new NumberPtg(value), }; } if (value != null) { throw new IllegalStateException("Both formula and value cannot be present"); } HSSFWorkbook wb = sheet.getWorkbook(); return HSSFFormulaParser.parse(formula, wb, FormulaType.CELL, wb.getSheetIndex(sheet)); - } + } static DVConstraint createDVConstraint(DVRecord dvRecord, FormulaRenderingWorkbook book) { switch (dvRecord.getDataType()) { diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormatting.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormatting.java index 26bdd6bd95..37fb0d09e3 100644 --- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormatting.java +++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormatting.java @@ -23,55 +23,45 @@ import org.apache.poi.ss.usermodel.ConditionalFormattingRule; import org.apache.poi.ss.util.CellRangeAddress; /** - * HSSFConditionalFormatting class encapsulates all settings of Conditional Formatting. - * - * The class can be used - * - * <UL> - * <LI> - * to make a copy HSSFConditionalFormatting settings. - * </LI> - * - * + * HSSFConditionalFormatting class encapsulates all settings of Conditional Formatting. + * + * The class can be used to make a copy HSSFConditionalFormatting settings. + * + * * For example: - * <PRE> + * <pre>{@code * HSSFConditionalFormatting cf = sheet.getConditionalFormattingAt(index); * newSheet.addConditionalFormatting(cf); - * </PRE> - * - * <LI> - * or to modify existing Conditional Formatting settings (formatting regions and/or rules). - * </LI> - * </UL> - * + * }</pre> + * + * or to modify existing Conditional Formatting settings (formatting regions and/or rules).<p> + * * Use {@link org.apache.poi.hssf.usermodel.HSSFSheet#getSheetConditionalFormatting()} to get access to an instance of this class. * <P> * To create a new Conditional Formatting set use the following approach: - * - * <PRE> - * + * + * <pre>{@code * // Define a Conditional Formatting rule, which triggers formatting * // when cell's value is greater or equal than 100.0 and * // applies patternFormatting defined below. * HSSFConditionalFormattingRule rule = sheet.createConditionalFormattingRule( - * ComparisonOperator.GE, - * "100.0", // 1st formula + * ComparisonOperator.GE, + * "100.0", // 1st formula * null // 2nd formula is not used for comparison operator GE * ); - * + * * // Create pattern with red background * HSSFPatternFormatting patternFmt = rule.cretePatternFormatting(); * patternFormatting.setFillBackgroundColor(HSSFColor.RED.index); - * + * * // Define a region containing first column - * Region [] regions = - * { + * Region [] regions = { * new Region(1,(short)1,-1,(short)1) * }; - * - * // Apply Conditional Formatting rule defined above to the regions + * + * // Apply Conditional Formatting rule defined above to the regions * sheet.addConditionalFormatting(regions, rule); - * </PRE> + * }</pre> */ public final class HSSFConditionalFormatting implements ConditionalFormatting { private final HSSFSheet sheet; @@ -84,7 +74,7 @@ public final class HSSFConditionalFormatting implements ConditionalFormatting { if(cfAggregate == null) { throw new IllegalArgumentException("cfAggregate must not be null"); } - this.sheet = sheet; + this.sheet = sheet; this.cfAggregate = cfAggregate; } CFRecordsAggregate getCFRecordsAggregate() { @@ -92,7 +82,7 @@ public final class HSSFConditionalFormatting implements ConditionalFormatting { } /** - * @return array of <tt>CellRangeAddress</tt>s. never <code>null</code> + * @return array of {@code CellRangeAddress}s. never {@code null} */ @Override public CellRangeAddress[] getFormattingRanges() { @@ -106,11 +96,11 @@ public final class HSSFConditionalFormatting implements ConditionalFormatting { } /** - * Replaces an existing Conditional Formatting rule at position idx. + * Replaces an existing Conditional Formatting rule at position idx. * Older versions of Excel only allow up to 3 Conditional Formatting rules, * and will ignore rules beyond that, while newer versions are fine. * This method can be useful to modify existing Conditional Formatting rules. - * + * * @param idx position of the rule. Should be between 0 and 2 for older Excel versions * @param cfRule - Conditional Formatting rule */ @@ -124,7 +114,7 @@ public final class HSSFConditionalFormatting implements ConditionalFormatting { } /** - * add a Conditional Formatting rule. + * add a Conditional Formatting rule. * Excel allows to create up to 3 Conditional Formatting rules. * @param cfRule - Conditional Formatting rule */ diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheetConditionalFormatting.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheetConditionalFormatting.java index 436a7f5d1f..3f723de47f 100644 --- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheetConditionalFormatting.java +++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheetConditionalFormatting.java @@ -31,7 +31,7 @@ import org.apache.poi.ss.usermodel.SheetConditionalFormatting; import org.apache.poi.ss.util.CellRangeAddress; /** - * The 'Conditional Formatting' facet of <tt>HSSFSheet</tt> + * The 'Conditional Formatting' facet of {@code HSSFSheet} */ public final class HSSFSheetConditionalFormatting implements SheetConditionalFormatting { private final HSSFSheet _sheet; @@ -48,7 +48,7 @@ public final class HSSFSheetConditionalFormatting implements SheetConditionalFor * TODO - formulas containing cell references are currently not parsed properly * * @param comparisonOperation - a constant value from - * <tt>{@link org.apache.poi.hssf.record.CFRuleBase.ComparisonOperator}</tt>: <p> + * {@code {@link org.apache.poi.hssf.record.CFRuleBase.ComparisonOperator}}: * <ul> * <li>BETWEEN</li> * <li>NOT_BETWEEN</li> @@ -59,12 +59,13 @@ public final class HSSFSheetConditionalFormatting implements SheetConditionalFor * <li>GE</li> * <li>LE</li> * </ul> - * </p> + * * @param formula1 - formula for the valued, compared with the cell * @param formula2 - second formula (only used with * {@link org.apache.poi.hssf.record.CFRuleBase.ComparisonOperator#BETWEEN}) and * {@link org.apache.poi.hssf.record.CFRuleBase.ComparisonOperator#NOT_BETWEEN} operations) */ + @Override public HSSFConditionalFormattingRule createConditionalFormattingRule( byte comparisonOperation, String formula1, @@ -73,6 +74,7 @@ public final class HSSFSheetConditionalFormatting implements SheetConditionalFor return new HSSFConditionalFormattingRule(_sheet, rr); } + @Override public HSSFConditionalFormattingRule createConditionalFormattingRule( byte comparisonOperation, String formula1) { @@ -87,6 +89,7 @@ public final class HSSFSheetConditionalFormatting implements SheetConditionalFor * TODO - formulas containing cell references are currently not parsed properly * @param formula - formula for the valued, compared with the cell */ + @Override public HSSFConditionalFormattingRule createConditionalFormattingRule(String formula) { CFRuleRecord rr = CFRuleRecord.create(_sheet, formula); return new HSSFConditionalFormattingRule(_sheet, rr); @@ -101,6 +104,7 @@ public final class HSSFSheetConditionalFormatting implements SheetConditionalFor * then * {@link HSSFIconMultiStateFormatting#getThresholds()} */ + @Override public HSSFConditionalFormattingRule createConditionalFormattingRule( IconSet iconSet) { CFRule12Record rr = CFRule12Record.create(_sheet, iconSet); @@ -121,6 +125,7 @@ public final class HSSFSheetConditionalFormatting implements SheetConditionalFor CFRule12Record rr = CFRule12Record.create(_sheet, color.getExtendedColor()); return new HSSFConditionalFormattingRule(_sheet, rr); } + @Override public HSSFConditionalFormattingRule createConditionalFormattingRule(ExtendedColor color) { return createConditionalFormattingRule((HSSFExtendedColor)color); } @@ -135,6 +140,7 @@ public final class HSSFSheetConditionalFormatting implements SheetConditionalFor * and * {@link HSSFColorScaleFormatting#getColors()} */ + @Override public HSSFConditionalFormattingRule createConditionalFormattingColorScaleRule() { CFRule12Record rr = CFRule12Record.createColorScale(_sheet); return new HSSFConditionalFormattingRule(_sheet, rr); @@ -158,6 +164,7 @@ public final class HSSFSheetConditionalFormatting implements SheetConditionalFor return _conditionalFormattingTable.add(cfraClone); } + @Override public int addConditionalFormatting( ConditionalFormatting cf ) { return addConditionalFormatting((HSSFConditionalFormatting)cf); } @@ -194,6 +201,7 @@ public final class HSSFSheetConditionalFormatting implements SheetConditionalFor return _conditionalFormattingTable.add(cfra); } + @Override public int addConditionalFormatting(CellRangeAddress[] regions, ConditionalFormattingRule[] cfRules) { HSSFConditionalFormattingRule[] hfRules; if(cfRules instanceof HSSFConditionalFormattingRule[]) { @@ -212,6 +220,7 @@ public final class HSSFSheetConditionalFormatting implements SheetConditionalFor ); } + @Override public int addConditionalFormatting(CellRangeAddress[] regions, ConditionalFormattingRule rule1) { return addConditionalFormatting(regions, (HSSFConditionalFormattingRule)rule1); @@ -224,6 +233,7 @@ public final class HSSFSheetConditionalFormatting implements SheetConditionalFor new HSSFConditionalFormattingRule[] { rule1, rule2 }); } + @Override public int addConditionalFormatting(CellRangeAddress[] regions, ConditionalFormattingRule rule1, ConditionalFormattingRule rule2) { @@ -240,6 +250,7 @@ public final class HSSFSheetConditionalFormatting implements SheetConditionalFor * of the Conditional Formatting object to fetch * @return Conditional Formatting object */ + @Override public HSSFConditionalFormatting getConditionalFormattingAt(int index) { CFRecordsAggregate cf = _conditionalFormattingTable.get(index); if (cf == null) { @@ -251,6 +262,7 @@ public final class HSSFSheetConditionalFormatting implements SheetConditionalFor /** * @return number of Conditional Formatting objects of the sheet */ + @Override public int getNumConditionalFormattings() { return _conditionalFormattingTable.size(); } @@ -259,6 +271,7 @@ public final class HSSFSheetConditionalFormatting implements SheetConditionalFor * removes a Conditional Formatting object by index * @param index of a Conditional Formatting object to remove */ + @Override public void removeConditionalFormatting(int index) { _conditionalFormattingTable.remove(index); } 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 bd86c2857f..dac56c030b 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 @@ -177,7 +177,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { * this holds the HSSFName objects attached to this workbook */ - private ArrayList<HSSFName> names; + private final ArrayList<HSSFName> names; /** * this holds the HSSFFont objects attached to this workbook. @@ -212,7 +212,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { * The locator of user-defined functions. * By default includes functions from the Excel Analysis Toolpack */ - private UDFFinder _udfFinder = new IndexedUDFFinder(AggregatingUDFFinder.DEFAULT); + private final UDFFinder _udfFinder = new IndexedUDFFinder(AggregatingUDFFinder.DEFAULT); public static HSSFWorkbook create(InternalWorkbook book) { return new HSSFWorkbook(book); @@ -583,7 +583,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { /** * Selects multiple sheets as a group. This is distinct from * the 'active' sheet (which is the sheet with focus). - * Unselects sheets that are not in <code>indexes</code>. + * Unselects sheets that are not in {@code indexes}. * * @param indexes Array of sheets to select, the index is 0-based. */ @@ -598,7 +598,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { /** * Selects multiple sheets as a group. This is distinct from * the 'active' sheet (which is the sheet with focus). - * Unselects sheets that are not in <code>indexes</code>. + * Unselects sheets that are not in {@code indexes}. * * @param indexes Collection of sheets to select, the index is 0-based. */ @@ -770,7 +770,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { * Returns the index of the given sheet * * @param sheet the sheet to look up - * @return index of the sheet (0 based). <tt>-1</tt> if not found + * @return index of the sheet (0 based). {@code -1} if not found */ @Override public int getSheetIndex(Sheet sheet) { @@ -873,11 +873,11 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { * 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> + * }</pre> * </p> * <p> * Except the 31-character constraint, Excel applies some other rules: @@ -1009,7 +1009,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { * Get sheet with the given name (case insensitive match) * * @param name of the sheet - * @return HSSFSheet with the name provided or <code>null</code> if it does not exist + * @return HSSFSheet with the name provided or {@code null} if it does not exist */ @Override @@ -1027,7 +1027,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { } /** - * Removes sheet at the given index.<p> + * Removes sheet at the given index. * <p> * Care must be taken if the removed sheet is the currently active or only selected sheet in * the workbook. There are a few situations when Excel must have a selection and/or active @@ -1408,7 +1408,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { */ private static final class SheetRecordCollector implements RecordVisitor { - private List<Record> _list; + private final List<Record> _list; private int _totalSize; public SheetRecordCollector() { @@ -1836,7 +1836,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { * Adds a picture to the workbook. * * @param pictureData The bytes of the picture - * @param format The format of the picture. One of <code>PICTURE_TYPE_*</code> + * @param format The format of the picture. One of {@code PICTURE_TYPE_*} * @return the index to this picture (1 based). * @see #PICTURE_TYPE_WMF * @see #PICTURE_TYPE_EMF diff --git a/poi/src/main/java/org/apache/poi/hssf/util/HSSFColor.java b/poi/src/main/java/org/apache/poi/hssf/util/HSSFColor.java index a7d53da928..de58ba380d 100644 --- a/poi/src/main/java/org/apache/poi/hssf/util/HSSFColor.java +++ b/poi/src/main/java/org/apache/poi/hssf/util/HSSFColor.java @@ -43,9 +43,9 @@ public class HSSFColor implements Color { private static Map<Integer,HSSFColor> indexHash; private static Map<HSSFColorPredefined,HSSFColor> enumList; - private java.awt.Color color; - private int index; - private int index2; + private final java.awt.Color color; + private final int index; + private final int index2; /** * Predefined HSSFColors with their given palette index (and an optional 2nd index) @@ -108,7 +108,7 @@ public class HSSFColor implements Color { */ AUTOMATIC (0x40, -1, 0x000000); - private HSSFColor color; + private final HSSFColor color; HSSFColorPredefined(int index, int index2, int rgb) { this.color = new HSSFColor(index, index2, new java.awt.Color(rgb)); @@ -167,7 +167,7 @@ public class HSSFColor implements Color { * This function returns all the colours in an unmodifiable Map. * The map is cached on first use. * - * @return a Map containing all colours keyed by <tt>Integer</tt> excel-style palette indexes + * @return a Map containing all colours keyed by {@code Integer} excel-style palette indexes */ public static synchronized Map<Integer,HSSFColor> getIndexHash() { if(indexHash == null) { @@ -344,7 +344,7 @@ public class HSSFColor implements Color { if (index != hssfColor.index) return false; if (index2 != hssfColor.index2) return false; - return color != null ? color.equals(hssfColor.color) : hssfColor.color == null; + return Objects.equals(color, hssfColor.color); } @Override @@ -353,7 +353,7 @@ public class HSSFColor implements Color { } /** - * Checked type cast <tt>color</tt> to an HSSFColor. + * Checked type cast {@code color} to an HSSFColor. * * @param color the color to type cast * @return the type casted color diff --git a/poi/src/main/java/org/apache/poi/poifs/dev/POIFSViewEngine.java b/poi/src/main/java/org/apache/poi/poifs/dev/POIFSViewEngine.java index 8db1bf3129..8eee26e13c 100644 --- a/poi/src/main/java/org/apache/poi/poifs/dev/POIFSViewEngine.java +++ b/poi/src/main/java/org/apache/poi/poifs/dev/POIFSViewEngine.java @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.poifs.dev; @@ -28,8 +28,6 @@ import java.util.List; /** * This class contains methods used to inspect POIFSViewable objects - * - * @author Marc Johnson (mjohnson at apache dot org) */ public class POIFSViewEngine diff --git a/poi/src/main/java/org/apache/poi/poifs/dev/POIFSViewable.java b/poi/src/main/java/org/apache/poi/poifs/dev/POIFSViewable.java index 8349e66973..a74ecb1025 100644 --- a/poi/src/main/java/org/apache/poi/poifs/dev/POIFSViewable.java +++ b/poi/src/main/java/org/apache/poi/poifs/dev/POIFSViewable.java @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.poifs.dev; @@ -31,8 +31,6 @@ import java.util.Iterator; * A POIFSViewable object is also expected to provide a short * description of itself, that can be used by a viewer when the * viewable object is collapsed. - * - * @author Marc Johnson (mjohnson at apache dot org) */ public interface POIFSViewable @@ -46,7 +44,7 @@ public interface POIFSViewable */ public Object [] getViewableArray(); - + /** * Get an Iterator of objects, some of which may implement * POIFSViewable diff --git a/poi/src/main/java/org/apache/poi/poifs/dev/POIFSViewer.java b/poi/src/main/java/org/apache/poi/poifs/dev/POIFSViewer.java index 0be693444f..4fc8d7a49e 100644 --- a/poi/src/main/java/org/apache/poi/poifs/dev/POIFSViewer.java +++ b/poi/src/main/java/org/apache/poi/poifs/dev/POIFSViewer.java @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.poifs.dev; @@ -27,8 +27,6 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem; /** * A simple viewer for POIFS files - * - * @author Marc Johnson (mjohnson at apache dot org) */ public final class POIFSViewer { diff --git a/poi/src/main/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderListener.java b/poi/src/main/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderListener.java index 56a3b78479..e095b486f5 100644 --- a/poi/src/main/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderListener.java +++ b/poi/src/main/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderListener.java @@ -15,15 +15,12 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.poifs.eventfilesystem; /** * Interface POIFSReaderListener - * - * @author Marc Johnson (mjohnson at apache dot org) - * @version %I%, %G% */ public interface POIFSReaderListener diff --git a/poi/src/main/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderRegistry.java b/poi/src/main/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderRegistry.java index 9ffac63120..2091eec512 100644 --- a/poi/src/main/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderRegistry.java +++ b/poi/src/main/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderRegistry.java @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.poifs.eventfilesystem; @@ -27,9 +27,6 @@ import org.apache.poi.poifs.filesystem.POIFSDocumentPath; /** * A registry for POIFSReaderListeners and the DocumentDescriptors of * the documents those listeners are interested in - * - * @author Marc Johnson (mjohnson at apache dot org) - * @version %I%, %G% */ class POIFSReaderRegistry diff --git a/poi/src/main/java/org/apache/poi/poifs/filesystem/BATManaged.java b/poi/src/main/java/org/apache/poi/poifs/filesystem/BATManaged.java index fcd3bde649..dd0a6d679a 100644 --- a/poi/src/main/java/org/apache/poi/poifs/filesystem/BATManaged.java +++ b/poi/src/main/java/org/apache/poi/poifs/filesystem/BATManaged.java @@ -15,15 +15,13 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.poifs.filesystem; /** * This interface defines behaviors for objects managed by the Block * Allocation Table (BAT). - * - * @author Marc Johnson (mjohnson at apache dot org) */ public interface BATManaged diff --git a/poi/src/main/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java b/poi/src/main/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java index 7148fda3cf..ed4f8c2bc5 100644 --- a/poi/src/main/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java +++ b/poi/src/main/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java @@ -30,8 +30,6 @@ import org.apache.poi.hpsf.ClassID; /** * This interface defines methods specific to Directory objects * managed by a Filesystem instance. - * - * @author Marc Johnson (mjohnson at apache dot org) */ public interface DirectoryEntry @@ -50,14 +48,14 @@ public interface DirectoryEntry */ public Iterator<Entry> getEntries(); - + /** * get the names of all the Entries contained directly in this * instance (in other words, names of children only; no grandchildren * etc). * * @return the names of all the entries that may be retrieved with - * getEntry(String), which may be empty (if this + * getEntry(String), which may be empty (if this * DirectoryEntry is empty) */ public Set<String> getEntryNames(); diff --git a/poi/src/main/java/org/apache/poi/poifs/filesystem/DocumentDescriptor.java b/poi/src/main/java/org/apache/poi/poifs/filesystem/DocumentDescriptor.java index 0c1b2c8177..b8d783638e 100644 --- a/poi/src/main/java/org/apache/poi/poifs/filesystem/DocumentDescriptor.java +++ b/poi/src/main/java/org/apache/poi/poifs/filesystem/DocumentDescriptor.java @@ -15,15 +15,12 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.poifs.filesystem; /** * Class DocumentDescriptor - * - * @author Marc Johnson (mjohnson at apache dot org) - * @version %I%, %G% */ public class DocumentDescriptor diff --git a/poi/src/main/java/org/apache/poi/poifs/filesystem/DocumentEntry.java b/poi/src/main/java/org/apache/poi/poifs/filesystem/DocumentEntry.java index 29f4b8afbf..dd1d9c21c9 100644 --- a/poi/src/main/java/org/apache/poi/poifs/filesystem/DocumentEntry.java +++ b/poi/src/main/java/org/apache/poi/poifs/filesystem/DocumentEntry.java @@ -15,15 +15,13 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.poifs.filesystem; /** * This interface defines methods specific to Document objects * managed by a Filesystem instance. - * - * @author Marc Johnson (mjohnson at apache dot org) */ public interface DocumentEntry diff --git a/poi/src/main/java/org/apache/poi/poifs/filesystem/Entry.java b/poi/src/main/java/org/apache/poi/poifs/filesystem/Entry.java index 2a8ea16aac..325c2a2738 100644 --- a/poi/src/main/java/org/apache/poi/poifs/filesystem/Entry.java +++ b/poi/src/main/java/org/apache/poi/poifs/filesystem/Entry.java @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.poifs.filesystem; @@ -23,8 +23,6 @@ package org.apache.poi.poifs.filesystem; * This interface provides access to an object managed by a Filesystem * instance. Entry objects are further divided into DocumentEntry and * DirectoryEntry instances. - * - * @author Marc Johnson (mjohnson at apache dot org) */ public interface Entry diff --git a/poi/src/main/java/org/apache/poi/poifs/filesystem/EntryNode.java b/poi/src/main/java/org/apache/poi/poifs/filesystem/EntryNode.java index a48d8e4f9a..c8c9b39deb 100644 --- a/poi/src/main/java/org/apache/poi/poifs/filesystem/EntryNode.java +++ b/poi/src/main/java/org/apache/poi/poifs/filesystem/EntryNode.java @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.poifs.filesystem; @@ -28,8 +28,6 @@ import org.apache.poi.poifs.property.Property; * appropriate * * Extending classes must override isDeleteOK() - * - * @author Marc Johnson (mjohnson at apache dot org) */ public abstract class EntryNode diff --git a/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java b/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java index 2fb09dc04d..7ac288a8a8 100644 --- a/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java +++ b/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java @@ -67,7 +67,7 @@ public class POIFSFileSystem extends BlockStore /** * Maximum number size (in blocks) of the allocation table as supported by - * POI.<p> + * POI. * <p> * This constant has been chosen to help POI identify corrupted data in the * header block (rather than crash immediately with {@link OutOfMemoryError} @@ -135,8 +135,8 @@ public class POIFSFileSystem extends BlockStore } /** - * <p>Creates a POIFSFileSystem from a <tt>File</tt>. This uses less memory than - * creating from an <tt>InputStream</tt>. The File will be opened read-only</p> + * <p>Creates a POIFSFileSystem from a {@code File}. This uses less memory than + * creating from an {@code InputStream}. The File will be opened read-only</p> * * <p>Note that with this constructor, you will need to call {@link #close()} * when you're done to have the underlying file closed, as the file is @@ -151,8 +151,8 @@ public class POIFSFileSystem extends BlockStore } /** - * <p>Creates a POIFSFileSystem from a <tt>File</tt>. This uses less memory than - * creating from an <tt>InputStream</tt>.</p> + * <p>Creates a POIFSFileSystem from a {@code File}. This uses less memory than + * creating from an {@code InputStream}.</p> * * <p>Note that with this constructor, you will need to call {@link #close()} * when you're done to have the underlying file closed, as the file is @@ -168,8 +168,8 @@ public class POIFSFileSystem extends BlockStore } /** - * <p>Creates a POIFSFileSystem from an open <tt>FileChannel</tt>. This uses - * less memory than creating from an <tt>InputStream</tt>. The stream will + * <p>Creates a POIFSFileSystem from an open {@code FileChannel}. This uses + * less memory than creating from an {@code InputStream}. The stream will * be used in read-only mode.</p> * * <p>Note that with this constructor, you will need to call {@link #close()} @@ -185,8 +185,8 @@ public class POIFSFileSystem extends BlockStore } /** - * <p>Creates a POIFSFileSystem from an open <tt>FileChannel</tt>. This uses - * less memory than creating from an <tt>InputStream</tt>.</p> + * <p>Creates a POIFSFileSystem from an open {@code FileChannel}. This uses + * less memory than creating from an {@code InputStream}.</p> * * <p>Note that with this constructor, you will need to call {@link #close()} * when you're done to have the underlying Channel closed, as the channel is @@ -240,21 +240,21 @@ public class POIFSFileSystem extends BlockStore } /** - * Create a POIFSFileSystem from an <tt>InputStream</tt>. Normally the stream is read until - * EOF. The stream is always closed.<p> + * Create a POIFSFileSystem from an {@code InputStream}. Normally the stream is read until + * EOF. The stream is always closed. * <p> - * Some streams are usable after reaching EOF (typically those that return <code>true</code> - * for <tt>markSupported()</tt>). In the unlikely case that the caller has such a stream + * Some streams are usable after reaching EOF (typically those that return {@code true} + * for {@code markSupported()}). In the unlikely case that the caller has such a stream * <i>and</i> needs to use it after this constructor completes, a work around is to wrap the - * stream in order to trap the <tt>close()</tt> call. A convenience method ( - * <tt>createNonClosingInputStream()</tt>) has been provided for this purpose: + * stream in order to trap the {@code close()} call. A convenience method ( + * {@code createNonClosingInputStream()}) has been provided for this purpose: * <pre> * InputStream wrappedStream = POIFSFileSystem.createNonClosingInputStream(is); * HSSFWorkbook wb = new HSSFWorkbook(wrappedStream); * is.reset(); * doSomethingElse(is); * </pre> - * Note also the special case of <tt>ByteArrayInputStream</tt> for which the <tt>close()</tt> + * Note also the special case of {@code ByteArrayInputStream} for which the {@code close()} * method does nothing. * <pre> * ByteArrayInputStream bais = ... @@ -316,7 +316,7 @@ public class POIFSFileSystem extends BlockStore /** * @param stream the stream to be closed - * @param success <code>false</code> if an exception is currently being thrown in the calling method + * @param success {@code false} if an exception is currently being thrown in the calling method */ private void closeInputStream(InputStream stream, boolean success) { try { @@ -902,12 +902,12 @@ public class POIFSFileSystem extends BlockStore } /** - * Creates a new {@link POIFSFileSystem} in a new {@link File}. + * Creates a new POIFSFileSystem in a new {@link File}. * Use {@link #POIFSFileSystem(File)} to open an existing File, * this should only be used to create a new empty filesystem. * * @param file The file to create and open - * @return The created and opened {@link POIFSFileSystem} + * @return The created and opened POIFSFileSystem */ public static POIFSFileSystem create(File file) throws IOException { // Create a new empty POIFS in the file diff --git a/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSWriterEvent.java b/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSWriterEvent.java index a3954c3720..5d08310202 100644 --- a/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSWriterEvent.java +++ b/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSWriterEvent.java @@ -15,15 +15,12 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.poifs.filesystem; /** * Class POIFSWriterEvent - * - * @author Marc Johnson (mjohnson at apache dot org) - * @version %I%, %G% */ public class POIFSWriterEvent diff --git a/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSWriterListener.java b/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSWriterListener.java index 9f9e396a11..0d57788283 100644 --- a/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSWriterListener.java +++ b/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSWriterListener.java @@ -15,15 +15,12 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.poifs.filesystem; /** * Interface POIFSWriterListener - * - * @author Marc Johnson (mjohnson at apache dot org) - * @version %I%, %G% */ public interface POIFSWriterListener diff --git a/poi/src/main/java/org/apache/poi/poifs/filesystem/TempFilePOIFSFileSystem.java b/poi/src/main/java/org/apache/poi/poifs/filesystem/TempFilePOIFSFileSystem.java index be162b6079..4bfb992d75 100644 --- a/poi/src/main/java/org/apache/poi/poifs/filesystem/TempFilePOIFSFileSystem.java +++ b/poi/src/main/java/org/apache/poi/poifs/filesystem/TempFilePOIFSFileSystem.java @@ -32,6 +32,7 @@ import java.io.IOException; public class TempFilePOIFSFileSystem extends POIFSFileSystem { File tempFile; + @Override protected void createNewDataSource() { try { tempFile = TempFile.createTempFile("poifs", ".tmp"); @@ -41,6 +42,7 @@ public class TempFilePOIFSFileSystem extends POIFSFileSystem { } } + @Override public void close() throws IOException { if (tempFile != null && tempFile.exists()) tempFile.delete(); super.close(); diff --git a/poi/src/main/java/org/apache/poi/poifs/macros/VBAMacroExtractor.java b/poi/src/main/java/org/apache/poi/poifs/macros/VBAMacroExtractor.java index 9874270a9d..c4ff962a94 100644 --- a/poi/src/main/java/org/apache/poi/poifs/macros/VBAMacroExtractor.java +++ b/poi/src/main/java/org/apache/poi/poifs/macros/VBAMacroExtractor.java @@ -30,7 +30,7 @@ import org.apache.poi.util.StringUtil; /** * This tool extracts out the source of all VBA Modules of an office file, * both OOXML (eg XLSM) and OLE2/POIFS (eg DOC), to STDOUT or a directory. - * + * * @since 3.15-beta2 */ public class VBAMacroExtractor { @@ -43,24 +43,24 @@ public class VBAMacroExtractor { System.err.println("Otherwise they are output to the screen"); System.exit(1); } - + File input = new File(args[0]); File output = null; if (args.length > 1) { output = new File(args[1]); } - + VBAMacroExtractor extractor = new VBAMacroExtractor(); extractor.extract(input, output); } - + /** * Extracts the VBA modules from a macro-enabled office file and writes them - * to files in <tt>outputDir</tt>. + * to files in {@code outputDir}. * - * Creates the <tt>outputDir</tt>, directory, including any necessary but - * nonexistent parent directories, if <tt>outputDir</tt> does not exist. - * If <tt>outputDir</tt> is null, writes the contents to standard out instead. + * Creates the {@code outputDir}, directory, including any necessary but + * nonexistent parent directories, if {@code outputDir} does not exist. + * If {@code outputDir} is null, writes the contents to standard out instead. * * @param input the macro-enabled office file. * @param outputDir the directory to write the extracted VBA modules to. @@ -83,7 +83,7 @@ public class VBAMacroExtractor { try (VBAMacroReader reader = new VBAMacroReader(input)) { macros = reader.readMacros(); } - + final String divider = "---------------------------------------"; for (Entry<String, String> entry : macros.entrySet()) { String moduleName = entry.getKey(); @@ -109,12 +109,12 @@ public class VBAMacroExtractor { /** * Extracts the VBA modules from a macro-enabled office file and writes them - * to <tt>.vba</tt> files in <tt>outputDir</tt>. - * - * Creates the <tt>outputDir</tt>, directory, including any necessary but - * nonexistent parent directories, if <tt>outputDir</tt> does not exist. - * If <tt>outputDir</tt> is null, writes the contents to standard out instead. - * + * to {@code .vba} files in {@code outputDir}. + * + * Creates the {@code outputDir}, directory, including any necessary but + * nonexistent parent directories, if {@code outputDir} does not exist. + * If {@code outputDir} is null, writes the contents to standard out instead. + * * @param input the macro-enabled office file. * @param outputDir the directory to write the extracted VBA modules to. * @since 3.15-beta2 diff --git a/poi/src/main/java/org/apache/poi/poifs/macros/VBAMacroReader.java b/poi/src/main/java/org/apache/poi/poifs/macros/VBAMacroReader.java index 2f28c6397e..76cfd66472 100644 --- a/poi/src/main/java/org/apache/poi/poifs/macros/VBAMacroReader.java +++ b/poi/src/main/java/org/apache/poi/poifs/macros/VBAMacroReader.java @@ -121,6 +121,7 @@ public class VBAMacroReader implements Closeable { throw new IllegalArgumentException("No VBA project found"); } + @Override public void close() throws IOException { fs.close(); fs = null; @@ -171,9 +172,11 @@ public class VBAMacroReader implements Closeable { out.close(); buf = out.toByteArray(); } + @Override public String getContent() { return new String(buf, charset); } + @Override public ModuleType geModuleType() { return moduleType; } @@ -183,9 +186,9 @@ public class VBAMacroReader implements Closeable { } /** - * Recursively traverses directory structure rooted at <tt>dir</tt>. + * Recursively traverses directory structure rooted at {@code dir}. * For each macro module that is found, the module's name and code are - * added to <tt>modules<tt>. + * added to {@code modules}. * * @param dir The directory of entries to look at * @param modules The resulting map of modules @@ -264,11 +267,10 @@ public class VBAMacroReader implements Closeable { module.read(decompressed); } return; - } catch (IllegalArgumentException | IllegalStateException e) { + } catch (IllegalArgumentException | IllegalStateException ignored) { } //bad module.offset, try brute force - ; byte[] decompressedBytes; try (InputStream compressed = new DocumentInputStream(documentNode)) { decompressedBytes = findCompressedStreamWBruteForce(compressed); @@ -282,7 +284,7 @@ public class VBAMacroReader implements Closeable { } /** - * Skips <tt>n</tt> bytes in an input stream, throwing IOException if the + * Skips {@code n} bytes in an input stream, throwing IOException if the * number of bytes skipped is different than requested. * @throws IOException If skipping would exceed the available data or skipping did not work. */ @@ -311,7 +313,7 @@ public class VBAMacroReader implements Closeable { /** * Reads VBA Project modules from a VBA Project directory located at - * <tt>macroDir</tt> into <tt>modules</tt>. + * {@code macroDir} into {@code modules}. * * @since 3.15-beta2 */ @@ -634,8 +636,8 @@ public class VBAMacroReader implements Closeable { Map<String, String> moduleNames, Charset charset) throws IOException { //see 2.3.3 PROJECTwm Stream: Module Name Information //multibytecharstring - String mbcs = null; - String unicode = null; + String mbcs; + String unicode; //arbitrary sanity threshold final int maxNameRecords = 10000; int records = 0; @@ -701,7 +703,7 @@ public class VBAMacroReader implements Closeable { } /** - * Read <tt>length</tt> bytes of MBCS (multi-byte character set) characters from the stream + * Read {@code length} bytes of MBCS (multi-byte character set) characters from the stream * * @param stream the inputstream to read from * @param length number of bytes to read from stream @@ -789,7 +791,7 @@ public class VBAMacroReader implements Closeable { * This relies on some, er, heuristics, admittedly. * * @param is full module inputstream to read - * @return uncompressed bytes if found, <code>null</code> otherwise + * @return uncompressed bytes if found, {@code null} otherwise * @throws IOException for a true IOException copying the is to a byte array */ private static byte[] findCompressedStreamWBruteForce(InputStream is) throws IOException { diff --git a/poi/src/main/java/org/apache/poi/poifs/property/Child.java b/poi/src/main/java/org/apache/poi/poifs/property/Child.java index 6047452149..340164911c 100644 --- a/poi/src/main/java/org/apache/poi/poifs/property/Child.java +++ b/poi/src/main/java/org/apache/poi/poifs/property/Child.java @@ -15,15 +15,13 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.poifs.property; /** * This interface defines methods for finding and setting sibling * Property instances - * - * @author Marc Johnson (mjohnson at apache dot org) */ public interface Child { diff --git a/poi/src/main/java/org/apache/poi/poifs/property/Property.java b/poi/src/main/java/org/apache/poi/poifs/property/Property.java index 6ffff00424..63f677c8ce 100644 --- a/poi/src/main/java/org/apache/poi/poifs/property/Property.java +++ b/poi/src/main/java/org/apache/poi/poifs/property/Property.java @@ -34,8 +34,6 @@ import org.apache.poi.util.ShortField; /** * This abstract base class is the ancestor of all classes * implementing POIFS Property behavior. - * - * @author Marc Johnson (mjohnson at apache dot org) */ public abstract class Property implements Child, POIFSViewable { diff --git a/poi/src/main/java/org/apache/poi/poifs/property/PropertyFactory.java b/poi/src/main/java/org/apache/poi/poifs/property/PropertyFactory.java index ba459050bf..469670b576 100644 --- a/poi/src/main/java/org/apache/poi/poifs/property/PropertyFactory.java +++ b/poi/src/main/java/org/apache/poi/poifs/property/PropertyFactory.java @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.poifs.property; @@ -31,8 +31,6 @@ import org.apache.poi.poifs.common.POIFSConstants; * should correspond to a Property, but which does not map to a proper * Property (i.e., a DirectoryProperty, DocumentProperty, or * RootProperty) will get mapped to a null Property in the array. - * - * @author Marc Johnson (mjohnson at apache dot org) */ final class PropertyFactory { @@ -69,7 +67,7 @@ final class PropertyFactory { properties.add(null); break; } - + offset += POIFSConstants.PROPERTY_SIZE; } } diff --git a/poi/src/main/java/org/apache/poi/poifs/storage/BlockWritable.java b/poi/src/main/java/org/apache/poi/poifs/storage/BlockWritable.java index 3bf833ec10..96f6d181c9 100644 --- a/poi/src/main/java/org/apache/poi/poifs/storage/BlockWritable.java +++ b/poi/src/main/java/org/apache/poi/poifs/storage/BlockWritable.java @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.poifs.storage; @@ -24,12 +24,8 @@ import java.io.OutputStream; /** * An interface for persisting block storage of POIFS components. - * - * @author Marc Johnson (mjohnson at apache dot org) */ - -public interface BlockWritable -{ +public interface BlockWritable { /** * Write the storage to an OutputStream diff --git a/poi/src/main/java/org/apache/poi/poifs/storage/HeaderBlockConstants.java b/poi/src/main/java/org/apache/poi/poifs/storage/HeaderBlockConstants.java index 5470bde5b8..a029505ac3 100644 --- a/poi/src/main/java/org/apache/poi/poifs/storage/HeaderBlockConstants.java +++ b/poi/src/main/java/org/apache/poi/poifs/storage/HeaderBlockConstants.java @@ -22,8 +22,6 @@ import org.apache.poi.util.LittleEndianConsts; /** * Constants used in reading/writing the Header block - * - * @author Marc Johnson (mjohnson at apache dot org) */ public interface HeaderBlockConstants { @@ -37,7 +35,7 @@ public interface HeaderBlockConstants // BAT ~= FAT // SBAT ~= MiniFAT // XBAT ~= DIFat - + // useful offsets int _signature_offset = 0; int _bat_count_offset = 0x2C; diff --git a/poi/src/main/java/org/apache/poi/sl/usermodel/ShapeContainer.java b/poi/src/main/java/org/apache/poi/sl/usermodel/ShapeContainer.java index 7706828c52..bd6b6e72c3 100644 --- a/poi/src/main/java/org/apache/poi/sl/usermodel/ShapeContainer.java +++ b/poi/src/main/java/org/apache/poi/sl/usermodel/ShapeContainer.java @@ -41,7 +41,7 @@ public interface ShapeContainer< * it is unchanged. * * @param shape the shape to be removed from this sheet, if present - * @return <tt>true</tt> if this sheet contained the specified element + * @return {@code true} if this sheet contained the specified element * @throws IllegalArgumentException if the type of the specified shape * is incompatible with this sheet (optional) */ @@ -61,22 +61,22 @@ public interface ShapeContainer< * create a text box */ TextBox<S,P> createTextBox(); - + /** * create a connector */ ConnectorShape<S,P> createConnector(); - + /** * create a group of shapes belonging to this container */ GroupShape<S,P> createGroup(); - + /** * create a picture belonging to this container */ PictureShape<S,P> createPicture(PictureData pictureData); - + /** * Create a new Table of the given number of rows and columns * @@ -84,7 +84,7 @@ public interface ShapeContainer< * @param numCols the number of columns */ TableShape<S,P> createTable(int numRows, int numCols); - + /** * Create a new OLE object shape with the given pictureData as preview image * diff --git a/poi/src/main/java/org/apache/poi/sl/usermodel/VerticalAlignment.java b/poi/src/main/java/org/apache/poi/sl/usermodel/VerticalAlignment.java index f302d8288f..1defe11f8e 100644 --- a/poi/src/main/java/org/apache/poi/sl/usermodel/VerticalAlignment.java +++ b/poi/src/main/java/org/apache/poi/sl/usermodel/VerticalAlignment.java @@ -20,11 +20,9 @@ package org.apache.poi.sl.usermodel; /** * Specifies a list of available anchoring types for text - * + * * <!-- FIXME: Identical to {@link org.apache.poi.ss.usermodel.VerticalAlignment}. Should merge these to * {@link org.apache.poi.common.usermodel}.VerticalAlignment in the future. --> - * - * @author Yegor Kozlov */ public enum VerticalAlignment { /** diff --git a/poi/src/main/java/org/apache/poi/ss/format/CellDateFormatter.java b/poi/src/main/java/org/apache/poi/ss/format/CellDateFormatter.java index 94a4f46710..b1d7f24431 100644 --- a/poi/src/main/java/org/apache/poi/ss/format/CellDateFormatter.java +++ b/poi/src/main/java/org/apache/poi/ss/format/CellDateFormatter.java @@ -162,7 +162,7 @@ public class CellDateFormatter extends CellFormatter { dateFmt.setTimeZone(LocaleUtil.getUserTimeZone()); } - /** {@inheritDoc} */ + @Override public synchronized void formatValue(StringBuffer toAppendTo, Object value) { if (value == null) value = 0.0; @@ -221,8 +221,9 @@ public class CellDateFormatter extends CellFormatter { /** * {@inheritDoc} * <p> - * For a date, this is <tt>"mm/d/y"</tt>. + * For a date, this is {@code "mm/d/y"}. */ + @Override public void simpleValue(StringBuffer toAppendTo, Object value) { synchronized (CellDateFormatter.class) { if (SIMPLE_DATE == null || !SIMPLE_DATE.EXCEL_EPOCH_CAL.equals(EXCEL_EPOCH_CAL)) { diff --git a/poi/src/main/java/org/apache/poi/ss/format/CellElapsedFormatter.java b/poi/src/main/java/org/apache/poi/ss/format/CellElapsedFormatter.java index 4a5e370e86..b877f1db56 100644 --- a/poi/src/main/java/org/apache/poi/ss/format/CellElapsedFormatter.java +++ b/poi/src/main/java/org/apache/poi/ss/format/CellElapsedFormatter.java @@ -26,8 +26,6 @@ import java.util.regex.Pattern; /** * This class implements printing out an elapsed time format. - * - * @author Ken Arnold, Industrious Media LLC */ public class CellElapsedFormatter extends CellFormatter { private final List<TimeSpec> specs; @@ -74,6 +72,7 @@ public class CellElapsedFormatter extends CellFormatter { // only special character for this is '%', so we have to handle all the // quoting in this method ourselves. + @Override public String handlePart(Matcher m, String part, CellFormatType type, StringBuffer desc) { @@ -186,7 +185,7 @@ public class CellElapsedFormatter extends CellFormatter { } } - /** {@inheritDoc} */ + @Override public void formatValue(StringBuffer toAppendTo, Object value) { double elapsed = ((Number) value).doubleValue(); @@ -208,8 +207,9 @@ public class CellElapsedFormatter extends CellFormatter { /** * {@inheritDoc} * <p> - * For a date, this is <tt>"mm/d/y"</tt>. + * For a date, this is {@code "mm/d/y"}. */ + @Override public void simpleValue(StringBuffer toAppendTo, Object value) { formatValue(toAppendTo, value); } diff --git a/poi/src/main/java/org/apache/poi/ss/format/CellFormat.java b/poi/src/main/java/org/apache/poi/ss/format/CellFormat.java index 86a1dabf4f..66a8ea5c49 100644 --- a/poi/src/main/java/org/apache/poi/ss/format/CellFormat.java +++ b/poi/src/main/java/org/apache/poi/ss/format/CellFormat.java @@ -48,17 +48,17 @@ import org.apache.poi.util.LocaleUtil; * specifies what to do with particular kinds of values, depending on the number * of parts given: * <dl> - * <dt>One part (example: <tt>[Green]#.##</tt>)</dt> + * <dt>One part (example: {@code [Green]#.##})</dt> * <dd>If the value is a number, display according to this one part (example: green text, * with up to two decimal points). If the value is text, display it as is.</dd> * - * <dt>Two parts (example: <tt>[Green]#.##;[Red]#.##</tt>)</dt> + * <dt>Two parts (example: {@code [Green]#.##;[Red]#.##})</dt> * <dd>If the value is a positive number or zero, display according to the first part (example: green * text, with up to two decimal points); if it is a negative number, display * according to the second part (example: red text, with up to two decimal * points). If the value is text, display it as is.</dd> * - * <dt>Three parts (example: <tt>[Green]#.##;[Black]#.##;[Red]#.##</tt>)</dt> + * <dt>Three parts (example: {@code [Green]#.##;[Black]#.##;[Red]#.##})</dt> * <dd>If the value is a positive * number, display according to the first part (example: green text, with up to * two decimal points); if it is zero, display according to the second part @@ -66,7 +66,7 @@ import org.apache.poi.util.LocaleUtil; * number, display according to the third part (example: red text, with up to * two decimal points). If the value is text, display it as is.</dd> * - * <dt>Four parts (example: <tt>[Green]#.##;[Black]#.##;[Red]#.##;[@]</tt>)</dt> + * <dt>Four parts (example: {@code [Green]#.##;[Black]#.##;[Red]#.##;[@]})</dt> * <dd>If the value is a positive number, display according to the first part (example: green text, * with up to two decimal points); if it is zero, display according to the * second part (example: black text, with up to two decimal points); if it is a @@ -77,7 +77,7 @@ import org.apache.poi.util.LocaleUtil; * </dl> * <p> * A given format part may specify a given Locale, by including something - * like <tt>[$$-409]</tt> or <tt>[$£-809]</tt> or <tt>[$-40C]</tt>. These + * like {@code [$$-409]} or {@code [$£-809]} or {@code [$-40C]}. These * are (currently) largely ignored. You can use {@link DateFormatConverter} * to look these up into Java Locales if desired. * <p> @@ -136,25 +136,25 @@ public class CellFormat { new WeakHashMap<>(); /** - * Returns a {@link CellFormat} that applies the given format. Two calls + * Returns a CellFormat that applies the given format. Two calls * with the same format may or may not return the same object. * * @param format The format. * - * @return A {@link CellFormat} that applies the given format. + * @return A CellFormat that applies the given format. */ public static CellFormat getInstance(String format) { return getInstance(LocaleUtil.getUserLocale(), format); } /** - * Returns a {@link CellFormat} that applies the given format. Two calls + * Returns a CellFormat that applies the given format. Two calls * with the same format may or may not return the same object. * * @param locale The locale. * @param format The format. * - * @return A {@link CellFormat} that applies the given format. + * @return A CellFormat that applies the given format. */ public static synchronized CellFormat getInstance(Locale locale, String format) { Map<String, CellFormat> formatMap = formatCache.computeIfAbsent(locale, k -> new WeakHashMap<>()); @@ -255,7 +255,7 @@ public class CellFormat { } else if (value instanceof java.util.Date) { // Don't know (and can't get) the workbook date windowing (1900 or 1904) // so assume 1900 date windowing - Double numericValue = DateUtil.getExcelDate((Date) value); + double numericValue = DateUtil.getExcelDate((Date) value); if (DateUtil.isValidExcelDate(numericValue)) { return getApplicableFormatPart(numericValue).apply(value); } else { @@ -294,7 +294,7 @@ public class CellFormat { case BOOLEAN: return apply(c.getBooleanCellValue()); case NUMERIC: - Double value = c.getNumericCellValue(); + double value = c.getNumericCellValue(); if (getApplicableFormatPart(value).getCellFormatType() == CellFormatType.DATE) { if (DateUtil.isValidExcelDate(value)) { return apply(c.getDateCellValue(), value); @@ -364,7 +364,7 @@ public class CellFormat { case BOOLEAN: return apply(label, c.getBooleanCellValue()); case NUMERIC: - Double value = c.getNumericCellValue(); + double value = c.getNumericCellValue(); if (getApplicableFormatPart(value).getCellFormatType() == CellFormatType.DATE) { if (DateUtil.isValidExcelDate(value)) { return apply(label, c.getDateCellValue(), value); @@ -450,12 +450,12 @@ public class CellFormat { } /** - * Returns <tt>true</tt> if the other object is a {@link CellFormat} object + * Returns {@code true} if the other object is a CellFormat object * with the same format. * * @param obj The other object. * - * @return <tt>true</tt> if the two objects are equal. + * @return {@code true} if the two objects are equal. */ @Override public boolean equals(Object obj) { diff --git a/poi/src/main/java/org/apache/poi/ss/format/CellFormatCondition.java b/poi/src/main/java/org/apache/poi/ss/format/CellFormatCondition.java index d44e18f4a7..b482d822d9 100644 --- a/poi/src/main/java/org/apache/poi/ss/format/CellFormatCondition.java +++ b/poi/src/main/java/org/apache/poi/ss/format/CellFormatCondition.java @@ -21,8 +21,6 @@ import java.util.Map; /** * This object represents a condition in a cell format. - * - * @author Ken Arnold, Industrious Media LLC */ public abstract class CellFormatCondition { private static final int LT = 0; @@ -69,36 +67,42 @@ public abstract class CellFormatCondition { switch (test) { case LT: return new CellFormatCondition() { + @Override public boolean pass(double value) { return value < c; } }; case LE: return new CellFormatCondition() { + @Override public boolean pass(double value) { return value <= c; } }; case GT: return new CellFormatCondition() { + @Override public boolean pass(double value) { return value > c; } }; case GE: return new CellFormatCondition() { + @Override public boolean pass(double value) { return value >= c; } }; case EQ: return new CellFormatCondition() { + @Override public boolean pass(double value) { return value == c; } }; case NE: return new CellFormatCondition() { + @Override public boolean pass(double value) { return value != c; } @@ -111,11 +115,11 @@ public abstract class CellFormatCondition { } /** - * Returns <tt>true</tt> if the given value passes the constraint's test. + * Returns {@code true} if the given value passes the constraint's test. * * @param value The value to compare against. * - * @return <tt>true</tt> if the given value passes the constraint's test. + * @return {@code true} if the given value passes the constraint's test. */ public abstract boolean pass(double value); }
\ No newline at end of file diff --git a/poi/src/main/java/org/apache/poi/ss/format/CellFormatPart.java b/poi/src/main/java/org/apache/poi/ss/format/CellFormatPart.java index 51f67df8b3..5aaec56b19 100644 --- a/poi/src/main/java/org/apache/poi/ss/format/CellFormatPart.java +++ b/poi/src/main/java/org/apache/poi/ss/format/CellFormatPart.java @@ -194,14 +194,14 @@ public class CellFormatPart { } /** - * Returns <tt>true</tt> if this format part applies to the given value. If + * Returns {@code true} if this format part applies to the given value. If * the value is a number and this is part has a condition, returns - * <tt>true</tt> only if the number passes the condition. Otherwise, this - * always return <tt>true</tt>. + * {@code true} only if the number passes the condition. Otherwise, this + * always return {@code true}. * * @param valueObject The value to evaluate. * - * @return <tt>true</tt> if this format part applies to the given value. + * @return {@code true} if this format part applies to the given value. */ public boolean applies(Object valueObject) { if (condition == null || !(valueObject instanceof Number)) { @@ -242,12 +242,12 @@ public class CellFormatPart { } /** - * Returns the color specification from the matcher, or <tt>null</tt> if + * Returns the color specification from the matcher, or {@code null} if * there is none. * * @param m The matcher for the format part. * - * @return The color specification or <tt>null</tt>. + * @return The color specification or {@code null}. */ private static Color getColor(Matcher m) { String cdesc = m.group(COLOR_GROUP); @@ -261,12 +261,12 @@ public class CellFormatPart { } /** - * Returns the condition specification from the matcher, or <tt>null</tt> if + * Returns the condition specification from the matcher, or {@code null} if * there is none. * * @param m The matcher for the format part. * - * @return The condition specification or <tt>null</tt>. + * @return The condition specification or {@code null}. */ private CellFormatCondition getCondition(Matcher m) { String mdesc = m.group(CONDITION_OPERATOR_GROUP); @@ -451,7 +451,7 @@ public class CellFormatPart { * @param label The label * @param value The value to apply this format part to. * - * @return <tt>true</tt> if the + * @return {@code true} if the */ public CellFormatResult apply(JLabel label, Object value) { CellFormatResult result = apply(value); @@ -473,9 +473,9 @@ public class CellFormatPart { } /** - * Returns <tt>true</tt> if this format part has a condition. + * Returns {@code true} if this format part has a condition. * - * @return <tt>true</tt> if this format part has a condition. + * @return {@code true} if this format part has a condition. */ boolean hasCondition() { return condition != null; @@ -566,13 +566,13 @@ public class CellFormatPart { } /** - * Returns the string from the group, or <tt>""</tt> if the group is - * <tt>null</tt>. + * Returns the string from the group, or {@code ""} if the group is + * {@code null}. * * @param m The matcher. * @param g The group number. * - * @return The group or <tt>""</tt>. + * @return The group or {@code ""}. */ public static String group(Matcher m, int g) { String str = m.group(g); diff --git a/poi/src/main/java/org/apache/poi/ss/format/CellFormatResult.java b/poi/src/main/java/org/apache/poi/ss/format/CellFormatResult.java index a22f77c277..f1a18d7b38 100644 --- a/poi/src/main/java/org/apache/poi/ss/format/CellFormatResult.java +++ b/poi/src/main/java/org/apache/poi/ss/format/CellFormatResult.java @@ -22,24 +22,23 @@ import java.awt.Color; * This object contains the result of applying a cell format or cell format part * to a value. * - * @author Ken Arnold, Industrious Media LLC * @see CellFormatPart#apply(Object) * @see CellFormat#apply(Object) */ public class CellFormatResult { /** - * This is <tt>true</tt> if no condition was given that applied to the + * This is {@code true} if no condition was given that applied to the * value, or if the condition is satisfied. If a condition is relevant, and - * when applied the value fails the test, this is <tt>false</tt>. + * when applied the value fails the test, this is {@code false}. */ public final boolean applies; - /** The resulting text. This will never be <tt>null</tt>. */ + /** The resulting text. This will never be {@code null}. */ public final String text; /** - * The color the format sets, or <tt>null</tt> if the format sets no color. - * This will always be <tt>null</tt> if {@link #applies} is <tt>false</tt>. + * The color the format sets, or {@code null} if the format sets no color. + * This will always be {@code null} if {@link #applies} is {@code false}. */ public final Color textColor; diff --git a/poi/src/main/java/org/apache/poi/ss/format/CellFormatType.java b/poi/src/main/java/org/apache/poi/ss/format/CellFormatType.java index af947b1db4..7693470afb 100644 --- a/poi/src/main/java/org/apache/poi/ss/format/CellFormatType.java +++ b/poi/src/main/java/org/apache/poi/ss/format/CellFormatType.java @@ -21,78 +21,91 @@ import java.util.Locale; /** * The different kinds of formats that the formatter understands. - * - * @author Ken Arnold, Industrious Media LLC */ public enum CellFormatType { - /** The general (default) format; also used for <tt>"General"</tt>. */ + /** The general (default) format; also used for {@code "General"}. */ GENERAL { + @Override boolean isSpecial(char ch) { return false; } + @Override CellFormatter formatter(String pattern) { return new CellGeneralFormatter(); } + @Override CellFormatter formatter(Locale locale, String pattern) { return new CellGeneralFormatter(locale); } }, /** A numeric format. */ NUMBER { + @Override boolean isSpecial(char ch) { return false; } + @Override CellFormatter formatter(String pattern) { return new CellNumberFormatter(pattern); } + @Override CellFormatter formatter(Locale locale, String pattern) { return new CellNumberFormatter(locale, pattern); } }, /** A date format. */ DATE { + @Override boolean isSpecial(char ch) { return ch == '\'' || (ch <= '\u007f' && Character.isLetter(ch)); } + @Override CellFormatter formatter(String pattern) { return new CellDateFormatter(pattern); } + @Override CellFormatter formatter(Locale locale, String pattern) { return new CellDateFormatter(locale, pattern); } }, /** An elapsed time format. */ ELAPSED { + @Override boolean isSpecial(char ch) { return false; } + @Override CellFormatter formatter(String pattern) { return new CellElapsedFormatter(pattern); } + @Override CellFormatter formatter(Locale locale, String pattern) { return new CellElapsedFormatter(pattern); } }, /** A text format. */ TEXT { + @Override boolean isSpecial(char ch) { return false; } + @Override CellFormatter formatter(String pattern) { return new CellTextFormatter(pattern); } + @Override CellFormatter formatter(Locale locale, String pattern) { return new CellTextFormatter(pattern); } }; /** - * Returns <tt>true</tt> if the format is special and needs to be quoted. + * Returns {@code true} if the format is special and needs to be quoted. * * @param ch The character to test. * - * @return <tt>true</tt> if the format is special and needs to be quoted. + * @return {@code true} if the format is special and needs to be quoted. */ abstract boolean isSpecial(char ch); diff --git a/poi/src/main/java/org/apache/poi/ss/format/CellGeneralFormatter.java b/poi/src/main/java/org/apache/poi/ss/format/CellGeneralFormatter.java index 2233c284aa..79fedf4539 100644 --- a/poi/src/main/java/org/apache/poi/ss/format/CellGeneralFormatter.java +++ b/poi/src/main/java/org/apache/poi/ss/format/CellGeneralFormatter.java @@ -23,8 +23,6 @@ import org.apache.poi.util.LocaleUtil; /** * A formatter for the default "General" cell format. - * - * @author Ken Arnold, Industrious Media LLC */ public class CellGeneralFormatter extends CellFormatter { /** Creates a new general formatter. */ diff --git a/poi/src/main/java/org/apache/poi/ss/format/CellNumberFormatter.java b/poi/src/main/java/org/apache/poi/ss/format/CellNumberFormatter.java index f25965af75..2da55efe90 100644 --- a/poi/src/main/java/org/apache/poi/ss/format/CellNumberFormatter.java +++ b/poi/src/main/java/org/apache/poi/ss/format/CellNumberFormatter.java @@ -79,6 +79,7 @@ public class CellNumberFormatter extends CellFormatter { super(locale, "General"); } + @Override public void formatValue(StringBuffer toAppendTo, Object value) { if (value == null) { return; @@ -95,6 +96,7 @@ public class CellNumberFormatter extends CellFormatter { cf.formatValue(toAppendTo, value); } + @Override public void simpleValue(StringBuffer toAppendTo, Object value) { formatValue(toAppendTo, value); } @@ -420,7 +422,7 @@ public class CellNumberFormatter extends CellFormatter { return (afterFractional == null) ? specials.size() : specials.indexOf(afterFractional); } - /** {@inheritDoc} */ + @Override public void formatValue(StringBuffer toAppendTo, Object valueObject) { double value = ((Number) valueObject).doubleValue(); value *= scale; @@ -842,9 +844,10 @@ public class CellNumberFormatter extends CellFormatter { /** * {@inheritDoc} * <p> - * For a number, this is <tt>"#"</tt> for integer values, and <tt>"#.#"</tt> + * For a number, this is {@code "#"} for integer values, and {@code "#.#"} * for floating-point values. */ + @Override public void simpleValue(StringBuffer toAppendTo, Object value) { SIMPLE_NUMBER.formatValue(toAppendTo, value); } diff --git a/poi/src/main/java/org/apache/poi/ss/format/CellNumberPartHandler.java b/poi/src/main/java/org/apache/poi/ss/format/CellNumberPartHandler.java index a9af31851f..a10aca3a28 100644 --- a/poi/src/main/java/org/apache/poi/ss/format/CellNumberPartHandler.java +++ b/poi/src/main/java/org/apache/poi/ss/format/CellNumberPartHandler.java @@ -39,6 +39,7 @@ public class CellNumberPartHandler implements PartHandler { private final List<Special> specials = new LinkedList<>(); private boolean improperFraction; + @Override public String handlePart(Matcher m, String part, CellFormatType type, StringBuffer descBuf) { int pos = descBuf.length(); char firstCh = part.charAt(0); @@ -148,7 +149,7 @@ public class CellNumberPartHandler implements PartHandler { } return null; } - + private static boolean isDigitFmt(Special s) { return s.ch == '0' || s.ch == '?' || s.ch == '#'; } diff --git a/poi/src/main/java/org/apache/poi/ss/format/CellTextFormatter.java b/poi/src/main/java/org/apache/poi/ss/format/CellTextFormatter.java index 3537520c46..f815407561 100644 --- a/poi/src/main/java/org/apache/poi/ss/format/CellTextFormatter.java +++ b/poi/src/main/java/org/apache/poi/ss/format/CellTextFormatter.java @@ -20,8 +20,6 @@ import java.util.Locale; /** * This class implements printing out text. - * - * @author Ken Arnold, Industrious Media LLC */ public class CellTextFormatter extends CellFormatter { private final int[] textPos; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/CacheAreaEval.java b/poi/src/main/java/org/apache/poi/ss/formula/CacheAreaEval.java index 2716e24084..e8c8d5a0ac 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/CacheAreaEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/CacheAreaEval.java @@ -26,7 +26,6 @@ import org.apache.poi.ss.formula.ptg.AreaI.OffsetArea; import org.apache.poi.ss.util.CellReference; /** - * @author Robert Hulbert * Provides holding structure for temporary values in arrays during the evaluation process. * As such, Row/Column references do not actually correspond to data in the file. */ diff --git a/poi/src/main/java/org/apache/poi/ss/formula/EvaluationCache.java b/poi/src/main/java/org/apache/poi/ss/formula/EvaluationCache.java index 451ccc7ba3..be8c5a09ef 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/EvaluationCache.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/EvaluationCache.java @@ -32,8 +32,6 @@ import org.apache.poi.ss.usermodel.CellType; * Performance optimisation for {@link org.apache.poi.ss.usermodel.FormulaEvaluator}. * This class stores previously calculated values of already visited cells, * to avoid unnecessary re-calculation when the same cells are referenced multiple times - * - * @author Josh Micich */ final class EvaluationCache { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/EvaluationCell.java b/poi/src/main/java/org/apache/poi/ss/formula/EvaluationCell.java index ae983d11d8..5dafd4aec7 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/EvaluationCell.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/EvaluationCell.java @@ -19,15 +19,13 @@ package org.apache.poi.ss.formula; import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.util.Internal; /** * Abstracts a cell for the purpose of formula evaluation. This interface represents both formula - * and non-formula cells.<br> - * - * For POI internal use only - * - * @author Josh Micich + * and non-formula cells. */ +@Internal public interface EvaluationCell { /** * @return an Object that identifies the underlying cell, diff --git a/poi/src/main/java/org/apache/poi/ss/formula/EvaluationName.java b/poi/src/main/java/org/apache/poi/ss/formula/EvaluationName.java index e43ab76c46..c7931069cc 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/EvaluationName.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/EvaluationName.java @@ -19,13 +19,12 @@ package org.apache.poi.ss.formula; import org.apache.poi.ss.formula.ptg.NamePtg; import org.apache.poi.ss.formula.ptg.Ptg; +import org.apache.poi.util.Internal; + /** - * Abstracts a name record for formula evaluation.<br> - * - * For POI internal use only - * - * @author Josh Micich + * Abstracts a name record for formula evaluation. */ +@Internal public interface EvaluationName { String getNameText(); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/EvaluationSheet.java b/poi/src/main/java/org/apache/poi/ss/formula/EvaluationSheet.java index 881f00fafd..885ba81985 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/EvaluationSheet.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/EvaluationSheet.java @@ -20,11 +20,7 @@ package org.apache.poi.ss.formula; import org.apache.poi.util.Internal; /** - * Abstracts a sheet for the purpose of formula evaluation.<br> - * - * For POI internal use only - * - * @author Josh Micich + * Abstracts a sheet for the purpose of formula evaluation. */ @Internal public interface EvaluationSheet { @@ -33,22 +29,22 @@ public interface EvaluationSheet { * @return <code>null</code> if there is no cell at the specified coordinates */ EvaluationCell getCell(int rowIndex, int columnIndex); - + /** * Propagated from {@link EvaluationWorkbook#clearAllCachedResultValues()} to clear locally cached data. - * + * * @see WorkbookEvaluator#clearAllCachedResultValues() * @see EvaluationWorkbook#clearAllCachedResultValues() * @since POI 3.15 beta 3 */ public void clearAllCachedResultValues(); - + /** * @return last row index referenced on this sheet, for evaluation optimization * @since POI 4.0.0 */ public int getLastRowNum(); - + /** * Used by SUBTOTAL and similar functions that have options to ignore hidden rows * @param rowIndex diff --git a/poi/src/main/java/org/apache/poi/ss/formula/EvaluationTracker.java b/poi/src/main/java/org/apache/poi/ss/formula/EvaluationTracker.java index a69386389c..30b9a45469 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/EvaluationTracker.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/EvaluationTracker.java @@ -32,8 +32,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; * The main purpose of this class is to detect an attempt to evaluate a cell * that is already being evaluated. In other words, it detects circular * references in spreadsheet formulas. - * - * @author Josh Micich */ final class EvaluationTracker { // TODO - consider deleting this class and letting CellEvaluationFrame take care of itself @@ -51,15 +49,15 @@ final class EvaluationTracker { * Notifies this evaluation tracker that evaluation of the specified cell is * about to start.<br> * - * In the case of a <code>true</code> return code, the caller should + * In the case of a {@code true} return code, the caller should * continue evaluation of the specified cell, and also be sure to call - * <tt>endEvaluate()</tt> when complete.<br> + * {@code endEvaluate()} when complete.<br> * - * In the case of a <code>null</code> return code, the caller should + * In the case of a {@code null} return code, the caller should * return an evaluation result of - * <tt>ErrorEval.CIRCULAR_REF_ERROR<tt>, and not call <tt>endEvaluate()</tt>. + * {@code ErrorEval.CIRCULAR_REF_ERROR}, and not call {@code endEvaluate()}. * <br> - * @return <code>false</code> if the specified cell is already being evaluated + * @return {@code false} if the specified cell is already being evaluated */ public boolean startEvaluate(FormulaCellCacheEntry cce) { if (cce == null) { @@ -96,7 +94,7 @@ final class EvaluationTracker { /** * Notifies this evaluation tracker that the evaluation of the specified cell is complete. <p> * - * Every successful call to <tt>startEvaluate</tt> must be followed by a call to <tt>endEvaluate</tt> (recommended in a finally block) to enable + * Every successful call to {@code startEvaluate} must be followed by a call to {@code endEvaluate} (recommended in a finally block) to enable * proper tracking of which cells are being evaluated at any point in time.<p> * * Assuming a well behaved client, parameters to this method would not be diff --git a/poi/src/main/java/org/apache/poi/ss/formula/EvaluationWorkbook.java b/poi/src/main/java/org/apache/poi/ss/formula/EvaluationWorkbook.java index 2a6aed0751..39a11e1259 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/EvaluationWorkbook.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/EvaluationWorkbook.java @@ -25,11 +25,7 @@ import org.apache.poi.ss.formula.udf.UDFFinder; import org.apache.poi.util.Internal; /** - * Abstracts a workbook for the purpose of formula evaluation.<br> - * - * For POI internal use only - * - * @author Josh Micich + * Abstracts a workbook for the purpose of formula evaluation. */ @Internal public interface EvaluationWorkbook { @@ -58,7 +54,7 @@ public interface EvaluationWorkbook { ExternalSheet getExternalSheet(String firstSheetName, String lastSheetName, int externalWorkbookNumber); /** * HSSF Only - convert an external sheet index to an internal sheet index, - * for an external-style reference to one of this workbook's own sheets + * for an external-style reference to one of this workbook's own sheets */ int convertFromExternSheetIndex(int externSheetIndex); @@ -70,19 +66,19 @@ public interface EvaluationWorkbook { * XSSF Only - fetch the external-style name details */ ExternalName getExternalName(String nameName, String sheetName, int externalWorkbookNumber); - + EvaluationName getName(NamePtg namePtg); EvaluationName getName(String name, int sheetIndex); String resolveNameXText(NameXPtg ptg); Ptg[] getFormulaTokens(EvaluationCell cell); UDFFinder getUDFFinder(); SpreadsheetVersion getSpreadsheetVersion(); - + /** * Propagated from {@link WorkbookEvaluator#clearAllCachedResultValues()} to clear locally cached data. * Implementations must call the same method on all referenced {@link EvaluationSheet} instances, as well as clearing local caches. * @see WorkbookEvaluator#clearAllCachedResultValues() - * + * * @since POI 3.15 beta 3 */ public void clearAllCachedResultValues(); @@ -108,7 +104,7 @@ public interface EvaluationWorkbook { super(workbookName, firstSheetName); this._lastSheetName = lastSheetName; } - + public String getFirstSheetName() { return getSheetName(); } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ExternSheetReferenceToken.java b/poi/src/main/java/org/apache/poi/ss/formula/ExternSheetReferenceToken.java index ce6bf0efdb..72adc88e2c 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ExternSheetReferenceToken.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ExternSheetReferenceToken.java @@ -21,8 +21,6 @@ package org.apache.poi.ss.formula; * Should be implemented by any {@link org.apache.poi.ss.formula.ptg.Ptg} subclass that needs has an extern sheet index <br> * * For POI internal use only - * - * @author Josh Micich */ public interface ExternSheetReferenceToken { int getExternSheetIndex(); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/Formula.java b/poi/src/main/java/org/apache/poi/ss/formula/Formula.java index cc32a63ad4..05516e0953 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/Formula.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/Formula.java @@ -72,11 +72,11 @@ public class Formula implements GenericRecord { return read(encodedTokenLen, in, encodedTokenLen); } /** - * When there are no array constants present, <tt>encodedTokenLen</tt>==<tt>totalEncodedLen</tt> + * When there are no array constants present, {@code encodedTokenLen}=={@code totalEncodedLen} * @param encodedTokenLen number of bytes in the stream taken by the plain formula tokens * @param totalEncodedLen the total number of bytes in the formula (includes trailing encoding - * for array constants, but does not include 2 bytes for initial <tt>ushort encodedTokenLen</tt> field. - * @return A new formula object as read from the stream. Possibly empty, never <code>null</code>. + * for array constants, but does not include 2 bytes for initial {@code ushort encodedTokenLen} field. + * @return A new formula object as read from the stream. Possibly empty, never {@code null}. */ public static Formula read(int encodedTokenLen, LittleEndianInput in, int totalEncodedLen) { byte[] byteEncoding = IOUtils.safelyAllocate(totalEncodedLen, MAX_ENCODED_LEN); @@ -117,7 +117,7 @@ public class Formula implements GenericRecord { * <li>tokenData</li> * <li>arrayConstantData (optional)</li> * </ul> - * Note - this value is different to <tt>tokenDataLength</tt> + * Note - this value is different to {@code tokenDataLength} */ public int getEncodedSize() { return 2 + _byteEncoding.length; @@ -134,10 +134,10 @@ public class Formula implements GenericRecord { } /** - * Creates a {@link Formula} object from a supplied {@link Ptg} array. - * Handles <code>null</code>s OK. - * @param ptgs may be <code>null</code> - * @return Never <code>null</code> (Possibly empty if the supplied <tt>ptgs</tt> is <code>null</code>) + * Creates a Formula object from a supplied {@link Ptg} array. + * Handles {@code null}s OK. + * @param ptgs may be {@code null} + * @return Never {@code null} (Possibly empty if the supplied {@code ptgs} is {@code null}) */ public static Formula create(Ptg[] ptgs) { if (ptgs == null || ptgs.length < 1) { @@ -150,11 +150,11 @@ public class Formula implements GenericRecord { return new Formula(encodedData, encodedTokenLen); } /** - * Gets the {@link Ptg} array from the supplied {@link Formula}. - * Handles <code>null</code>s OK. + * Gets the {@link Ptg} array from the supplied Formula. + * Handles {@code null}s OK. * - * @param formula may be <code>null</code> - * @return possibly <code>null</code> (if the supplied <tt>formula</tt> is <code>null</code>) + * @param formula may be {@code null} + * @return possibly {@code null} (if the supplied {@code formula} is {@code null}) */ public static Ptg[] getTokens(Formula formula) { if (formula == null) { @@ -176,7 +176,7 @@ public class Formula implements GenericRecord { * The return value is usually not the same as the location of the cell containing this formula. * * @return the firstRow & firstColumn of an array formula or shared formula that this formula - * belongs to. <code>null</code> if this formula is not part of an array or shared formula. + * belongs to. {@code null} if this formula is not part of an array or shared formula. */ public CellReference getExpReference() { byte[] data = _byteEncoding; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/FormulaCellCache.java b/poi/src/main/java/org/apache/poi/ss/formula/FormulaCellCache.java index fc097eb884..41317f934a 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/FormulaCellCache.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/FormulaCellCache.java @@ -21,10 +21,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; -/** - * - * @author Josh Micich - */ final class FormulaCellCache { static interface IEntryOperation { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/FormulaCellCacheEntrySet.java b/poi/src/main/java/org/apache/poi/ss/formula/FormulaCellCacheEntrySet.java index 9a40cbc95e..aff5522755 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/FormulaCellCacheEntrySet.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/FormulaCellCacheEntrySet.java @@ -23,8 +23,6 @@ package org.apache.poi.ss.formula; * Profiling tests (Oct 2008) have shown that each element {@link FormulaCellCacheEntry} takes * around 32 bytes to store in a HashSet, but around 6 bytes to store here. For Spreadsheets with * thousands of formula cells with multiple interdependencies, the savings can be very significant. - * - * @author Josh Micich */ final class FormulaCellCacheEntrySet { private static final FormulaCellCacheEntry[] EMPTY_ARRAY = { }; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/FormulaParseException.java b/poi/src/main/java/org/apache/poi/ss/formula/FormulaParseException.java index 4b1040f16d..fa8d4b8010 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/FormulaParseException.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/FormulaParseException.java @@ -22,8 +22,6 @@ package org.apache.poi.ss.formula; * supported by POI). It is primarily used by test code to confirm specific parsing exceptions. * Application code should also handle this exception if it potentially supplies formula text * that is not guaranteed to be well-formed. - * - * @author Josh Micich */ public final class FormulaParseException extends RuntimeException { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/FormulaParsingWorkbook.java b/poi/src/main/java/org/apache/poi/ss/formula/FormulaParsingWorkbook.java index 1d0c275b91..df79610b74 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/FormulaParsingWorkbook.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/FormulaParsingWorkbook.java @@ -28,15 +28,13 @@ import org.apache.poi.ss.util.CellReference; * Abstracts a workbook for the purpose of formula parsing.<br> * * For POI internal use only - * - * @author Josh Micich */ public interface FormulaParsingWorkbook { /** * named range name matching is case insensitive */ EvaluationName getName(String name, int sheetIndex); - + /** * Return the underlying workbook */ @@ -46,12 +44,12 @@ public interface FormulaParsingWorkbook { * XSSF Only - gets a table that exists in the worksheet */ Table getTable(String name); - + /** * Return an external name (named range, function, user-defined function) Ptg */ Ptg getNameXPtg(String name, SheetIdentifier sheet); - + /** * Produce the appropriate Ptg for a 3d cell reference */ diff --git a/poi/src/main/java/org/apache/poi/ss/formula/FormulaRenderer.java b/poi/src/main/java/org/apache/poi/ss/formula/FormulaRenderer.java index c247b1b61e..599d8fb6f5 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/FormulaRenderer.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/FormulaRenderer.java @@ -26,14 +26,12 @@ import org.apache.poi.ss.formula.ptg.MemFuncPtg; import org.apache.poi.ss.formula.ptg.OperationPtg; import org.apache.poi.ss.formula.ptg.ParenthesisPtg; import org.apache.poi.ss.formula.ptg.Ptg; +import org.apache.poi.util.Internal; /** - * Common logic for rendering formulas.<br> - * - * For POI internal use only - * - * @author Josh Micich + * Common logic for rendering formulas. */ +@Internal public class FormulaRenderer { /** diff --git a/poi/src/main/java/org/apache/poi/ss/formula/FormulaRenderingWorkbook.java b/poi/src/main/java/org/apache/poi/ss/formula/FormulaRenderingWorkbook.java index 94b791d31f..50c93a7531 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/FormulaRenderingWorkbook.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/FormulaRenderingWorkbook.java @@ -20,20 +20,18 @@ package org.apache.poi.ss.formula; import org.apache.poi.ss.formula.EvaluationWorkbook.ExternalSheet; import org.apache.poi.ss.formula.ptg.NamePtg; import org.apache.poi.ss.formula.ptg.NameXPtg; +import org.apache.poi.util.Internal; /** - * Abstracts a workbook for the purpose of converting formula to text.<br> - * - * For POI internal use only - * - * @author Josh Micich + * Abstracts a workbook for the purpose of converting formula to text. */ +@Internal public interface FormulaRenderingWorkbook { /** * @return <code>null</code> if externSheetIndex refers to a sheet inside the current workbook */ ExternalSheet getExternalSheet(int externSheetIndex); - + /** * @return the name of the (first) sheet referred to by the given external sheet index */ @@ -42,7 +40,7 @@ public interface FormulaRenderingWorkbook { * @return the name of the (last) sheet referred to by the given external sheet index */ String getSheetLastNameByExternSheet(int externSheetIndex); - + String resolveNameXText(NameXPtg nameXPtg); String getNameText(NamePtg namePtg); } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/IEvaluationListener.java b/poi/src/main/java/org/apache/poi/ss/formula/IEvaluationListener.java index 6182a28cfd..a7e34fae86 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/IEvaluationListener.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/IEvaluationListener.java @@ -23,8 +23,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; * Tests can implement this class to track the internal working of the {@link WorkbookEvaluator}.<br> * * For POI internal testing use only - * - * @author Josh Micich */ interface IEvaluationListener { /** diff --git a/poi/src/main/java/org/apache/poi/ss/formula/IStabilityClassifier.java b/poi/src/main/java/org/apache/poi/ss/formula/IStabilityClassifier.java index e4576a7c4d..7d1fbedad6 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/IStabilityClassifier.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/IStabilityClassifier.java @@ -22,7 +22,7 @@ package org.apache.poi.ss.formula; * parts of a workbook are <em>final</em>.<br> * The term <b>final</b> is introduced here to denote immutability or 'having constant definition'. * This classification refers to potential actions (on the evaluated workbook) by the evaluating - * application. It does not refer to operations performed by the evaluator ({@link + * application. It does not refer to operations performed by the evaluator ({@link * WorkbookEvaluator}).<br> * <br> * <b>General guidelines</b>: @@ -31,29 +31,27 @@ package org.apache.poi.ss.formula; * to {@link WorkbookEvaluator#evaluate(EvaluationCell)}. * </li> * <li>a formula cell can be marked as 'final' if its formula will not be changed after the first - * call to {@link WorkbookEvaluator#evaluate(EvaluationCell)}. This remains true even if changes + * call to {@link WorkbookEvaluator#evaluate(EvaluationCell)}. This remains true even if changes * in dependent values may cause the evaluated value to change.</li> * <li>plain value cells should be marked as 'not final' if their plain value value may change. - * </li> - * <li>formula cells should be marked as 'not final' if their formula definition may change.</li> + * </li> + * <li>formula cells should be marked as 'not final' if their formula definition may change.</li> * <li>cells which may switch between plain value and formula should also be marked as 'not final'. - * </li> + * </li> * </ul> * <b>Notes</b>: * <ul> * <li>If none of the spreadsheet cells is expected to have its definition changed after evaluation - * begins, every cell can be marked as 'final'. This is the most efficient / least resource + * begins, every cell can be marked as 'final'. This is the most efficient / least resource * intensive option.</li> * <li>To retain freedom to change any cell definition at any time, an application may classify all * cells as 'not final'. This freedom comes at the expense of greater memory consumption.</li> - * <li>For the purpose of these classifications, setting the cached formula result of a cell (for + * <li>For the purpose of these classifications, setting the cached formula result of a cell (for * example in {@link org.apache.poi.ss.usermodel.FormulaEvaluator#evaluateFormulaCell(org.apache.poi.ss.usermodel.Cell)}) * does not constitute changing the definition of the cell.</li> - * <li>Updating cells which have been classified as 'final' will cause the evaluator to behave - * unpredictably (typically ignoring the update).</li> + * <li>Updating cells which have been classified as 'final' will cause the evaluator to behave + * unpredictably (typically ignoring the update).</li> * </ul> - * - * @author Josh Micich */ public interface IStabilityClassifier { @@ -69,14 +67,14 @@ public interface IStabilityClassifier { /** * Checks if a cell's value(/formula) is fixed - in other words - not expected to be modified - * between calls to the evaluator. (Note - this is an independent concept from whether a + * between calls to the evaluator. (Note - this is an independent concept from whether a * formula cell's evaluated value may change during successive calls to the evaluator). - * + * * @param sheetIndex zero based index into workbook sheet list * @param rowIndex zero based row index of cell * @param columnIndex zero based column index of cell - * @return <code>false</code> if the evaluating application may need to modify the specified - * cell between calls to the evaluator. + * @return <code>false</code> if the evaluating application may need to modify the specified + * cell between calls to the evaluator. */ boolean isCellFinal(int sheetIndex, int rowIndex, int columnIndex); } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/OperandClassTransformer.java b/poi/src/main/java/org/apache/poi/ss/formula/OperandClassTransformer.java index 341919af58..ce5e5b539c 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/OperandClassTransformer.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/OperandClassTransformer.java @@ -28,7 +28,6 @@ import org.apache.poi.ss.formula.ptg.Ptg; import org.apache.poi.ss.formula.ptg.RangePtg; import org.apache.poi.ss.formula.ptg.UnionPtg; import org.apache.poi.ss.formula.ptg.ValueOperatorPtg; -import org.apache.poi.util.Removal; /** * This class performs 'operand class' transformation. Non-base tokens are classified into three @@ -53,8 +52,6 @@ import org.apache.poi.util.Removal; * * Hopefully, as additional important test cases are identified and added to the test suite, * patterns might become more obvious in this code and allow for simplification. - * - * @author Josh Micich */ final class OperandClassTransformer { @@ -65,7 +62,7 @@ final class OperandClassTransformer { } /** - * Traverses the supplied formula parse tree, calling <tt>Ptg.setClass()</tt> for each non-base + * Traverses the supplied formula parse tree, calling {@code Ptg.setClass()} for each non-base * token to set its operand class. */ public void transformFormula(ParseNode rootNode) { @@ -90,7 +87,7 @@ final class OperandClassTransformer { } /** - * @param callerForceArrayFlag <code>true</code> if one of the current node's parents is a + * @param callerForceArrayFlag {@code true} if one of the current node's parents is a * function Ptg which has been changed from default 'V' to 'A' type (due to requirements on * the function return value). */ @@ -102,8 +99,8 @@ final class OperandClassTransformer { if (isSimpleValueFunc) { boolean localForceArray = desiredOperandClass == Ptg.CLASS_ARRAY; - for (int i = 0; i < children.length; i++) { - transformNode(children[i], desiredOperandClass, localForceArray); + for (ParseNode child : children) { + transformNode(child, desiredOperandClass, localForceArray); } setSimpleValueFuncClass((AbstractFunctionPtg) token, desiredOperandClass, callerForceArrayFlag); return; @@ -128,8 +125,8 @@ final class OperandClassTransformer { // All direct operands of value operators that are initially 'R' type will // be converted to 'V' type. byte localDesiredOperandClass = desiredOperandClass == Ptg.CLASS_REF ? Ptg.CLASS_VALUE : desiredOperandClass; - for (int i = 0; i < children.length; i++) { - transformNode(children[i], localDesiredOperandClass, callerForceArrayFlag); + for (ParseNode child : children) { + transformNode(child, localDesiredOperandClass, callerForceArrayFlag); } return; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluationContext.java b/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluationContext.java index fcb1ccf9f2..9b6cda50c5 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluationContext.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluationContext.java @@ -152,7 +152,7 @@ public final class OperationEvaluationContext { } /** - * @return <code>null</code> if either workbook or sheet is not found + * @return {@code null} if either workbook or sheet is not found */ private SheetRefEvaluator createExternSheetRefEvaluator(String workbookName, String sheetName) { WorkbookEvaluator targetEvaluator; @@ -184,18 +184,18 @@ public final class OperationEvaluationContext { /** * Resolves a cell or area reference dynamically. - * @param workbookName the name of the workbook containing the reference. If <code>null</code> + * @param workbookName the name of the workbook containing the reference. If {@code null} * the current workbook is assumed. Note - to evaluate formulas which use multiple workbooks, * a {@link CollaboratingWorkbooksEnvironment} must be set up. - * @param sheetName the name of the sheet containing the reference. May be <code>null</code> - * (when <tt>workbookName</tt> is also null) in which case the current workbook and sheet is + * @param sheetName the name of the sheet containing the reference. May be {@code null} + * (when {@code workbookName} is also null) in which case the current workbook and sheet is * assumed. * @param refStrPart1 the single cell reference or first part of the area reference. Must not - * be <code>null</code>. + * be {@code null}. * @param refStrPart2 the second part of the area reference. For single cell references this - * parameter must be <code>null</code> - * @param isA1Style specifies the format for <tt>refStrPart1</tt> and <tt>refStrPart2</tt>. - * Pass <code>true</code> for 'A1' style and <code>false</code> for 'R1C1' style. + * parameter must be {@code null} + * @param isA1Style specifies the format for {@code refStrPart1} and {@code refStrPart2}. + * Pass {@code true} for 'A1' style and {@code false} for 'R1C1' style. * TODO - currently POI only supports 'A1' reference style * @return a {@link RefEval} or {@link AreaEval} */ diff --git a/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluatorFactory.java b/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluatorFactory.java index ca10b13075..542e026ad9 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluatorFactory.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluatorFactory.java @@ -57,10 +57,8 @@ import org.apache.poi.ss.formula.ptg.UnaryPlusPtg; import org.apache.poi.ss.util.CellRangeAddress; /** - * This class creates <tt>OperationEval</tt> instances to help evaluate <tt>OperationPtg</tt> + * This class creates {@code OperationEval} instances to help evaluate {@code OperationPtg} * formula tokens. - * - * @author Josh Micich */ final class OperationEvaluatorFactory { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ParseNode.java b/poi/src/main/java/org/apache/poi/ss/formula/ParseNode.java index a41ec26346..d9f01cec1c 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ParseNode.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ParseNode.java @@ -25,16 +25,16 @@ import org.apache.poi.ss.formula.ptg.MemFuncPtg; import org.apache.poi.ss.formula.ptg.Ptg; import org.apache.poi.ss.formula.function.FunctionMetadataRegistry; /** - * Represents a syntactic element from a formula by encapsulating the corresponding <tt>Ptg</tt> - * token. Each <tt>ParseNode</tt> may have child <tt>ParseNode</tt>s in the case when the wrapped - * <tt>Ptg</tt> is non-atomic. + * Represents a syntactic element from a formula by encapsulating the corresponding {@code Ptg} + * token. Each {@code ParseNode} may have child {@code ParseNode}s in the case when the wrapped + * {@code Ptg} is non-atomic. */ final class ParseNode { public static final ParseNode[] EMPTY_ARRAY = { }; private final Ptg _token; private final ParseNode[] _children; - private boolean _isIf; + private final boolean _isIf; private final int _tokenCount; public ParseNode(Ptg token, ParseNode[] children) { @@ -45,8 +45,8 @@ final class ParseNode { _children = children.clone(); _isIf = isIf(token); int tokenCount = 1; - for (int i = 0; i < children.length; i++) { - tokenCount += children[i].getTokenCount(); + for (ParseNode child : children) { + tokenCount += child.getTokenCount(); } if (_isIf) { // there will be 2 or 3 extra tAttr tokens according to whether the false param is present @@ -68,14 +68,14 @@ final class ParseNode { } public int getEncodedSize() { int result = _token instanceof ArrayPtg ? ArrayPtg.PLAIN_TOKEN_SIZE : _token.getSize(); - for (int i = 0; i < _children.length; i++) { - result += _children[i].getEncodedSize(); + for (ParseNode child : _children) { + result += child.getEncodedSize(); } return result; } /** - * Collects the array of <tt>Ptg</tt> tokens for the specified tree. + * Collects the array of {@code Ptg} tokens for the specified tree. */ public static Ptg[] toTokenArray(ParseNode rootNode) { TokenCollector temp = new TokenCollector(rootNode.getTokenCount()); @@ -150,9 +150,7 @@ final class ParseNode { private static boolean isIf(Ptg token) { if (token instanceof FuncVarPtg) { FuncVarPtg func = (FuncVarPtg) token; - if (FunctionMetadataRegistry.FUNCTION_NAME_IF.equals(func.getName())) { - return true; - } + return FunctionMetadataRegistry.FUNCTION_NAME_IF.equals(func.getName()); } return false; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/PlainValueCellCacheEntry.java b/poi/src/main/java/org/apache/poi/ss/formula/PlainValueCellCacheEntry.java index 171b12e179..4b62110669 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/PlainValueCellCacheEntry.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/PlainValueCellCacheEntry.java @@ -21,8 +21,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; /** * Used for non-formula cells, primarily to keep track of the referencing (formula) cells. - * - * @author Josh Micich */ final class PlainValueCellCacheEntry extends CellCacheEntry { public PlainValueCellCacheEntry(ValueEval value) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/SheetNameFormatter.java b/poi/src/main/java/org/apache/poi/ss/formula/SheetNameFormatter.java index cff04f3249..8f92043a5e 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/SheetNameFormatter.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/SheetNameFormatter.java @@ -26,13 +26,11 @@ import org.apache.poi.ss.SpreadsheetVersion; /** * Formats sheet names for use in formula expressions. - * - * @author Josh Micich */ public final class SheetNameFormatter { - + private static final char DELIMITER = '\''; - + /** * Matches a single cell ref with no absolute ('$') markers */ @@ -44,8 +42,8 @@ public final class SheetNameFormatter { /** * Used to format sheet names as they would appear in cell formula expressions. * @return the sheet name unchanged if there is no need for delimiting. Otherwise the sheet - * name is enclosed in single quotes ('). Any single quotes which were already present in the - * sheet name will be converted to double single quotes (''). + * name is enclosed in single quotes ('). Any single quotes which were already present in the + * sheet name will be converted to double single quotes (''). */ public static String format(String rawSheetName) { StringBuilder sb = new StringBuilder((rawSheetName == null ? 0 : rawSheetName.length()) + 2); @@ -158,7 +156,7 @@ public final class SheetNameFormatter { } if(Character.isLetter(rawSheetName.charAt(0)) && Character.isDigit(rawSheetName.charAt(len-1))) { - // note - values like "A$1:$C$20" don't get this far + // note - values like "A$1:$C$20" don't get this far if(nameLooksLikePlainCellReference(rawSheetName)) { return true; } @@ -170,7 +168,7 @@ public final class SheetNameFormatter { // so they don't get this far return false; } - + private static boolean nameLooksLikeBooleanLiteral(String rawSheetName) { switch(rawSheetName.charAt(0)) { case 'T': case 't': @@ -182,8 +180,8 @@ public final class SheetNameFormatter { } /** - * @return <code>true</code> if the presence of the specified character in a sheet name would - * require the sheet name to be delimited in formulas. This includes every non-alphanumeric + * @return <code>true</code> if the presence of the specified character in a sheet name would + * require the sheet name to be delimited in formulas. This includes every non-alphanumeric * character besides underscore '_' and dot '.'. */ /* package */ static boolean isSpecialChar(char ch) { @@ -198,20 +196,20 @@ public final class SheetNameFormatter { case '\n': case '\r': case '\t': - throw new RuntimeException("Illegal character (0x" + throw new RuntimeException("Illegal character (0x" + Integer.toHexString(ch) + ") found in sheet name"); } return true; } - + /** - * Used to decide whether sheet names like 'AB123' need delimiting due to the fact that they + * Used to decide whether sheet names like 'AB123' need delimiting due to the fact that they * look like cell references. * <p> * This code is currently being used for translating formulas represented with <code>Ptg</code> - * tokens into human readable text form. In formula expressions, a sheet name always has a - * trailing '!' so there is little chance for ambiguity. It doesn't matter too much what this + * tokens into human readable text form. In formula expressions, a sheet name always has a + * trailing '!' so there is little chance for ambiguity. It doesn't matter too much what this * method returns but it is worth noting the likely consumers of these formula text strings: * <ol> * <li>POI's own formula parser</li> @@ -220,9 +218,9 @@ public final class SheetNameFormatter { * <li>Manual entry into Excel cell contents</li> * <li>Some third party formula parser</li> * </ol> - * + * * At the time of writing, POI's formula parser tolerates cell-like sheet names in formulas - * with or without delimiters. The same goes for Excel(2007), both manual and automated entry. + * with or without delimiters. The same goes for Excel(2007), both manual and automated entry. * <p> * For better or worse this implementation attempts to replicate Excel's formula renderer. * Excel uses range checking on the apparent 'row' and 'column' components. Note however that @@ -234,11 +232,11 @@ public final class SheetNameFormatter { } /** - * Note - this method assumes the specified rawSheetName has only letters and digits. It + * Note - this method assumes the specified rawSheetName has only letters and digits. It * cannot be used to match absolute or range references (using the dollar or colon char). * <p> * Some notable cases: - * <blockquote><table border="0" cellpadding="1" cellspacing="0" + * <blockquote><table border="0" cellpadding="1" cellspacing="0" * summary="Notable cases."> * <tr><th>Input </th><th>Result </th><th>Comments</th></tr> * <tr><td>"A1" </td><td>true</td><td> </td></tr> @@ -251,7 +249,7 @@ public final class SheetNameFormatter { * <tr><td>"SALES20080101" </td><td>true</td> * <td>Still needs delimiting even though well out of range</td></tr> * </table></blockquote> - * + * * @return <code>true</code> if there is any possible ambiguity that the specified rawSheetName * could be interpreted as a valid cell name. */ @@ -260,7 +258,7 @@ public final class SheetNameFormatter { if(!matcher.matches()) { return false; } - + // rawSheetName == "Sheet1" gets this far. String lettersPrefix = matcher.group(1); String numbersSuffix = matcher.group(2); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/UserDefinedFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/UserDefinedFunction.java index c526137554..70546b2d19 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/UserDefinedFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/UserDefinedFunction.java @@ -24,10 +24,7 @@ import org.apache.poi.ss.formula.functions.FreeRefFunction; /** * * Common entry point for all user-defined (non-built-in) functions (where - * <tt>AbstractFunctionPtg.field_2_fnc_index</tt> == 255) - * - * @author Josh Micich - * @author Petr Udalau - Improved resolving of UDFs through the ToolPacks. + * {@code AbstractFunctionPtg.field_2_fnc_index} == 255) */ final class UserDefinedFunction implements FreeRefFunction { @@ -37,6 +34,7 @@ final class UserDefinedFunction implements FreeRefFunction { // enforce singleton } + @Override public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) { int nIncomingArgs = args.length; if(nIncomingArgs < 1) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/WorkbookDependentFormula.java b/poi/src/main/java/org/apache/poi/ss/formula/WorkbookDependentFormula.java index 59bd2a1a80..acecc26bd9 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/WorkbookDependentFormula.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/WorkbookDependentFormula.java @@ -17,14 +17,12 @@ package org.apache.poi.ss.formula; +import org.apache.poi.util.Internal; + /** * Should be implemented by any {@link org.apache.poi.ss.formula.ptg.Ptg} subclass that needs a workbook to render its formula. - * <br> - * - * For POI internal use only - * - * @author Josh Micich */ +@Internal public interface WorkbookDependentFormula { String toFormulaString(FormulaRenderingWorkbook book); } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/WorkbookEvaluator.java b/poi/src/main/java/org/apache/poi/ss/formula/WorkbookEvaluator.java index 8cb4cbf26b..2b278a9bc8 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/WorkbookEvaluator.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/WorkbookEvaluator.java @@ -45,20 +45,15 @@ import org.apache.poi.util.Internal; import static org.apache.logging.log4j.util.Unbox.box; /** - * Evaluates formula cells.<p/> + * Evaluates formula cells.<p> * * For performance reasons, this class keeps a cache of all previously calculated intermediate * cell values. Be sure to call {@link #clearAllCachedResultValues()} if any workbook cells are changed between - * calls to evaluate~ methods on this class.<br/> - * - * For POI internal use only - * - * @author Josh Micich - * @author Thies Wellpott (debug output enhancements) + * calls to evaluate~ methods on this class. */ @Internal public final class WorkbookEvaluator { - + private static final Logger LOG = LogManager.getLogger(WorkbookEvaluator.class); private final EvaluationWorkbook _workbook; @@ -86,7 +81,7 @@ public final class WorkbookEvaluator { private int dbgEvaluationOutputIndent = -1; /** - * @param udfFinder pass <code>null</code> for default (AnalysisToolPak only) + * @param udfFinder pass {@code null} for default (AnalysisToolPak only) */ public WorkbookEvaluator(EvaluationWorkbook workbook, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder) { this (workbook, null, stabilityClassifier, udfFinder); @@ -120,7 +115,7 @@ public final class WorkbookEvaluator { /* package */ EvaluationSheet getSheet(int sheetIndex) { return _workbook.getSheet(sheetIndex); } - + /* package */ EvaluationWorkbook getWorkbook() { return _workbook; } @@ -185,7 +180,7 @@ public final class WorkbookEvaluator { int sheetIndex = getSheetIndex(cell.getSheet()); _cache.notifyDeleteCell(_workbookIx, sheetIndex, cell); } - + private int getSheetIndex(EvaluationSheet sheet) { Integer result = _sheetIndexesBySheet.get(sheet); if (result == null) { @@ -193,10 +188,10 @@ public final class WorkbookEvaluator { if (sheetIndex < 0) { throw new RuntimeException("Specified sheet from a different book"); } - result = Integer.valueOf(sheetIndex); + result = sheetIndex; _sheetIndexesBySheet.put(sheet, result); } - return result.intValue(); + return result; } public ValueEval evaluate(EvaluationCell srcCell) { @@ -215,19 +210,19 @@ public final class WorkbookEvaluator { if (sheetIndex < 0) { return -1; } - result = Integer.valueOf(sheetIndex); + result = sheetIndex; _sheetIndexesByName.put(sheetName, result); } - return result.intValue(); + return result; } - + /* package */ int getSheetIndexByExternIndex(int externSheetIndex) { return _workbook.convertFromExternSheetIndex(externSheetIndex); } /** - * @return never <code>null</code>, never {@link BlankEval} + * @return never {@code null}, never {@link BlankEval} */ private ValueEval evaluateAny(EvaluationCell srcCell, int sheetIndex, int rowIndex, int columnIndex, EvaluationTracker tracker) { @@ -339,8 +334,8 @@ public final class WorkbookEvaluator { } /** * Gets the value from a non-formula cell. - * @param cell may be <code>null</code> - * @return {@link BlankEval} if cell is <code>null</code> or blank, never <code>null</code> + * @param cell may be {@code null} + * @return {@link BlankEval} if cell is {@code null} or blank, never {@code null} */ /* package */ static ValueEval getValueFromNonFormulaCell(EvaluationCell cell) { if (cell == null) { @@ -361,7 +356,7 @@ public final class WorkbookEvaluator { default: throw new RuntimeException("Unexpected cell type (" + cellType + ")"); } - + } @@ -518,7 +513,7 @@ public final class WorkbookEvaluator { FuncVarPtg f = (FuncVarPtg)ptgs[ii]; try { Function func = FunctionEval.getBasicFunction(f.getFunctionIndex()); - if (func != null && func instanceof ArrayMode) { + if (func instanceof ArrayMode) { arrayMode = true; } } catch (NotImplementedException ne){ @@ -552,9 +547,9 @@ public final class WorkbookEvaluator { if (!stack.isEmpty()) { throw new IllegalStateException("evaluation stack not empty"); } - + ValueEval result; - + if (ec.isSingleValue()) { result = dereferenceResult(value, ec); } @@ -577,32 +572,32 @@ public final class WorkbookEvaluator { /** * Calculates the number of tokens that the evaluator should skip upon reaching a tAttrSkip. * - * @return the number of tokens (starting from <tt>startIndex+1</tt>) that need to be skipped - * to achieve the specified <tt>distInBytes</tt> skip distance. + * @return the number of tokens (starting from {@code startIndex+1}) that need to be skipped + * to achieve the specified {@code distInBytes} skip distance. */ private static int countTokensToBeSkipped(Ptg[] ptgs, int startIndex, int distInBytes) { int remBytes = distInBytes; int index = startIndex; while (remBytes != 0) { index++; + if (index >= ptgs.length) { + throw new RuntimeException("Skip distance too far (ran out of formula tokens)."); + } remBytes -= ptgs[index].getSize(); if (remBytes < 0) { throw new RuntimeException("Bad skip distance (wrong token size calculation)."); } - if (index >= ptgs.length) { - throw new RuntimeException("Skip distance too far (ran out of formula tokens)."); - } } return index-startIndex; } - + /** * Dereferences a single value from any AreaEval or RefEval evaluation * result. If the supplied evaluationResult is just a plain value, it is * returned as-is. * * @return a {@link NumberEval}, {@link StringEval}, {@link BoolEval}, or - * {@link ErrorEval}. Never <code>null</code>. {@link BlankEval} is + * {@link ErrorEval}. Never {@code null}. {@link BlankEval} is * converted to {@link NumberEval#ZERO} */ private static ValueEval dereferenceResult(ValueEval evaluationResult, OperationEvaluationContext ec) { @@ -617,7 +612,7 @@ public final class WorkbookEvaluator { EvaluationSheet evalSheet = ec.getWorkbook().getSheet(ec.getSheetIndex()); EvaluationCell evalCell = evalSheet.getCell(ec.getRowIndex(), ec.getColumnIndex()); - + if (evalCell != null && evalCell.isPartOfArrayFormulaGroup() && evaluationResult instanceof AreaEval) { value = OperandResolver.getElementFromArray((AreaEval) evaluationResult, evalCell); } @@ -630,7 +625,7 @@ public final class WorkbookEvaluator { // Formulas _never_ evaluate to blank. If a formula appears to have evaluated to // blank, the actual value is empty string. This can be verified with ISBLANK(). } - + return value; } @@ -640,7 +635,7 @@ public final class WorkbookEvaluator { * returned as-is. * * @return a {@link NumberEval}, {@link StringEval}, {@link BoolEval}, or - * {@link ErrorEval}. Never <code>null</code>. {@link BlankEval} is + * {@link ErrorEval}. Never {@code null}. {@link BlankEval} is * converted to {@link NumberEval#ZERO} */ public static ValueEval dereferenceResult(ValueEval evaluationResult, int srcRowNum, int srcColNum) { @@ -663,8 +658,9 @@ public final class WorkbookEvaluator { /** * returns an appropriate Eval impl instance for the Ptg. The Ptg must be * one of: Area3DPtg, AreaPtg, ReferencePtg, Ref3DPtg, IntPtg, NumberPtg, - * StringPtg, BoolPtg <br/>special Note: OperationPtg subtypes cannot be - * passed here! + * StringPtg, BoolPtg<p> + * + * special Note: OperationPtg subtypes cannot be passed here! */ private ValueEval getEvalForPtg(Ptg ptg, OperationEvaluationContext ec) { // consider converting all these (ptg instanceof XxxPtg) expressions to (ptg.getClass() == XxxPtg.class) @@ -726,7 +722,7 @@ public final class WorkbookEvaluator { AreaPtg aptg = (AreaPtg) ptg; return ec.getAreaEval(aptg.getFirstRow(), aptg.getFirstColumn(), aptg.getLastRow(), aptg.getLastColumn()); } - + if (ptg instanceof ArrayPtg) { ArrayPtg aptg = (ArrayPtg) ptg; return ec.getAreaValueEval(0, 0, aptg.getRowCount() - 1, aptg.getColumnCount() - 1, aptg.getTokenArrayValues()); @@ -746,7 +742,7 @@ public final class WorkbookEvaluator { throw new RuntimeException("Unexpected ptg class (" + ptg.getClass().getName() + ")"); } - + private ValueEval processNameEval(ValueEval eval, OperationEvaluationContext ec) { if (eval instanceof ExternalNameEval) { EvaluationName name = ((ExternalNameEval)eval).getName(); @@ -754,7 +750,7 @@ public final class WorkbookEvaluator { } return eval; } - + private ValueEval getEvalForNameRecord(EvaluationName nameRecord, OperationEvaluationContext ec) { if (nameRecord.isFunctionName()) { return new FunctionNameEval(nameRecord.getNameText()); @@ -765,7 +761,7 @@ public final class WorkbookEvaluator { throw new RuntimeException("Don't know how to evaluate name '" + nameRecord.getNameText() + "'"); } - + /** * YK: Used by OperationEvaluationContext to resolve indirect names. */ @@ -773,7 +769,7 @@ public final class WorkbookEvaluator { if (ptgs.length == 1 && !(ptgs[0] instanceof FuncVarPtg)) { return getEvalForPtg(ptgs[0], ec); } - + OperationEvaluationContext anyValueContext = new OperationEvaluationContext(this, ec.getWorkbook(), ec.getSheetIndex(), ec.getRowIndex(), ec.getColumnIndex(), new EvaluationTracker(_cache), false); return evaluateFormula(anyValueContext, ptgs); } @@ -794,7 +790,7 @@ public final class WorkbookEvaluator { /** * Evaluate a formula outside a cell value, e.g. conditional format rules or data validation expressions - * + * * @param formula to evaluate * @param ref defines the optional sheet and row/column base for the formula, if it is relative * @return value @@ -810,17 +806,17 @@ public final class WorkbookEvaluator { int rowIndex = ref == null ? -1 : ref.getRow(); short colIndex = ref == null ? -1 : ref.getCol(); final OperationEvaluationContext ec = new OperationEvaluationContext( - this, - getWorkbook(), - sheetIndex, - rowIndex, - colIndex, + this, + getWorkbook(), + sheetIndex, + rowIndex, + colIndex, new EvaluationTracker(_cache) ); Ptg[] ptgs = FormulaParser.parse(formula, (FormulaParsingWorkbook) getWorkbook(), FormulaType.CELL, sheetIndex, rowIndex); return evaluateNameFormula(ptgs, ec); } - + /** * Some expressions need to be evaluated in terms of an offset from the top left corner of a region, * such as some data validation and conditional format expressions, when those constraints apply @@ -828,7 +824,7 @@ public final class WorkbookEvaluator { * offset position relative to the top left of the range. * <p> * Returns a single value e.g. a cell formula result or boolean value for conditional formatting. - * + * * @param formula The formula to evaluate * @param target cell context for the operation * @param region containing the cell @@ -838,7 +834,7 @@ public final class WorkbookEvaluator { public ValueEval evaluate(String formula, CellReference target, CellRangeAddressBase region) { return evaluate(formula, target, region, FormulaType.CELL); } - + /** * Some expressions need to be evaluated in terms of an offset from the top left corner of a region, * such as some data validation and conditional format expressions, when those constraints apply @@ -856,28 +852,29 @@ public final class WorkbookEvaluator { public ValueEval evaluateList(String formula, CellReference target, CellRangeAddressBase region) { return evaluate(formula, target, region, FormulaType.DATAVALIDATION_LIST); } - + private ValueEval evaluate(String formula, CellReference target, CellRangeAddressBase region, FormulaType formulaType) { final String sheetName = target == null ? null : target.getSheetName(); if (sheetName == null) throw new IllegalArgumentException("Sheet name is required"); - + final int sheetIndex = getWorkbook().getSheetIndex(sheetName); Ptg[] ptgs = FormulaParser.parse(formula, (FormulaParsingWorkbook) getWorkbook(), formulaType, sheetIndex, target.getRow()); adjustRegionRelativeReference(ptgs, target, region); - + final OperationEvaluationContext ec = new OperationEvaluationContext(this, getWorkbook(), sheetIndex, target.getRow(), target.getCol(), new EvaluationTracker(_cache), formulaType.isSingleValue()); return evaluateNameFormula(ptgs, ec); } - + /** * Adjust formula relative references by the offset between the start of the given region and the given target cell. * That is, treat the region top-left cell as "A1" for the purposes of evaluating relative reference components (row and/or column), - * and further move references by the position of the target within the region. - * <p><pre>formula ref + range top-left + current cell range offset </pre></p> + * and further move references by the position of the target within the region.<p> + * + * {@code formula ref + range top-left + current cell range offset} * which simplifies to - * <p><pre>formula ref + current cell ref</pre></p> - * @param ptgs + * {@code formula ref + current cell ref} + * * @param target cell within the region to use. * @param region containing the cell, OR, for conditional format rules with multiple ranges, the region with the top-left-most cell * @return true if any Ptg references were shifted @@ -886,10 +883,10 @@ public final class WorkbookEvaluator { */ protected boolean adjustRegionRelativeReference(Ptg[] ptgs, CellReference target, CellRangeAddressBase region) { // region may not be the one that contains the target, if a conditional formatting rule applies to multiple regions - + int deltaRow = target.getRow() - region.getFirstRow(); int deltaColumn = target.getCol() - region.getFirstColumn(); - + boolean shifted = false; for (Ptg ptg : ptgs) { // base class for cell reference "things" @@ -917,7 +914,7 @@ public final class WorkbookEvaluator { } return shifted; } - + /** * Whether to ignore missing references to external workbooks and * use cached formula results in the main workbook instead. diff --git a/poi/src/main/java/org/apache/poi/ss/formula/atp/ArgumentsEvaluator.java b/poi/src/main/java/org/apache/poi/ss/formula/atp/ArgumentsEvaluator.java index 0c3f537dd6..00680a8183 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/atp/ArgumentsEvaluator.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/atp/ArgumentsEvaluator.java @@ -31,8 +31,6 @@ import org.apache.poi.ss.util.DateParser; /** * Evaluator for formula arguments. - * - * @author jfaenomoto@gmail.com */ final class ArgumentsEvaluator { @@ -44,7 +42,7 @@ final class ArgumentsEvaluator { /** * Evaluate a generic {@link ValueEval} argument to a double value that represents a date in POI. - * + * * @param arg {@link ValueEval} an argument. * @param srcCellRow number cell row. * @param srcCellCol number cell column. @@ -68,7 +66,7 @@ final class ArgumentsEvaluator { /** * Evaluate a generic {@link ValueEval} argument to an array of double values that represents dates in POI. - * + * * @param arg {@link ValueEval} an argument. * @param srcCellRow number cell row. * @param srcCellCol number cell column. @@ -103,7 +101,7 @@ final class ArgumentsEvaluator { /** * Evaluate a generic {@link ValueEval} argument to a double value. - * + * * @param arg {@link ValueEval} an argument. * @param srcCellRow number cell row. * @param srcCellCol number cell column. diff --git a/poi/src/main/java/org/apache/poi/ss/formula/atp/IfError.java b/poi/src/main/java/org/apache/poi/ss/formula/atp/IfError.java index 9e405e3c23..d500d81807 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/atp/IfError.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/atp/IfError.java @@ -27,11 +27,9 @@ import org.apache.poi.ss.formula.functions.FreeRefFunction; * Implementation of 'Analysis Toolpak' Excel function IFERROR()<br> * * Returns an error text if there is an error in the evaluation<p> - * + * * <b>Syntax</b><br> * <b>IFERROR</b>(<b>expression</b>, <b>string</b>) - * - * @author Johan Karlsteen */ final class IfError implements FreeRefFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/atp/MRound.java b/poi/src/main/java/org/apache/poi/ss/formula/atp/MRound.java index 73f5ab320b..f1e6227a9b 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/atp/MRound.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/atp/MRound.java @@ -29,10 +29,6 @@ import org.apache.poi.ss.formula.functions.NumericFunction; * * <b>Syntax</b><br> * <b>MROUND</b>(<b>number</b>, <b>multiple</b>) - * - * <p> - * - * @author Yegor Kozlov */ final class MRound implements FreeRefFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/atp/NetworkdaysFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/atp/NetworkdaysFunction.java index e01ba84793..da57eef5e1 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/atp/NetworkdaysFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/atp/NetworkdaysFunction.java @@ -33,8 +33,6 @@ import org.apache.poi.ss.formula.functions.FreeRefFunction; * <b>Syntax</b><br> * <b>NETWORKDAYS</b>(<b>startDate</b>, <b>endDate</b>, holidays) * <p> - * - * @author jfaenomoto@gmail.com */ final class NetworkdaysFunction implements FreeRefFunction { @@ -44,7 +42,7 @@ final class NetworkdaysFunction implements FreeRefFunction { /** * Constructor. - * + * * @param anEvaluator an injected {@link ArgumentsEvaluator}. */ private NetworkdaysFunction(ArgumentsEvaluator anEvaluator) { @@ -55,7 +53,7 @@ final class NetworkdaysFunction implements FreeRefFunction { /** * Evaluate for NETWORKDAYS. Given two dates and a optional date or interval of holidays, determines how many working days are there * between those dates. - * + * * @return {@link ValueEval} for the number of days between two dates. */ public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) { // NOSONAR diff --git a/poi/src/main/java/org/apache/poi/ss/formula/atp/ParityFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/atp/ParityFunction.java index b59b4808b5..e01b07eb46 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/atp/ParityFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/atp/ParityFunction.java @@ -26,8 +26,6 @@ import org.apache.poi.ss.formula.functions.FreeRefFunction; import org.apache.poi.ss.formula.OperationEvaluationContext; /** * Implementation of Excel 'Analysis ToolPak' function ISEVEN() ISODD()<br> - * - * @author Josh Micich */ final class ParityFunction implements FreeRefFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/atp/RandBetween.java b/poi/src/main/java/org/apache/poi/ss/formula/atp/RandBetween.java index 79f1c0acea..4e96f9ad57 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/atp/RandBetween.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/atp/RandBetween.java @@ -34,8 +34,6 @@ import org.apache.poi.ss.formula.OperationEvaluationContext; * * <b>bottom</b> is the smallest integer RANDBETWEEN will return.<br> * <b>top</b> is the largest integer RANDBETWEEN will return.<br> - - * @author Brendan Nolan */ final class RandBetween implements FreeRefFunction{ @@ -49,17 +47,17 @@ final class RandBetween implements FreeRefFunction{ * Evaluate for RANDBETWEEN(). Must be given two arguments. Bottom must be greater than top. * Bottom is rounded up and top value is rounded down. After rounding top has to be set greater * than top. - * + * * @see org.apache.poi.ss.formula.functions.FreeRefFunction#evaluate(org.apache.poi.ss.formula.eval.ValueEval[], org.apache.poi.ss.formula.OperationEvaluationContext) */ public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) { - + double bottom, top; if (args.length != 2) { return ErrorEval.VALUE_INVALID; } - + try { bottom = OperandResolver.coerceValueToDouble(OperandResolver.getSingleValue(args[0], ec.getRowIndex(), ec.getColumnIndex())); top = OperandResolver.coerceValueToDouble(OperandResolver.getSingleValue(args[1], ec.getRowIndex(), ec.getColumnIndex())); @@ -76,9 +74,9 @@ final class RandBetween implements FreeRefFunction{ if(bottom > top) { top = bottom; } - + return new NumberEval((bottom + (long)(Math.random() * ((top - bottom) + 1)))); - + } - + } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/atp/WorkdayFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/atp/WorkdayFunction.java index d4eff0261f..83cba23259 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/atp/WorkdayFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/atp/WorkdayFunction.java @@ -33,8 +33,6 @@ import org.apache.poi.ss.usermodel.DateUtil; * <b>Syntax</b><br> * <b>WORKDAY</b>(<b>startDate</b>, <b>days</b>, holidays) * <p> - * - * @author jfaenomoto@gmail.com */ final class WorkdayFunction implements FreeRefFunction { @@ -50,7 +48,7 @@ final class WorkdayFunction implements FreeRefFunction { /** * Evaluate for WORKDAY. Given a date, a number of days and a optional date or interval of holidays, determines which date it is past * number of parametrized workdays. - * + * * @return {@link ValueEval} with date as its value. */ public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/constant/ConstantValueParser.java b/poi/src/main/java/org/apache/poi/ss/formula/constant/ConstantValueParser.java index 2d49270d0d..4487dc83ba 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/constant/ConstantValueParser.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/constant/ConstantValueParser.java @@ -23,22 +23,20 @@ import org.apache.poi.util.StringUtil; /** * To support Constant Values (2.5.7) as required by the CRN record. - * This class is also used for two dimensional arrays which are encoded by + * This class is also used for two dimensional arrays which are encoded by * EXTERNALNAME (5.39) records and Array tokens.<p> - * - * @author Josh Micich */ public final class ConstantValueParser { // note - these (non-combinable) enum values are sparse. private static final int TYPE_EMPTY = 0; private static final int TYPE_NUMBER = 1; private static final int TYPE_STRING = 2; - private static final int TYPE_BOOLEAN = 4; + private static final int TYPE_BOOLEAN = 4; private static final int TYPE_ERROR_CODE = 16; // TODO - update OOO document to include this value - - private static final int TRUE_ENCODING = 1; + + private static final int TRUE_ENCODING = 1; private static final int FALSE_ENCODING = 0; - + // TODO - is this the best way to represent 'EMPTY'? private static final Object EMPTY_REPRESENTATION = null; @@ -59,7 +57,7 @@ public final class ConstantValueParser { switch(grbit) { case TYPE_EMPTY: in.readLong(); // 8 byte 'not used' field - return EMPTY_REPRESENTATION; + return EMPTY_REPRESENTATION; case TYPE_NUMBER: return Double.valueOf(in.readDouble()); case TYPE_STRING: @@ -105,7 +103,7 @@ public final class ConstantValueParser { return 8; } Class<?> cls = object.getClass(); - + if(cls == Boolean.class || cls == Double.class || cls == ErrorConstant.class) { return 8; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/constant/ErrorConstant.java b/poi/src/main/java/org/apache/poi/ss/formula/constant/ErrorConstant.java index 3d8fb50c84..5082acff75 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/constant/ErrorConstant.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/constant/ErrorConstant.java @@ -27,7 +27,7 @@ import static org.apache.logging.log4j.util.Unbox.box; * Represents a constant error code value as encoded in a constant values array. <p> * * This class is a type-safe wrapper for a 16-bit int value performing a similar job to - * <tt>ErrorEval</tt>. + * {@code ErrorEval}. */ public final class ErrorConstant { private static final Logger LOG = LogManager.getLogger(ErrorConstant.class); @@ -74,10 +74,6 @@ public final class ErrorConstant { } public String toString() { - StringBuilder sb = new StringBuilder(64); - sb.append(getClass().getName()).append(" ["); - sb.append(getText()); - sb.append("]"); - return sb.toString(); + return getClass().getName() + " [" + getText() + "]"; } } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/AreaEvalBase.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/AreaEvalBase.java index 96633318d9..0903f51f29 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/AreaEvalBase.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/AreaEvalBase.java @@ -20,9 +20,6 @@ package org.apache.poi.ss.formula.eval; import org.apache.poi.ss.formula.SheetRange; import org.apache.poi.ss.formula.ptg.AreaI; -/** - * @author Josh Micich - */ public abstract class AreaEvalBase implements AreaEval { private final int _firstSheet; @@ -42,7 +39,7 @@ public abstract class AreaEvalBase implements AreaEval { _nColumns = _lastColumn - _firstColumn + 1; _nRows = _lastRow - _firstRow + 1; - + if (sheets != null) { _firstSheet = sheets.getFirstSheetIndex(); _lastSheet = sheets.getLastSheetIndex(); @@ -77,14 +74,14 @@ public abstract class AreaEvalBase implements AreaEval { public final int getLastRow() { return _lastRow; } - + public int getFirstSheetIndex() { return _firstSheet; } public int getLastSheetIndex() { return _lastSheet; } - + public final ValueEval getAbsoluteValue(int row, int col) { int rowOffsetIx = row - _firstRow; int colOffsetIx = col - _firstColumn; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/BlankEval.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/BlankEval.java index 845e7deaab..894f58b402 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/BlankEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/BlankEval.java @@ -18,8 +18,7 @@ package org.apache.poi.ss.formula.eval; /** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > This class is a - * marker class. It is a special value for empty cells. + * This class is a marker class. It is a special value for empty cells. */ public final class BlankEval implements ValueEval { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/BoolEval.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/BoolEval.java index 49fe3cf2a4..9e35d4c904 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/BoolEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/BoolEval.java @@ -17,12 +17,9 @@ package org.apache.poi.ss.formula.eval; -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - */ public final class BoolEval implements NumericValueEval, StringValueEval { - private boolean _value; + private final boolean _value; public static final BoolEval FALSE = new BoolEval(false); @@ -30,9 +27,9 @@ public final class BoolEval implements NumericValueEval, StringValueEval { /** * Convenience method for the following:<br> - * <code>(b ? BoolEval.TRUE : BoolEval.FALSE)</code> + * {@code (b ? BoolEval.TRUE : BoolEval.FALSE)} * - * @return the <tt>BoolEval</tt> instance representing <tt>b</tt>. + * @return the {@code BoolEval} instance representing {@code b}. */ public static BoolEval valueOf(boolean b) { return b ? TRUE : FALSE; @@ -46,10 +43,12 @@ public final class BoolEval implements NumericValueEval, StringValueEval { return _value; } + @Override public double getNumberValue() { return _value ? 1 : 0; } + @Override public String getStringValue() { return _value ? "TRUE" : "FALSE"; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/ConcatEval.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/ConcatEval.java index 5622be8705..cec4b987e8 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/ConcatEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/ConcatEval.java @@ -20,9 +20,6 @@ package org.apache.poi.ss.formula.eval; import org.apache.poi.ss.formula.functions.Fixed2ArgFunction; import org.apache.poi.ss.formula.functions.Function; -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - */ public final class ConcatEval extends Fixed2ArgFunction { public static final Function instance = new ConcatEval(); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/EvaluationException.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/EvaluationException.java index b0071a728c..21a368e2e5 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/EvaluationException.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/EvaluationException.java @@ -19,10 +19,10 @@ package org.apache.poi.ss.formula.eval; /** * This class is used to simplify error handling logic <i>within</i> operator and function - * implementations. Note - <tt>OperationEval.evaluate()</tt> and <tt>Function.evaluate()</tt> + * implementations. Note - {@code OperationEval.evaluate()} and {@code Function.evaluate()} * method signatures do not throw this exception so it cannot propagate outside.<p> * - * Here is an example coded without <tt>EvaluationException</tt>, to show how it can help: + * Here is an example coded without {@code EvaluationException}, to show how it can help: * <pre>{@code * public Eval evaluate(Eval[] args, int srcRow, short srcCol) { * // ... @@ -52,8 +52,9 @@ package org.apache.poi.ss.formula.eval; * In this example, if any error is encountered while processing the arguments, an error is * returned immediately. This code is difficult to refactor due to all the points where errors * are returned.<br> - * Using <tt>EvaluationException</tt> allows the error returning code to be consolidated to one - * place.<p> + * Using {@code EvaluationException} allows the error returning code to be consolidated to one + * place. + * * <pre>{@code * public Eval evaluate(Eval[] args, int srcRow, short srcCol) { * try { @@ -100,12 +101,10 @@ package org.apache.poi.ss.formula.eval; * error), because exceptions conveniently propagate up the call stack regardless of execution * points or the number of levels of nested calls.<p> * - * <b>Note</b> - Only standard evaluation errors are represented by <tt>EvaluationException</tt> ( + * <b>Note</b> - Only standard evaluation errors are represented by {@code EvaluationException} ( * i.e. conditions expected to be encountered when evaluating arbitrary Excel formulas). Conditions * that could never occur in an Excel spreadsheet should result in runtime exceptions. Care should * be taken to not translate any POI internal error into an Excel evaluation error code. - * - * @author Josh Micich */ public final class EvaluationException extends Exception { private final ErrorEval _errorEval; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/FunctionNameEval.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/FunctionNameEval.java index 82e0296399..b98c8a80f9 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/FunctionNameEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/FunctionNameEval.java @@ -17,9 +17,6 @@ package org.apache.poi.ss.formula.eval; -/** - * @author Josh Micich - */ public final class FunctionNameEval implements ValueEval { private final String _functionName; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/IntersectionEval.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/IntersectionEval.java index 4063790c73..36cd234c68 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/IntersectionEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/IntersectionEval.java @@ -20,9 +20,6 @@ package org.apache.poi.ss.formula.eval; import org.apache.poi.ss.formula.functions.Fixed2ArgFunction; import org.apache.poi.ss.formula.functions.Function; -/** - * @author Josh Micich - */ public final class IntersectionEval extends Fixed2ArgFunction { public static final Function instance = new IntersectionEval(); @@ -31,6 +28,7 @@ public final class IntersectionEval extends Fixed2ArgFunction { // enforces singleton } + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { try { @@ -48,7 +46,7 @@ public final class IntersectionEval extends Fixed2ArgFunction { /** * @return simple rectangular {@link AreaEval} which represents the intersection of areas - * <tt>aeA</tt> and <tt>aeB</tt>. If the two areas do not intersect, the result is <code>null</code>. + * {@code aeA} and {@code aeB}. If the two areas do not intersect, the result is {@code null}. */ private static AreaEval resolveRange(AreaEval aeA, AreaEval aeB) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/MissingArgEval.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/MissingArgEval.java index 70d25040f4..185509e57e 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/MissingArgEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/MissingArgEval.java @@ -23,8 +23,6 @@ package org.apache.poi.ss.formula.eval; * COUNT and COUNTA <em>do</em> count their missing args. Note - the differences between * {@link MissingArgEval} and {@link BlankEval} have not been investigated fully, so the POI * evaluator may need to be updated to account for these as they are found. - * - * @author Josh Micich */ public final class MissingArgEval implements ValueEval { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/NumberEval.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/NumberEval.java index 87d425356b..d0a462dbc3 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/NumberEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/NumberEval.java @@ -25,12 +25,8 @@ import org.apache.poi.ss.formula.ptg.NumberPtg; import org.apache.poi.ss.formula.ptg.Ptg; import org.apache.poi.ss.util.NumberToTextConverter; -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * - */ public final class NumberEval implements NumericValueEval, StringValueEval { - + public static final NumberEval ZERO = new NumberEval(0); private final double _value; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/NumericValueEval.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/NumericValueEval.java index c6dcf1dc27..92c7dc3c47 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/NumericValueEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/NumericValueEval.java @@ -14,16 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * Created on May 8, 2005 - * - */ package org.apache.poi.ss.formula.eval; -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * - */ public interface NumericValueEval extends ValueEval { double getNumberValue(); 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 59a383c3e1..2177e9115b 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 @@ -26,9 +26,6 @@ import java.util.regex.Pattern; /** * Provides functionality for evaluating arguments to functions and operators. - * - * @author Josh Micich - * @author Brendan Nolan */ public final class OperandResolver { @@ -43,7 +40,7 @@ public final class OperandResolver { "(\\."+Digits+"("+Exp+")?))"+ "[\\x00-\\x20]*"); private static final Pattern fpPattern = Pattern.compile(fpRegex); - + private OperandResolver() { // no instances of this class } @@ -54,8 +51,8 @@ public final class OperandResolver { * @param arg the evaluated argument as passed to the function or operator. * @param srcCellRow used when arg is a single column AreaRef * @param srcCellCol used when arg is a single row AreaRef - * @return a <tt>NumberEval</tt>, <tt>StringEval</tt>, <tt>BoolEval</tt> or <tt>BlankEval</tt>. - * Never <code>null</code> or <tt>ErrorEval</tt>. + * @return a {@code NumberEval}, {@code StringEval}, {@code BoolEval} or {@code BlankEval}. + * Never {@code null} or {@code ErrorEval}. * @throws EvaluationException if srcCellRow or srcCellCol do not properly index into * an AreaEval. If the actual value retrieved is an ErrorEval, a corresponding * EvaluationException is thrown. @@ -75,15 +72,15 @@ public final class OperandResolver { } return result; } - + /** * Retrieves a single value from an area evaluation utilizing the 2D indices of the cell * within its own area reference to index the value in the area evaluation. * * @param ae area reference after evaluation * @param cell the source cell of the formula that contains its 2D indices - * @return a <tt>NumberEval</tt>, <tt>StringEval</tt>, <tt>BoolEval</tt> or <tt>BlankEval</tt>. or <tt>ErrorEval<tt> - * Never <code>null</code>. + * @return a {@code NumberEval}, {@code StringEval}, {@code BoolEval} or {@code BlankEval}. or {@code ErrorEval} + * Never {@code null}. */ public static ValueEval getElementFromArray(AreaEval ae, EvaluationCell cell) { @@ -105,7 +102,7 @@ public final class OperandResolver { else if (ae.isRow() && relativeColIndex < ae.getWidth()) { return ae.getRelativeValue(0, relativeColIndex); } - + return ErrorEval.NA; } @@ -142,14 +139,14 @@ public final class OperandResolver { * * Of course with carefully (or carelessly) chosen parameters, cyclic references can occur and * hence this method <b>can</b> throw a 'circular reference' EvaluationException. Note that - * this method does not attempt to detect cycles. Every cell in the specified Area <tt>ae</tt> + * this method does not attempt to detect cycles. Every cell in the specified Area {@code ae} * has already been evaluated prior to this method call. Any cell (or cell<b>s</b>) part of - * <tt>ae</tt> that would incur a cyclic reference error if selected by this method, will - * already have the value <t>ErrorEval.CIRCULAR_REF_ERROR</tt> upon entry to this method. It + * {@code ae} that would incur a cyclic reference error if selected by this method, will + * already have the value {@code ErrorEval.CIRCULAR_REF_ERROR} upon entry to this method. It * is assumed logic exists elsewhere to produce this behaviour. * - * @return whatever the selected cell's evaluated value is. Never <code>null</code>. Never - * <tt>ErrorEval</tt>. + * @return whatever the selected cell's evaluated value is. Never {@code null}. Never + * {@code ErrorEval}. * @throws EvaluationException if there is a problem with indexing into the area, or if the * evaluated cell has an error. */ @@ -163,7 +160,7 @@ public final class OperandResolver { } /** - * @return possibly <tt>ErrorEval</tt>, and <code>null</code> + * @return possibly {@code ErrorEval}, and {@code null} */ private static ValueEval chooseSingleElementFromAreaInternal(AreaEval ae, int srcCellRow, int srcCellCol) throws EvaluationException { @@ -212,21 +209,21 @@ public final class OperandResolver { } return ae.getAbsoluteValue(ae.getFirstRow(), srcCellCol); } - + private static ValueEval chooseSingleElementFromRef(RefEval ref) { return ref.getInnerValueEval( ref.getFirstSheetIndex() ); } /** * Applies some conversion rules if the supplied value is not already an integer.<br> - * Value is first coerced to a <tt>double</tt> ( See <tt>coerceValueToDouble()</tt> ). - * Note - <tt>BlankEval</tt> is converted to <code>0</code>.<p> + * Value is first coerced to a {@code double} ( See {@code coerceValueToDouble()} ). + * Note - {@code BlankEval} is converted to {@code 0}.<p> * * Excel typically converts doubles to integers by truncating toward negative infinity.<br> * The equivalent java code is:<br> - * <code>return (int)Math.floor(d);</code><br> + * {@code return (int)Math.floor(d);}<br> * <b>not</b>:<br> - * <code>return (int)d; // wrong - rounds toward zero</code> + * {@code return (int)d; // wrong - rounds toward zero} * */ public static int coerceValueToInt(ValueEval ev) throws EvaluationException { @@ -241,12 +238,12 @@ public final class OperandResolver { /** * Applies some conversion rules if the supplied value is not already a number. - * Note - <tt>BlankEval</tt> is converted to {@link NumberEval#ZERO}. + * Note - {@code BlankEval} is converted to {@link NumberEval#ZERO}. * @param ev must be a {@link NumberEval}, {@link StringEval}, {@link BoolEval} or * {@link BlankEval} * @return actual, parsed or interpreted double value (respectively). * @throws EvaluationException if a StringEval is supplied and cannot be parsed - * as a double (See <tt>parseDouble()</tt> for allowable formats). + * as a double (See {@code parseDouble()} for allowable formats). * @throws RuntimeException if the supplied parameter is not {@link NumberEval}, * {@link StringEval}, {@link BoolEval} or {@link BlankEval} */ @@ -266,7 +263,7 @@ public final class OperandResolver { if (dd == null) { throw EvaluationException.invalidValue(); } - return dd.doubleValue(); + return dd; } throw new RuntimeException("Unexpected arg eval type (" + ev.getClass().getName() + ")"); } @@ -274,8 +271,8 @@ public final class OperandResolver { /** * Converts a string to a double using standard rules that Excel would use.<br> * Tolerates leading and trailing spaces, <p> - * - * Doesn't support currency prefixes, commas, percentage signs or arithmetic operations strings. + * + * Doesn't support currency prefixes, commas, percentage signs or arithmetic operations strings. * * Some examples:<br> * " 123 " -> 123.0<br> @@ -288,7 +285,7 @@ public final class OperandResolver { * "5**2" -> 500<br> * "250%" -> 2.5<br> * - * @return <code>null</code> if the specified text cannot be parsed as a number + * @return {@code null} if the specified text cannot be parsed as a number */ public static Double parseDouble(String pText) { @@ -301,7 +298,7 @@ public final class OperandResolver { else { return null; } - + } public static Double parseDateTime(String pText) { @@ -315,8 +312,8 @@ public final class OperandResolver { } /** - * @param ve must be a <tt>NumberEval</tt>, <tt>StringEval</tt>, <tt>BoolEval</tt>, or <tt>BlankEval</tt> - * @return the converted string value. never <code>null</code> + * @param ve must be a {@code NumberEval}, {@code StringEval}, {@code BoolEval}, or {@code BlankEval} + * @return the converted string value. never {@code null} */ public static String coerceValueToString(ValueEval ve) { if (ve instanceof StringValueEval) { @@ -330,7 +327,7 @@ public final class OperandResolver { } /** - * @return <code>null</code> to represent blank values + * @return {@code null} to represent blank values * @throws EvaluationException if ve is an ErrorEval, or if a string value cannot be converted */ public static Boolean coerceValueToBoolean(ValueEval ve, boolean stringsAreBlanks) throws EvaluationException { @@ -340,7 +337,7 @@ public final class OperandResolver { return null; } if (ve instanceof BoolEval) { - return Boolean.valueOf(((BoolEval) ve).getBooleanValue()); + return ((BoolEval) ve).getBooleanValue(); } if (ve instanceof StringEval) { @@ -364,7 +361,7 @@ public final class OperandResolver { if (Double.isNaN(d)) { throw new EvaluationException(ErrorEval.VALUE_INVALID); } - return Boolean.valueOf(d != 0); + return d != 0; } if (ve instanceof ErrorEval) { throw new EvaluationException((ErrorEval) ve); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/PercentEval.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/PercentEval.java index d6162e54c0..dcaaf9802e 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/PercentEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/PercentEval.java @@ -23,7 +23,6 @@ import org.apache.poi.ss.formula.functions.Function; /** * Implementation of Excel formula token '%'. <p> - * @author Josh Micich */ public final class PercentEval extends Fixed1ArgFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/RangeEval.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/RangeEval.java index 617d20a765..f11fb72245 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/RangeEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/RangeEval.java @@ -21,10 +21,6 @@ import org.apache.poi.ss.formula.functions.Fixed2ArgFunction; import org.apache.poi.ss.formula.functions.Function; -/** - * - * @author Josh Micich - */ public final class RangeEval extends Fixed2ArgFunction { public static final Function instance = new RangeEval(); @@ -33,6 +29,7 @@ public final class RangeEval extends Fixed2ArgFunction { // enforces singleton } + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { try { @@ -46,7 +43,7 @@ public final class RangeEval extends Fixed2ArgFunction { /** * @return simple rectangular {@link AreaEval} which fully encloses both areas - * <tt>aeA</tt> and <tt>aeB</tt> + * {@code aeA} and {@code aeB} */ private static AreaEval resolveRange(AreaEval aeA, AreaEval aeB) { int aeAfr = aeA.getFirstRow(); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/RelationalOperationEval.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/RelationalOperationEval.java index a9684c95d9..0c808ea843 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/RelationalOperationEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/RelationalOperationEval.java @@ -24,8 +24,6 @@ import org.apache.poi.ss.util.NumberComparer; /** * Base class for all comparison operator evaluators - * - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > */ public abstract class RelationalOperationEval extends Fixed2ArgFunction implements ArrayFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/StringEval.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/StringEval.java index 61515e438f..cad32e0050 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/StringEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/StringEval.java @@ -22,9 +22,6 @@ package org.apache.poi.ss.formula.eval; import org.apache.poi.ss.formula.ptg.Ptg; import org.apache.poi.ss.formula.ptg.StringPtg; -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - */ public final class StringEval implements StringValueEval { public static final StringEval EMPTY_INSTANCE = new StringEval(""); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/StringValueEval.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/StringValueEval.java index 4e1b712fbc..2741079cd2 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/StringValueEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/StringValueEval.java @@ -17,10 +17,6 @@ package org.apache.poi.ss.formula.eval; -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * - */ public interface StringValueEval extends ValueEval { /** diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/TwoOperandNumericOperation.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/TwoOperandNumericOperation.java index 8d15ebea93..f60c7855ff 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/TwoOperandNumericOperation.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/TwoOperandNumericOperation.java @@ -23,16 +23,13 @@ import org.apache.poi.ss.formula.functions.Function; import org.apache.poi.ss.formula.functions.MatrixFunction.MutableValueCollector; import org.apache.poi.ss.formula.functions.MatrixFunction.TwoArrayArg; -/** - * @author Josh Micich - */ public abstract class TwoOperandNumericOperation extends Fixed2ArgFunction implements ArrayFunction { protected final double singleOperandEvaluate(ValueEval arg, int srcCellRow, int srcCellCol) throws EvaluationException { ValueEval ve = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol); return OperandResolver.coerceValueToDouble(ve); } - + public ValueEval evaluateArray(ValueEval[] args, int srcRowIndex, int srcColumnIndex) { if (args.length != 2) { return ErrorEval.VALUE_INVALID; @@ -52,7 +49,7 @@ public abstract class TwoOperandNumericOperation extends Fixed2ArgFunction imple }); } - + public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { double result; try { @@ -78,27 +75,27 @@ public abstract class TwoOperandNumericOperation extends Fixed2ArgFunction imple private final class ArrayEval extends TwoArrayArg { private final MutableValueCollector instance = new MutableValueCollector(true, true); - + protected double[] collectValues(ValueEval arg) throws EvaluationException { return instance.collectValues(arg); } - + protected double[][] evaluate(double[][] d1, double[][] d2) throws IllegalArgumentException, EvaluationException { int width = (d1[0].length < d2[0].length) ? d1[0].length : d2[0].length; int height = (d1.length < d2.length) ? d1.length : d2.length; double[][] result = new double[height][width]; - + for (int j = 0; j < height; j++) { for (int i = 0; i < width; i++) { result[j][i] = TwoOperandNumericOperation.this.evaluate(d1[j][i], d2[j][i]); } } - + return result; } } - + public static final Function AddEval = new TwoOperandNumericOperation() { protected double evaluate(double d0, double d1) { return d0+d1; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/UnaryMinusEval.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/UnaryMinusEval.java index 8107c48544..922c5cc90a 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/UnaryMinusEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/UnaryMinusEval.java @@ -21,9 +21,6 @@ import org.apache.poi.ss.formula.functions.ArrayFunction; import org.apache.poi.ss.formula.functions.Fixed1ArgFunction; import org.apache.poi.ss.formula.functions.Function; -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - */ public final class UnaryMinusEval extends Fixed1ArgFunction implements ArrayFunction { public static final Function instance = new UnaryMinusEval(); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/UnaryPlusEval.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/UnaryPlusEval.java index 81b36aad40..f8d73dfd15 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/UnaryPlusEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/UnaryPlusEval.java @@ -22,9 +22,6 @@ import org.apache.poi.ss.formula.functions.Fixed1ArgFunction; import org.apache.poi.ss.formula.functions.Function; -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - */ public final class UnaryPlusEval extends Fixed1ArgFunction implements ArrayFunction { public static final Function instance = new UnaryPlusEval(); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/ValueEval.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/ValueEval.java index c1309a7df6..a9db4cac58 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/ValueEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/ValueEval.java @@ -17,9 +17,6 @@ package org.apache.poi.ss.formula.eval; -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - */ public interface ValueEval { // no methods } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationCell.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationCell.java index 7a25291325..7f7f137c98 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationCell.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationCell.java @@ -32,8 +32,6 @@ import org.apache.poi.ss.util.CellRangeAddress; /** * Represents a cell being used for forked evaluation that has had a value set different from the * corresponding cell in the shared master workbook. - * - * @author Josh Micich */ final class ForkedEvaluationCell implements EvaluationCell { @@ -140,12 +138,12 @@ final class ForkedEvaluationCell implements EvaluationCell { public int getColumnIndex() { return _masterCell.getColumnIndex(); } - + @Override public CellRangeAddress getArrayFormulaRange() { return _masterCell.getArrayFormulaRange(); } - + @Override public boolean isPartOfArrayFormulaGroup() { return _masterCell.isPartOfArrayFormulaGroup(); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluator.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluator.java index b85cc15ea9..8231653cea 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluator.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluator.java @@ -52,14 +52,14 @@ public final class ForkedEvaluator { } /** - * @param udfFinder pass <code>null</code> for default (AnalysisToolPak only) + * @param udfFinder pass {@code null} for default (AnalysisToolPak only) */ public static ForkedEvaluator create(Workbook wb, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder) { return new ForkedEvaluator(wb.createEvaluationWorkbook(), stabilityClassifier, udfFinder); } /** - * Sets the specified cell to the supplied <tt>value</tt> + * Sets the specified cell to the supplied {@code value} * @param sheetName the name of the sheet containing the cell * @param rowIndex zero based * @param columnIndex zero based @@ -72,8 +72,8 @@ public final class ForkedEvaluator { } /** * Copies the values of all updated cells (modified by calls to {@link - * #updateCell(String, int, int, ValueEval)}) to the supplied <tt>workbook</tt>.<br> - * Typically, the supplied <tt>workbook</tt> is a writable copy of the 'master workbook', + * #updateCell(String, int, int, ValueEval)}) to the supplied {@code workbook}.<br> + * Typically, the supplied {@code workbook} is a writable copy of the 'master workbook', * but at the very least it must contain sheets with the same names. */ public void copyUpdatedCells(Workbook workbook) { @@ -90,7 +90,7 @@ public final class ForkedEvaluator { * @param sheetName the name of the sheet containing the cell * @param rowIndex zero based * @param columnIndex zero based - * @return <code>null</code> if the supplied cell is <code>null</code> or blank + * @return {@code null} if the supplied cell is {@code null} or blank */ public ValueEval evaluate(String sheetName, int rowIndex, int columnIndex) { EvaluationCell cell = _sewb.getEvaluationCell(sheetName, rowIndex, columnIndex); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionDataBuilder.java b/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionDataBuilder.java index 0be53f555e..fefc4d0987 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionDataBuilder.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionDataBuilder.java @@ -23,10 +23,8 @@ import java.util.Map; import java.util.Set; /** - * Temporarily collects <tt>FunctionMetadata</tt> instances for creation of a - * <tt>FunctionMetadataRegistry</tt>. - * - * @author Josh Micich + * Temporarily collects {@code FunctionMetadata} instances for creation of a + * {@code FunctionMetadataRegistry}. */ final class FunctionDataBuilder { private int _maxFunctionIndex; @@ -47,7 +45,7 @@ final class FunctionDataBuilder { FunctionMetadata fm = new FunctionMetadata(functionIndex, functionName, minParams, maxParams, returnClassCode, parameterClassCodes); - Integer indexKey = Integer.valueOf(functionIndex); + Integer indexKey = functionIndex; if(functionIndex > _maxFunctionIndex) { @@ -60,7 +58,7 @@ final class FunctionDataBuilder { if(!hasFootnote || !_mutatingFunctionIndexes.contains(indexKey)) { throw new RuntimeException("Multiple entries for function name '" + functionName + "'"); } - _functionDataByIndex.remove(Integer.valueOf(prevFM.getIndex())); + _functionDataByIndex.remove(prevFM.getIndex()); } prevFM = _functionDataByIndex.get(indexKey); if(prevFM != null) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadata.java b/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadata.java index fa8ca34aca..9c80cd4623 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadata.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadata.java @@ -19,8 +19,6 @@ package org.apache.poi.ss.formula.function; /** * Holds information about Excel built-in functions. - * - * @author Josh Micich */ public final class FunctionMetadata { /** @@ -80,7 +78,7 @@ public final class FunctionMetadata { } /** - * Some varags functions (like VLOOKUP) have a specific limit to the number of arguments that + * Some varags functions (like VLOOKUP) have a specific limit to the number of arguments that * can be passed. Other functions (like SUM) don't have such a limit. For those functions, * the spreadsheet version determines the maximum number of arguments that can be passed. * @return <code>true</code> if this function can the maximum number of arguments allowable by diff --git a/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java b/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java index dc83e9c601..fce0793765 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java @@ -31,9 +31,7 @@ import org.apache.poi.ss.formula.ptg.Ptg; import org.apache.poi.util.IOUtils; /** - * Converts the text meta-data file into a <tt>FunctionMetadataRegistry</tt> - * - * @author Josh Micich + * Converts the text meta-data file into a {@code FunctionMetadataRegistry} */ final class FunctionMetadataReader { @@ -150,12 +148,7 @@ final class FunctionMetadataReader { } private static boolean isDash(String codes) { - if(codes.length() == 1) { - if (codes.charAt(0) == '-') { - return true; - } - } - return false; + return codes.length() == 1 && codes.charAt(0) == '-'; } private static byte parseOperandTypeCode(String code) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadataRegistry.java b/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadataRegistry.java index bb01b41163..2430fa2551 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadataRegistry.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadataRegistry.java @@ -19,10 +19,9 @@ package org.apache.poi.ss.formula.function; import java.util.Map; import java.util.Set; + /** * Allows clients to get {@link FunctionMetadata} instances for any built-in function of Excel. - * - * @author Josh Micich */ public final class FunctionMetadataRegistry { /** diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Address.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Address.java index ea5244c1eb..315d689193 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Address.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Address.java @@ -22,8 +22,6 @@ import org.apache.poi.ss.util.CellReference; /** * Creates a text reference as text, given specified row and column numbers. - * - * @author Aniket Banerjee (banerjee@google.com) */ public class Address implements Function { public static final int REF_ABSOLUTE = 1; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/AggregateFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/AggregateFunction.java index 5eb90c3417..fc79c814c1 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/AggregateFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/AggregateFunction.java @@ -24,9 +24,6 @@ import org.apache.poi.ss.formula.eval.NumberEval; import org.apache.poi.ss.formula.eval.OperandResolver; import org.apache.poi.ss.formula.eval.ValueEval; -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - */ public abstract class AggregateFunction extends MultiOperandNumericFunction { private static final class LargeSmall extends Fixed2ArgFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Areas.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Areas.java index 6d06c6375e..f6034ef5a5 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Areas.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Areas.java @@ -25,8 +25,6 @@ import org.apache.poi.ss.formula.ptg.NumberPtg; /** * Returns the number of areas in a reference. An area is a range of contiguous cells or a single cell. - * - * @author Loopbing (loopbing@gmail.com) */ public final class Areas implements Function { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/ArrayFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/ArrayFunction.java index 46b89d5013..aa896ecc32 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/ArrayFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/ArrayFunction.java @@ -24,7 +24,6 @@ import org.apache.poi.ss.formula.eval.*; import java.util.function.BiFunction; /** - * @author Robert Hulbert * Common Interface for any excel built-in function that has implemented array formula functionality. */ diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Bin2Dec.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Bin2Dec.java index 69a01fe69c..e2c5100a97 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Bin2Dec.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Bin2Dec.java @@ -37,8 +37,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; * Remark * If number is not a valid binary number, or if number contains more than 10 characters (10 bits), * BIN2DEC returns the #NUM! error value. - * - * @author cedric dot walter @ gmail dot com */ public class Bin2Dec extends Fixed1ArgFunction implements FreeRefFunction { @@ -80,10 +78,10 @@ public class Bin2Dec extends Fixed1ArgFunction implements FreeRefFunction { String inverted = toggleBits(unsigned); // Calculate decimal number int sum = getDecimalValue(inverted); - + //Add 1 to obtained number sum++; - + value = "-" + sum; } } catch (NumberFormatException e) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/CalendarFieldFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/CalendarFieldFunction.java index 28af57a2a5..0a93244cc3 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/CalendarFieldFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/CalendarFieldFunction.java @@ -30,9 +30,6 @@ import org.apache.poi.ss.usermodel.DateUtil; * Implementation of Excel functions Date parsing functions: * Date - DAY, MONTH and YEAR * Time - HOUR, MINUTE and SECOND - * - * @author Others (not mentioned in code) - * @author Thies Wellpott */ public final class CalendarFieldFunction extends Fixed1ArgFunction { public static final Function YEAR = new CalendarFieldFunction(Calendar.YEAR); @@ -79,12 +76,12 @@ public final class CalendarFieldFunction extends Fixed1ArgFunction { // rounding issues); use UTC here to prevent daylight saving issues for HOUR Calendar c = DateUtil.getJavaCalendarUTC(serialDate + 0.4995 / DateUtil.SECONDS_PER_DAY, false); int result = c.get(_dateFieldId); - + // Month is a special case due to C semantics if (_dateFieldId == Calendar.MONTH) { result++; } - + return result; } } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Choose.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Choose.java index 127ffd43d7..6bcb825c3d 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Choose.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Choose.java @@ -24,9 +24,6 @@ import org.apache.poi.ss.formula.eval.MissingArgEval; import org.apache.poi.ss.formula.eval.OperandResolver; import org.apache.poi.ss.formula.eval.ValueEval; -/** - * @author Josh Micich - */ public final class Choose implements Function { public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Code.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Code.java index f285d58580..784500f095 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Code.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Code.java @@ -27,8 +27,6 @@ import org.apache.poi.ss.formula.eval.*; * Returns a numeric code for the first character in a text string. The returned code corresponds to the character set used by your computer. * <p> * text The text for which you want the code of the first character. - * - * @author cedric dot walter @ gmail dot com */ public class Code extends Fixed1ArgFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Columns.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Columns.java index 3c1fdc54a2..b129eb2f80 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Columns.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Columns.java @@ -25,8 +25,6 @@ import org.apache.poi.ss.formula.TwoDEval; /** * Implementation for Excel COLUMNS function. - * - * @author Josh Micich */ public final class Columns extends Fixed1ArgFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Complex.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Complex.java index b616eba7a7..5950260d95 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Complex.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Complex.java @@ -51,8 +51,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; * <li>If omitted, suffix is assumed to be "i".</li> * <li>If suffix is neither "i" nor "j", COMPLEX returns the #VALUE! error value.</li> * </ul> - * - * @author cedric dot walter @ gmail dot com */ public class Complex extends Var2or3ArgFunction implements FreeRefFunction { @@ -96,7 +94,7 @@ public class Complex extends Var2or3ArgFunction implements FreeRefFunction { if (suffixValue.length() == 0) { suffixValue = DEFAULT_SUFFIX; } - if (suffixValue.equals(DEFAULT_SUFFIX.toUpperCase(Locale.ROOT)) || + if (suffixValue.equals(DEFAULT_SUFFIX.toUpperCase(Locale.ROOT)) || suffixValue.equals(SUPPORTED_SUFFIX.toUpperCase(Locale.ROOT))) { return ErrorEval.VALUE_INVALID; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/CountUtils.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/CountUtils.java index 5dae60f946..29066c66b5 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/CountUtils.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/CountUtils.java @@ -24,8 +24,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; /** * Common logic for COUNT, COUNTA and COUNTIF - * - * @author Josh Micich */ final class CountUtils { @@ -57,12 +55,12 @@ final class CountUtils { for (int rrIx=0; rrIx<height; rrIx++) { for (int rcIx=0; rcIx<width; rcIx++) { ValueEval ve = areaEval.getValue(sIx, rrIx, rcIx); - + if(criteriaPredicate instanceof I_MatchAreaPredicate){ I_MatchAreaPredicate areaPredicate = (I_MatchAreaPredicate)criteriaPredicate; if(!areaPredicate.matches(areaEval, rrIx, rcIx)) continue; } - + if(criteriaPredicate.matches(ve)) { result++; } @@ -76,7 +74,7 @@ final class CountUtils { */ public static int countMatchingCellsInRef(RefEval refEval, I_MatchPredicate criteriaPredicate) { int result = 0; - + final int firstSheetIndex = refEval.getFirstSheetIndex(); final int lastSheetIndex = refEval.getLastSheetIndex(); for (int sIx = firstSheetIndex; sIx <= lastSheetIndex; sIx++) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Counta.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Counta.java index c725f012a2..e8d54c9e39 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Counta.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Counta.java @@ -31,8 +31,6 @@ import org.apache.poi.ss.formula.functions.CountUtils.I_MatchAreaPredicate; * Excel Syntax * COUNTA(value1,value2,...) * Value1, value2, ... are 1 to 30 arguments representing the values or ranges to be counted. - * - * @author Josh Micich */ public final class Counta implements Function { private final I_MatchPredicate _predicate; @@ -98,7 +96,7 @@ public final class Counta implements Function { public boolean matches(ValueEval valueEval) { return defaultPredicate.matches(valueEval); } - + /** * don't count cells in rows that are hidden or subtotal cells */ @@ -106,7 +104,7 @@ public final class Counta implements Function { return !areEval.isSubTotal(rowIndex, columnIndex) && ! areEval.isRowHidden(rowIndex); } }; - + public static Counta subtotalInstance(boolean includeHiddenRows) { return new Counta(includeHiddenRows ? subtotalPredicate : subtotalVisibleOnlyPredicate); } 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 af2016f807..560a776b54 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 @@ -29,8 +29,6 @@ import org.apache.poi.ss.formula.functions.CountUtils.I_MatchPredicate; * <tr><th>range </th><td>is the range of cells to count blanks</td></tr> * </table> * </p> - * - * @author Mads Mohr Christensen */ public final class Countblank extends Fixed1ArgFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/DateValue.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/DateValue.java index fa241a7389..e4f9aa0d64 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/DateValue.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/DateValue.java @@ -41,8 +41,6 @@ import org.apache.poi.ss.usermodel.DateUtil; * <p> * To view a date serial number as a date, you must apply a date format to the cell. Find links to more * information about displaying numbers as dates in the See Also section. - * - * @author Milosz Rembisz */ public class DateValue extends Fixed1ArgFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Dec2Bin.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Dec2Bin.java index 2ec9ea30c7..c38710f23e 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Dec2Bin.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Dec2Bin.java @@ -45,8 +45,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; * <li>If places is nonnumeric, DEC2BIN returns the #VALUE! error value.</li> * <li>If places is zero or negative, DEC2BIN returns the #NUM! error value.</li> * </ul> - * - * @author cedric dot walter @ gmail dot com */ public class Dec2Bin extends Var1or2ArgFunction implements FreeRefFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Delta.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Delta.java index 4fd112f4b0..b2b24ce69c 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Delta.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Delta.java @@ -37,8 +37,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; * <li>If number1 is nonnumeric, DELTA returns the #VALUE! error value.</li> * <li>If number2 is nonnumeric, DELTA returns the #VALUE! error value.</li> * </ul> - * - * @author cedric dot walter @ gmail dot com */ public final class Delta extends Fixed2ArgFunction implements FreeRefFunction { 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 71565fdef0..486465a7b1 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 @@ -30,8 +30,7 @@ import org.apache.poi.ss.usermodel.FormulaError; * <b>Syntax:</b><br> * <b>ERROR.TYPE</b>(<b>errorValue</b>)</p> * <p> - * Returns a number corresponding to the error type of the supplied argument.<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()"> * <tr><td>errorValue</td><td>Return Value</td></tr> * <tr><td>#NULL!</td><td>1</td></tr> @@ -45,13 +44,11 @@ import org.apache.poi.ss.usermodel.FormulaError; * </table> * * Note - the results of ERROR.TYPE() are different to the constants defined in - * <tt>ErrorConstants</tt>. - * </p> - * - * @author Josh Micich + * {@code ErrorConstants}. */ public final class Errortype extends Fixed1ArgFunction { + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0) { try { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/FactDouble.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/FactDouble.java index 8c3394854d..70efd0c6a4 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/FactDouble.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/FactDouble.java @@ -38,8 +38,6 @@ import java.util.HashMap; * <li>If number is negative, FACTDOUBLE returns the #NUM! error value.</li> * </ul> * Use a cache for more speed of previously calculated factorial - * - * @author cedric dot walter @ gmail dot com */ public class FactDouble extends Fixed1ArgFunction implements FreeRefFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/FinanceFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/FinanceFunction.java index 988007386b..f7376e2531 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/FinanceFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/FinanceFunction.java @@ -24,9 +24,6 @@ import org.apache.poi.ss.formula.eval.MissingArgEval; import org.apache.poi.ss.formula.eval.NumberEval; import org.apache.poi.ss.formula.eval.ValueEval; -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - */ public abstract class FinanceFunction implements Function3Arg, Function4Arg { private static final ValueEval DEFAULT_ARG3 = NumberEval.ZERO; private static final ValueEval DEFAULT_ARG4 = BoolEval.FALSE; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/FinanceLib.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/FinanceLib.java index 9f7aeaebae..c5920cd039 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/FinanceLib.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/FinanceLib.java @@ -18,9 +18,6 @@ package org.apache.poi.ss.formula.functions; /** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * - * * This class is a functon library for common fiscal functions. * <b>Glossary of terms/abbreviations:</b> * <br> diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Fixed1ArgFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Fixed1ArgFunction.java index 0b3317d5be..9987303532 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Fixed1ArgFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Fixed1ArgFunction.java @@ -22,8 +22,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; /** * Convenience base class for functions that must take exactly one argument. - * - * @author Josh Micich */ public abstract class Fixed1ArgFunction implements Function1Arg { public final ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Fixed2ArgFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Fixed2ArgFunction.java index 0ba3d40de8..aeef8a6818 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Fixed2ArgFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Fixed2ArgFunction.java @@ -22,8 +22,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; /** * Convenience base class for functions that must take exactly two arguments. - * - * @author Josh Micich */ public abstract class Fixed2ArgFunction implements Function2Arg { public final ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Fixed3ArgFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Fixed3ArgFunction.java index 421a398022..05b6a0f64a 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Fixed3ArgFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Fixed3ArgFunction.java @@ -22,8 +22,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; /** * Convenience base class for functions that must take exactly three arguments. - * - * @author Josh Micich */ public abstract class Fixed3ArgFunction implements Function3Arg { public final ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Fixed4ArgFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Fixed4ArgFunction.java index e3f8ace412..1cdf449d2f 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Fixed4ArgFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Fixed4ArgFunction.java @@ -22,8 +22,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; /** * Convenience base class for functions that must take exactly four arguments. - * - * @author Josh Micich */ public abstract class Fixed4ArgFunction implements Function4Arg { public final ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/FreeRefFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/FreeRefFunction.java index b7affe2a2f..be05953c2a 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/FreeRefFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/FreeRefFunction.java @@ -35,16 +35,14 @@ import org.apache.poi.ss.formula.OperationEvaluationContext; * * For the moment this interface only exists to serve the <b>INDIRECT</b> which can decode * arbitrary text into cell references, and evaluate them.. - * - * @author Josh Micich */ public interface FreeRefFunction { /** - * @param args the pre-evaluated arguments for this function. args is never <code>null</code>, + * @param args the pre-evaluated arguments for this function. args is never {@code null}, * nor are any of its elements. * @param ec primarily used to identify the source cell containing the formula being evaluated. * may also be used to dynamically create reference evals. - * @return never <code>null</code>. Possibly an instance of <tt>ErrorEval</tt> in the case of + * @return never {@code null}. Possibly an instance of {@code ErrorEval} in the case of * a specified Excel error (Exceptions are never thrown to represent Excel errors). */ ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Frequency.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Frequency.java index 9df832366d..94fa553521 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Frequency.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Frequency.java @@ -35,8 +35,6 @@ import java.util.Arrays; * If data_array contains no values, FREQUENCY returns an array of zeros.<br> * <b>bins_array</b> Required. An array of or reference to intervals into which you want to group the values in data_array. * If bins_array contains no values, FREQUENCY returns the number of elements in data_array.<br> - * - * @author Yegor Kozlov */ public class Frequency extends Fixed2ArgFunction { public static final Function instance = new Frequency(); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Function.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Function.java index 5f97b81a24..4ed160ede6 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Function.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Function.java @@ -24,8 +24,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; /** * Common interface for all implementations of Excel built-in functions. - * - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > */ public interface Function { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Function1Arg.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Function1Arg.java index ec214f4f09..81f1432d77 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Function1Arg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Function1Arg.java @@ -21,8 +21,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; /** * Implemented by all functions that can be called with one argument - * - * @author Josh Micich */ public interface Function1Arg extends Function { /** diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Function2Arg.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Function2Arg.java index bd395cc51e..1099e8ae0c 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Function2Arg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Function2Arg.java @@ -21,8 +21,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; /** * Implemented by all functions that can be called with two arguments - * - * @author Josh Micich */ public interface Function2Arg extends Function { /** diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Function3Arg.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Function3Arg.java index ad5eee1586..9e27a3945a 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Function3Arg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Function3Arg.java @@ -21,8 +21,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; /** * Implemented by all functions that can be called with three arguments - * - * @author Josh Micich */ public interface Function3Arg extends Function { /** diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Function4Arg.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Function4Arg.java index f0eee52241..f08af616b9 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Function4Arg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Function4Arg.java @@ -21,8 +21,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; /** * Implemented by all functions that can be called with four arguments - * - * @author Josh Micich */ public interface Function4Arg extends Function { /** diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Hex2Dec.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Hex2Dec.java index c3b1341d91..d80ce76235 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Hex2Dec.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Hex2Dec.java @@ -32,8 +32,6 @@ import org.apache.poi.ss.formula.eval.*; * The remaining 39 bits are magnitude bits. Negative numbers are represented using two's-complement notation. * Remark * If number is not a valid hexadecimal number, HEX2DEC returns the #NUM! error value. - * - * @author cedric dot walter @ gmail dot com */ public class Hex2Dec extends Fixed1ArgFunction implements FreeRefFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Hlookup.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Hlookup.java index 5658ec49ec..931ca942bf 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Hlookup.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Hlookup.java @@ -36,17 +36,17 @@ import org.apache.poi.ss.formula.TwoDEval; * <b>row_index_num</b> a 1 based index specifying which row value of the lookup data will be returned.<br> * <b>range_lookup</b> If TRUE (default), HLOOKUP finds the largest value less than or equal to * the lookup_value. If FALSE, only exact matches will be considered<br> - * - * @author Josh Micich */ public final class Hlookup extends Var3or4ArgFunction { private static final ValueEval DEFAULT_ARG3 = BoolEval.TRUE; + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2) { return evaluate(srcRowIndex, srcColumnIndex, arg0, arg1, arg2, DEFAULT_ARG3); } + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2, ValueEval arg3) { try { @@ -65,7 +65,7 @@ public final class Hlookup extends Var3or4ArgFunction { } /** - * Returns one column from an <tt>AreaEval</tt> + * Returns one column from an {@code AreaEval} * * @param rowIndex assumed to be non-negative * diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Hyperlink.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Hyperlink.java index c69c0b47cb..8bb04e0d81 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Hyperlink.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Hyperlink.java @@ -32,8 +32,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; * <b>friendly_name</b> (optional) the value to display<p> * * Returns last argument. Leaves type unchanged (does not convert to {@link org.apache.poi.ss.formula.eval.StringEval}). - * - * @author Wayne Clingingsmith */ public final class Hyperlink extends Var1or2ArgFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/ImReal.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/ImReal.java index c5a6e15a51..6c4a4d7f2e 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/ImReal.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/ImReal.java @@ -40,8 +40,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; * <li>If inumber is not in the form x + yi or x + yj, this function returns the #NUM! error value.</li> * <li>Use COMPLEX to convert real and imaginary coefficients into a complex number.</li> * </ul> - * - * @author cedric dot walter @ gmail dot com */ public class ImReal extends Fixed1ArgFunction implements FreeRefFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Imaginary.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Imaginary.java index a030107207..3a22097f0d 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Imaginary.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Imaginary.java @@ -36,8 +36,6 @@ import java.util.regex.Pattern; * <ul> * <li>Use COMPLEX to convert real and imaginary coefficients into a complex number.</li> * </ul> - * - * @author cedric dot walter @ gmail dot com */ public class Imaginary extends Fixed1ArgFunction implements FreeRefFunction { 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 2dc6622d05..1238f03125 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 @@ -30,8 +30,8 @@ import org.apache.poi.ss.formula.TwoDEval; * Implementation for the Excel function INDEX * <p> * - * Syntax : <br> - * INDEX ( reference, row_num[, column_num [, area_num]])</br> + * 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"> * <tr><th>reference</th><td>typically an area reference, possibly a union of areas</td></tr> @@ -40,9 +40,6 @@ import org.apache.poi.ss.formula.TwoDEval; * <tr><th>column_num</th><td>selects column within the array or area reference. default is 1</td></tr> * <tr><th>area_num</th><td>used when reference is a union of areas</td></tr> * </table> - * </p> - * - * @author Josh Micich */ public final class Index implements Function2Arg, Function3Arg, Function4Arg, ArrayMode { 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 ee44b9435d..0eb2c04afc 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 @@ -42,8 +42,6 @@ import org.apache.poi.ss.usermodel.Table; * normally be written in a cell formula.<br> * <b>isA1Style</b> (default TRUE) specifies whether the ref_text should be * interpreted as A1-style or R1C1-style. - * - * @author Josh Micich */ public final class Indirect implements FreeRefFunction { @@ -95,7 +93,7 @@ public final class Indirect implements FreeRefFunction { private static ValueEval evaluateIndirect(final OperationEvaluationContext ec, String text, boolean isA1style) { - + // Search backwards for '!' because sheet names can contain '!' int plingPos = text.lastIndexOf('!'); @@ -132,7 +130,7 @@ public final class Indirect implements FreeRefFunction { int colonPos = refText.indexOf(':'); if (colonPos < 0) { refStrPart1 = refText.trim(); - refStrPart2 = null; + refStrPart2 = null; } else { refStrPart1 = refText.substring(0, colonPos).trim(); refStrPart2 = refText.substring(colonPos + 1).trim(); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Intercept.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Intercept.java index 89542e2dab..706d777596 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Intercept.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Intercept.java @@ -29,9 +29,6 @@ import org.apache.poi.ss.formula.functions.LinearRegressionFunction.FUNCTION; * (http://introcs.cs.princeton.edu/java/97data/LinearRegression.java.html) * <b>Syntax</b>:<br> * <b>INTERCEPT</b>(<b>arrayX</b>, <b>arrayY</b>)<p> - * - * - * @author Johan Karlsteen */ public final class Intercept extends Fixed2ArgFunction { @@ -39,7 +36,7 @@ public final class Intercept extends Fixed2ArgFunction { public Intercept() { func = new LinearRegressionFunction(FUNCTION.INTERCEPT); } - + public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { return func.evaluate(srcRowIndex, srcColumnIndex, arg0, arg1); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/LinearRegressionFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/LinearRegressionFunction.java index 513daa3a1b..5ecd7c2053 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/LinearRegressionFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/LinearRegressionFunction.java @@ -35,10 +35,7 @@ import org.apache.poi.ss.formula.functions.LookupUtils.ValueVector; * <b>Syntax</b>:<br> * <b>INTERCEPT</b>(<b>arrayX</b>, <b>arrayY</b>)<p> * or - * <b>SLOPE</b>(<b>arrayX</b>, <b>arrayY</b>)<p> - * - * - * @author Johan Karlsteen + * <b>SLOPE</b>(<b>arrayX</b>, <b>arrayY</b>) */ public final class LinearRegressionFunction extends Fixed2ArgFunction { @@ -48,7 +45,8 @@ public final class LinearRegressionFunction extends Fixed2ArgFunction { _size = size; } - public ValueEval getItem(int index) { + @Override + public ValueEval getItem(int index) { if (index < 0 || index > _size) { throw new IllegalArgumentException("Specified index " + index + " is outside range (0.." + (_size - 1) + ")"); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/LogicalFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/LogicalFunction.java index 9df2803c3c..69d456872e 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/LogicalFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/LogicalFunction.java @@ -25,7 +25,8 @@ import org.apache.poi.ss.formula.eval.*; */ public abstract class LogicalFunction extends Fixed1ArgFunction implements ArrayFunction{ - @SuppressWarnings("unused") + @Override + @SuppressWarnings("unused") public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0) { ValueEval ve; try { @@ -58,21 +59,25 @@ public abstract class LogicalFunction extends Fixed1ArgFunction implements Array protected abstract boolean evaluate(ValueEval arg); public static final Function ISLOGICAL = new LogicalFunction() { + @Override protected boolean evaluate(ValueEval arg) { return arg instanceof BoolEval; } }; public static final Function ISNONTEXT = new LogicalFunction() { + @Override protected boolean evaluate(ValueEval arg) { return !(arg instanceof StringEval); } }; public static final Function ISNUMBER = new LogicalFunction() { + @Override protected boolean evaluate(ValueEval arg) { return arg instanceof NumberEval; } }; public static final Function ISTEXT = new LogicalFunction() { + @Override protected boolean evaluate(ValueEval arg) { return arg instanceof StringEval; } @@ -80,6 +85,7 @@ public abstract class LogicalFunction extends Fixed1ArgFunction implements Array public static final Function ISBLANK = new LogicalFunction() { + @Override protected boolean evaluate(ValueEval arg) { return arg instanceof BlankEval; } @@ -87,21 +93,22 @@ public abstract class LogicalFunction extends Fixed1ArgFunction implements Array public static final Function ISERROR = new LogicalFunction() { + @Override protected boolean evaluate(ValueEval arg) { return arg instanceof ErrorEval; } }; /** - * Implementation of Excel <tt>ISERR()</tt> function.<p> + * Implementation of Excel {@code ISERR()} function.<p> * * <b>Syntax</b>:<br> * <b>ISERR</b>(<b>value</b>)<p> * * <b>value</b> The value to be tested<p> * - * Returns the logical value <tt>TRUE</tt> if value refers to any error value except - * <tt>'#N/A'</tt>; otherwise, it returns <tt>FALSE</tt>. + * Returns the logical value {@code TRUE} if value refers to any error value except + * {@code '#N/A'}; otherwise, it returns {@code FALSE}. */ public static final Function ISERR = new LogicalFunction() { @Override @@ -121,10 +128,11 @@ public abstract class LogicalFunction extends Fixed1ArgFunction implements Array * * <b>value</b> The value to be tested<br> * <br> - * Returns <tt>TRUE</tt> if the specified value is '#N/A', <tt>FALSE</tt> otherwise. + * Returns {@code TRUE} if the specified value is '#N/A', {@code FALSE} otherwise. */ public static final Function ISNA = new LogicalFunction() { + @Override protected boolean evaluate(ValueEval arg) { return arg == ErrorEval.NA; } @@ -132,6 +140,7 @@ public abstract class LogicalFunction extends Fixed1ArgFunction implements Array public static final Function ISREF = new Fixed1ArgFunction() { + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0) { if (arg0 instanceof RefEval || arg0 instanceof AreaEval || arg0 instanceof RefListEval) { return BoolEval.TRUE; 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 9af09c301b..135614d3c7 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 @@ -39,7 +39,7 @@ import org.apache.poi.ss.formula.eval.ValueEval; final class LookupUtils { /** - * Represents a single row or column within an <tt>AreaEval</tt>. + * Represents a single row or column within an {@code AreaEval}. */ public interface ValueVector { ValueEval getItem(int index); @@ -64,6 +64,7 @@ final class LookupUtils { _size = tableArray.getWidth(); } + @Override public ValueEval getItem(int index) { if(index > _size) { throw new ArrayIndexOutOfBoundsException("Specified index (" + index @@ -71,6 +72,7 @@ final class LookupUtils { } return _tableArray.getValue(_rowIndex, index); } + @Override public int getSize() { return _size; } @@ -93,6 +95,7 @@ final class LookupUtils { _size = _tableArray.getHeight(); } + @Override public ValueEval getItem(int index) { if(index > _size) { throw new ArrayIndexOutOfBoundsException("Specified index (" + index @@ -100,6 +103,7 @@ final class LookupUtils { } return _tableArray.getValue(index, _columnIndex); } + @Override public int getSize() { return _size; } @@ -114,7 +118,8 @@ final class LookupUtils { _re = re; } - public ValueEval getItem(int index) { + @Override + public ValueEval getItem(int index) { if(index >= _size) { throw new ArrayIndexOutOfBoundsException("Specified index (" + index + ") is outside the allowed range (0.." + (_size-1) + ")"); @@ -122,7 +127,8 @@ final class LookupUtils { int sheetIndex = _re.getFirstSheetIndex() + index; return _re.getInnerValueEval(sheetIndex); } - public int getSize() { + @Override + public int getSize() { return _size; } } @@ -134,7 +140,7 @@ final class LookupUtils { return new ColumnVector(tableArray, relativeColumnIndex); } /** - * @return <code>null</code> if the supplied area is neither a single row nor a single column + * @return {@code null} if the supplied area is neither a single row nor a single column */ public static ValueVector createVector(TwoDEval ae) { if (ae.isColumn()) { @@ -158,7 +164,7 @@ final class LookupUtils { * changes behaviour when the evaluated 'mid' value has a different type to the lookup value.<p> * * A simple int might have done the same job, but there is risk in confusion with the well - * known <tt>Comparable.compareTo()</tt> and <tt>Comparator.compare()</tt> which both use + * known {@code Comparable.compareTo()} and {@code Comparator.compare()} which both use * a ubiquitous 3 value result encoding. */ public static final class CompareResult { @@ -241,8 +247,8 @@ final class LookupUtils { public interface LookupValueComparer { /** - * @return one of 4 instances or <tt>CompareResult</tt>: <tt>LESS_THAN</tt>, <tt>EQUAL</tt>, - * <tt>GREATER_THAN</tt> or <tt>TYPE_MISMATCH</tt> + * @return one of 4 instances or {@code CompareResult}: {@code LESS_THAN}, {@code EQUAL}, + * {@code GREATER_THAN} or {@code TYPE_MISMATCH} */ CompareResult compareTo(ValueEval other); } @@ -256,6 +262,7 @@ final class LookupUtils { } _targetClass = targetValue.getClass(); } + @Override public final CompareResult compareTo(ValueEval other) { if (other == null) { throw new RuntimeException("compare to value cannot be null"); @@ -291,6 +298,7 @@ final class LookupUtils { _isMatchFunction = isMatchFunction; } + @Override protected CompareResult compareSameType(ValueEval other) { StringEval se = (StringEval) other; @@ -307,6 +315,7 @@ final class LookupUtils { return CompareResult.valueOf(_value.compareToIgnoreCase(stringValue)); } + @Override protected String getValueAsString() { return _value; } @@ -318,10 +327,12 @@ final class LookupUtils { super(ne); _value = ne.getNumberValue(); } + @Override protected CompareResult compareSameType(ValueEval other) { NumberEval ne = (NumberEval) other; return CompareResult.valueOf(Double.compare(_value, ne.getNumberValue())); } + @Override protected String getValueAsString() { return String.valueOf(_value); } @@ -333,6 +344,7 @@ final class LookupUtils { super(be); _value = be.getBooleanValue(); } + @Override protected CompareResult compareSameType(ValueEval other) { BoolEval be = (BoolEval) other; boolean otherVal = be.getBooleanValue(); @@ -345,6 +357,7 @@ final class LookupUtils { } return CompareResult.LESS_THAN; } + @Override protected String getValueAsString() { return String.valueOf(_value); } @@ -430,7 +443,7 @@ final class LookupUtils { /** * Resolves the last (optional) parameter (<b>range_lookup</b>) to the VLOOKUP and HLOOKUP functions. - * @param rangeLookupArg must not be <code>null</code> + * @param rangeLookupArg must not be {@code null} */ public static boolean resolveRangeLookupArg(ValueEval rangeLookupArg, int srcCellRow, int srcCellCol) throws EvaluationException { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Match.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Match.java index 4a61476657..96dd7a3972 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Match.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Match.java @@ -64,12 +64,14 @@ import org.apache.poi.ss.formula.functions.LookupUtils.ValueVector; */ public final class Match extends Var2or3ArgFunction { + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { // default match_type is 1.0 return eval(srcRowIndex, srcColumnIndex, arg0, arg1, 1.0); } + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2) { @@ -111,7 +113,8 @@ public final class Match extends Var2or3ArgFunction { _value = value; } - public ValueEval getItem(int index) { + @Override + public ValueEval getItem(int index) { if (index != 0) { throw new RuntimeException("Invalid index (" + index + ") only zero is allowed"); @@ -119,6 +122,7 @@ public final class Match extends Var2or3ArgFunction { return _value; } + @Override public int getSize() { return 1; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/MathX.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/MathX.java index 7b33de57ec..387a4e8397 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/MathX.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/MathX.java @@ -20,7 +20,6 @@ package org.apache.poi.ss.formula.functions; import org.apache.poi.ss.util.NumberToTextConverter; /** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > * This class is an extension to the standard math library * provided by java.lang.Math class. It follows the Math class * in that it has a private constructor and all static methods. diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/MatrixFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/MatrixFunction.java index 4159ddcd98..db7380d9e9 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/MatrixFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/MatrixFunction.java @@ -29,11 +29,8 @@ import org.apache.commons.math3.linear.Array2DRowRealMatrix; import org.apache.commons.math3.linear.LUDecomposition; import org.apache.commons.math3.linear.MatrixUtils; -/** - * @author Robert Hulbert - */ public abstract class MatrixFunction implements Function{ - + public static void checkValues(double[] results) throws EvaluationException { for (double result : results) { if (Double.isNaN(result) || Double.isInfinite(result)) { @@ -41,20 +38,20 @@ public abstract class MatrixFunction implements Function{ } } } - + protected final double singleOperandEvaluate(ValueEval arg, int srcCellRow, int srcCellCol) throws EvaluationException { ValueEval ve = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol); return OperandResolver.coerceValueToDouble(ve); } - + /* converts 1D array to 2D array for calculations */ private static double[][] fillDoubleArray(double[] vector, int rows, int cols) throws EvaluationException { int i = 0, j = 0; - + if (rows < 1 || cols < 1 || vector.length < 1) { throw new EvaluationException(ErrorEval.VALUE_INVALID); } - + double[][] matrix = new double[rows][cols]; for (double aVector : vector) { @@ -66,18 +63,18 @@ public abstract class MatrixFunction implements Function{ if (j < matrix.length) matrix[j][i++] = aVector; } } - + return matrix; } - + /* retrieves 1D array from 2D array after calculations */ private static double[] extractDoubleArray(double[][] matrix) throws EvaluationException { int idx = 0; - + if (matrix == null || matrix.length < 1 || matrix[0].length < 1) { throw new EvaluationException(ErrorEval.VALUE_INVALID); } - + double[] vector = new double[matrix.length * matrix[0].length]; for (double[] aMatrix : matrix) { @@ -87,19 +84,19 @@ public abstract class MatrixFunction implements Function{ } return vector; } - + public static abstract class OneArrayArg extends Fixed1ArgFunction { protected OneArrayArg() { //no fields to initialize } - + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0) { if (arg0 instanceof AreaEval) { double[] result; double[][] resultArray; int width, height; - + try { double[] values = collectValues(arg0); double[][] array = fillDoubleArray(values, ((AreaEval) arg0).getHeight(), ((AreaEval) arg0).getWidth()); @@ -107,7 +104,7 @@ public abstract class MatrixFunction implements Function{ width = resultArray[0].length; height = resultArray.length; result = extractDoubleArray(resultArray); - + checkValues(result); } catch(EvaluationException e){ @@ -115,18 +112,18 @@ public abstract class MatrixFunction implements Function{ } ValueEval[] vals = new ValueEval[result.length]; - + for (int idx = 0; idx < result.length; idx++) { vals[idx] = new NumberEval(result[idx]); } - + if (result.length == 1) { return vals[0]; } else { /* find a better solution */ - return new CacheAreaEval(((AreaEval) arg0).getFirstRow(), ((AreaEval) arg0).getFirstColumn(), - ((AreaEval) arg0).getFirstRow() + height - 1, + return new CacheAreaEval(((AreaEval) arg0).getFirstRow(), ((AreaEval) arg0).getFirstColumn(), + ((AreaEval) arg0).getFirstRow() + height - 1, ((AreaEval) arg0).getFirstColumn() + width - 1, vals); } } @@ -141,20 +138,20 @@ public abstract class MatrixFunction implements Function{ catch (EvaluationException e) { return e.getErrorEval(); } - + return new NumberEval(result[0][0]); } } - + protected abstract double[][] evaluate(double[][] d1) throws EvaluationException; protected abstract double[] collectValues(ValueEval arg) throws EvaluationException; } - + public static abstract class TwoArrayArg extends Fixed2ArgFunction { protected TwoArrayArg() { //no fields to initialize } - + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { double[] result; @@ -183,7 +180,7 @@ public abstract class MatrixFunction implements Function{ return e.getErrorEval(); } } - + if (arg1 instanceof AreaEval) { try { double[] values = collectValues(arg1); @@ -202,7 +199,7 @@ public abstract class MatrixFunction implements Function{ return e.getErrorEval(); } } - + resultArray = evaluate(array0, array1); width = resultArray[0].length; height = resultArray.length; @@ -218,26 +215,26 @@ public abstract class MatrixFunction implements Function{ ValueEval[] vals = new ValueEval[result.length]; - + for (int idx = 0; idx < result.length; idx++) { vals[idx] = new NumberEval(result[idx]); } - + if (result.length == 1) return vals[0]; else { - return new CacheAreaEval(((AreaEval) arg0).getFirstRow(), ((AreaEval) arg0).getFirstColumn(), - ((AreaEval) arg0).getFirstRow() + height - 1, + return new CacheAreaEval(((AreaEval) arg0).getFirstRow(), ((AreaEval) arg0).getFirstColumn(), + ((AreaEval) arg0).getFirstRow() + height - 1, ((AreaEval) arg0).getFirstColumn() + width - 1, vals); } - + } - + protected abstract double[][] evaluate(double[][] d1, double[][] d2) throws EvaluationException; protected abstract double[] collectValues(ValueEval arg) throws EvaluationException; } - + public static final class MutableValueCollector extends MultiOperandNumericFunction { public MutableValueCollector(boolean isReferenceBoolCounted, boolean isBlankCounted) { super(isReferenceBoolCounted, isBlankCounted); @@ -249,44 +246,44 @@ public abstract class MatrixFunction implements Function{ throw new IllegalStateException("should not be called"); } } - + public static final Function MINVERSE = new OneArrayArg() { private final MutableValueCollector instance = new MutableValueCollector(false, false); - + protected double[] collectValues(ValueEval arg) throws EvaluationException { double[] values = instance.collectValues(arg); - + /* handle case where MDETERM is operating on an array that that is not completely filled*/ if (arg instanceof AreaEval && values.length == 1) throw new EvaluationException(ErrorEval.VALUE_INVALID); - + return values; } - + protected double[][] evaluate(double[][] d1) throws EvaluationException { if (d1.length != d1[0].length) { throw new EvaluationException(ErrorEval.VALUE_INVALID); } - + Array2DRowRealMatrix temp = new Array2DRowRealMatrix(d1); return MatrixUtils.inverse(temp).getData(); } }; - + public static final Function TRANSPOSE = new OneArrayArg() { private final MutableValueCollector instance = new MutableValueCollector(false, true); - + protected double[] collectValues(ValueEval arg) throws EvaluationException { return instance.collectValues(arg); } - + protected double[][] evaluate(double[][] d1) throws EvaluationException { - + Array2DRowRealMatrix temp = new Array2DRowRealMatrix(d1); return temp.transpose().getData(); } }; - + public static final Function MDETERM = new Mdeterm(); private static class Mdeterm extends OneArrayArg { @@ -299,14 +296,14 @@ public abstract class MatrixFunction implements Function{ protected double[] collectValues(ValueEval arg) throws EvaluationException { double[] values = instance.collectValues(arg); - + /* handle case where MDETERM is operating on an array that that is not completely filled*/ if (arg instanceof AreaEval && values.length == 1) throw new EvaluationException(ErrorEval.VALUE_INVALID); return instance.collectValues(arg); } - + protected double[][] evaluate(double[][] d1) throws EvaluationException { if (d1.length != d1[0].length) { throw new EvaluationException(ErrorEval.VALUE_INVALID); @@ -318,32 +315,32 @@ public abstract class MatrixFunction implements Function{ return result; } } - + public static final Function MMULT = new TwoArrayArg() { private final MutableValueCollector instance = new MutableValueCollector(false, false); - + protected double[] collectValues(ValueEval arg) throws EvaluationException { double[] values = instance.collectValues(arg); - + /* handle case where MMULT is operating on an array that is not completely filled*/ if (arg instanceof AreaEval && values.length == 1) throw new EvaluationException(ErrorEval.VALUE_INVALID); - + return values; } - + protected double[][] evaluate(double[][] d1, double[][] d2) throws EvaluationException{ Array2DRowRealMatrix first = new Array2DRowRealMatrix(d1); Array2DRowRealMatrix second = new Array2DRowRealMatrix(d2); - + try { MatrixUtils.checkMultiplicationCompatible(first, second); } catch (DimensionMismatchException e) { throw new EvaluationException(ErrorEval.VALUE_INVALID); } - - return first.multiply(second).getData(); + + return first.multiply(second).getData(); } }; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/MinaMaxa.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/MinaMaxa.java index 247192273c..c7f892a7cf 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/MinaMaxa.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/MinaMaxa.java @@ -17,10 +17,6 @@ package org.apache.poi.ss.formula.functions; -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * - */ public abstract class MinaMaxa extends MultiOperandNumericFunction { protected MinaMaxa() { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Mirr.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Mirr.java index 764be8ac5b..d19e2d286f 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Mirr.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Mirr.java @@ -38,9 +38,6 @@ import org.apache.poi.ss.formula.eval.EvaluationException; * Finance_rate is the interest rate you pay on the money used in the cash flows. * Reinvest_rate is the interest rate you receive on the cash flows as you reinvest them. * - * @author Carlos Delgado (carlos dot del dot est at gmail dot com) - * @author Cedric Walter (cedric dot walter at gmail dot com) - * * @see <a href="http://en.wikipedia.org/wiki/MIRR">Wikipedia on MIRR</a> * @see <a href="http://office.microsoft.com/en-001/excel-help/mirr-HP005209180.aspx">Excel MIRR</a> * @see Irr diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Mode.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Mode.java index 978c9cad38..1c123f0d24 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Mode.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Mode.java @@ -31,10 +31,6 @@ import org.apache.poi.ss.formula.eval.RefEval; import org.apache.poi.ss.formula.eval.StringEval; import org.apache.poi.ss.formula.eval.ValueEval; -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * - */ public final class Mode implements Function { /** diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Npv.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Npv.java index 1c19b84c1e..774b1d84c8 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Npv.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Npv.java @@ -30,9 +30,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; * values). Minimum 2 arguments, first arg is the rate of discount over the * length of one period others up to 254 arguments representing the payments and * income. - * - * @author SPetrakovsky - * @author Marcel May */ public final class Npv implements Function { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/NumericFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/NumericFunction.java index 74597910b5..40c97c6473 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/NumericFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/NumericFunction.java @@ -40,7 +40,7 @@ public abstract class NumericFunction implements Function { } /** - * @throws EvaluationException (#NUM!) if <tt>result</tt> is {@code NaN} or {@code Infinity} + * @throws EvaluationException (#NUM!) if {@code result} is {@code NaN} or {@code Infinity} */ public static void checkValue(double result) throws EvaluationException { if (Double.isNaN(result) || Double.isInfinite(result)) { @@ -48,6 +48,7 @@ public abstract class NumericFunction implements Function { } } + @Override public final ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) { double result; try { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Oct2Dec.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Oct2Dec.java index ae34904e02..260aa3cb1e 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Oct2Dec.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Oct2Dec.java @@ -36,8 +36,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; * Negative numbers are represented using two's-complement notation.. * <p> * If number is not a valid octal number, OCT2DEC returns the #NUM! error value. - * - * @author cedric dot walter @ gmail dot com */ public class Oct2Dec extends Fixed1ArgFunction implements FreeRefFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Offset.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Offset.java index 75aac0e780..25567a108b 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Offset.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Offset.java @@ -37,8 +37,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; * <b>cols</b> is the number of columns left or right from the base reference.<br> * <b>height</b> (default same height as base reference) is the row count for the returned area reference.<br> * <b>width</b> (default same width as base reference) is the column count for the returned area reference.<br> - * - * @author Josh Micich */ public final class Offset implements Function { // These values are specific to BIFF8 @@ -79,7 +77,7 @@ public final class Offset implements Function { * * @param translationAmount may be zero negative or positive * - * @return the equivalent <tt>LinearOffsetRange</tt> with a positive length, moved by the + * @return the equivalent {@code LinearOffsetRange} with a positive length, moved by the * specified translationAmount. */ public LinearOffsetRange normaliseAndTranslate(int translationAmount) { @@ -93,20 +91,10 @@ public final class Offset implements Function { } public boolean isOutOfBounds(int lowValidIx, int highValidIx) { - if(_offset < lowValidIx) { - return true; - } - if(getLastIndex() > highValidIx) { - return true; - } - return false; + return _offset < lowValidIx || getLastIndex() > highValidIx; } public String toString() { - StringBuilder sb = new StringBuilder(64); - sb.append(getClass().getName()).append(" ["); - sb.append(_offset).append("...").append(getLastIndex()); - sb.append("]"); - return sb.toString(); + return getClass().getName() + " [" + _offset + "..." + getLastIndex() + "]"; } } @@ -161,6 +149,7 @@ public final class Offset implements Function { } } + @Override @SuppressWarnings("fallthrough") public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) { if(args.length < 1 || args.length > 5) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/PPMT.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/PPMT.java index 2df2304db1..d7284d9492 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/PPMT.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/PPMT.java @@ -23,8 +23,6 @@ import org.apache.poi.ss.formula.eval.*; /** * Compute the interest portion of a payment. - * - * @author Mike Argyriou micharg@gmail.com */ public class PPMT extends NumericFunction { @@ -49,10 +47,10 @@ public class PPMT extends NumericFunction { result = Finance.ppmt(interestRate, period, numberPayments, PV) ; checkValue(result); - + return result; } - + } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Rank.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Rank.java index 97d0700e15..b6fdca0442 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Rank.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Rank.java @@ -40,8 +40,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; * If order is 0 (zero) or omitted, Microsoft Excel ranks number as if ref were a list sorted in descending order. * If order is any nonzero value, Microsoft Excel ranks number as if ref were a list sorted in ascending order. - * - * @author Rubin Wang */ public class Rank extends Var2or3ArgFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Rate.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Rate.java index d0a840f6b7..484be43a96 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Rate.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Rate.java @@ -31,6 +31,7 @@ import org.apache.poi.ss.formula.eval.ValueEval; public class Rate implements Function { private static final Logger LOG = LogManager.getLogger(Rate.class); + @Override public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) { if (args.length < 3) { //First 3 parameters are mandatory return ErrorEval.VALUE_INVALID; @@ -52,7 +53,7 @@ public class Rate implements Function { if (args.length >= 6) v6 = OperandResolver.getSingleValue(args[5], srcRowIndex, srcColumnIndex); - periods = OperandResolver.coerceValueToDouble(v1); + periods = OperandResolver.coerceValueToDouble(v1); payment = OperandResolver.coerceValueToDouble(v2); present_val = OperandResolver.coerceValueToDouble(v3); if (args.length >= 4) @@ -77,7 +78,7 @@ public class Rate implements Function { int FINANCIAL_MAX_ITERATIONS = 20;//Bet accuracy with 128 double FINANCIAL_PRECISION = 0.0000001;//1.0e-8 - double y, y0, y1, x0, x1 = 0, f = 0, i = 0; + double y, y0, y1, x0, x1, f = 0, i; double rate = guess; if (Math.abs(rate) < FINANCIAL_PRECISION) { y = pv * (1 + nper * rate) + pmt * (1 + rate * type) * nper + fv; @@ -112,8 +113,8 @@ public class Rate implements Function { /** * Excel does not support infinities and NaNs, rather, it gives a #NUM! error in these cases - * - * @throws EvaluationException (#NUM!) if <tt>result</tt> is <tt>NaN</> or <tt>Infinity</tt> + * + * @throws EvaluationException (#NUM!) if {@code result} is {@code NaN} or {@code Infinity} */ static void checkValue(double result) throws EvaluationException { if (Double.isNaN(result) || Double.isInfinite(result)) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Replace.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Replace.java index 5b4eeabef2..b53e56b8ef 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Replace.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Replace.java @@ -34,8 +34,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; * <b>startNum</b> The position of the first character to replace (1-based)<br> * <b>numChars</b> The number of characters to replace<br> * <b>newText</b> The new text value to replace the removed section<br> - * - * @author Manda Wilson < wilson at c bio dot msk cc dot org > */ public final class Replace extends Fixed4ArgFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Rept.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Rept.java index 50dc559fab..952a1bed16 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Rept.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Rept.java @@ -37,8 +37,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; * If this argument contains a decimal value, this function ignores the numbers to the right side of the decimal point. * * The result of the REPT function cannot be longer than 32,767 characters, or REPT returns #VALUE!. - * - * @author cedric dot walter @ gmail dot com */ public class Rept extends Fixed2ArgFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Rows.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Rows.java index 1e363222ab..f5a6650688 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Rows.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Rows.java @@ -25,8 +25,6 @@ import org.apache.poi.ss.formula.TwoDEval; /** * Implementation for Excel ROWS function. - * - * @author Josh Micich */ public final class Rows extends Fixed1ArgFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Slope.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Slope.java index cb8b07aee7..645ae933e7 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Slope.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Slope.java @@ -29,17 +29,14 @@ import org.apache.poi.ss.formula.functions.LinearRegressionFunction.FUNCTION; * (http://introcs.cs.princeton.edu/java/97data/LinearRegression.java.html) * <b>Syntax</b>:<br> * <b>SLOPE</b>(<b>arrayX</b>, <b>arrayY</b>)<p> - * - * - * @author Johan Karlsteen */ public final class Slope extends Fixed2ArgFunction { - + private final LinearRegressionFunction func; public Slope() { func = new LinearRegressionFunction(FUNCTION.SLOPE); } - + public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { return func.evaluate(srcRowIndex, srcColumnIndex, arg0, arg1); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/StatsLib.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/StatsLib.java index 528a14c511..f7d79e0b5d 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/StatsLib.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/StatsLib.java @@ -20,8 +20,6 @@ package org.apache.poi.ss.formula.functions; import java.util.Arrays; /** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * * Library for common statistics functions */ final class StatsLib { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Substitute.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Substitute.java index 69d5cf5ec8..c20a0d1cd1 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Substitute.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Substitute.java @@ -25,7 +25,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; /** * An implementation of the SUBSTITUTE function:<p> * Substitutes text in a text string with new text, some number of times. - * @author Manda Wilson < wilson at c bio dot msk cc dot org > */ public final class Substitute extends Var3or4ArgFunction { 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 8d7084be83..bbdb6c96e3 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 @@ -71,8 +71,6 @@ import java.util.List; * * Not implemented in POI yet. Functions 101-111 are the same as functions 1-11 but with * the option 'ignore hidden values'. * <p> - * - * @author Paul Tomlin < pault at bulk sms dot com > */ public class Subtotal implements Function { 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 ceeff9b1d1..5ae3f1cba1 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 @@ -35,8 +35,6 @@ import org.apache.poi.ss.formula.functions.CountUtils.I_MatchPredicate; * <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> * </table><br> - * </p> - * @author Josh Micich */ public final class Sumif extends Var2or3ArgFunction { @@ -69,7 +67,7 @@ public final class Sumif extends Var2or3ArgFunction { AreaEval aeSum) { // TODO - junit to prove last arg must be srcColumnIndex and not srcRowIndex I_MatchPredicate mp = Countif.createCriteriaPredicate(arg1, srcRowIndex, srcColumnIndex); - + // handle empty cells if(mp == null) { return NumberEval.ZERO; 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 aea1fdb8ad..481e7f492d 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 @@ -50,8 +50,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; * A<b>n</b><sub>(<b>i</b>,<b>j</b>)</sub> * ) * ) - * </p> - * @author Josh Micich */ public final class Sumproduct implements Function { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumx2my2.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumx2my2.java index 28887a5bf0..2a091a32bd 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumx2my2.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumx2my2.java @@ -26,17 +26,17 @@ package org.apache.poi.ss.formula.functions; * <b>SUMX2MY2</b>(<b>arrayX</b>, <b>arrayY</b>)<p> * * result = Σ<sub>i: 0..n</sub>(x<sub>i</sub><sup>2</sup>-y<sub>i</sub><sup>2</sup>) - * - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > */ public final class Sumx2my2 extends XYNumericFunction { private static final Accumulator XSquaredMinusYSquaredAccumulator = new Accumulator() { - public double accumulate(double x, double y) { + @Override + public double accumulate(double x, double y) { return x * x - y * y; } }; + @Override protected Accumulator createAccumulator() { return XSquaredMinusYSquaredAccumulator; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumx2py2.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumx2py2.java index cae17d7e35..c5e894ddd5 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumx2py2.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumx2py2.java @@ -26,17 +26,17 @@ package org.apache.poi.ss.formula.functions; * <b>SUMX2PY2</b>(<b>arrayX</b>, <b>arrayY</b>)<p> * * result = Σ<sub>i: 0..n</sub>(x<sub>i</sub><sup>2</sup>+y<sub>i</sub><sup>2</sup>) - * - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > */ public final class Sumx2py2 extends XYNumericFunction { private static final Accumulator XSquaredPlusYSquaredAccumulator = new Accumulator() { - public double accumulate(double x, double y) { + @Override + public double accumulate(double x, double y) { return x * x + y * y; } }; + @Override protected Accumulator createAccumulator() { return XSquaredPlusYSquaredAccumulator; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumxmy2.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumxmy2.java index 1d5effa0cc..f8cf7400d4 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumxmy2.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumxmy2.java @@ -25,18 +25,18 @@ package org.apache.poi.ss.formula.functions; * <b>SUMXMY2</b>(<b>arrayX</b>, <b>arrayY</b>)<p> * * result = Σ<sub>i: 0..n</sub>(x<sub>i</sub>-y<sub>i</sub>)<sup>2</sup> - * - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > */ public final class Sumxmy2 extends XYNumericFunction { private static final Accumulator XMinusYSquaredAccumulator = new Accumulator() { - public double accumulate(double x, double y) { + @Override + public double accumulate(double x, double y) { double xmy = x - y; return xmy * xmy; } }; + @Override protected Accumulator createAccumulator() { return XMinusYSquaredAccumulator; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/TextFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/TextFunction.java index f344d57ca5..d934825d54 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/TextFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/TextFunction.java @@ -19,7 +19,6 @@ package org.apache.poi.ss.formula.functions; import java.util.Locale; -import org.apache.poi.ss.formula.OperationEvaluationContext; import org.apache.poi.ss.formula.eval.AreaEval; import org.apache.poi.ss.formula.eval.BoolEval; import org.apache.poi.ss.formula.eval.ErrorEval; @@ -30,11 +29,6 @@ import org.apache.poi.ss.formula.eval.StringEval; import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.usermodel.DataFormatter; -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * @author Josh Micich - * @author Stephen Wolke (smwolke at geistig.com) - */ public abstract class TextFunction implements Function { protected static final DataFormatter formatter = new DataFormatter(); @@ -52,6 +46,7 @@ public abstract class TextFunction implements Function { return OperandResolver.coerceValueToDouble(ve); } + @Override public final ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) { try { return evaluateFunc(args, srcCellRow, srcCellCol); @@ -69,6 +64,7 @@ public abstract class TextFunction implements Function { protected SingleArgTextFunc() { // no fields to initialise } + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0) { String arg; try { @@ -85,7 +81,8 @@ public abstract class TextFunction implements Function { * Returns the character specified by a number. */ public static final Function CHAR = new Fixed1ArgFunction() { - public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0) { + @Override + public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0) { int arg; try { arg = evaluateIntArg(arg0, srcRowIndex, srcColumnIndex); @@ -101,16 +98,19 @@ public abstract class TextFunction implements Function { }; public static final Function LEN = new SingleArgTextFunc() { + @Override protected ValueEval evaluate(String arg) { return new NumberEval(arg.length()); } }; public static final Function LOWER = new SingleArgTextFunc() { + @Override protected ValueEval evaluate(String arg) { return new StringEval(arg.toLowerCase(Locale.ROOT)); } }; public static final Function UPPER = new SingleArgTextFunc() { + @Override protected ValueEval evaluate(String arg) { return new StringEval(arg.toUpperCase(Locale.ROOT)); } @@ -124,6 +124,7 @@ public abstract class TextFunction implements Function { * This is nearly equivalent to toTitleCase if the Java language had it */ public static final Function PROPER = new SingleArgTextFunc() { + @Override protected ValueEval evaluate(String text) { StringBuilder sb = new StringBuilder(); boolean shouldMakeUppercase = true; @@ -151,6 +152,7 @@ public abstract class TextFunction implements Function { * Author: Manda Wilson < wilson at c bio dot msk cc dot org > */ public static final Function TRIM = new SingleArgTextFunc() { + @Override protected ValueEval evaluate(String arg) { return new StringEval(arg.trim()); } @@ -163,7 +165,8 @@ public abstract class TextFunction implements Function { * Author: Aniket Banerjee(banerjee@google.com) */ public static final Function CLEAN = new SingleArgTextFunc() { - protected ValueEval evaluate(String arg) { + @Override + protected ValueEval evaluate(String arg) { StringBuilder result = new StringBuilder(); for (final char c : arg.toCharArray()) { if (isPrintable(c)) { @@ -201,6 +204,7 @@ public abstract class TextFunction implements Function { */ public static final Function MID = new Fixed3ArgFunction() { + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2) { String text; @@ -239,9 +243,11 @@ public abstract class TextFunction implements Function { protected LeftRight(boolean isLeft) { _isLeft = isLeft; } + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0) { return evaluate(srcRowIndex, srcColumnIndex, arg0, DEFAULT_ARG1); } + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { String arg; @@ -270,45 +276,43 @@ public abstract class TextFunction implements Function { public static final Function LEFT = new LeftRight(true); public static final Function RIGHT = new LeftRight(false); - public static final FreeRefFunction CONCAT = new FreeRefFunction() { - public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) { - StringBuilder sb = new StringBuilder(); - for (ValueEval arg : args) { - try { - if (arg instanceof AreaEval) { - AreaEval area = (AreaEval)arg; - for (int rn=0; rn<area.getHeight(); rn++) { - for (int cn=0; cn<area.getWidth(); cn++) { - ValueEval ve = area.getRelativeValue(rn, cn); - sb.append(evaluateStringArg(ve, ec.getRowIndex(), ec.getColumnIndex())); - } - } - } else { - sb.append(evaluateStringArg(arg, ec.getRowIndex(), ec.getColumnIndex())); - } - } catch (EvaluationException e) { - return e.getErrorEval(); - } - } - return new StringEval(sb.toString()); - } + public static final FreeRefFunction CONCAT = (args, ec) -> { + StringBuilder sb = new StringBuilder(); + for (ValueEval arg : args) { + try { + if (arg instanceof AreaEval) { + AreaEval area = (AreaEval)arg; + for (int rn=0; rn<area.getHeight(); rn++) { + for (int cn=0; cn<area.getWidth(); cn++) { + ValueEval ve = area.getRelativeValue(rn, cn); + sb.append(evaluateStringArg(ve, ec.getRowIndex(), ec.getColumnIndex())); + } + } + } else { + sb.append(evaluateStringArg(arg, ec.getRowIndex(), ec.getColumnIndex())); + } + } catch (EvaluationException e) { + return e.getErrorEval(); + } + } + return new StringEval(sb.toString()); }; - public static final Function CONCATENATE = new Function() { - public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) { - StringBuilder sb = new StringBuilder(); - for (ValueEval arg : args) { - try { - sb.append(evaluateStringArg(arg, srcRowIndex, srcColumnIndex)); - } catch (EvaluationException e) { - return e.getErrorEval(); - } - } - return new StringEval(sb.toString()); - } + + public static final Function CONCATENATE = (args, srcRowIndex, srcColumnIndex) -> { + StringBuilder sb = new StringBuilder(); + for (ValueEval arg : args) { + try { + sb.append(evaluateStringArg(arg, srcRowIndex, srcColumnIndex)); + } catch (EvaluationException e) { + return e.getErrorEval(); + } + } + return new StringEval(sb.toString()); }; public static final Function EXACT = new Fixed2ArgFunction() { + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { String s0; @@ -335,6 +339,7 @@ public abstract class TextFunction implements Function { */ public static final Function TEXT = new Fixed2ArgFunction() { + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { double s0; String s1; @@ -362,6 +367,7 @@ public abstract class TextFunction implements Function { public SearchFind(boolean isCaseSensitive) { _isCaseSensitive = isCaseSensitive; } + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { try { String needle = TextFunction.evaluateStringArg(arg0, srcRowIndex, srcColumnIndex); @@ -371,6 +377,7 @@ public abstract class TextFunction implements Function { return e.getErrorEval(); } } + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2) { try { @@ -407,8 +414,8 @@ public abstract class TextFunction implements Function { * <b>FIND</b>(<b>find_text</b>, <b>within_text</b>, start_num)<p> * * FIND returns the character position of the first (case sensitive) occurrence of - * <tt>find_text</tt> inside <tt>within_text</tt>. The third parameter, - * <tt>start_num</tt>, is optional (default=1) and specifies where to start searching + * {@code find_text} inside {@code within_text}. The third parameter, + * {@code start_num}, is optional (default=1) and specifies where to start searching * from. Character positions are 1-based.<p> * * Author: Torstein Tauno Svendsen (torstei@officenet.no) diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/TimeFunc.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/TimeFunc.java index 8423919e1a..c9674ea024 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/TimeFunc.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/TimeFunc.java @@ -25,9 +25,7 @@ import org.apache.poi.ss.formula.eval.OperandResolver; import org.apache.poi.ss.formula.eval.ValueEval; /** - * Implementation for the Excel function TIME - * - * @author Steven Butler (sebutler @ gmail dot com) + * Implementation for the Excel function TIME<p> * * Based on POI {@link DateFunc} */ diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Var1or2ArgFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Var1or2ArgFunction.java index 1938b79d3b..af37016e41 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Var1or2ArgFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Var1or2ArgFunction.java @@ -21,10 +21,7 @@ import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.ss.formula.eval.ValueEval; /** - * Convenience base class for any function which must take two or three - * arguments - * - * @author Josh Micich + * Convenience base class for any function which must take two or three arguments */ abstract class Var1or2ArgFunction implements Function1Arg, Function2Arg { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Var2or3ArgFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Var2or3ArgFunction.java index cf3f350d6e..f11281b021 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Var2or3ArgFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Var2or3ArgFunction.java @@ -21,10 +21,7 @@ import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.ss.formula.eval.ValueEval; /** - * Convenience base class for any function which must take two or three - * arguments - * - * @author Josh Micich + * Convenience base class for any function which must take two or three arguments */ abstract class Var2or3ArgFunction implements Function2Arg, Function3Arg { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Var3or4ArgFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Var3or4ArgFunction.java index e701b2d9a2..874f338305 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Var3or4ArgFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Var3or4ArgFunction.java @@ -21,10 +21,7 @@ import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.ss.formula.eval.ValueEval; /** - * Convenience base class for any function which must take three or four - * arguments - * - * @author Josh Micich + * Convenience base class for any function which must take three or four arguments */ abstract class Var3or4ArgFunction implements Function3Arg, Function4Arg { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Vlookup.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Vlookup.java index a2daa856e4..12f12dd389 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Vlookup.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Vlookup.java @@ -40,11 +40,13 @@ import org.apache.poi.ss.formula.TwoDEval; public final class Vlookup extends Var3or4ArgFunction { private static final ValueEval DEFAULT_ARG3 = BoolEval.TRUE; + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2) { return evaluate(srcRowIndex, srcColumnIndex, arg0, arg1, arg2, DEFAULT_ARG3); } + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval lookup_value, ValueEval table_array, ValueEval col_index, ValueEval range_lookup) { try { @@ -69,7 +71,7 @@ public final class Vlookup extends Var3or4ArgFunction { /** - * Returns one column from an <tt>AreaEval</tt> + * Returns one column from an {@code AreaEval} * * @param colIndex assumed to be non-negative * diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/WeekdayFunc.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/WeekdayFunc.java index 184866e7c2..48a858b901 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/WeekdayFunc.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/WeekdayFunc.java @@ -33,8 +33,6 @@ import org.apache.poi.ss.usermodel.DateUtil; /** * Implementation for the Excel function WEEKDAY - * - * @author Thies Wellpott */ public final class WeekdayFunc implements Function { //or: extends Var1or2ArgFunction { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/XYNumericFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/XYNumericFunction.java index da2a0f3127..033ca01009 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/XYNumericFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/XYNumericFunction.java @@ -25,9 +25,6 @@ import org.apache.poi.ss.formula.eval.RefEval; import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.formula.functions.LookupUtils.ValueVector; -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - */ public abstract class XYNumericFunction extends Fixed2ArgFunction { private static abstract class ValueArray implements ValueVector { @@ -35,7 +32,8 @@ public abstract class XYNumericFunction extends Fixed2ArgFunction { protected ValueArray(int size) { _size = size; } - public ValueEval getItem(int index) { + @Override + public ValueEval getItem(int index) { if (index < 0 || index > _size) { throw new IllegalArgumentException("Specified index " + index + " is outside range (0.." + (_size - 1) + ")"); @@ -43,6 +41,7 @@ public abstract class XYNumericFunction extends Fixed2ArgFunction { return getItemInternal(index); } protected abstract ValueEval getItemInternal(int index); + @Override public final int getSize() { return _size; } @@ -54,6 +53,7 @@ public abstract class XYNumericFunction extends Fixed2ArgFunction { super(1); _value = value; } + @Override protected ValueEval getItemInternal(int index) { return _value; } @@ -62,14 +62,15 @@ public abstract class XYNumericFunction extends Fixed2ArgFunction { private static final class RefValueArray extends ValueArray { private final RefEval _ref; private final int _width; - + public RefValueArray(RefEval ref) { super(ref.getNumberOfSheets()); _ref = ref; _width = ref.getNumberOfSheets(); } + @Override protected ValueEval getItemInternal(int index) { - int sIx = (index % _width) + _ref.getFirstSheetIndex(); + int sIx = (index % _width) + _ref.getFirstSheetIndex(); return _ref.getInnerValueEval(sIx); } } @@ -83,6 +84,7 @@ public abstract class XYNumericFunction extends Fixed2ArgFunction { _ae = ae; _width = ae.getWidth(); } + @Override protected ValueEval getItemInternal(int index) { int rowIx = index / _width; int colIx = index % _width; @@ -90,7 +92,7 @@ public abstract class XYNumericFunction extends Fixed2ArgFunction { } } - protected static interface Accumulator { + protected interface Accumulator { double accumulate(double x, double y); } @@ -99,6 +101,7 @@ public abstract class XYNumericFunction extends Fixed2ArgFunction { */ protected abstract Accumulator createAccumulator(); + @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { double result; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java index bc77d6049b..5003f20be1 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java @@ -55,6 +55,7 @@ public abstract class AbstractFunctionPtg extends OperationPtg { returnClass = (byte) pReturnClass; paramClass = paramTypes; } + @Override public final boolean isBaseToken() { return false; } @@ -62,6 +63,7 @@ public abstract class AbstractFunctionPtg extends OperationPtg { public final short getFunctionIndex() { return _functionIndex; } + @Override public final int getNumberOfOperands() { return _numberOfArgs; } @@ -71,16 +73,18 @@ public abstract class AbstractFunctionPtg extends OperationPtg { } /** * external functions get some special processing - * @return <code>true</code> if this is an external function + * @return {@code true} if this is an external function */ public final boolean isExternalFunction() { return _functionIndex == FUNCTION_INDEX_EXTERNAL; } + @Override public final String toFormulaString() { return getName(); } + @Override public String toFormulaString(String[] operands) { StringBuilder buf = new StringBuilder(); @@ -105,6 +109,7 @@ public abstract class AbstractFunctionPtg extends OperationPtg { buf.append(")"); } + @Override public abstract int getSize(); @@ -112,8 +117,8 @@ public abstract class AbstractFunctionPtg extends OperationPtg { * Used to detect whether a function name found in a formula is one of the standard excel functions * <p> * The name matching is case insensitive. - * @return <code>true</code> if the name specifies a standard worksheet function, - * <code>false</code> if the name should be assumed to be an external function. + * @return {@code true} if the name specifies a standard worksheet function, + * {@code false} if the name should be assumed to be an external function. */ public static boolean isBuiltInFunctionName(String name) { short ix = FunctionMetadataRegistry.lookupIndexByName(name.toUpperCase(Locale.ROOT)); @@ -144,7 +149,7 @@ public abstract class AbstractFunctionPtg extends OperationPtg { * Resolves internal function names into function indexes. * <p> * The name matching is case insensitive. - * @return the standard worksheet function index if found, otherwise <tt>FUNCTION_INDEX_EXTERNAL</tt> + * @return the standard worksheet function index if found, otherwise {@code FUNCTION_INDEX_EXTERNAL} */ protected static short lookupIndex(String name) { short ix = FunctionMetadataRegistry.lookupIndexByName(name.toUpperCase(Locale.ROOT)); @@ -154,6 +159,7 @@ public abstract class AbstractFunctionPtg extends OperationPtg { return ix; } + @Override public byte getDefaultOperandClass() { return returnClass; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/AreaErrPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/AreaErrPtg.java index 911abbf5bc..a9f650e0db 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/AreaErrPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/AreaErrPtg.java @@ -54,7 +54,8 @@ public final class AreaErrPtg extends OperandPtg { return FormulaError.REF.getString(); } - public byte getDefaultOperandClass() { + @Override + public byte getDefaultOperandClass() { return Ptg.CLASS_REF; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/AreaNPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/AreaNPtg.java index 0ac7d5e74d..5cdfbd22e7 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/AreaNPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/AreaNPtg.java @@ -21,7 +21,6 @@ import org.apache.poi.util.LittleEndianInput; /** * Specifies a rectangular area of cells A1:A4 for instance. - * @author Jason Height (jheight at chariot dot net dot au) */ public final class AreaNPtg extends Area2DPtgBase { public static final short sid = 0x2D; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/AreaPtgBase.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/AreaPtgBase.java index 5fbefc365e..496300720b 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/AreaPtgBase.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/AreaPtgBase.java @@ -297,6 +297,7 @@ public abstract class AreaPtgBase extends OperandPtg implements AreaI { return formatReferenceAsString(); } + @Override public byte getDefaultOperandClass() { return Ptg.CLASS_REF; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/ArrayInitialPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/ArrayInitialPtg.java index f242fb2b39..2c5a4295f1 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/ArrayInitialPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/ArrayInitialPtg.java @@ -44,12 +44,14 @@ final class ArrayInitialPtg extends Ptg { private static RuntimeException invalid() { throw new IllegalStateException("This object is a partially initialised tArray, and cannot be used as a Ptg"); } - public byte getDefaultOperandClass() { + @Override + public byte getDefaultOperandClass() { throw invalid(); } public int getSize() { return ArrayPtg.PLAIN_TOKEN_SIZE; } + @Override public boolean isBaseToken() { return false; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/ArrayPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/ArrayPtg.java index aff4aa3918..e1217b70bf 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/ArrayPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/ArrayPtg.java @@ -113,6 +113,7 @@ public final class ArrayPtg extends Ptg { return result; } + @Override public boolean isBaseToken() { return false; } @@ -208,7 +209,8 @@ public final class ArrayPtg extends Ptg { throw new IllegalArgumentException("Unexpected constant class (" + o.getClass().getName() + ")"); } - public byte getDefaultOperandClass() { + @Override + public byte getDefaultOperandClass() { return Ptg.CLASS_ARRAY; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/AttrPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/AttrPtg.java index 99e0ea0c10..bcf9732b2f 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/AttrPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/AttrPtg.java @@ -104,7 +104,7 @@ public final class AttrPtg extends ControlPtg { } /** - * @param type a constant from <tt>SpaceType</tt> + * @param type a constant from {@code SpaceType} * @param count the number of space characters */ public static AttrPtg createSpace(int type, int count) { @@ -173,6 +173,7 @@ public final class AttrPtg extends ControlPtg { return _chooseFuncOffset; } + @Override public void write(LittleEndianOutput out) { out.writeByte(sid + getPtgClass()); out.writeByte(_options); @@ -191,6 +192,7 @@ public final class AttrPtg extends ControlPtg { return sid; } + @Override public int getSize() { if (_jumpTable != null) { return SIZE + (_jumpTable.length + 1) * LittleEndianConsts.SHORT_SIZE; @@ -219,6 +221,7 @@ public final class AttrPtg extends ControlPtg { return -1; } + @Override public String toFormulaString() { if (semiVolatile.isSet(_options)) { return "ATTR(semiVolatile)"; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/ControlPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/ControlPtg.java index a206b5dbe9..86425a0f6a 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/ControlPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/ControlPtg.java @@ -21,10 +21,12 @@ public abstract class ControlPtg extends Ptg { protected ControlPtg() {} + @Override public boolean isBaseToken() { return true; } - public final byte getDefaultOperandClass() { + @Override + public final byte getDefaultOperandClass() { throw new IllegalStateException("Control tokens are not classified"); } } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/Deleted3DPxg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/Deleted3DPxg.java index b58b8e5298..5db3fa838b 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/Deleted3DPxg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/Deleted3DPxg.java @@ -74,6 +74,7 @@ public final class Deleted3DPxg extends OperandPtg implements Pxg { return sb.toString(); } + @Override public byte getDefaultOperandClass() { return Ptg.CLASS_VALUE; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/DeletedArea3DPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/DeletedArea3DPtg.java index 1143dc5e7b..71dfd66f16 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/DeletedArea3DPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/DeletedArea3DPtg.java @@ -56,7 +56,8 @@ public final class DeletedArea3DPtg extends OperandPtg implements WorkbookDepend public String toFormulaString() { throw new RuntimeException("3D references need a workbook to determine formula text"); } - public byte getDefaultOperandClass() { + @Override + public byte getDefaultOperandClass() { return Ptg.CLASS_REF; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/DeletedRef3DPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/DeletedRef3DPtg.java index 04908988d1..d43e3ced93 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/DeletedRef3DPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/DeletedRef3DPtg.java @@ -56,7 +56,8 @@ public final class DeletedRef3DPtg extends OperandPtg implements WorkbookDepende public String toFormulaString() { throw new RuntimeException("3D references need a workbook to determine formula text"); } - public byte getDefaultOperandClass() { + @Override + public byte getDefaultOperandClass() { return Ptg.CLASS_REF; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/EqualPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/EqualPtg.java index b95a4b4262..e2492aa840 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/EqualPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/EqualPtg.java @@ -17,10 +17,6 @@ package org.apache.poi.ss.formula.ptg; -/** - * - * @author andy - */ public final class EqualPtg extends ValueOperatorPtg { public static final byte sid = 0x0b; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/ExternSheetNameResolver.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/ExternSheetNameResolver.java index 2717662d2b..3a35909cc2 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/ExternSheetNameResolver.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/ExternSheetNameResolver.java @@ -22,9 +22,6 @@ import org.apache.poi.ss.formula.EvaluationWorkbook.ExternalSheetRange; import org.apache.poi.ss.formula.FormulaRenderingWorkbook; import org.apache.poi.ss.formula.SheetNameFormatter; -/** - * @author Josh Micich - */ final class ExternSheetNameResolver { private ExternSheetNameResolver() { // no instances of this class diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/IntPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/IntPtg.java index 977c8b6bc4..642201a422 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/IntPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/IntPtg.java @@ -35,8 +35,8 @@ public final class IntPtg extends ScalarConstantPtg { /** * Excel represents integers 0..65535 with the tInt token. * - * @return <code>true</code> if the specified value is within the range of values - * <tt>IntPtg</tt> can represent. + * @return {@code true} if the specified value is within the range of values + * {@code IntPtg} can represent. */ public static boolean isInRange(int i) { return i >= MIN_VALUE && i <= MAX_VALUE; @@ -61,6 +61,7 @@ public final class IntPtg extends ScalarConstantPtg { return field_1_value; } + @Override public void write(LittleEndianOutput out) { out.writeByte(sid + getPtgClass()); out.writeShort(getValue()); @@ -71,10 +72,12 @@ public final class IntPtg extends ScalarConstantPtg { return sid; } + @Override public int getSize() { return SIZE; } + @Override public String toFormulaString() { return String.valueOf(getValue()); } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/IntersectionPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/IntersectionPtg.java index 963564ad71..a8871bfd62 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/IntersectionPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/IntersectionPtg.java @@ -28,7 +28,8 @@ public final class IntersectionPtg extends OperationPtg { // enforce singleton } - public final boolean isBaseToken() { + @Override + public final boolean isBaseToken() { return true; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/MemAreaPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/MemAreaPtg.java index 18a00eed8b..37f6dd265a 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/MemAreaPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/MemAreaPtg.java @@ -65,7 +65,8 @@ public final class MemAreaPtg extends OperandPtg { return ""; // TODO: Not sure how to format this. -- DN } - public byte getDefaultOperandClass() { + @Override + public byte getDefaultOperandClass() { return Ptg.CLASS_VALUE; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/MemErrPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/MemErrPtg.java index 41adefcaff..cac2e38fbe 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/MemErrPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/MemErrPtg.java @@ -60,7 +60,8 @@ public final class MemErrPtg extends OperandPtg { return "ERR#"; } - public byte getDefaultOperandClass() { + @Override + public byte getDefaultOperandClass() { return Ptg.CLASS_VALUE; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/MemFuncPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/MemFuncPtg.java index 548f15f1b4..5ba8d950f7 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/MemFuncPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/MemFuncPtg.java @@ -59,7 +59,8 @@ public final class MemFuncPtg extends OperandPtg { return ""; } - public byte getDefaultOperandClass() { + @Override + public byte getDefaultOperandClass() { return Ptg.CLASS_REF; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/NameXPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/NameXPtg.java index 5ca85df72f..4f8835ed80 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/NameXPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/NameXPtg.java @@ -87,7 +87,8 @@ public final class NameXPtg extends OperandPtg implements WorkbookDependentFormu throw new RuntimeException("3D references need a workbook to determine formula text"); } - public byte getDefaultOperandClass() { + @Override + public byte getDefaultOperandClass() { return Ptg.CLASS_VALUE; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/NameXPxg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/NameXPxg.java index 8ed4c9c43f..2b357b7166 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/NameXPxg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/NameXPxg.java @@ -90,6 +90,7 @@ public final class NameXPxg extends OperandPtg implements Pxg { return sb.toString(); } + @Override public byte getDefaultOperandClass() { return Ptg.CLASS_VALUE; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/NumberPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/NumberPtg.java index ed6f15f1ee..996e7bed17 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/NumberPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/NumberPtg.java @@ -57,6 +57,7 @@ public final class NumberPtg extends ScalarConstantPtg { return field_1_value; } + @Override public void write(LittleEndianOutput out) { out.writeByte(sid + getPtgClass()); out.writeDouble(getValue()); @@ -67,10 +68,12 @@ public final class NumberPtg extends ScalarConstantPtg { return sid; } + @Override public int getSize() { return SIZE; } + @Override public String toFormulaString() { return NumberToTextConverter.toText(field_1_value); } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/OperandPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/OperandPtg.java index 1f1ab3c761..f216e17c97 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/OperandPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/OperandPtg.java @@ -28,7 +28,8 @@ public abstract class OperandPtg extends Ptg { /** * All Operand {@link Ptg}s are classified ('relative', 'value', 'array') */ - public final boolean isBaseToken() { + @Override + public final boolean isBaseToken() { return false; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/OperationPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/OperationPtg.java index 111f58b4e6..795c1e37b6 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/OperationPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/OperationPtg.java @@ -22,7 +22,6 @@ import java.util.function.Supplier; /** * defines a Ptg that is an operation instead of an operand - * @author andy */ public abstract class OperationPtg extends Ptg { public static final int TYPE_UNARY = 0; @@ -44,6 +43,7 @@ public abstract class OperationPtg extends Ptg { */ public abstract int getNumberOfOperands(); + @Override public byte getDefaultOperandClass() { return Ptg.CLASS_VALUE; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/Ptg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/Ptg.java index 3651ab93b2..1263540f74 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/Ptg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/Ptg.java @@ -28,16 +28,16 @@ import org.apache.poi.util.LittleEndianInput; import org.apache.poi.util.LittleEndianOutput; /** - * <tt>Ptg</tt> represents a syntactic token in a formula. 'PTG' is an acronym for + * {@code Ptg} represents a syntactic token in a formula. 'PTG' is an acronym for * '<b>p</b>arse <b>t</b>hin<b>g</b>'. Originally, the name referred to the single - * byte identifier at the start of the token, but in POI, <tt>Ptg</tt> encapsulates + * byte identifier at the start of the token, but in POI, {@code Ptg} encapsulates * the whole formula token (initial byte + value data). * <p> * - * <tt>Ptg</tt>s are logically arranged in a tree representing the structure of the - * parsed formula. However, in BIFF files <tt>Ptg</tt>s are written/read in + * {@code Ptg}s are logically arranged in a tree representing the structure of the + * parsed formula. However, in BIFF files {@code Ptg}s are written/read in * <em>Reverse-Polish Notation</em> order. The RPN ordering also simplifies formula - * evaluation logic, so POI mostly accesses <tt>Ptg</tt>s in the same way. + * evaluation logic, so POI mostly accesses {@code Ptg}s in the same way. */ public abstract class Ptg implements Duplicatable, GenericRecord { public static final Ptg[] EMPTY_PTG_ARRAY = { }; @@ -55,8 +55,8 @@ public abstract class Ptg implements Duplicatable, GenericRecord { } /** - * Reads <tt>size</tt> bytes of the input stream, to create an array of <tt>Ptg</tt>s. - * Extra data (beyond <tt>size</tt>) may be read if and <tt>ArrayPtg</tt>s are present. + * Reads {@code size} bytes of the input stream, to create an array of {@code Ptg}s. + * Extra data (beyond {@code size}) may be read if and {@code ArrayPtg}s are present. */ public static Ptg[] readTokens(int size, LittleEndianInput in) { List<Ptg> temp = new ArrayList<>(4 + size / 2); @@ -181,7 +181,7 @@ public abstract class Ptg implements Duplicatable, GenericRecord { /** * This method will return the same result as {@link #getEncodedSizeWithoutArrayData(Ptg[])} * if there are no array tokens present. - * @return the full size taken to encode the specified <tt>Ptg</tt>s + * @return the full size taken to encode the specified {@code Ptg}s */ public static int getEncodedSize(Ptg[] ptgs) { int result = 0; @@ -285,7 +285,7 @@ public abstract class Ptg implements Duplicatable, GenericRecord { public abstract byte getDefaultOperandClass(); /** - * @return <code>false</code> if this token is classified as 'reference', 'value', or 'array' + * @return {@code false} if this token is classified as 'reference', 'value', or 'array' */ public abstract boolean isBaseToken(); @@ -311,10 +311,7 @@ public abstract class Ptg implements Duplicatable, GenericRecord { if (ptg instanceof AreaErrPtg) { return true; } - if (ptg instanceof RefErrorPtg) { - return true; - } - return false; + return ptg instanceof RefErrorPtg; } @Override diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/RangePtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/RangePtg.java index 25b145a3cb..9a4cb4a819 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/RangePtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/RangePtg.java @@ -30,6 +30,7 @@ public final class RangePtg extends OperationPtg { // enforce singleton } + @Override public final boolean isBaseToken() { return true; } @@ -39,14 +40,17 @@ public final class RangePtg extends OperationPtg { return sid; } + @Override public int getSize() { return SIZE; } + @Override public void write(LittleEndianOutput out) { out.writeByte(sid + getPtgClass()); } + @Override public String toFormulaString() { return ":"; @@ -54,10 +58,12 @@ public final class RangePtg extends OperationPtg { /** implementation of method from OperationsPtg*/ + @Override public String toFormulaString(String[] operands) { return operands[0] + ":" + operands[1]; } + @Override public int getNumberOfOperands() { return 2; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/RefErrorPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/RefErrorPtg.java index 06c8489276..9a16b3a77e 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/RefErrorPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/RefErrorPtg.java @@ -32,7 +32,7 @@ public final class RefErrorPtg extends OperandPtg { private static final int SIZE = 5; public static final byte sid = 0x2A; - private int field_1_reserved; + private final int field_1_reserved; public RefErrorPtg() { field_1_reserved = 0; @@ -47,6 +47,7 @@ public final class RefErrorPtg extends OperandPtg { field_1_reserved = in.readInt(); } + @Override public void write(LittleEndianOutput out) { out.writeByte(sid + getPtgClass()); out.writeInt(field_1_reserved); @@ -57,14 +58,17 @@ public final class RefErrorPtg extends OperandPtg { return sid; } + @Override public int getSize() { return SIZE; } + @Override public String toFormulaString() { return FormulaError.REF.getString(); } + @Override public byte getDefaultOperandClass() { return Ptg.CLASS_REF; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/ScalarConstantPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/ScalarConstantPtg.java index 310ffb2b1d..9f4bbb2fd2 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/ScalarConstantPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/ScalarConstantPtg.java @@ -22,11 +22,13 @@ package org.apache.poi.ss.formula.ptg; * Common superclass of all {@link Ptg Ptgs} that represent simple constant values. */ public abstract class ScalarConstantPtg extends Ptg { + @Override public final boolean isBaseToken() { return true; } - public final byte getDefaultOperandClass() { + @Override + public final byte getDefaultOperandClass() { return Ptg.CLASS_VALUE; } } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/UnionPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/UnionPtg.java index da3175f56f..dbd530304a 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/UnionPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/UnionPtg.java @@ -20,9 +20,6 @@ package org.apache.poi.ss.formula.ptg; import org.apache.poi.util.LittleEndianOutput; -/** - * @author Glen Stampoultzis (glens at apache.org) - */ public final class UnionPtg extends OperationPtg { public static final byte sid = 0x10; @@ -32,6 +29,7 @@ public final class UnionPtg extends OperationPtg { // enforce singleton } + @Override public final boolean isBaseToken() { return true; } @@ -41,14 +39,17 @@ public final class UnionPtg extends OperationPtg { return sid; } + @Override public int getSize() { return 1; } + @Override public void write(LittleEndianOutput out) { out.writeByte(sid + getPtgClass()); } + @Override public String toFormulaString() { return ","; @@ -56,10 +57,12 @@ public final class UnionPtg extends OperationPtg { /** implementation of method from OperationsPtg*/ + @Override public String toFormulaString(String[] operands) { return operands[0] + "," + operands[1]; } + @Override public int getNumberOfOperands() { return 2; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/UnknownPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/UnknownPtg.java index bd92b9b56e..5e71320064 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/UnknownPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/UnknownPtg.java @@ -29,9 +29,11 @@ public class UnknownPtg extends Ptg { _sid = sid; } + @Override public boolean isBaseToken() { return true; } + @Override public void write(LittleEndianOutput out) { out.writeByte(_sid); } @@ -41,13 +43,16 @@ public class UnknownPtg extends Ptg { return (byte)_sid; } + @Override public int getSize() { return size; } + @Override public String toFormulaString() { return "UNKNOWN"; } + @Override public byte getDefaultOperandClass() { return Ptg.CLASS_VALUE; } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/ptg/ValueOperatorPtg.java b/poi/src/main/java/org/apache/poi/ss/formula/ptg/ValueOperatorPtg.java index 1eff73a826..72922967b3 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/ptg/ValueOperatorPtg.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/ptg/ValueOperatorPtg.java @@ -29,24 +29,29 @@ public abstract class ValueOperatorPtg extends OperationPtg { protected ValueOperatorPtg() {} /** - * All Operator <tt>Ptg</tt>s are base tokens (i.e. are not RVA classified) + * All Operator {@code Ptg}s are base tokens (i.e. are not RVA classified) */ + @Override public final boolean isBaseToken() { return true; } - public final byte getDefaultOperandClass() { + @Override + public final byte getDefaultOperandClass() { return Ptg.CLASS_VALUE; } + @Override public void write(LittleEndianOutput out) { out.writeByte(getSid()); } + @Override public final int getSize() { return 1; } + @Override public final String toFormulaString() { // TODO - prune this method out of the hierarchy throw new RuntimeException("toFormulaString(String[] operands) should be used for subclasses of OperationPtgs"); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/udf/AggregatingUDFFinder.java b/poi/src/main/java/org/apache/poi/ss/formula/udf/AggregatingUDFFinder.java index 593a0ee1b5..8a435b77fd 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/udf/AggregatingUDFFinder.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/udf/AggregatingUDFFinder.java @@ -26,14 +26,12 @@ import java.util.Collection; /** * Collects add-in libraries and VB macro functions together into one UDF finder - * - * @author PUdalau */ public class AggregatingUDFFinder implements UDFFinder { - + /** * Default UDFFinder implementation - */ + */ public static final UDFFinder DEFAULT = new AggregatingUDFFinder(AnalysisToolPak.instance); private final Collection<UDFFinder> _usedToolPacks; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/udf/DefaultUDFFinder.java b/poi/src/main/java/org/apache/poi/ss/formula/udf/DefaultUDFFinder.java index 4234054583..18f53f6790 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/udf/DefaultUDFFinder.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/udf/DefaultUDFFinder.java @@ -25,8 +25,6 @@ import org.apache.poi.ss.formula.functions.FreeRefFunction; /** * Default UDF finder - for adding your own user defined functions. - * - * @author PUdalau */ public final class DefaultUDFFinder implements UDFFinder { private final Map<String, FreeRefFunction> _functionsByName; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/udf/IndexedUDFFinder.java b/poi/src/main/java/org/apache/poi/ss/formula/udf/IndexedUDFFinder.java index c5af8d5254..29490c910b 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/udf/IndexedUDFFinder.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/udf/IndexedUDFFinder.java @@ -23,8 +23,6 @@ import java.util.HashMap; /** * A UDFFinder that can retrieve functions both by name and by fake index. - * - * @author Yegor Kozlov */ @Internal public class IndexedUDFFinder extends AggregatingUDFFinder { diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/CellBase.java b/poi/src/main/java/org/apache/poi/ss/usermodel/CellBase.java index 726c9bd82b..e892a4f7d0 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/CellBase.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/CellBase.java @@ -31,7 +31,6 @@ import java.util.Locale; /** * Common implementation-independent logic shared by all implementations of {@link Cell}. - * @author Vladislav "gallon" Galas gallon at apache dot org */ public abstract class CellBase implements Cell { /** diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/CellRange.java b/poi/src/main/java/org/apache/poi/ss/usermodel/CellRange.java index 4868dd8e81..0c52cf0193 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/CellRange.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/CellRange.java @@ -29,7 +29,7 @@ public interface CellRange<C extends Cell> extends Iterable<C> { /** * Gets the number of cells in this range. - * @return <tt>height * width </tt> + * @return {@code height * width } */ int size(); @@ -40,24 +40,24 @@ public interface CellRange<C extends Cell> extends Iterable<C> { String getReferenceText(); /** - * @return the cell at relative coordinates (0,0). Never <code>null</code>. + * @return the cell at relative coordinates (0,0). Never {@code null}. */ C getTopLeftCell(); /** - * @param relativeRowIndex must be between <tt>0</tt> and <tt>height-1</tt> - * @param relativeColumnIndex must be between <tt>0</tt> and <tt>width-1</tt> - * @return the cell at the specified coordinates. Never <code>null</code>. + * @param relativeRowIndex must be between {@code 0} and {@code height-1} + * @param relativeColumnIndex must be between {@code 0} and {@code width-1} + * @return the cell at the specified coordinates. Never {@code null}. */ C getCell(int relativeRowIndex, int relativeColumnIndex); /** - * @return a flattened array of all the cells in this {@link CellRange} + * @return a flattened array of all the cells in this CellRange */ C[] getFlattenedCells(); /** - * @return a 2-D array of all the cells in this {@link CellRange}. The first - * array dimension is the row index (values <tt>0...height-1</tt>) - * and the second dimension is the column index (values <tt>0...width-1</tt>) + * @return a 2-D array of all the cells in this CellRange. The first + * array dimension is the row index (values {@code 0...height-1}) + * and the second dimension is the column index (values {@code 0...width-1}) */ C[][] getCells(); @@ -65,5 +65,6 @@ public interface CellRange<C extends Cell> extends Iterable<C> { * @return an {@link Iterator} over all cells in this range. Iteration starts * with all cells in the first row followed by all cells in the next row, etc. */ + @Override Iterator<C> iterator(); } diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/ConditionalFormatting.java b/poi/src/main/java/org/apache/poi/ss/usermodel/ConditionalFormatting.java index d7789e14ea..da6889bf79 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/ConditionalFormatting.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/ConditionalFormatting.java @@ -24,31 +24,22 @@ import org.apache.poi.ss.util.CellRangeAddress; /** * The ConditionalFormatting class encapsulates all settings of Conditional Formatting. * - * The class can be used - * - * <UL> - * <LI> - * to make a copy ConditionalFormatting settings. - * </LI> - * - * + * The class can be used to make a copy ConditionalFormatting settings. + * <p> * For example: - * <PRE> + * <pre>{@code * ConditionalFormatting cf = sheet.getConditionalFormattingAt(index); * newSheet.addConditionalFormatting(cf); - * </PRE> + * }</pre> * - * <LI> - * or to modify existing Conditional Formatting settings (formatting regions and/or rules). - * </LI> - * </UL> + * or to modify existing Conditional Formatting settings (formatting regions and/or rules).<p> * * Use {@link org.apache.poi.ss.usermodel.Sheet#getSheetConditionalFormatting()} * to get access to an instance of this class. - * <P> + * <p> * To create a new Conditional Formatting set use the following approach: * - * <PRE> + * <pre>{@code * * // Define a Conditional Formatting rule, which triggers formatting * // when cell's value is greater or equal than 100.0 and @@ -71,18 +62,18 @@ import org.apache.poi.ss.util.CellRangeAddress; * * // Apply Conditional Formatting rule defined above to the regions * sheet.addConditionalFormatting(regions, rule); - * </PRE> + * }</pre> */ public interface ConditionalFormatting { /** - * @return array of <tt>CellRangeAddress</tt>s. Never <code>null</code> + * @return array of {@code CellRangeAddress}s. Never {@code null} */ CellRangeAddress[] getFormattingRanges(); /** * Sets the cell ranges the rule conditional formatting must be applied to. - * @param ranges non-null array of <tt>CellRangeAddress</tt>s + * @param ranges non-null array of {@code CellRangeAddress}s */ void setFormattingRanges(CellRangeAddress[] ranges); diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/DataFormatter.java b/poi/src/main/java/org/apache/poi/ss/usermodel/DataFormatter.java index 78bbd79b55..634d2d54b7 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/DataFormatter.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/DataFormatter.java @@ -66,26 +66,25 @@ 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>DataFormatter.addFormat(String,Format)</code>. The following + * via {@code DataFormatter.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> + * <pre>{@code + * SSN "000-00-0000" + * Phone Number "(###) ###-####" + * Zip plus 4 "00000-0000" + * }</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> - * DataFormatter.setDefaultNumberFormat(Format)</code>. <b>Note:</b> the + * can override the default format pattern with {@code + * DataFormatter.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. * @@ -95,24 +94,24 @@ import org.apache.poi.util.LocaleUtil; * </p> * <p>Example:</p> * <p> - * Consider a numeric cell with a value <code>12.343</code> and format <code>"##.##_ "</code>. - * The trailing underscore and space ("_ ") in the format adds a space to the end and Excel formats this cell as <code>"12.34 "</code>, - * but <code>DataFormatter</code> trims the formatted value and returns <code>"12.34"</code>. + * Consider a numeric cell with a value {@code 12.343} and format {@code "##.##_ "}. + * The trailing underscore and space ("_ ") in the format adds a space to the end and Excel formats this cell as {@code "12.34 "}, + * but {@code DataFormatter} trims the formatted value and returns {@code "12.34"}. * </p> - * You can enable spaces by passing the <code>emulateCSV=true</code> flag in the <code>DateFormatter</code> cosntructor. + * You can enable spaces by passing the {@code emulateCSV=true} flag in the {@code DateFormatter} cosntructor. * If set to true, then the output tries to conform to what you get when you take an xls or xlsx in Excel and Save As CSV file: * <ul> * <li>returned values are not trimmed</li> * <li>Invalid dates are formatted as 255 pound signs ("#")</li> * <li>simulate Excel's handling of a format string of all # when the value is 0. - * Excel will output "", <code>DataFormatter</code> will output "0". + * Excel will output "", {@code DataFormatter} will output "0". * </ul> * <p> * Some formats are automatically "localized" by Excel, eg show as mm/dd/yyyy when * loaded in Excel in some Locales but as dd/mm/yyyy in others. These are always * returned in the "default" (US) format, as stored in the file. * Some format strings request an alternate locale, eg - * <code>[$-809]d/m/yy h:mm AM/PM</code> which explicitly requests UK locale. + * {@code [$-809]d/m/yy h:mm AM/PM} which explicitly requests UK locale. * These locale directives are (currently) ignored. * You can use {@link DateFormatConverter} to do some of this localisation if * you need it. @@ -269,7 +268,7 @@ public class DataFormatter { /** * Return a Format for the given cell if one exists, otherwise try to - * create one. This method will return <code>null</code> if any of the + * create one. This method will return {@code null} if any of the * following is true: * <ul> * <li>the cell's style is null</li> @@ -685,7 +684,7 @@ public class DataFormatter { private static class InternalDecimalFormatWithScale extends Format { private static final Pattern endsWithCommas = Pattern.compile("(,+)$"); - private BigDecimal divider; + private final BigDecimal divider; private static final BigDecimal ONE_THOUSAND = new BigDecimal(1000); private final DecimalFormat df; private static String trimTrailingCommas(String s) { @@ -798,8 +797,8 @@ public class DataFormatter { } /** - * Returns the formatted value of an Excel date as a <tt>String</tt> based - * on the cell's <code>DataFormat</code>. i.e. "Thursday, January 02, 2003" + * Returns the formatted value of an Excel date as a {@code String} based + * on the cell's {@code DataFormat}. i.e. "Thursday, January 02, 2003" * , "01/02/2003" , "02-Jan" , etc. * <p> * If any conditional format rules apply, the highest priority with a number format is used. @@ -839,8 +838,8 @@ public class DataFormatter { } /** - * Returns the formatted value of an Excel number as a <tt>String</tt> - * based on the cell's <code>DataFormat</code>. Supported formats include + * Returns the formatted value of an Excel number as a {@code String} + * based on the cell's {@code DataFormat}. Supported formats include * currency, percents, decimals, phone number, SSN, etc.: * "61.54%", "$100.00", "(800) 555-1234". * <p> @@ -929,7 +928,7 @@ public class DataFormatter { /** * <p> - * Returns the formatted value of a cell as a <tt>String</tt> regardless + * Returns the formatted value of a cell as a {@code String} regardless * of the cell type. If the Excel format pattern cannot be parsed then the * cell value will be formatted using a default format. * </p> @@ -946,7 +945,7 @@ public class DataFormatter { /** * <p> - * Returns the formatted value of a cell as a <tt>String</tt> regardless + * Returns the formatted value of a cell as a {@code String} regardless * of the cell type. If the Excel number format pattern cannot be parsed then the * cell value will be formatted using a default format. * </p> @@ -967,7 +966,7 @@ public class DataFormatter { /** * <p> - * Returns the formatted value of a cell as a <tt>String</tt> regardless + * Returns the formatted value of a cell as a {@code String} regardless * of the cell type. If the Excel number format pattern cannot be parsed then the * cell value will be formatted using a default format. * </p> @@ -1038,9 +1037,9 @@ public class DataFormatter { * </p> * <p> * The value that will be passed to the Format's format method (specified - * by <code>java.text.Format#format</code>) will be a double value from a + * by {@code java.text.Format#format}) will be a double value from a * numeric cell. Therefore the code in the format method should expect a - * <code>Number</code> value. + * {@code Number} value. * </p> * * @param format A Format instance to be used as a default @@ -1059,9 +1058,9 @@ public class DataFormatter { * Adds a new format to the available formats. * <p> * The value that will be passed to the Format's format method (specified - * by <code>java.text.Format#format</code>) will be a double value from a + * by {@code java.text.Format#format}) will be a double value from a * numeric cell. Therefore the code in the format method should expect a - * <code>Number</code> value. + * {@code Number} value. * </p> * @param excelFormatStr The data format string * @param format A Format instance @@ -1073,7 +1072,7 @@ public class DataFormatter { // Some custom formats /** - * @return a <tt>DecimalFormat</tt> with parseIntegerOnly set <code>true</code> + * @return a {@code DecimalFormat} with parseIntegerOnly set {@code true} */ private static DecimalFormat createIntegerOnlyFormat(String fmt) { DecimalFormatSymbols dsf = DecimalFormatSymbols.getInstance(Locale.ROOT); @@ -1164,8 +1163,6 @@ public class DataFormatter { /** * Format class for Excel's SSN format. This class mimics Excel's built-in * SSN formatting. - * - * @author James May */ @SuppressWarnings("serial") private static final class SSNFormat extends Format { @@ -1197,7 +1194,6 @@ public class DataFormatter { /** * Format class for Excel Zip + 4 format. This class mimics Excel's * built-in formatting for Zip + 4. - * @author James May */ @SuppressWarnings("serial") private static final class ZipPlusFourFormat extends Format { @@ -1228,7 +1224,6 @@ public class DataFormatter { /** * Format class for Excel phone number format. This class mimics Excel's * built-in phone number formatting. - * @author James May */ @SuppressWarnings("serial") private static final class PhoneFormat extends Format { @@ -1312,6 +1307,7 @@ public class DataFormatter { private CellFormatResultWrapper(CellFormatResult result) { this.result = result; } + @Override public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { if (emulateCSV) { return toAppendTo.append(result.text); @@ -1319,6 +1315,7 @@ public class DataFormatter { return toAppendTo.append(result.text.trim()); } } + @Override public Object parseObject(String source, ParsePosition pos) { return null; // Not supported } diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/DataValidationHelper.java b/poi/src/main/java/org/apache/poi/ss/usermodel/DataValidationHelper.java index 2e749467e4..6a73a8c504 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/DataValidationHelper.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/DataValidationHelper.java @@ -18,29 +18,25 @@ package org.apache.poi.ss.usermodel; import org.apache.poi.ss.util.CellRangeAddressList; -/** - * @author <a href="rjankiraman@emptoris.com">Radhakrishnan J</a> - * - */ public interface DataValidationHelper { - + DataValidationConstraint createFormulaListConstraint(String listFormula); DataValidationConstraint createExplicitListConstraint(String[] listOfValues); DataValidationConstraint createNumericConstraint(int validationType,int operatorType, String formula1, String formula2); - + DataValidationConstraint createTextLengthConstraint(int operatorType, String formula1, String formula2); - + DataValidationConstraint createDecimalConstraint(int operatorType, String formula1, String formula2); - + DataValidationConstraint createIntegerConstraint(int operatorType, String formula1, String formula2); - + DataValidationConstraint createDateConstraint(int operatorType, String formula1, String formula2,String dateFormat); - + DataValidationConstraint createTimeConstraint(int operatorType, String formula1, String formula2); - + DataValidationConstraint createCustomConstraint(String formula); - + DataValidation createValidation(DataValidationConstraint constraint,CellRangeAddressList cellRangeAddressList); } diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/FontFamily.java b/poi/src/main/java/org/apache/poi/ss/usermodel/FontFamily.java index 829246678e..614789fb35 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/FontFamily.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/FontFamily.java @@ -21,8 +21,6 @@ package org.apache.poi.ss.usermodel; /** * The font family this font belongs to. A font family is a set of fonts having common stroke width and serif * characteristics. The font name overrides when there are conflicting values. - * - * @author Gisella Bronzetti */ public enum FontFamily { diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/FontScheme.java b/poi/src/main/java/org/apache/poi/ss/usermodel/FontScheme.java index 1bf2318362..d786bd7977 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/FontScheme.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/FontScheme.java @@ -24,8 +24,6 @@ package org.apache.poi.ss.usermodel; * When a new theme is chosen, every font that is part of a theme definition is updated to use the new major or minor font definition for that * theme. * Usually major fonts are used for styles like headings, and minor fonts are used for body & paragraph text. - * - * @author Gisella Bronzetti */ public enum FontScheme { diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/FontUnderline.java b/poi/src/main/java/org/apache/poi/ss/usermodel/FontUnderline.java index a78062b92b..5089d4ed0c 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/FontUnderline.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/FontUnderline.java @@ -19,8 +19,6 @@ package org.apache.poi.ss.usermodel; /** * the different types of possible underline formatting - * - * @author Gisella Bronzetti */ public enum FontUnderline { diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java b/poi/src/main/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java index 776c022d14..3138f6d9a3 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java @@ -23,13 +23,10 @@ import java.util.Map; /** * Evaluates formula cells.<p> - * + * * For performance reasons, this class keeps a cache of all previously calculated intermediate * cell values. Be sure to call {@link #clearAllCachedResultValues()} if any workbook cells are changed between * calls to evaluate~ methods on this class. - * - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * @author Josh Micich */ public interface FormulaEvaluator { @@ -40,7 +37,7 @@ public interface FormulaEvaluator { */ void clearAllCachedResultValues(); /** - * Should be called to tell the cell value cache that the specified (value or formula) cell + * Should be called to tell the cell value cache that the specified (value or formula) cell * has changed. * Failure to call this method after changing cell values will cause incorrect behaviour * of the evaluate~ methods of this class @@ -48,7 +45,7 @@ public interface FormulaEvaluator { void notifySetFormula(Cell cell); /** * Should be called to tell the cell value cache that the specified cell has just become a - * formula cell, or the formula text has changed + * formula cell, or the formula text has changed */ void notifyDeleteCell(Cell cell); @@ -62,14 +59,14 @@ public interface FormulaEvaluator { /** * Loops over all cells in all sheets of the associated workbook. - * For cells that contain formulas, their formulas are evaluated, + * For cells that contain formulas, their formulas are evaluated, * and the results are saved. These cells remain as formula cells. * For cells that do not contain formulas, no changes are made. - * This is a helpful wrapper around looping over all cells, and + * This is a helpful wrapper around looping over all cells, and * calling evaluateFormulaCell on each one. */ void evaluateAll(); - + /** * If cell contains a formula, the formula is evaluated and returned, * else the CellValue simply copies the appropriate cell value from @@ -97,7 +94,7 @@ public interface FormulaEvaluator { * and the result. If you want the cell replaced with * the result of the formula, use {@link #evaluateInCell(Cell)} * @param cell The cell to evaluate - * @return The type of the formula result, i.e. -1 if the cell is not a formula, + * @return The type of the formula result, i.e. -1 if the cell is not a formula, * or one of {@link CellType#NUMERIC}, {@link CellType#STRING}, * {@link CellType#BOOLEAN}, {@link CellType#ERROR} * Note: the cell's type remains as CellType.FORMULA however. @@ -121,7 +118,7 @@ public interface FormulaEvaluator { * @param cell The {@link Cell} to evaluate and modify. */ Cell evaluateInCell(Cell cell); - + /** * Sets up the Formula Evaluator to be able to reference and resolve * links to other workbooks, eg [Test.xls]Sheet1!A1. @@ -139,7 +136,7 @@ public interface FormulaEvaluator { * In some cases external workbooks referenced by formulas in the main workbook are not available. * With this method you can control how POI handles such missing references: * <ul> - * <li>by default ignoreMissingWorkbooks=false and POI throws + * <li>by default ignoreMissingWorkbooks=false and POI throws * {@link org.apache.poi.ss.formula.CollaboratingWorkbooksEnvironment.WorkbookNotFoundException} * if an external reference cannot be resolved</li> * <li>if ignoreMissingWorkbooks=true then POI uses cached formula result @@ -149,13 +146,13 @@ public interface FormulaEvaluator { * @param ignore whether to ignore missing references to external workbooks */ void setIgnoreMissingWorkbooks(boolean ignore); - + /** * Perform detailed output of formula evaluation for next evaluation only? * Is for developer use only (also developers using POI for their XLS files). * Log-Level WARN is for basic info, INFO for detailed information. These quite * high levels are used because you have to explicitly enable this specific logging. - + * @param value whether to perform detailed output */ void setDebugEvaluationOutputForNextEval(boolean value); diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/IndexedColors.java b/poi/src/main/java/org/apache/poi/ss/usermodel/IndexedColors.java index 19053f1cc1..4bf7daf354 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/IndexedColors.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/IndexedColors.java @@ -25,9 +25,6 @@ package org.apache.poi.ss.usermodel; * Each element corresponds to a color index (zero-based). When using the default indexed color palette, * the values are not written out, but instead are implied. When the color palette has been modified from default, * then the entire color palette is used. - * </p> - * - * @author Yegor Kozlov */ public enum IndexedColors { @@ -96,7 +93,7 @@ public enum IndexedColors { _values[color.index] = color; } } - + public final short index; IndexedColors(int idx){ @@ -111,9 +108,9 @@ public enum IndexedColors { public short getIndex(){ return index; } - + /** - * + * * * @param index the index of the color * @return the corresponding IndexedColors enum diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/PageOrder.java b/poi/src/main/java/org/apache/poi/ss/usermodel/PageOrder.java index c3faf36b3e..0e966c53b8 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/PageOrder.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/PageOrder.java @@ -19,8 +19,6 @@ package org.apache.poi.ss.usermodel; /** * Specifies printed page order. - * - * @author Gisella Bronzetti */ public enum PageOrder { diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/PaperSize.java b/poi/src/main/java/org/apache/poi/ss/usermodel/PaperSize.java index abd65f3eaa..3ccb916b1e 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/PaperSize.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/PaperSize.java @@ -19,8 +19,6 @@ package org.apache.poi.ss.usermodel; /** * The enumeration value indicating the possible paper size for a sheet - * - * @author Daniele Montagni */ public enum PaperSize { LETTER_PAPER, diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/PatternFormatting.java b/poi/src/main/java/org/apache/poi/ss/usermodel/PatternFormatting.java index 0eb0c589c7..6d1be84e16 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/PatternFormatting.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/PatternFormatting.java @@ -19,9 +19,6 @@ package org.apache.poi.ss.usermodel; -/** - * @author Yegor Kozlov - */ public interface PatternFormatting { /** No background */ public static final short NO_FILL = 0 ; diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/PrintCellComments.java b/poi/src/main/java/org/apache/poi/ss/usermodel/PrintCellComments.java index ecbea6dafe..35c97f7dab 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/PrintCellComments.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/PrintCellComments.java @@ -19,8 +19,6 @@ package org.apache.poi.ss.usermodel; /** * These enumerations specify how cell comments shall be displayed for paper printing purposes. - * - * @author Gisella Bronzetti */ public enum PrintCellComments { diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/PrintOrientation.java b/poi/src/main/java/org/apache/poi/ss/usermodel/PrintOrientation.java index 8d5716f31e..0cf07fc460 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/PrintOrientation.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/PrintOrientation.java @@ -19,8 +19,6 @@ package org.apache.poi.ss.usermodel; /** * The enumeration value indicating the print orientation for a sheet. - * - * @author Gisella Bronzetti */ public enum PrintOrientation { diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/RichTextString.java b/poi/src/main/java/org/apache/poi/ss/usermodel/RichTextString.java index 551fede973..e38f12355c 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/RichTextString.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/RichTextString.java @@ -18,14 +18,11 @@ package org.apache.poi.ss.usermodel; /** - * Rich text unicode string. These strings can have fonts + * Rich text unicode string. These strings can have fonts * applied to arbitary parts of the string. - * - * @author Glen Stampoultzis (glens at apache.org) - * @author Jason Height (jheight at apache.org) */ public interface RichTextString { - + /** * Applies a font to the specified characters of a string. * diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/ShapeTypes.java b/poi/src/main/java/org/apache/poi/ss/usermodel/ShapeTypes.java index 3c5747ee5a..8ff30b24ea 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/ShapeTypes.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/ShapeTypes.java @@ -18,8 +18,6 @@ package org.apache.poi.ss.usermodel; /** * All known types of automatic shapes in DrawingML - * - * @author Yegor Kozlov */ public class ShapeTypes { public static final int LINE = 1; diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/Sheet.java b/poi/src/main/java/org/apache/poi/ss/usermodel/Sheet.java index bc93818a5c..1186207bba 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/Sheet.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/Sheet.java @@ -127,7 +127,7 @@ public interface Sheet extends Iterable<Row> { * Get the hidden state for a given column * * @param columnIndex - the column to set (0-based) - * @return hidden - <code>false</code> if the column is visible + * @return hidden - {@code false} if the column is visible */ boolean isColumnHidden(int columnIndex); @@ -153,7 +153,7 @@ public interface Sheet extends Iterable<Row> { * in a cell that is formatted with the standard font (first font in the workbook).<p> * * Character width is defined as the maximum digit width - * of the numbers <code>0, 1, 2, ... 9</code> as rendered + * of the numbers {@code 0, 1, 2, ... 9} as rendered * using the default font (first font in the workbook).<p> * * Unless you are using a very special font, the default character is '0' (zero), @@ -166,19 +166,19 @@ public interface Sheet extends Iterable<Row> { * To compute the actual number of visible characters, * Excel uses the following formula (Section 3.3.1.12 of the OOXML spec):<p> * - * <code> + * {@code * width = Truncate([{Number of Visible Characters} * * {Maximum Digit Width} + {5 pixel padding}]/{Maximum Digit Width}*256)/256 - * </code> + * } * * Using the Calibri font as an example, the maximum digit width of 11 point font size is 7 pixels (at 96 dpi). - * If you set a column width to be eight characters wide, e.g. <code>setColumnWidth(columnIndex, 8*256)</code>, + * If you set a column width to be eight characters wide, e.g. {@code setColumnWidth(columnIndex, 8*256)}, * then the actual value of visible characters (the value shown in Excel) is derived from the following equation: - * <code> + * {@code * Truncate([numChars*7+5]/7*256)/256 = 8; - * </code> + * } * - * which gives <code>7.29</code>. + * which gives {@code 7.29}. * * @param columnIndex - the column to set (0-based) * @param width - the width in units of 1/256th of a character width @@ -191,7 +191,7 @@ public interface Sheet extends Iterable<Row> { * * <p> * Character width is defined as the maximum digit width - * of the numbers <code>0, 1, 2, ... 9</code> as rendered + * of the numbers {@code 0, 1, 2, ... 9} as rendered * using the default font (first font in the workbook) * </p> * @@ -409,7 +409,7 @@ public interface Sheet extends Iterable<Row> { /** * Flag indicating whether the sheet displays Automatic Page Breaks. * - * @param value <code>true</code> if the sheet displays Automatic Page Breaks. + * @param value {@code true} if the sheet displays Automatic Page Breaks. */ void setAutobreaks(boolean value); @@ -440,7 +440,7 @@ public interface Sheet extends Iterable<Row> { /** * Flag indicating whether the Fit to Page print option is enabled. * - * @param value <code>true</code> if the Fit to Page print option is enabled. + * @param value {@code true} if the Fit to Page print option is enabled. */ void setFitToPage(boolean value); @@ -455,7 +455,7 @@ public interface Sheet extends Iterable<Row> { * When false a summary row is inserted above the detailed data being summarized and a new outline level * is established on that row. * </p> - * @param value <code>true</code> if row summaries appear below detail in the outline + * @param value {@code true} if row summaries appear below detail in the outline */ void setRowSumsBelow(boolean value); @@ -470,14 +470,14 @@ public interface Sheet extends Iterable<Row> { * When false a summary column is inserted to the left of the detailed data being * summarized and a new outline level is established on that column. * </p> - * @param value <code>true</code> if col summaries appear right of the detail in the outline + * @param value {@code true} if col summaries appear right of the detail in the outline */ void setRowSumsRight(boolean value); /** * Flag indicating whether the sheet displays Automatic Page Breaks. * - * @return <code>true</code> if the sheet displays Automatic Page Breaks. + * @return {@code true} if the sheet displays Automatic Page Breaks. */ boolean getAutobreaks(); @@ -492,7 +492,7 @@ public interface Sheet extends Iterable<Row> { /** * Flag indicating whether the Fit to Page print option is enabled. * - * @return <code>true</code> if the Fit to Page print option is enabled. + * @return {@code true} if the Fit to Page print option is enabled. */ boolean getFitToPage(); @@ -507,7 +507,7 @@ public interface Sheet extends Iterable<Row> { * When false a summary row is inserted above the detailed data being summarized and a new outline level * is established on that row. * </p> - * @return <code>true</code> if row summaries appear below detail in the outline + * @return {@code true} if row summaries appear below detail in the outline */ boolean getRowSumsBelow(); @@ -522,7 +522,7 @@ public interface Sheet extends Iterable<Row> { * When false a summary column is inserted to the left of the detailed data being * summarized and a new outline level is established on that column. * </p> - * @return <code>true</code> if col summaries appear right of the detail in the outline + * @return {@code true} if col summaries appear right of the detail in the outline */ boolean getRowSumsRight(); @@ -530,7 +530,7 @@ public interface Sheet extends Iterable<Row> { * Gets the flag indicating whether this sheet displays the lines * between rows and columns to make editing and reading easier. * - * @return <code>true</code> if this sheet prints gridlines. + * @return {@code true} if this sheet prints gridlines. * @see #isDisplayGridlines() to check if gridlines are displayed on screen */ boolean isPrintGridlines(); @@ -539,7 +539,7 @@ public interface Sheet extends Iterable<Row> { * Sets the flag indicating whether this sheet should print the lines * between rows and columns to make editing and reading easier. * - * @param show <code>true</code> if this sheet should print gridlines. + * @param show {@code true} if this sheet should print gridlines. * @see #setDisplayGridlines(boolean) to display gridlines on screen */ void setPrintGridlines(boolean show); @@ -548,7 +548,7 @@ public interface Sheet extends Iterable<Row> { * Gets the flag indicating whether this sheet prints the * row and column headings when printing. * - * @return <code>true</code> if this sheet prints row and column headings. + * @return {@code true} if this sheet prints row and column headings. */ boolean isPrintRowAndColumnHeadings(); @@ -556,7 +556,7 @@ public interface Sheet extends Iterable<Row> { * Sets the flag indicating whether this sheet should print * row and columns headings when printing. * - * @param show <code>true</code> if this sheet should print row and column headings. + * @param show {@code true} if this sheet should print row and column headings. */ void setPrintRowAndColumnHeadings(boolean show); @@ -572,7 +572,7 @@ public interface Sheet extends Iterable<Row> { * * Note that XSSF offers more kinds of document headers than HSSF does * - * @return the document header. Never <code>null</code> + * @return the document header. Never {@code null} */ Header getHeader(); @@ -581,7 +581,7 @@ public interface Sheet extends Iterable<Row> { * * Note that XSSF offers more kinds of document footers than HSSF does. * - * @return the document footer. Never <code>null</code> + * @return the document footer. Never {@code null} */ Footer getFooter(); @@ -590,7 +590,7 @@ public interface Sheet extends Iterable<Row> { * * Note: multiple sheets can be selected, but only one sheet can be active at one time. * - * @param value <code>true</code> if this sheet is selected + * @param value {@code true} if this sheet is selected * @see Workbook#setActiveSheet(int) */ void setSelected(boolean value); @@ -620,7 +620,7 @@ public interface Sheet extends Iterable<Row> { /** * Sets the protection enabled as well as the password - * @param password to set for protection. Pass <code>null</code> to remove protection + * @param password to set for protection. Pass {@code null} to remove protection */ void protectSheet(String password); @@ -809,8 +809,8 @@ public interface Sheet extends Iterable<Row> { * Sets a page break at the indicated row * Breaks occur above the specified row and left of the specified column inclusive. * - * For example, <code>sheet.setColumnBreak(2);</code> breaks the sheet into two parts - * with columns A,B,C in the first and D,E,... in the second. Similar, <code>sheet.setRowBreak(2);</code> + * For example, {@code sheet.setColumnBreak(2);} breaks the sheet into two parts + * with columns A,B,C in the first and D,E,... in the second. Similar, {@code sheet.setRowBreak(2);} * breaks the sheet into two parts with first three rows (rownum=1...3) in the first part * and rows starting with rownum=4 in the second. * @@ -847,8 +847,8 @@ public interface Sheet extends Iterable<Row> { * Sets a page break at the indicated column. * Breaks occur above the specified row and left of the specified column inclusive. * - * For example, <code>sheet.setColumnBreak(2);</code> breaks the sheet into two parts - * with columns A,B,C in the first and D,E,... in the second. Similar, <code>sheet.setRowBreak(2);</code> + * For example, {@code sheet.setColumnBreak(2);} breaks the sheet into two parts + * with columns A,B,C in the first and D,E,... in the second. Similar, {@code sheet.setRowBreak(2);} * breaks the sheet into two parts with first three rows (rownum=1...3) in the first part * and rows starting with rownum=4 in the second. * @@ -958,7 +958,7 @@ public interface Sheet extends Iterable<Row> { /** * Returns cell comment for the specified location * - * @return cell comment or <code>null</code> if not found + * @return cell comment or {@code null} if not found */ Comment getCellComment(CellAddress ref); @@ -1005,7 +1005,7 @@ public interface Sheet extends Iterable<Row> { /** * Note - this is not the same as whether the sheet is focused (isActive) - * @return <code>true</code> if this sheet is currently selected + * @return {@code true} if this sheet is currently selected */ boolean isSelected(); @@ -1052,7 +1052,7 @@ public interface Sheet extends Iterable<Row> { AutoFilter setAutoFilter(CellRangeAddress range); /** - * The 'Conditional Formatting' facet for this <tt>Sheet</tt> + * The 'Conditional Formatting' facet for this {@code Sheet} * * @return conditional formatting rule for this sheet */ @@ -1182,7 +1182,7 @@ public interface Sheet extends Iterable<Row> { List<? extends Hyperlink> getHyperlinkList(); /** - * Return location of the active cell, e.g. <code>A1</code>. + * Return location of the active cell, e.g. {@code A1}. * * @return the location of the active cell. * @since 3.14beta1 @@ -1192,7 +1192,7 @@ public interface Sheet extends Iterable<Row> { /** * Sets location of the active cell * - * @param address the location of the active cell, e.g. <code>A1</code>. + * @param address the location of the active cell, e.g. {@code A1}. * @since 3.14beta1 */ void setActiveCell(CellAddress address); diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/SheetConditionalFormatting.java b/poi/src/main/java/org/apache/poi/ss/usermodel/SheetConditionalFormatting.java index 98e2aa7846..755fbd7986 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/SheetConditionalFormatting.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/SheetConditionalFormatting.java @@ -23,7 +23,7 @@ import org.apache.poi.ss.usermodel.IconMultiStateFormatting.IconSet; import org.apache.poi.ss.util.CellRangeAddress; /** - * The 'Conditional Formatting' facet of <tt>Sheet</tt> + * The 'Conditional Formatting' facet of {@code Sheet} * * @since 3.8 */ @@ -88,7 +88,7 @@ public interface SheetConditionalFormatting { * </p> * * @param comparisonOperation - MUST be a constant value from - * <tt>{@link ComparisonOperator}</tt>: <p> + * {@link ComparisonOperator}: * <ul> * <li>BETWEEN</li> * <li>NOT_BETWEEN</li> @@ -99,7 +99,6 @@ public interface SheetConditionalFormatting { * <li>GE</li> * <li>LE</li> * </ul> - * </p> * @param formula1 - formula for the valued, compared with the cell * @param formula2 - second formula (only used with * {@link ComparisonOperator#BETWEEN}) and {@link ComparisonOperator#NOT_BETWEEN} operations) @@ -117,7 +116,7 @@ public interface SheetConditionalFormatting { * </p> * * @param comparisonOperation MUST be a constant value from - * <tt>{@link ComparisonOperator}</tt> except BETWEEN and NOT_BETWEEN + * {@link ComparisonOperator} except BETWEEN and NOT_BETWEEN * * @param formula the formula to determine if the conditional formatting is applied */ @@ -138,20 +137,20 @@ public interface SheetConditionalFormatting { /** * Create a Databar conditional formatting rule. - * <p>The thresholds and colour for it will be created, but will be - * empty and require configuring with + * <p>The thresholds and colour for it will be created, but will be + * empty and require configuring with * {@link ConditionalFormattingRule#getDataBarFormatting()} * then * {@link DataBarFormatting#getMinThreshold()} - * and + * and * {@link DataBarFormatting#getMaxThreshold()} */ ConditionalFormattingRule createConditionalFormattingRule(ExtendedColor color); - + /** * Create an Icon Set / Multi-State conditional formatting rule. * <p>The thresholds for it will be created, but will be empty - * and require configuring with + * and require configuring with * {@link ConditionalFormattingRule#getMultiStateFormatting()} * then * {@link IconMultiStateFormatting#getThresholds()} @@ -160,8 +159,8 @@ public interface SheetConditionalFormatting { /** * Create a Color Scale / Color Gradient conditional formatting rule. - * <p>The thresholds and colours for it will be created, but will be - * empty and require configuring with + * <p>The thresholds and colours for it will be created, but will be + * empty and require configuring with * {@link ConditionalFormattingRule#getColorScaleFormatting()} * then * {@link ColorScaleFormatting#getThresholds()} @@ -169,12 +168,12 @@ public interface SheetConditionalFormatting { * {@link ColorScaleFormatting#getColors()} */ ConditionalFormattingRule createConditionalFormattingColorScaleRule(); - + /** * Gets Conditional Formatting object at a particular index * * @param index 0-based index of the Conditional Formatting object to fetch - * @return Conditional Formatting object or <code>null</code> if not found + * @return Conditional Formatting object or {@code null} if not found * @throws IllegalArgumentException if the index is outside of the allowable range (0 ... numberOfFormats-1) */ ConditionalFormatting getConditionalFormattingAt(int index); 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 ffe672f7ee..6312673b57 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 @@ -26,22 +26,22 @@ import org.apache.poi.util.StringUtil; public class AreaReference { - /** The character (!) that separates sheet names from cell references */ + /** The character (!) that separates sheet names from cell references */ private static final char SHEET_NAME_DELIMITER = '!'; /** The character (:) that separates the two cell references in a multi-cell area reference */ private static final char CELL_DELIMITER = ':'; /** The character (') used to quote sheet names when they contain special characters */ private static final char SPECIAL_NAME_DELIMITER = '\''; private static final SpreadsheetVersion DEFAULT_SPREADSHEET_VERSION = SpreadsheetVersion.EXCEL97; - + private final CellReference _firstCell; private final CellReference _lastCell; private final boolean _isSingleCell; private final SpreadsheetVersion _version; // never null - + /** * Create an area ref from a string representation. Sheet names containing special characters should be - * delimited and escaped as per normal syntax rules for formulas.<br> + * delimited and escaped as per normal syntax rules for formulas.<br> * The area reference must be contiguous (i.e. represent a single rectangle, not a union of rectangles) */ public AreaReference(String reference, SpreadsheetVersion version) { @@ -58,7 +58,7 @@ public class AreaReference { // TODO - probably shouldn't initialize area ref when text is really a cell ref // Need to fix some named range stuff to get rid of this _firstCell = new CellReference(part0); - + _lastCell = _firstCell; _isSingleCell = true; return; @@ -66,7 +66,7 @@ public class AreaReference { if (parts.length != 2) { throw new IllegalArgumentException("Bad area ref '" + reference + "'"); } - + String part1 = parts[1]; if (isPlainColumn(part0)) { if (!isPlainColumn(part1)) { @@ -78,10 +78,10 @@ public class AreaReference { boolean firstIsAbs = CellReference.isPartAbsolute(part0); boolean lastIsAbs = CellReference.isPartAbsolute(part1); - + int col0 = CellReference.convertColStringToIndex(part0); int col1 = CellReference.convertColStringToIndex(part1); - + _firstCell = new CellReference(0, col0, true, firstIsAbs); _lastCell = new CellReference(0xFFFF, col1, true, lastIsAbs); _isSingleCell = false; @@ -92,7 +92,7 @@ public class AreaReference { _isSingleCell = part0.equals(part1); } } - + /** * Creates an area ref from a pair of Cell References. */ @@ -145,7 +145,7 @@ public class AreaReference { } _isSingleCell = false; } - + private static boolean isPlainColumn(String refPart) { for(int i=refPart.length()-1; i>=0; i--) { int ch = refPart.charAt(i); @@ -190,9 +190,9 @@ public class AreaReference { */ public static boolean isWholeColumnReference(SpreadsheetVersion version, CellReference topLeft, CellReference botRight) { if (null == version) { - version = DEFAULT_SPREADSHEET_VERSION; // how the code used to behave. + version = DEFAULT_SPREADSHEET_VERSION; // how the code used to behave. } - + // These are represented as something like // C$1:C$65535 or D$1:F$0 // i.e. absolute from 1st row to 0th one @@ -222,7 +222,7 @@ public class AreaReference { * Separates Area refs in two parts and returns them as separate elements in a String array, * each qualified with the sheet name (if present) * - * @return array with one or two elements. never <code>null</code> + * @return array with one or two elements. never {@code null} */ private static String[] separateAreaRefs(String reference) { // TODO - refactor cell reference parsing logic to one place. @@ -322,13 +322,13 @@ public class AreaReference { } return results.toArray(new String[0]); } - + public boolean isWholeColumnReference() { return isWholeColumnReference(_version, _firstCell, _lastCell); } - + /** - * @return <code>false</code> if this area reference involves more than one cell + * @return {@code false} if this area reference involves more than one cell */ public boolean isSingleCell() { return _isSingleCell; @@ -344,7 +344,7 @@ public class AreaReference { /** * Note - if this area reference refers to a single cell, the return value of this method will - * be identical to that of <tt>getFirstCell()</tt> + * be identical to that of {@code getFirstCell()} * @return the second cell reference which defines this area. For multi-cell areas, this is * cell diagonally opposite the 'first cell'. Usually this cell is in the lower right corner * of the area (but this is not a requirement). diff --git a/poi/src/main/java/org/apache/poi/ss/util/CellAddress.java b/poi/src/main/java/org/apache/poi/ss/util/CellAddress.java index f9129647d9..197cc0e5c2 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/CellAddress.java +++ b/poi/src/main/java/org/apache/poi/ss/util/CellAddress.java @@ -26,11 +26,11 @@ import org.apache.poi.ss.usermodel.Cell; * It is barely a container for these two coordinates. The implementation * of the Comparable interface sorts by "natural" order top left to bottom right.</p> * - * <p>Use <tt>CellAddress</tt> when you want to refer to the location of a cell in a sheet + * <p>Use {@code CellAddress} when you want to refer to the location of a cell in a sheet * when the concept of relative/absolute does not apply (such as the anchor location * of a cell comment). Use {@link CellReference} when the concept of * relative/absolute does apply (such as a cell reference in a formula). - * <tt>CellAddress</tt>es do not have a concept of "sheet", while <tt>CellReference</tt>s do.</p> + * {@code CellAddress}es do not have a concept of "sheet", while {@code CellReference}s do.</p> */ public class CellAddress implements Comparable<CellAddress> { /** A constant for references to the first cell in a sheet. */ @@ -127,7 +127,6 @@ public class CellAddress implements Comparable<CellAddress> { * Compare this CellAddress using the "natural" row-major, column-minor ordering. * That is, top-left to bottom-right ordering. * - * @param other * @return <ul> * <li>-1 if this CellAddress is before (above/left) of other</li> * <li>0 if addresses are the same</li> @@ -137,16 +136,8 @@ public class CellAddress implements Comparable<CellAddress> { @Override public int compareTo(CellAddress other) { int r = this._row-other._row; - if (r!=0) { - return r; - } - - r = this._col-other._col; - if (r!=0) { - return r; - } + return r != 0 ? r : this._col - other._col; - return 0; } @Override diff --git a/poi/src/main/java/org/apache/poi/ss/util/CellRangeAddress.java b/poi/src/main/java/org/apache/poi/ss/util/CellRangeAddress.java index 1a3bc11746..328148d3c4 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/CellRangeAddress.java +++ b/poi/src/main/java/org/apache/poi/ss/util/CellRangeAddress.java @@ -29,7 +29,6 @@ import org.apache.poi.util.LittleEndianOutput; * Ref8U - see page 831 of version 1.0 of the documentation. * * Note - {@link SelectionRecord} uses the BIFF5 version of this structure - * @author Dragos Buleandra (dragos.buleandra@trade2b.ro) */ public class CellRangeAddress extends CellRangeAddressBase { public static final int ENCODED_SIZE = 8; diff --git a/poi/src/main/java/org/apache/poi/ss/util/CellRangeAddressList.java b/poi/src/main/java/org/apache/poi/ss/util/CellRangeAddressList.java index c4ac6289b7..fe48e19ddc 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/CellRangeAddressList.java +++ b/poi/src/main/java/org/apache/poi/ss/util/CellRangeAddressList.java @@ -37,20 +37,19 @@ import org.apache.poi.util.LittleEndianOutput; * several records (not formulas). A cell range address list consists of a field * with the number of ranges and the list of the range addresses. Each cell * range address (called an ADDR structure) contains 4 16-bit-values. - * </p> */ public class CellRangeAddressList implements GenericRecord { /** - * List of <tt>CellRangeAddress</tt>es. Each structure represents a cell range + * List of {@code CellRangeAddress}es. Each structure represents a cell range */ protected final List<CellRangeAddress> _list = new ArrayList<>(); public CellRangeAddressList() { } /** - * Convenience constructor for creating a <tt>CellRangeAddressList</tt> with a single - * <tt>CellRangeAddress</tt>. Other <tt>CellRangeAddress</tt>es may be added later. + * Convenience constructor for creating a {@code CellRangeAddressList} with a single + * {@code CellRangeAddress}. Other {@code CellRangeAddress}es may be added later. */ public CellRangeAddressList(int firstRow, int lastRow, int firstCol, int lastCol) { addCellRangeAddress(firstRow, firstCol, lastRow, lastCol); @@ -104,7 +103,7 @@ public class CellRangeAddressList implements GenericRecord { } /** - * @return <tt>CellRangeAddress</tt> at the given index + * @return {@code CellRangeAddress} at the given index */ public CellRangeAddress getCellRangeAddress(int index) { return _list.get(index); 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 6ba8c566de..f1132285ac 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 @@ -38,12 +38,12 @@ import org.apache.poi.util.GenericRecordUtil; * style references. Handles sheet-based and sheet-free references * as well, eg "Sheet1!A1" and "$B$72"</p> * - * <p>Use <tt>CellReference</tt> when the concept of + * <p>Use {@code CellReference} when the concept of * relative/absolute does apply (such as a cell reference in a formula). * Use {@link CellAddress} when you want to refer to the location of a cell in a sheet * when the concept of relative/absolute does not apply (such as the anchor location * of a cell comment). - * <tt>CellReference</tt>s have a concept of "sheet", while <tt>CellAddress</tt>es do not.</p> + * {@code CellReference}s have a concept of "sheet", while {@code CellAddress}es do not.</p> */ public class CellReference implements GenericRecord { /** @@ -177,7 +177,7 @@ public class CellReference implements GenericRecord { public boolean isRowAbsolute(){return _isRowAbs;} public boolean isColAbsolute(){return _isColAbs;} /** - * @return possibly <code>null</code> if this is a 2D reference. Special characters are not + * @return possibly {@code null} if this is a 2D reference. Special characters are not * escaped or delimited */ public String getSheetName(){ @@ -216,7 +216,7 @@ public class CellReference implements GenericRecord { /** * Classifies an identifier as either a simple (2D) cell reference or a named range name - * @return one of the values from <tt>NameType</tt> + * @return one of the values from {@code NameType} */ public static NameType classifyCellReference(String str, SpreadsheetVersion ssVersion) { int len = str.length(); @@ -290,7 +290,6 @@ public class CellReference implements GenericRecord { * reference is valid (in range) becomes important. * <p> * Note - that the maximum sheet size varies across Excel versions: - * <p> * <blockquote><table border="0" cellpadding="1" cellspacing="0" * summary="Notable cases."> * <tr><th>Version </th><th>File Format </th> @@ -317,7 +316,7 @@ public class CellReference implements GenericRecord { * * @param colStr a string of only letter characters * @param rowStr a string of only digit characters - * @return <code>true</code> if the row and col parameters are within range of a BIFF8 spreadsheet. + * @return {@code true} if the row and col parameters are within range of a BIFF8 spreadsheet. */ public static boolean cellReferenceIsWithinRange(String colStr, String rowStr, SpreadsheetVersion ssVersion) { if (!isColumnWithinRange(colStr, ssVersion)) { diff --git a/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java b/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java index 4d5e3e01c7..1a7c4aaf65 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java +++ b/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java @@ -44,12 +44,9 @@ import org.apache.poi.ss.usermodel.Workbook; * style change to a cell, the code will attempt to see if a style already exists that meets your * needs. If not, then it will create a new style. This is to prevent creating too many styles. * there is an upper limit in Excel on the number of styles that can be supported. - * - *@author Eric Pugh epugh@upstate.com - *@author (secondary) Avinash Kewalramani akewalramani@accelrys.com */ public final class CellUtil { - + private static final Logger LOGGER = LogManager.getLogger(CellUtil.class); // FIXME: Move these constants into an enum @@ -73,7 +70,7 @@ public final class CellUtil { public static final String ROTATION = "rotation"; public static final String VERTICAL_ALIGNMENT = "verticalAlignment"; public static final String WRAP_TEXT = "wrapText"; - + private static final Set<String> shortValues = Collections.unmodifiableSet( new HashSet<>(Arrays.asList( BOTTOM_BORDER_COLOR, @@ -87,8 +84,8 @@ public final class CellUtil { ROTATION ))); private static final Set<String> intValues = Collections.unmodifiableSet( - new HashSet<>(Arrays.asList( - FONT + new HashSet<>(Collections.singletonList( + FONT ))); private static final Set<String> booleanValues = Collections.unmodifiableSet( new HashSet<>(Arrays.asList( @@ -105,7 +102,7 @@ public final class CellUtil { ))); - private static UnicodeMapping[] unicodeMappings; + private static final UnicodeMapping[] unicodeMappings; private static final class UnicodeMapping { @@ -190,7 +187,7 @@ public final class CellUtil { /** * Take a cell, and align it. - * + * * This is superior to cell.getCellStyle().setAlignment(align) because * this method will not modify the CellStyle object that may be referenced * by multiple cells. Instead, this method will search for existing CellStyles @@ -206,10 +203,10 @@ public final class CellUtil { public static void setAlignment(Cell cell, HorizontalAlignment align) { setCellStyleProperty(cell, ALIGNMENT, align); } - + /** * Take a cell, and vertically align it. - * + * * This is superior to cell.getCellStyle().setVerticalAlignment(align) because * this method will not modify the CellStyle object that may be referenced * by multiple cells. Instead, this method will search for existing CellStyles @@ -225,13 +222,13 @@ public final class CellUtil { public static void setVerticalAlignment(Cell cell, VerticalAlignment align) { setCellStyleProperty(cell, VERTICAL_ALIGNMENT, align); } - + /** * Take a cell, and apply a font to it * * @param cell the cell to set the alignment for * @param font The Font that you want to set. - * @throws IllegalArgumentException if <tt>font</tt> and <tt>cell</tt> do not belong to the same workbook + * @throws IllegalArgumentException if {@code font} and {@code cell} do not belong to the same workbook */ public static void setFont(Cell cell, Font font) { // Check if font belongs to workbook @@ -248,19 +245,19 @@ public final class CellUtil { } /** - * <p>This method attempts to find an existing CellStyle that matches the <code>cell</code>'s - * current style plus styles properties in <code>properties</code>. A new style is created if the + * <p>This method attempts to find an existing CellStyle that matches the {@code cell}'s + * current style plus styles properties in {@code properties}. A new style is created if the * workbook does not contain a matching style.</p> - * - * <p>Modifies the cell style of <code>cell</code> without affecting other cells that use the + * + * <p>Modifies the cell style of {@code cell} without affecting other cells that use the * same style.</p> - * + * * <p>This is necessary because Excel has an upper limit on the number of styles that it supports.</p> - * + * * <p>This function is more efficient than multiple calls to * {@link #setCellStyleProperty(Cell, String, Object)} * if adding multiple cell styles.</p> - * + * * <p>For performance reasons, if this is the only cell in a workbook that uses a cell style, * this method does NOT remove the old style from the workbook. * <!-- NOT IMPLEMENTED: Unused styles should be @@ -304,18 +301,18 @@ public final class CellUtil { } /** - * <p>This method attempts to find an existing CellStyle that matches the <code>cell</code>'s - * current style plus a single style property <code>propertyName</code> with value - * <code>propertyValue</code>. + * <p>This method attempts to find an existing CellStyle that matches the {@code cell}'s + * current style plus a single style property {@code propertyName} with value + * {@code propertyValue}. * A new style is created if the workbook does not contain a matching style.</p> - * - * <p>Modifies the cell style of <code>cell</code> without affecting other cells that use the + * + * <p>Modifies the cell style of {@code cell} without affecting other cells that use the * same style.</p> - * + * * <p>If setting more than one cell style property on a cell, use * {@link #setCellStyleProperties(Cell, Map)}, * which is faster and does not add unnecessary intermediate CellStyles to the workbook.</p> - * + * * @param cell The cell that is to be changed. * @param propertyName The name of the property that is to be changed. * @param propertyValue The value of the property that is to be changed. @@ -327,8 +324,8 @@ public final class CellUtil { /** * Returns a map containing the format properties of the given cell style. - * The returned map is not tied to <code>style</code>, so subsequent changes - * to <code>style</code> will not modify the map, and changes to the returned + * The returned map is not tied to {@code style}, so subsequent changes + * to {@code style} will not modify the map, and changes to the returned * map will not modify the cell style. The returned map is mutable. * * @param style cell style @@ -359,7 +356,7 @@ public final class CellUtil { put(properties, WRAP_TEXT, style.getWrapText()); return properties; } - + /** * Copies the entries in src to dest, using the preferential data type * so that maps can be compared for equality @@ -452,7 +449,7 @@ public final class CellUtil { } return 0; } - + /** * Utility method that returns the named BorderStyle value from the given map. * @@ -469,7 +466,7 @@ public final class CellUtil { // @deprecated 3.15 beta 2. getBorderStyle will only work on BorderStyle enums instead of codes in the future. else if (value instanceof Short) { LOGGER.atWarn().log("Deprecation warning: CellUtil properties map uses Short values for {}. Should use BorderStyle enums instead.", name); - short code = ((Short) value).shortValue(); + short code = (Short) value; border = BorderStyle.valueOf(code); } else if (value == null) { @@ -480,7 +477,7 @@ public final class CellUtil { } return border; } - + /** * Utility method that returns the named FillPatternType value from the given map. * @@ -498,7 +495,7 @@ public final class CellUtil { // @deprecated 3.15 beta 2. getFillPattern will only work on FillPatternType enums instead of codes in the future. else if (value instanceof Short) { LOGGER.atWarn().log("Deprecation warning: CellUtil properties map uses Short values for {}. Should use FillPatternType enums instead.", name); - short code = ((Short) value).shortValue(); + short code = (Short) value; pattern = FillPatternType.forInt(code); } else if (value == null) { @@ -509,7 +506,7 @@ public final class CellUtil { } return pattern; } - + /** * Utility method that returns the named HorizontalAlignment value from the given map. * @@ -527,7 +524,7 @@ public final class CellUtil { // @deprecated 3.15 beta 2. getHorizontalAlignment will only work on HorizontalAlignment enums instead of codes in the future. else if (value instanceof Short) { LOGGER.atWarn().log("Deprecation warning: CellUtil properties map used a Short value for {}. Should use HorizontalAlignment enums instead.", name); - short code = ((Short) value).shortValue(); + short code = (Short) value; align = HorizontalAlignment.forInt(code); } else if (value == null) { @@ -538,7 +535,7 @@ public final class CellUtil { } return align; } - + /** * Utility method that returns the named VerticalAlignment value from the given map. * @@ -556,7 +553,7 @@ public final class CellUtil { // @deprecated 3.15 beta 2. getVerticalAlignment will only work on VerticalAlignment enums instead of codes in the future. else if (value instanceof Short) { LOGGER.atWarn().log("Deprecation warning: CellUtil properties map used a Short value for {}. Should use VerticalAlignment enums instead.", name); - short code = ((Short) value).shortValue(); + short code = (Short) value; align = VerticalAlignment.forInt(code); } else if (value == null) { @@ -580,7 +577,7 @@ public final class CellUtil { Object value = properties.get(name); //noinspection SimplifiableIfStatement if (value instanceof Boolean) { - return ((Boolean) value).booleanValue(); + return (Boolean) value; } return false; } diff --git a/poi/src/main/java/org/apache/poi/ss/util/ExpandedDouble.java b/poi/src/main/java/org/apache/poi/ss/util/ExpandedDouble.java index 40d4066af8..fd0c3d39d8 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/ExpandedDouble.java +++ b/poi/src/main/java/org/apache/poi/ss/util/ExpandedDouble.java @@ -29,10 +29,8 @@ import static org.apache.poi.ss.util.IEEEDouble.*; * <br> * where:<br> * - * <tt>a</tt> = <i>significand</i><br> - * <tt>b</tt> = <i>binaryExponent</i> - bitLength(significand) + 1<br> - * - * @author Josh Micich + * {@code a} = <i>significand</i><br> + * {@code b} = <i>binaryExponent</i> - bitLength(significand) + 1<br> */ final class ExpandedDouble { private static final BigInteger BI_FRAC_MASK = BigInteger.valueOf(FRAC_MASK); @@ -60,7 +58,7 @@ final class ExpandedDouble { BigInteger frac = BigInteger.valueOf(rawBits).and(BI_FRAC_MASK); int expAdj = 64 - frac.bitLength(); _significand = frac.shiftLeft(expAdj); - _binaryExponent = (biasedExp & 0x07FF) - 1023 - expAdj; + _binaryExponent = -1023 - expAdj; } else { _significand = getFrac(rawBits); _binaryExponent = (biasedExp & 0x07FF) - 1023; diff --git a/poi/src/main/java/org/apache/poi/ss/util/IEEEDouble.java b/poi/src/main/java/org/apache/poi/ss/util/IEEEDouble.java index 91d8fea434..bb1fca7769 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/IEEEDouble.java +++ b/poi/src/main/java/org/apache/poi/ss/util/IEEEDouble.java @@ -20,8 +20,6 @@ package org.apache.poi.ss.util; /** * For working with the internals of IEEE 754-2008 'binary64' (double precision) floating point numbers - * - * @author Josh Micich */ final class IEEEDouble { private static final long EXPONENT_MASK = 0x7FF0000000000000L; diff --git a/poi/src/main/java/org/apache/poi/ss/util/NormalisedDecimal.java b/poi/src/main/java/org/apache/poi/ss/util/NormalisedDecimal.java index 6c945f26b5..633dc49acd 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/NormalisedDecimal.java +++ b/poi/src/main/java/org/apache/poi/ss/util/NormalisedDecimal.java @@ -38,9 +38,7 @@ import java.math.BigInteger; * <br> * where:<br> * - * <tt>significand</tt> = wholePart + fractionalPart / 2<sup>24</sup><br> - * - * @author Josh Micich + * {@code significand} = wholePart + fractionalPart / 2<sup>24</sup><br> */ final class NormalisedDecimal { /** @@ -168,10 +166,10 @@ final class NormalisedDecimal { * The resulting transformed object is easily converted to a 64 bit IEEE double: * <ul> * <li>bits 2-53 of the {@link #composeFrac()} become the 52 bit 'fraction'.</li> - * <li>{@link #getBinaryExponent()} is biased by 1023 to give the 'exponent'.</li> + * <li>{@link #getDecimalExponent()} is biased by 1023 to give the 'exponent'.</li> * </ul> * The sign bit must be obtained from somewhere else. - * @return a new {@link NormalisedDecimal} normalised to base 2 representation. + * @return a new NormalisedDecimal normalised to base 2 representation. */ public ExpandedDouble normaliseBaseTwo() { MutableFPNumber cc = new MutableFPNumber(composeFrac(), 39); diff --git a/poi/src/main/java/org/apache/poi/ss/util/NumberComparer.java b/poi/src/main/java/org/apache/poi/ss/util/NumberComparer.java index 31be44e834..0a6b35de44 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/NumberComparer.java +++ b/poi/src/main/java/org/apache/poi/ss/util/NumberComparer.java @@ -24,9 +24,6 @@ import static org.apache.poi.ss.util.IEEEDouble.*; /** * Excel compares numbers using different rules to those of java, so * {@link Double#compare(double, double)} won't do. - * - * - * @author Josh Micich */ public final class NumberComparer { @@ -37,10 +34,9 @@ public final class NumberComparer { * decimal digits of precision and a decimal exponent, before completing the comparison. * <p> * In Excel formula evaluation, expressions like "(0.06-0.01)=0.05" evaluate to "TRUE" even - * though the equivalent java expression is <code>false</code>. In examples like this, + * though the equivalent java expression is {@code false}. In examples like this, * Excel achieves the effect by having additional logic for comparison operations. * <p> - * <p> * Note - Excel also gives special treatment to expressions like "0.06-0.01-0.05" which * evaluates to "0" (in java, rounding anomalies give a result of 6.9E-18). The special * behaviour here is for different reasons to the example above: If the last operator in a @@ -55,8 +51,8 @@ public final class NumberComparer { * This rule (for rounding the result of a final addition or subtraction), has not been * implemented in POI (as of Jul-2009). * - * @return <code>negative, 0, or positive</code> according to the standard Excel comparison - * of values <tt>a</tt> and <tt>b</tt>. + * @return {@code negative, 0, or positive} according to the standard Excel comparison + * of values {@code a} and {@code b}. */ public static int compare(double a, double b) { long rawBitsA = Double.doubleToLongBits(a); @@ -142,7 +138,7 @@ public final class NumberComparer { * Usually any normal number is greater (in magnitude) than any subnormal number. * However there are some anomalous cases around the threshold where Excel produces screwy results * @param isNegative both values are either negative or positive. This parameter affects the sign of the comparison result - * @return usually <code>isNegative ? -1 : +1</code> + * @return usually {@code isNegative ? -1 : +1} */ private static int compareAcrossSubnormalThreshold(long normalRawBitsA, long subnormalRawBitsB, boolean isNegative) { long fracB = subnormalRawBitsB & FRAC_MASK; 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 7023063de2..c41cc96f67 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 @@ -20,14 +20,14 @@ package org.apache.poi.ss.util; /** * Excel converts numbers to text with different rules to those of java, so - * <code>Double.toString(value)</tt> won't do. + * {@code Double.toString(value)} won't do. * <ul> * <li>No more than 15 significant figures are output (java does 18).</li> * <li>The sign char for the exponent is included even if positive</li> - * <li>Special values (<tt>NaN</tt> and <tt>Infinity</tt>) get rendered like the ordinary + * <li>Special values ({@code NaN} and {@code Infinity}) get rendered like the ordinary * number that the bit pattern represents.</li> * <li>Denormalised values (between ±2<sup>-1074</sup> and ±2<sup>-1022</sup> - * are displayed as "0"</sup> + * are displayed as "0"</li> * </ul> * IEEE 64-bit Double Rendering Comparison * @@ -106,8 +106,6 @@ package org.apache.poi.ss.util; * Excel's text to number conversion is not a true <i>inverse</i> of this operation. The * allowable ranges are different. Some numbers that don't correctly convert to text actually * <b>do</b> get handled properly when used in arithmetic evaluations. - * - * @author Josh Micich */ public final class NumberToTextConverter { @@ -119,9 +117,9 @@ public final class NumberToTextConverter { } /** - * Converts the supplied <tt>value</tt> to the text representation that Excel would give if + * Converts the supplied {@code value} to the text representation that Excel would give if * the value were to appear in an unformatted cell, or as a literal number in a formula.<br> - * Note - the results from this method differ slightly from those of <tt>Double.toString()</tt> + * Note - the results from this method differ slightly from those of {@code Double.toString()} * In some special cases Excel behaves quite differently. This function attempts to reproduce * those results. */ diff --git a/poi/src/main/java/org/apache/poi/ss/util/SSCellRange.java b/poi/src/main/java/org/apache/poi/ss/util/SSCellRange.java index 766e2e3564..776d00f5d1 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/SSCellRange.java +++ b/poi/src/main/java/org/apache/poi/ss/util/SSCellRange.java @@ -58,25 +58,31 @@ public final class SSCellRange<K extends Cell> implements CellRange<K> { return new SSCellRange<>(firstRow, firstColumn, height, width, flattenedArray); } - public int getHeight() { + @Override + public int getHeight() { return _height; } + @Override public int getWidth() { return _width; } + @Override public int size() { return _height*_width; } + @Override public String getReferenceText() { CellRangeAddress cra = new CellRangeAddress(_firstRow, _firstRow+_height-1, _firstColumn, _firstColumn+_width-1); return cra.formatAsString(); } + @Override public K getTopLeftCell() { return _flattenedArray[0]; } + @Override public K getCell(int relativeRowIndex, int relativeColumnIndex) { if (relativeRowIndex < 0 || relativeRowIndex >= _height) { throw new ArrayIndexOutOfBoundsException("Specified row " + relativeRowIndex @@ -89,10 +95,12 @@ public final class SSCellRange<K extends Cell> implements CellRange<K> { int flatIndex = _width * relativeRowIndex + relativeColumnIndex; return _flattenedArray[flatIndex]; } + @Override public K[] getFlattenedCells() { return _flattenedArray.clone(); } + @Override public K[][] getCells() { Class<?> itemCls = _flattenedArray.getClass(); @SuppressWarnings("unchecked") @@ -107,6 +115,7 @@ public final class SSCellRange<K extends Cell> implements CellRange<K> { return result; } + @Override public Iterator<K> iterator() { return Stream.of(_flattenedArray).iterator(); } diff --git a/poi/src/main/java/org/apache/poi/ss/util/SheetBuilder.java b/poi/src/main/java/org/apache/poi/ss/util/SheetBuilder.java index 32fdb134a3..cff608a0a9 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/SheetBuilder.java +++ b/poi/src/main/java/org/apache/poi/ss/util/SheetBuilder.java @@ -5,9 +5,9 @@ The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,8 +28,6 @@ import org.apache.poi.ss.usermodel.Cell; * Class {@code SheetBuilder} provides an easy way of building workbook sheets * from 2D array of Objects. It can be used in test cases to improve code * readability or in Swing applications with tables. - * - * @author Roman Kashitsyn */ public class SheetBuilder { diff --git a/poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java b/poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java index 5033e8ec85..cda7674c83 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java +++ b/poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java @@ -43,8 +43,6 @@ import org.apache.poi.util.Internal; /** * Helper methods for when working with Usermodel sheets - * - * @author Yegor Kozlov */ public class SheetUtil { diff --git a/poi/src/main/java/org/apache/poi/ss/util/WorkbookUtil.java b/poi/src/main/java/org/apache/poi/ss/util/WorkbookUtil.java index 8475a0d53c..9153113e70 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/WorkbookUtil.java +++ b/poi/src/main/java/org/apache/poi/ss/util/WorkbookUtil.java @@ -21,10 +21,10 @@ package org.apache.poi.ss.util; * Helper methods for when working with Usermodel Workbooks */ public class WorkbookUtil { - + /** * Creates a valid sheet name, which is conform to the rules. - * In any case, the result safely can be used for + * In any case, the result safely can be used for * {@link org.apache.poi.ss.usermodel.Workbook#setSheetName(int, String)}. * <br> * Rules: @@ -36,10 +36,10 @@ public class WorkbookUtil { * <li>Sheet names must not begin or end with ' (apostrophe)</li> * </ul> * Invalid characters are replaced by one space character ' '. - * + * * @param nameProposal can be any string, will be truncated if necessary, * allowed to be null - * @return a valid string, "empty" if to short, "null" if null + * @return a valid string, "empty" if to short, "null" if null */ public static String createSafeSheetName(final String nameProposal) { return createSafeSheetName(nameProposal, ' '); @@ -104,7 +104,7 @@ public class WorkbookUtil { * Validates sheet name. * * <p> - * The character count <tt>MUST</tt> be greater than or equal to 1 and less than or equal to 31. + * The character count {@code MUST} be greater than or equal to 1 and less than or equal to 31. * The string MUST NOT contain the any of the following characters: * <ul> * <li> 0x0000 </li> @@ -118,7 +118,6 @@ public class WorkbookUtil { * <li> closing square bracket (]) </li> * </ul> * The string MUST NOT begin or end with the single quote (') character. - * </p> * * @param sheetName the name to validate * @throws IllegalArgumentException if validation fails diff --git a/poi/src/main/java/org/apache/poi/ss/util/cellwalk/CellHandler.java b/poi/src/main/java/org/apache/poi/ss/util/cellwalk/CellHandler.java index 9fb4542c7d..25e8830434 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/cellwalk/CellHandler.java +++ b/poi/src/main/java/org/apache/poi/ss/util/cellwalk/CellHandler.java @@ -5,9 +5,9 @@ The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,8 +20,7 @@ package org.apache.poi.ss.util.cellwalk; import org.apache.poi.ss.usermodel.Cell; /** - * Represents callback for CellWalk traverse method. - * @author Roman Kashitsyn + * Represents callback for CellWalk traverse method. */ public interface CellHandler { 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 f22bd6f584..ecf80895f2 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 @@ -5,9 +5,9 @@ The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,9 +17,6 @@ package org.apache.poi.ss.util.cellwalk; -/** - * @author Roman Kashitsyn - */ public interface CellWalkContext { /** diff --git a/poi/src/main/java/org/apache/poi/util/BitField.java b/poi/src/main/java/org/apache/poi/util/BitField.java index c9d669d92f..92e5180a65 100644 --- a/poi/src/main/java/org/apache/poi/util/BitField.java +++ b/poi/src/main/java/org/apache/poi/util/BitField.java @@ -21,9 +21,6 @@ package org.apache.poi.util; /** * Manage operations dealing with bit-mapped fields. - * - * @author Marc Johnson (mjohnson at apache dot org) - * @author Andrew C. Oliver (acoliver at apache dot org) */ @Internal(since="POI 3.15 beta 3") public class BitField diff --git a/poi/src/main/java/org/apache/poi/util/ByteField.java b/poi/src/main/java/org/apache/poi/util/ByteField.java index ca62277918..a28b32c6dd 100644 --- a/poi/src/main/java/org/apache/poi/util/ByteField.java +++ b/poi/src/main/java/org/apache/poi/util/ByteField.java @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.util; @@ -27,8 +27,6 @@ import java.nio.BufferUnderflowException; /** * representation of a byte (8-bit) field at a fixed location within a * byte array - * - * @author Marc Johnson (mjohnson at apache dot org */ public class ByteField diff --git a/poi/src/main/java/org/apache/poi/util/DelayableLittleEndianOutput.java b/poi/src/main/java/org/apache/poi/util/DelayableLittleEndianOutput.java index 6dd4930b9a..bcdc43ed3d 100644 --- a/poi/src/main/java/org/apache/poi/util/DelayableLittleEndianOutput.java +++ b/poi/src/main/java/org/apache/poi/util/DelayableLittleEndianOutput.java @@ -23,12 +23,10 @@ package org.apache.poi.util; * the header has been written. The client code can call {@link #createDelayedOutput(int)} * to reserve two bytes of the output for the 'ushort size' header field. The delayed output can * be written at any stage. - * - * @author Josh Micich */ public interface DelayableLittleEndianOutput extends LittleEndianOutput { /** - * Creates an output stream intended for outputting a sequence of <tt>size</tt> bytes. + * Creates an output stream intended for outputting a sequence of {@code size} bytes. */ LittleEndianOutput createDelayedOutput(int size); } diff --git a/poi/src/main/java/org/apache/poi/util/FixedField.java b/poi/src/main/java/org/apache/poi/util/FixedField.java index 45d6c6f714..f1334dfb09 100644 --- a/poi/src/main/java/org/apache/poi/util/FixedField.java +++ b/poi/src/main/java/org/apache/poi/util/FixedField.java @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.util; @@ -25,8 +25,6 @@ import java.io.*; /** * behavior of a field at a fixed location within a byte array - * - * @author Marc Johnson (mjohnson at apache dot org */ public interface FixedField diff --git a/poi/src/main/java/org/apache/poi/util/IOUtils.java b/poi/src/main/java/org/apache/poi/util/IOUtils.java index 115e05734d..7853f68ac1 100644 --- a/poi/src/main/java/org/apache/poi/util/IOUtils.java +++ b/poi/src/main/java/org/apache/poi/util/IOUtils.java @@ -231,7 +231,7 @@ public final class IOUtils { } /** - * Helper method, just calls <tt>readFully(in, b, 0, b.length)</tt> + * Helper method, just calls {@code readFully(in, b, 0, b.length)} * * @param in the stream from which the data is read. * @param b the buffer into which the data is read. @@ -248,14 +248,14 @@ public final class IOUtils { * <p>Same as the normal {@link InputStream#read(byte[], int, int)}, but tries to ensure * that the entire len number of bytes is read.</p> * - * <p>If the end of file is reached before any bytes are read, returns <tt>-1</tt>. If + * <p>If the end of file is reached before any bytes are read, returns {@code -1}. If * the end of the file is reached after some bytes are read, returns the - * number of bytes read. If the end of the file isn't reached before <tt>len</tt> - * bytes have been read, will return <tt>len</tt> bytes.</p> + * number of bytes read. If the end of the file isn't reached before {@code len} + * bytes have been read, will return {@code len} bytes.</p> * * @param in the stream from which the data is read. * @param b the buffer into which the data is read. - * @param off the start offset in array <tt>b</tt> at which the data is written. + * @param off the start offset in array {@code b} at which the data is written. * @param len the maximum number of bytes to read. * * @return the number of bytes read or -1 if no bytes were read @@ -277,7 +277,7 @@ public final class IOUtils { } /** - * Same as the normal <tt>channel.read(b)</tt>, but tries to ensure + * Same as the normal {@code channel.read(b)}, but tries to ensure * that the buffer is filled completely if possible, i.e. b.remaining() * returns 0. * <p> @@ -401,7 +401,7 @@ public final class IOUtils { /** * Quietly (no exceptions) close Closable resource. In case of error it will - * be printed to {@link IOUtils} class logger. + * be printed to IOUtils class logger. * * @param closeable * resource to close @@ -430,18 +430,15 @@ public final class IOUtils { * than delegating to {@link InputStream#skip(long)}. * This means that the method may be considerably less efficient than using the actual skip implementation, * this is done to guarantee that the correct number of bytes are skipped. - * </p> * <p> * This mimics POI's {@link #readFully(InputStream, byte[])}. - * If the end of file is reached before any bytes are read, returns <tt>-1</tt>. If + * If the end of file is reached before any bytes are read, returns {@code -1}. If * the end of the file is reached after some bytes are read, returns the - * number of bytes read. If the end of the file isn't reached before <tt>len</tt> - * bytes have been read, will return <tt>len</tt> bytes.</p> + * number of bytes read. If the end of the file isn't reached before {@code len} + * bytes have been read, will return {@code len} bytes. - * </p> * <p> * Copied nearly verbatim from commons-io 41a3e9c - * </p> * * @param input byte stream to skip * @param toSkip number of bytes to skip. diff --git a/poi/src/main/java/org/apache/poi/util/IntList.java b/poi/src/main/java/org/apache/poi/util/IntList.java index 4bfe8caffe..acb2ddda2f 100644 --- a/poi/src/main/java/org/apache/poi/util/IntList.java +++ b/poi/src/main/java/org/apache/poi/util/IntList.java @@ -40,8 +40,6 @@ package org.apache.poi.util; * remove(int index) * <li> subList is not supported * </ul> - * - * @author Marc Johnson */ public class IntList { diff --git a/poi/src/main/java/org/apache/poi/util/IntegerField.java b/poi/src/main/java/org/apache/poi/util/IntegerField.java index c86a008b77..63554dae33 100644 --- a/poi/src/main/java/org/apache/poi/util/IntegerField.java +++ b/poi/src/main/java/org/apache/poi/util/IntegerField.java @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.util; @@ -26,8 +26,6 @@ import java.io.*; /** * representation of an integer (32-bit) field at a fixed location * within a byte array - * - * @author Marc Johnson (mjohnson at apache dot org */ public class IntegerField diff --git a/poi/src/main/java/org/apache/poi/util/Internal.java b/poi/src/main/java/org/apache/poi/util/Internal.java index 565a908d7b..76c93b8e61 100644 --- a/poi/src/main/java/org/apache/poi/util/Internal.java +++ b/poi/src/main/java/org/apache/poi/util/Internal.java @@ -34,7 +34,6 @@ import java.lang.annotation.Documented; * not subject to the POI project policy of deprecating an element for 2 major * releases before removing. * - * @author Yegor Kozlov * @since POI-3.6 */ @Documented diff --git a/poi/src/main/java/org/apache/poi/util/LittleEndian.java b/poi/src/main/java/org/apache/poi/util/LittleEndian.java index 0ef687298f..09e9fd3ecb 100644 --- a/poi/src/main/java/org/apache/poi/util/LittleEndian.java +++ b/poi/src/main/java/org/apache/poi/util/LittleEndian.java @@ -32,8 +32,6 @@ public final class LittleEndian implements LittleEndianConsts { /** * Exception to handle buffer underruns - * - * @author Marc Johnson (mjohnson at apache dot org) */ public static final class BufferUnderrunException extends IOException { /** diff --git a/poi/src/main/java/org/apache/poi/util/LittleEndianConsts.java b/poi/src/main/java/org/apache/poi/util/LittleEndianConsts.java index 9f7e4a21a5..09ea2b186f 100644 --- a/poi/src/main/java/org/apache/poi/util/LittleEndianConsts.java +++ b/poi/src/main/java/org/apache/poi/util/LittleEndianConsts.java @@ -15,15 +15,12 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.util; /** * a repository for constants shared by classes within this package - * - * @author Marc Johnson - * @author Andrew C. Oliver (acoliver at apache dot org) */ public interface LittleEndianConsts { diff --git a/poi/src/main/java/org/apache/poi/util/LittleEndianOutput.java b/poi/src/main/java/org/apache/poi/util/LittleEndianOutput.java index 708d97bf4a..365899ec53 100644 --- a/poi/src/main/java/org/apache/poi/util/LittleEndianOutput.java +++ b/poi/src/main/java/org/apache/poi/util/LittleEndianOutput.java @@ -16,10 +16,7 @@ ==================================================================== */ package org.apache.poi.util; -/** - * - * @author Josh Micich - */ + public interface LittleEndianOutput { void writeByte(int v); void writeShort(int v); diff --git a/poi/src/main/java/org/apache/poi/util/LongField.java b/poi/src/main/java/org/apache/poi/util/LongField.java index 9aeffb36ea..6d1ecc678d 100644 --- a/poi/src/main/java/org/apache/poi/util/LongField.java +++ b/poi/src/main/java/org/apache/poi/util/LongField.java @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.util; @@ -26,8 +26,6 @@ import java.io.*; /** * representation of a long (16-bit) field at a fixed location within * a byte array - * - * @author Marc Johnson (mjohnson at apache dot org */ public class LongField diff --git a/poi/src/main/java/org/apache/poi/util/ShortField.java b/poi/src/main/java/org/apache/poi/util/ShortField.java index 29d91df7f4..424af8a858 100644 --- a/poi/src/main/java/org/apache/poi/util/ShortField.java +++ b/poi/src/main/java/org/apache/poi/util/ShortField.java @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.util; @@ -26,8 +26,6 @@ import java.io.*; /** * representation of a short (16-bit) field at a fixed location within * a byte array - * - * @author Marc Johnson (mjohnson at apache dot org */ public class ShortField diff --git a/poi/src/main/java/org/apache/poi/util/StringUtil.java b/poi/src/main/java/org/apache/poi/util/StringUtil.java index d281c63386..c635a536cd 100644 --- a/poi/src/main/java/org/apache/poi/util/StringUtil.java +++ b/poi/src/main/java/org/apache/poi/util/StringUtil.java @@ -51,7 +51,7 @@ public final class StringUtil { * byte array. it is assumed that string[ offset ] and string[ offset + * 1 ] contain the first 16-bit unicode character * @param len the length of the final string - * @return the converted string, never <code>null</code>. + * @return the converted string, never {@code null}. * @throws ArrayIndexOutOfBoundsException if offset is out of bounds for * the byte array (i.e., is negative or is greater than or equal to * string.length) @@ -85,7 +85,7 @@ public final class StringUtil { * { 0x16, 0x00 } -0x16 * * @param string the byte array to be converted - * @return the converted string, never <code>null</code> + * @return the converted string, never {@code null} */ public static String getFromUnicodeLE(byte[] string) { if (string.length == 0) { @@ -129,7 +129,7 @@ public final class StringUtil { } /** - * InputStream <tt>in</tt> is expected to contain: + * InputStream {@code in} is expected to contain: * <ol> * <li>ushort nChars</li> * <li>byte is16BitFlag</li> @@ -150,7 +150,7 @@ public final class StringUtil { } /** - * InputStream <tt>in</tt> is expected to contain: + * InputStream {@code in} is expected to contain: * <ol> * <li>byte is16BitFlag</li> * <li>byte[]/char[] characterData</li> @@ -170,7 +170,7 @@ public final class StringUtil { } /** - * OutputStream <tt>out</tt> will get: + * OutputStream {@code out} will get: * <ol> * <li>ushort nChars</li> * <li>byte is16BitFlag</li> @@ -191,7 +191,7 @@ public final class StringUtil { } /** - * OutputStream <tt>out</tt> will get: + * OutputStream {@code out} will get: * <ol> * <li>byte is16BitFlag</li> * <li>byte[]/char[] characterData</li> @@ -622,7 +622,7 @@ public final class StringUtil { * byte array. it is assumed that string[ offset ] and string[ offset + * 1 ] contain the first 16-bit unicode character * @param len the max. length of the final string - * @return the converted string, never <code>null</code>. + * @return the converted string, never {@code null}. * @throws ArrayIndexOutOfBoundsException if offset is out of bounds for * the byte array (i.e., is negative or is greater than or equal to * string.length) diff --git a/poi/src/test/java/org/apache/poi/POIDataSamples.java b/poi/src/test/java/org/apache/poi/POIDataSamples.java index d74839e3a7..0772017d0a 100644 --- a/poi/src/test/java/org/apache/poi/POIDataSamples.java +++ b/poi/src/test/java/org/apache/poi/POIDataSamples.java @@ -47,7 +47,7 @@ public final class POIDataSamples { private static POIDataSamples _instXmlDSign; private File _resolvedDataDir; - /** <code>true</code> if standard system propery is not set, + /** {@code true} if standard system propery is not set, * but the data is available on the test runtime classpath */ private boolean _sampleDataIsAvaliableOnClassPath; private final String _moduleDir; @@ -125,7 +125,7 @@ public final class POIDataSamples { * Opens a sample file from the test data directory * * @param sampleFileName the file to open - * @return an open <tt>InputStream</tt> for the specified sample file + * @return an open {@code InputStream} for the specified sample file */ public InputStream openResourceAsStream(String sampleFileName) { @@ -223,7 +223,7 @@ public final class POIDataSamples { * Opens a test sample file from the 'data' sub-package of this class's package. * * @param sampleFileName the file to open - * @return <code>null</code> if the sample file is not deployed on the classpath. + * @return {@code null} if the sample file is not deployed on the classpath. */ private InputStream openClasspathResource(String sampleFileName) { return getClass().getResourceAsStream("/" + _moduleDir + "/" + sampleFileName); diff --git a/poi/src/test/java/org/apache/poi/hssf/HSSFITestDataProvider.java b/poi/src/test/java/org/apache/poi/hssf/HSSFITestDataProvider.java index 5d80a26d53..9f073c1fa5 100644 --- a/poi/src/test/java/org/apache/poi/hssf/HSSFITestDataProvider.java +++ b/poi/src/test/java/org/apache/poi/hssf/HSSFITestDataProvider.java @@ -28,25 +28,22 @@ import org.apache.poi.ss.usermodel.FormulaEvaluator; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; -/** - * @author Yegor Kozlov - */ public final class HSSFITestDataProvider implements ITestDataProvider { public static final HSSFITestDataProvider instance = new HSSFITestDataProvider(); private HSSFITestDataProvider(){ // enforce singleton } - + @Override public HSSFWorkbook openSampleWorkbook(String sampleFileName) { return HSSFTestDataSamples.openSampleWorkbook(sampleFileName); } - + public InputStream openWorkbookStream(String sampleFileName) { return HSSFTestDataSamples.openSampleFileStream(sampleFileName); } - + @Override public HSSFWorkbook writeOutAndReadBack(Workbook original) { if(!(original instanceof HSSFWorkbook)) { @@ -54,22 +51,22 @@ public final class HSSFITestDataProvider implements ITestDataProvider { } return HSSFTestDataSamples.writeOutAndReadBack((HSSFWorkbook)original); } - + @Override public HSSFWorkbook createWorkbook(){ return new HSSFWorkbook(); } - + //************ SXSSF-specific methods ***************// @Override public HSSFWorkbook createWorkbook(int rowAccessWindowSize) { return createWorkbook(); } - + @Override public void trackAllColumnsForAutosizing(Sheet sheet) {} //************ End SXSSF-specific methods ***************// - + @Override public FormulaEvaluator createFormulaEvaluator(Workbook wb) { return new HSSFFormulaEvaluator((HSSFWorkbook) wb); @@ -79,12 +76,12 @@ public final class HSSFITestDataProvider implements ITestDataProvider { public byte[] getTestDataFileContent(String fileName) { return POIDataSamples.getSpreadSheetInstance().readFile(fileName); } - + @Override public SpreadsheetVersion getSpreadsheetVersion(){ return SpreadsheetVersion.EXCEL97; } - + @Override public String getStandardFileNameExtension() { return "xls"; diff --git a/poi/src/test/java/org/apache/poi/hssf/HSSFTestDataSamples.java b/poi/src/test/java/org/apache/poi/hssf/HSSFTestDataSamples.java index 2fe3359d4d..3835802725 100644 --- a/poi/src/test/java/org/apache/poi/hssf/HSSFTestDataSamples.java +++ b/poi/src/test/java/org/apache/poi/hssf/HSSFTestDataSamples.java @@ -28,8 +28,6 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; /** * Centralises logic for finding/opening sample files in the src/testcases/org/apache/poi/hssf/hssf/data folder. - * - * @author Josh Micich */ public final class HSSFTestDataSamples { @@ -53,8 +51,8 @@ public final class HSSFTestDataSamples { } } /** - * Writes a spreadsheet to a <tt>ByteArrayOutputStream</tt> and reads it back - * from a <tt>ByteArrayInputStream</tt>.<p> + * Writes a spreadsheet to a {@code ByteArrayOutputStream} and reads it back + * from a {@code ByteArrayInputStream}.<p> * Useful for verifying that the serialisation round trip */ public static HSSFWorkbook writeOutAndReadBack(HSSFWorkbook original) { diff --git a/poi/src/test/java/org/apache/poi/hssf/model/TestFormulaParserIf.java b/poi/src/test/java/org/apache/poi/hssf/model/TestFormulaParserIf.java index f9c06bbedb..608427bae2 100644 --- a/poi/src/test/java/org/apache/poi/hssf/model/TestFormulaParserIf.java +++ b/poi/src/test/java/org/apache/poi/hssf/model/TestFormulaParserIf.java @@ -36,7 +36,7 @@ import org.apache.poi.ss.formula.ptg.StringPtg; import org.junit.jupiter.api.Test; /** - * Tests <tt>FormulaParser</tt> specifically with respect to IF() functions + * Tests {@code FormulaParser} specifically with respect to IF() functions */ final class TestFormulaParserIf { private static Ptg[] parseFormula(String formula) { diff --git a/poi/src/test/java/org/apache/poi/hssf/model/TestOperandClassTransformer.java b/poi/src/test/java/org/apache/poi/hssf/model/TestOperandClassTransformer.java index f36ee053a8..f7ff69ed66 100644 --- a/poi/src/test/java/org/apache/poi/hssf/model/TestOperandClassTransformer.java +++ b/poi/src/test/java/org/apache/poi/hssf/model/TestOperandClassTransformer.java @@ -35,7 +35,7 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; /** - * Tests specific formula examples in <tt>OperandClassTransformer</tt>. + * Tests specific formula examples in {@code OperandClassTransformer}. */ final class TestOperandClassTransformer { @@ -70,7 +70,7 @@ final class TestOperandClassTransformer { } /** - * In the example: <code>INDEX(PI(),1)</code>, Excel encodes PI() as 'array'. It is not clear + * In the example: {@code INDEX(PI(),1)}, Excel encodes PI() as 'array'. It is not clear * what rule justifies this. POI currently encodes it as 'value' which Excel(2007) seems to * tolerate. Changing the metadata for INDEX to have first parameter as 'array' class breaks * other formulas involving INDEX. It seems like a special case needs to be made. Perhaps an diff --git a/poi/src/test/java/org/apache/poi/hssf/model/TestRVA.java b/poi/src/test/java/org/apache/poi/hssf/model/TestRVA.java index 488a9e6fc5..5bc9583844 100644 --- a/poi/src/test/java/org/apache/poi/hssf/model/TestRVA.java +++ b/poi/src/test/java/org/apache/poi/hssf/model/TestRVA.java @@ -41,7 +41,7 @@ import org.junit.jupiter.params.provider.MethodSource; /** * Tests 'operand class' transformation performed by - * <tt>OperandClassTransformer</tt> by comparing its results with those + * {@code OperandClassTransformer} by comparing its results with those * directly produced by Excel (in a sample spreadsheet). */ final class TestRVA { diff --git a/poi/src/test/java/org/apache/poi/hssf/model/TestRowBlocksReader.java b/poi/src/test/java/org/apache/poi/hssf/model/TestRowBlocksReader.java index fde901216b..472dbba2b5 100644 --- a/poi/src/test/java/org/apache/poi/hssf/model/TestRowBlocksReader.java +++ b/poi/src/test/java/org/apache/poi/hssf/model/TestRowBlocksReader.java @@ -35,8 +35,6 @@ import org.junit.jupiter.api.Test; /** * Tests for {@link RowBlocksReader} - * - * @author Josh Micich */ final class TestRowBlocksReader { @Test diff --git a/poi/src/test/java/org/apache/poi/hssf/model/TestSheet.java b/poi/src/test/java/org/apache/poi/hssf/model/TestSheet.java index aef0c5e40b..8175d43584 100644 --- a/poi/src/test/java/org/apache/poi/hssf/model/TestSheet.java +++ b/poi/src/test/java/org/apache/poi/hssf/model/TestSheet.java @@ -419,7 +419,7 @@ final class TestSheet { /** * Prior to bug 45066, POI would get the estimated sheet size wrong - * when an <tt>UncalcedRecord</tt> was present.<p> + * when an {@code UncalcedRecord} was present. */ @Test void testUncalcSize_bug45066() { @@ -448,7 +448,7 @@ final class TestSheet { } /** - * Prior to bug 45145 <tt>RowRecordsAggregate</tt> and <tt>ValueRecordsAggregate</tt> could + * Prior to bug 45145 {@code RowRecordsAggregate} and {@code ValueRecordsAggregate} could * sometimes occur in reverse order. This test reproduces one of those situations and makes * sure that RRA comes before VRA.<br> * diff --git a/poi/src/test/java/org/apache/poi/hssf/record/TestFeatRecord.java b/poi/src/test/java/org/apache/poi/hssf/record/TestFeatRecord.java index c6a9cd9581..18a1cdc0cc 100644 --- a/poi/src/test/java/org/apache/poi/hssf/record/TestFeatRecord.java +++ b/poi/src/test/java/org/apache/poi/hssf/record/TestFeatRecord.java @@ -35,7 +35,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.junit.jupiter.api.Test; /** - * Tests for <tt>FeatRecord</tt> + * Tests for {@code FeatRecord} */ final class TestFeatRecord { @Test diff --git a/poi/src/test/java/org/apache/poi/hssf/record/TestLabelRecord.java b/poi/src/test/java/org/apache/poi/hssf/record/TestLabelRecord.java index 84946bd6b2..bb365e648a 100644 --- a/poi/src/test/java/org/apache/poi/hssf/record/TestLabelRecord.java +++ b/poi/src/test/java/org/apache/poi/hssf/record/TestLabelRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.junit.jupiter.api.Test; /** - * Tests for <tt>LabelRecord</tt> + * Tests for {@code LabelRecord} */ final class TestLabelRecord { diff --git a/poi/src/test/java/org/apache/poi/hssf/record/TestRecordFactoryInputStream.java b/poi/src/test/java/org/apache/poi/hssf/record/TestRecordFactoryInputStream.java index 9c7d6be428..0e1bc1589b 100644 --- a/poi/src/test/java/org/apache/poi/hssf/record/TestRecordFactoryInputStream.java +++ b/poi/src/test/java/org/apache/poi/hssf/record/TestRecordFactoryInputStream.java @@ -31,8 +31,6 @@ import org.junit.jupiter.api.Test; /** * Tests for {@link RecordFactoryInputStream} - * - * @author Josh Micich */ final class TestRecordFactoryInputStream { /** diff --git a/poi/src/test/java/org/apache/poi/hssf/record/TestSSTDeserializer.java b/poi/src/test/java/org/apache/poi/hssf/record/TestSSTDeserializer.java index 7bde03cb06..6e120a5276 100644 --- a/poi/src/test/java/org/apache/poi/hssf/record/TestSSTDeserializer.java +++ b/poi/src/test/java/org/apache/poi/hssf/record/TestSSTDeserializer.java @@ -30,8 +30,6 @@ import org.junit.jupiter.api.Test; /** * Exercise the SSTDeserializer class. - * - * @author Glen Stampoultzis (glens at apache.org) */ final class TestSSTDeserializer { private static final int FAKE_SID = -5555; diff --git a/poi/src/test/java/org/apache/poi/hssf/record/TestSharedFormulaRecord.java b/poi/src/test/java/org/apache/poi/hssf/record/TestSharedFormulaRecord.java index 17855c08de..afd8298896 100644 --- a/poi/src/test/java/org/apache/poi/hssf/record/TestSharedFormulaRecord.java +++ b/poi/src/test/java/org/apache/poi/hssf/record/TestSharedFormulaRecord.java @@ -70,7 +70,7 @@ final class TestSharedFormulaRecord { }; /** - * The method <tt>SharedFormulaRecord.convertSharedFormulas()</tt> converts formulas from + * The method {@code SharedFormulaRecord.convertSharedFormulas()} converts formulas from * 'shared formula' to 'single cell formula' format. It is important that token operand * classes are preserved during this transformation, because Excel may not tolerate the * incorrect encoding. The formula here is one such example (Excel displays #VALUE!). diff --git a/poi/src/test/java/org/apache/poi/hssf/record/TestTextObjectRecord.java b/poi/src/test/java/org/apache/poi/hssf/record/TestTextObjectRecord.java index 272b1802e1..83a5144562 100644 --- a/poi/src/test/java/org/apache/poi/hssf/record/TestTextObjectRecord.java +++ b/poi/src/test/java/org/apache/poi/hssf/record/TestTextObjectRecord.java @@ -33,8 +33,6 @@ import org.junit.jupiter.api.Test; /** * Tests that serialization and deserialization of the TextObjectRecord . * Test data taken directly from a real Excel file. - * - * @author Yegor Kozlov */ final class TestTextObjectRecord { diff --git a/poi/src/test/java/org/apache/poi/hssf/record/TestcaseRecordInputStream.java b/poi/src/test/java/org/apache/poi/hssf/record/TestcaseRecordInputStream.java index 93c62912a9..1d38a8e7ac 100644 --- a/poi/src/test/java/org/apache/poi/hssf/record/TestcaseRecordInputStream.java +++ b/poi/src/test/java/org/apache/poi/hssf/record/TestcaseRecordInputStream.java @@ -32,8 +32,6 @@ import org.apache.poi.util.LittleEndianInput; * A Record Input Stream derivative that makes access to byte arrays used in the * test cases work a bit easier. * <p> Creates the stream and moves to the first record. - * - * @author Jason Height (jheight at apache.org) */ public final class TestcaseRecordInputStream { @@ -52,8 +50,8 @@ public final class TestcaseRecordInputStream { return create(mergeDataAndSid(sid, data.length, data)); } /** - * First 4 bytes of <tt>data</tt> are assumed to be record identifier and length. The supplied - * <tt>data</tt> can contain multiple records (sequentially encoded in the same way) + * First 4 bytes of {@code data} are assumed to be record identifier and length. The supplied + * {@code data} can contain multiple records (sequentially encoded in the same way) */ public static RecordInputStream create(byte[] data) { InputStream is = new ByteArrayInputStream(data); diff --git a/poi/src/test/java/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java b/poi/src/test/java/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java index 38018f3627..570ec4f5ac 100644 --- a/poi/src/test/java/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java +++ b/poi/src/test/java/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java @@ -215,15 +215,15 @@ final class TestValueRecordsAggregate { } /** - * Sometimes the 'shared formula' flag (<tt>FormulaRecord.isSharedFormula()</tt>) is set when + * Sometimes the 'shared formula' flag ({@code FormulaRecord.isSharedFormula()}) is set when * there is no corresponding SharedFormulaRecord available. SharedFormulaRecord definitions do * not span multiple sheets. They are are only defined within a sheet, and thus they do not * have a sheet index field (only row and column range fields).<br> * So it is important that the code which locates the SharedFormulaRecord for each - * FormulaRecord does not allow matches across sheets.</br> + * FormulaRecord does not allow matches across sheets.<p> * - * Prior to bugzilla 44449 (Feb 2008), POI <tt>ValueRecordsAggregate.construct(int, List)</tt> - * allowed <tt>SharedFormulaRecord</tt>s to be erroneously used across sheets. That incorrect + * Prior to bugzilla 44449 (Feb 2008), POI {@code ValueRecordsAggregate.construct(int, List)} + * allowed {@code SharedFormulaRecord}s to be erroneously used across sheets. That incorrect * behaviour is shown by this test.<p> * * <b>Notes on how to produce the test spreadsheet</b>:</p> @@ -237,10 +237,10 @@ final class TestValueRecordsAggregate { * <li>Four rows on Sheet1 "5" through "8" were deleted ('delete rows' alt-E D, not 'clear' Del).</li> * <li>The spreadsheet was saved as AbnormalSharedFormulaFlag.xls.</li> * </ol> - * Prior to the row delete action the spreadsheet has two <tt>SharedFormulaRecord</tt>s. One + * Prior to the row delete action the spreadsheet has two {@code SharedFormulaRecord}s. One * for each sheet. To expose the bug, the shared formulas have been made to overlap.<br> * The row delete action (as described here) seems to to delete the - * <tt>SharedFormulaRecord</tt> from Sheet1 (but not clear the 'shared formula' flags.<br> + * {@code SharedFormulaRecord} from Sheet1 (but not clear the 'shared formula' flags.<br> * There are other variations on this theme to create the same effect. * */ diff --git a/poi/src/test/java/org/apache/poi/hssf/record/cf/TestCellRange.java b/poi/src/test/java/org/apache/poi/hssf/record/cf/TestCellRange.java index cb0a6a548b..52f3d3147d 100644 --- a/poi/src/test/java/org/apache/poi/hssf/record/cf/TestCellRange.java +++ b/poi/src/test/java/org/apache/poi/hssf/record/cf/TestCellRange.java @@ -43,7 +43,7 @@ final class TestCellRange { biggest, tenthColumn, tenthRow, box10x10, box9x9, box10to20c, oneCell, }; - /** cross-reference of <tt>contains()</tt> operations for sampleRanges against itself */ + /** cross-reference of {@code contains()} operations for sampleRanges against itself */ private static final boolean [][] containsExpectedResults = { // biggest, tenthColumn, tenthRow, box10x10, box9x9, box10to20c, oneCell diff --git a/poi/src/test/java/org/apache/poi/hssf/record/common/TestUnicodeString.java b/poi/src/test/java/org/apache/poi/hssf/record/common/TestUnicodeString.java index 45151b90ff..35f84590f7 100644 --- a/poi/src/test/java/org/apache/poi/hssf/record/common/TestUnicodeString.java +++ b/poi/src/test/java/org/apache/poi/hssf/record/common/TestUnicodeString.java @@ -47,8 +47,6 @@ import org.junit.jupiter.api.Test; /** * Tests that {@link UnicodeString} record size calculates correctly. The record size * is used when serializing {@link SSTRecord}s. - * - * @author Jason Height (jheight at apache.org) */ final class TestUnicodeString { private static final int MAX_DATA_SIZE = RecordInputStream.MAX_RECORD_DATA_SIZE; @@ -61,7 +59,7 @@ final class TestUnicodeString { } /** - * Note - a value of zero for <tt>amountUsedInCurrentRecord</tt> would only ever occur just + * Note - a value of zero for {@code amountUsedInCurrentRecord} would only ever occur just * after a {@link ContinueRecord} had been started. In the initial {@link SSTRecord} this * value starts at 8 (for the first {@link UnicodeString} written). In general, it can be * any value between 0 and {@link #MAX_DATA_SIZE} @@ -432,7 +430,7 @@ final class TestUnicodeString { } /** - * @param is16Bit if <code>true</code> the created string will have characters > 0x00FF + * @param is16Bit if {@code true} the created string will have characters > 0x00FF * @return a string of the specified number of characters */ private static UnicodeString makeUnicodeString(int numChars, boolean is16Bit) { diff --git a/poi/src/test/java/org/apache/poi/hssf/usermodel/FormulaExtractor.java b/poi/src/test/java/org/apache/poi/hssf/usermodel/FormulaExtractor.java index c44b3c0c7b..a9db1d5497 100644 --- a/poi/src/test/java/org/apache/poi/hssf/usermodel/FormulaExtractor.java +++ b/poi/src/test/java/org/apache/poi/hssf/usermodel/FormulaExtractor.java @@ -22,16 +22,14 @@ import org.apache.poi.hssf.record.aggregates.FormulaRecordAggregate; import org.apache.poi.ss.formula.ptg.Ptg; /** - * Test utility class to get <tt>Ptg</tt> arrays out of formula cells - * - * @author Josh Micich + * Test utility class to get {@code Ptg} arrays out of formula cells */ public final class FormulaExtractor { private FormulaExtractor() { // no instances of this class } - + public static Ptg[] getPtgs(HSSFCell cell) { CellValueRecordInterface vr = cell.getCellValueRecord(); if (!(vr instanceof FormulaRecordAggregate)) { diff --git a/poi/src/test/java/org/apache/poi/hssf/usermodel/HSSFEvaluationTestHelper.java b/poi/src/test/java/org/apache/poi/hssf/usermodel/HSSFEvaluationTestHelper.java index 96196c146e..c299fc428f 100644 --- a/poi/src/test/java/org/apache/poi/hssf/usermodel/HSSFEvaluationTestHelper.java +++ b/poi/src/test/java/org/apache/poi/hssf/usermodel/HSSFEvaluationTestHelper.java @@ -20,9 +20,7 @@ package org.apache.poi.hssf.usermodel; import org.apache.poi.ss.formula.EvaluationCell; /** - * Raises visibility of some internal functionality for test purposes - * - * @author Josh Micich + * Raises visibility of some internal functionality for test purposes */ public final class HSSFEvaluationTestHelper { diff --git a/poi/src/test/java/org/apache/poi/hssf/usermodel/StreamUtility.java b/poi/src/test/java/org/apache/poi/hssf/usermodel/StreamUtility.java index d467333ffc..26dbcc5cfb 100644 --- a/poi/src/test/java/org/apache/poi/hssf/usermodel/StreamUtility.java +++ b/poi/src/test/java/org/apache/poi/hssf/usermodel/StreamUtility.java @@ -27,8 +27,6 @@ import java.util.List; * any significant detail. Normally this task would be simple except for the presence of artifacts * in the file that change every time it is generated. Usually these volatile artifacts are * time-stamps, user names, or other machine dependent parameters. - * - * @author Josh Micich */ public final class StreamUtility { diff --git a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestCloneSheet.java b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestCloneSheet.java index cb3d92d113..5b4739d4ab 100644 --- a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestCloneSheet.java +++ b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestCloneSheet.java @@ -37,7 +37,6 @@ import org.junit.jupiter.api.Test; * Test the ability to clone a sheet. * If adding new records that belong to a sheet (as opposed to a book) * add that record to the sheet in the testCloneSheetBasic method. - * @author avik */ final class TestCloneSheet extends BaseTestCloneSheet { public TestCloneSheet() { diff --git a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestDataValidation.java b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestDataValidation.java index 4a120b2ac6..777e436e32 100644 --- a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestDataValidation.java +++ b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestDataValidation.java @@ -50,8 +50,6 @@ import org.junit.jupiter.api.Test; /** * Class for testing Excel's data validation mechanism - * - * @author Dragos Buleandra ( dragos.buleandra@trade2b.ro ) */ final class TestDataValidation extends BaseTestDataValidation { diff --git a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFComment.java b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFComment.java index 181cd5052b..d6d36a18ce 100644 --- a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFComment.java +++ b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFComment.java @@ -48,8 +48,6 @@ import org.junit.jupiter.api.Test; /** * Tests TestHSSFCellComment. - * - * @author Yegor Kozlov */ final class TestHSSFComment extends BaseTestCellComment { diff --git a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFHyperlink.java b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFHyperlink.java index 67cb04010d..3bf170d73f 100644 --- a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFHyperlink.java +++ b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFHyperlink.java @@ -32,8 +32,6 @@ import org.junit.jupiter.api.Test; /** * Tests HSSFHyperlink. - * - * @author Yegor Kozlov */ final class TestHSSFHyperlink extends BaseTestHyperlink { diff --git a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFRow.java b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFRow.java index b588f1375c..d58a00f838 100644 --- a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFRow.java +++ b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFRow.java @@ -34,8 +34,6 @@ import org.junit.jupiter.api.Test; /** * Test HSSFRow is okay. - * - * @author Glen Stampoultzis (glens at apache.org) */ final class TestHSSFRow extends BaseTestRow { diff --git a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFSheetShiftRows.java b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFSheetShiftRows.java index d78c3bf660..96273fe965 100644 --- a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFSheetShiftRows.java +++ b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFSheetShiftRows.java @@ -20,9 +20,6 @@ package org.apache.poi.hssf.usermodel; import org.apache.poi.hssf.HSSFITestDataProvider; import org.apache.poi.ss.usermodel.BaseTestSheetShiftRows; -/** - * @author Yegor Kozlov - */ final class TestHSSFSheetShiftRows extends BaseTestSheetShiftRows { public TestHSSFSheetShiftRows() { diff --git a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestReadWriteChart.java b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestReadWriteChart.java index f1e9f0ef1f..77e89f040e 100644 --- a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestReadWriteChart.java +++ b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestReadWriteChart.java @@ -33,9 +33,6 @@ import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.util.LocaleUtil; import org.junit.jupiter.api.Test; -/** - * @author Glen Stampoultzis (glens at apache.org) - */ final class TestReadWriteChart { /** diff --git a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestSanityChecker.java b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestSanityChecker.java index 428fb3030e..16f268a69e 100644 --- a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestSanityChecker.java +++ b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestSanityChecker.java @@ -35,8 +35,6 @@ import org.junit.jupiter.api.Test; /** * A Test case for a test utility class.<br> * Okay, this may seem strange but I need to test my test logic. - * - * @author Glen Stampoultzis (glens at apache.org) */ final class TestSanityChecker { private static final Record INTERFACEHDR = new InterfaceHdrRecord(InterfaceHdrRecord.CODEPAGE); diff --git a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestText.java b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestText.java index a7065cda2e..6cea76d5bf 100644 --- a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestText.java +++ b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestText.java @@ -28,10 +28,6 @@ import org.apache.poi.hssf.record.ObjRecord; import org.apache.poi.hssf.record.TextObjectRecord; import org.junit.jupiter.api.Test; -/** - * @author Evgeniy Berlog - * @date 25.06.12 - */ class TestText { @Test diff --git a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java index 76701fd1dd..ac1ed44f1b 100644 --- a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java +++ b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java @@ -32,8 +32,6 @@ import org.apache.poi.ss.usermodel.Workbook; import org.junit.jupiter.api.Test; /** - * @author aviks - * * This testcase contains tests for bugs that are yet to be fixed. Therefore, * the standard ant test target does not run these tests. Run this testcase with * the single-test target. The names of the tests usually correspond to the diff --git a/poi/src/test/java/org/apache/poi/poifs/eventfilesystem/Listener.java b/poi/src/test/java/org/apache/poi/poifs/eventfilesystem/Listener.java index 4b597c1719..f584af239f 100644 --- a/poi/src/test/java/org/apache/poi/poifs/eventfilesystem/Listener.java +++ b/poi/src/test/java/org/apache/poi/poifs/eventfilesystem/Listener.java @@ -15,20 +15,14 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.poifs.eventfilesystem; /** * Class Listener - * - * @author Marc Johnson (mjohnson at apache dot org) - * @version %I%, %G% */ - -class Listener - implements POIFSReaderListener -{ +class Listener implements POIFSReaderListener { /** * Process a POIFSReaderEvent that this listener had registered diff --git a/poi/src/test/java/org/apache/poi/poifs/eventfilesystem/TestPOIFSReaderRegistry.java b/poi/src/test/java/org/apache/poi/poifs/eventfilesystem/TestPOIFSReaderRegistry.java index 1eb939f961..9bfc7be578 100644 --- a/poi/src/test/java/org/apache/poi/poifs/eventfilesystem/TestPOIFSReaderRegistry.java +++ b/poi/src/test/java/org/apache/poi/poifs/eventfilesystem/TestPOIFSReaderRegistry.java @@ -30,8 +30,6 @@ import org.junit.jupiter.api.Test; /** * Class to test POIFSReaderRegistry functionality - * - * @author Marc Johnson */ final class TestPOIFSReaderRegistry { private final POIFSReaderListener[] listeners = diff --git a/poi/src/test/java/org/apache/poi/poifs/filesystem/ReaderWriter.java b/poi/src/test/java/org/apache/poi/poifs/filesystem/ReaderWriter.java index ed2ce941ab..195682ae75 100644 --- a/poi/src/test/java/org/apache/poi/poifs/filesystem/ReaderWriter.java +++ b/poi/src/test/java/org/apache/poi/poifs/filesystem/ReaderWriter.java @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.poifs.filesystem; @@ -34,13 +34,8 @@ import org.apache.poi.util.IOUtils; /** * Test (Proof of concept) program that employs the * POIFSReaderListener and POIFSWriterListener interfaces - * - * @author Marc Johnson (mjohnson at apache dot org) */ - -public final class ReaderWriter - implements POIFSReaderListener, POIFSWriterListener -{ +public final class ReaderWriter implements POIFSReaderListener, POIFSWriterListener { private final DirectoryEntry root; // keys are DocumentDescriptors, values are byte[]s diff --git a/poi/src/test/java/org/apache/poi/poifs/property/TestRootProperty.java b/poi/src/test/java/org/apache/poi/poifs/property/TestRootProperty.java index 4b311a8ec8..de51fcefde 100644 --- a/poi/src/test/java/org/apache/poi/poifs/property/TestRootProperty.java +++ b/poi/src/test/java/org/apache/poi/poifs/property/TestRootProperty.java @@ -31,8 +31,6 @@ import org.junit.jupiter.api.Test; /** * Class to test RootProperty functionality - * - * @author Marc Johnson */ final class TestRootProperty { private RootProperty _property; diff --git a/poi/src/test/java/org/apache/poi/sl/draw/geom/TestFormulaParser.java b/poi/src/test/java/org/apache/poi/sl/draw/geom/TestFormulaParser.java index a99041c852..a4274d56da 100644 --- a/poi/src/test/java/org/apache/poi/sl/draw/geom/TestFormulaParser.java +++ b/poi/src/test/java/org/apache/poi/sl/draw/geom/TestFormulaParser.java @@ -24,8 +24,6 @@ import org.junit.jupiter.api.Test; /** * Date: 10/24/11 - * - * @author Yegor Kozlov */ class TestFormulaParser { @Test diff --git a/poi/src/test/java/org/apache/poi/ss/ITestDataProvider.java b/poi/src/test/java/org/apache/poi/ss/ITestDataProvider.java index e258e1a4a2..7feeca2e6a 100644 --- a/poi/src/test/java/org/apache/poi/ss/ITestDataProvider.java +++ b/poi/src/test/java/org/apache/poi/ss/ITestDataProvider.java @@ -46,8 +46,8 @@ public interface ITestDataProvider { * @return an instance of Workbook */ Workbook createWorkbook(); - - + + //************ SXSSF-specific methods ***************// /** * Provides way of creating a SXSSFWorkbook with a specific row access window size. @@ -55,7 +55,7 @@ public interface ITestDataProvider { * @return an instance of Workbook */ Workbook createWorkbook(int rowAccessWindowSize); - + /** * Only matters for SXSSF - enables tracking of the column * widths so that autosizing can work. No-op on others. @@ -65,17 +65,17 @@ public interface ITestDataProvider { /** * Creates the corresponding {@link FormulaEvaluator} for the - * type of Workbook handled by this Provider. + * type of Workbook handled by this Provider. * * @param wb The workbook to base the formula evaluator on. - * @return A new instance of a matching type of formula evaluator. + * @return A new instance of a matching type of formula evaluator. */ FormulaEvaluator createFormulaEvaluator(Workbook wb); /** * Opens a sample file from the standard HSSF test data directory * - * @return an open <tt>InputStream</tt> for the specified sample file + * @return an open {@code InputStream} for the specified sample file */ byte[] getTestDataFileContent(String fileName); diff --git a/poi/src/test/java/org/apache/poi/ss/formula/EvaluationListener.java b/poi/src/test/java/org/apache/poi/ss/formula/EvaluationListener.java index 3524c3f7d0..3f385cde6f 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/EvaluationListener.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/EvaluationListener.java @@ -23,8 +23,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; * Tests should extend this class if they need to track the internal working of the {@link WorkbookEvaluator}.<br> * * Default method implementations all do nothing - * - * @author Josh Micich */ public abstract class EvaluationListener implements IEvaluationListener { @Override diff --git a/poi/src/test/java/org/apache/poi/ss/formula/TestSheetNameFormatter.java b/poi/src/test/java/org/apache/poi/ss/formula/TestSheetNameFormatter.java index 484e5597cb..b2bcc080de 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/TestSheetNameFormatter.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/TestSheetNameFormatter.java @@ -26,8 +26,6 @@ import org.junit.jupiter.api.Test; /** * Tests for {@link SheetNameFormatter} - * - * @author Josh Micich */ final class TestSheetNameFormatter { /** diff --git a/poi/src/test/java/org/apache/poi/ss/formula/TestWorkbookEvaluator.java b/poi/src/test/java/org/apache/poi/ss/formula/TestWorkbookEvaluator.java index 39eafbe65f..b0d6a019d4 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/TestWorkbookEvaluator.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/TestWorkbookEvaluator.java @@ -54,8 +54,6 @@ import org.junit.jupiter.api.Test; /** * Tests {@link WorkbookEvaluator}. - * - * @author Josh Micich */ class TestWorkbookEvaluator { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/WorkbookEvaluatorTestHelper.java b/poi/src/test/java/org/apache/poi/ss/formula/WorkbookEvaluatorTestHelper.java index 673cb9500c..9001e9dc9a 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/WorkbookEvaluatorTestHelper.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/WorkbookEvaluatorTestHelper.java @@ -22,8 +22,6 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; /** * Allows tests to execute {@link WorkbookEvaluator}s and track the internal workings. - * - * @author Josh Micich */ public final class WorkbookEvaluatorTestHelper { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/eval/EvalInstances.java b/poi/src/test/java/org/apache/poi/ss/formula/eval/EvalInstances.java index 4a15444773..1a84fb06fb 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/eval/EvalInstances.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/eval/EvalInstances.java @@ -21,8 +21,6 @@ import org.apache.poi.ss.formula.functions.Function; /** * Collects eval instances for easy access by tests in this package - * - * @author Josh Micich */ final class EvalInstances { private EvalInstances() { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/eval/TestAreaEval.java b/poi/src/test/java/org/apache/poi/ss/formula/eval/TestAreaEval.java index 40b9a09715..37618b8536 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/eval/TestAreaEval.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/eval/TestAreaEval.java @@ -28,7 +28,7 @@ import org.apache.poi.ss.util.AreaReference; import org.junit.jupiter.api.Test; /** - * Tests for <tt>AreaEval</tt> + * Tests for {@code AreaEval} */ final class TestAreaEval { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/eval/TestFormulasFromSpreadsheet.java b/poi/src/test/java/org/apache/poi/ss/formula/eval/TestFormulasFromSpreadsheet.java index 80ddc6d988..19147487c4 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/eval/TestFormulasFromSpreadsheet.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/eval/TestFormulasFromSpreadsheet.java @@ -44,10 +44,10 @@ import org.junit.jupiter.params.provider.MethodSource; /** * Tests formulas and operators as loaded from a test data spreadsheet.<p> - * This class does not test implementors of <tt>Function</tt> and <tt>OperationEval</tt> in - * isolation. Much of the evaluation engine (i.e. <tt>HSSFFormulaEvaluator</tt>, ...) gets + * This class does not test implementors of {@code Function} and {@code OperationEval} in + * isolation. Much of the evaluation engine (i.e. {@code HSSFFormulaEvaluator}, ...) gets * exercised as well. Tests for bug fixes and specific/tricky behaviour can be found in the - * corresponding test class (<tt>TestXxxx</tt>) of the target (<tt>Xxxx</tt>) implementor, + * corresponding test class ({@code TestXxxx}) of the target ({@code Xxxx}) implementor, * where execution can be observed more easily. */ public final class TestFormulasFromSpreadsheet { @@ -125,7 +125,7 @@ public final class TestFormulasFromSpreadsheet { /** * @param startRowIndex row index in the spreadsheet where the first function/operator is found - * Typically pass <code>null</code> to test all functions + * Typically pass {@code null} to test all functions */ private static void processFunctionGroup(List<Arguments> data, int startRowIndex) { for (int rowIndex = startRowIndex; true; rowIndex += SS.NUMBER_OF_ROWS_PER_FUNCTION) { @@ -202,7 +202,7 @@ public final class TestFormulasFromSpreadsheet { } } /** - * @return <code>null</code> if cell is missing, empty or blank + * @return {@code null} if cell is missing, empty or blank */ private static String getTargetFunctionName(Row r) { if(r == null) { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/eval/TestHSSFCircularReferences.java b/poi/src/test/java/org/apache/poi/ss/formula/eval/TestHSSFCircularReferences.java index 90d9739efb..5eba366903 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/eval/TestHSSFCircularReferences.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/eval/TestHSSFCircularReferences.java @@ -21,8 +21,6 @@ import org.apache.poi.hssf.HSSFITestDataProvider; /** * Tests HSSFFormulaEvaluator for its handling of cell formula circular references. - * - * @author Josh Micich */ final class TestHSSFCircularReferences extends BaseTestCircularReferences { public TestHSSFCircularReferences() { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/eval/TestOperandResolver.java b/poi/src/test/java/org/apache/poi/ss/formula/eval/TestOperandResolver.java index f37b818142..cadd4eb4cf 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/eval/TestOperandResolver.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/eval/TestOperandResolver.java @@ -27,7 +27,7 @@ import java.util.Map; import org.junit.jupiter.api.Test; /** - * Tests for <tt>OperandResolver</tt> + * Tests for {@code OperandResolver} */ final class TestOperandResolver { @Test diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/BaseTestNumeric.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/BaseTestNumeric.java index d5e02e0de8..33111ed2d5 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/BaseTestNumeric.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/BaseTestNumeric.java @@ -22,10 +22,6 @@ package org.apache.poi.ss.formula.functions; import static org.junit.jupiter.api.Assertions.assertTrue; -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * - */ public abstract class BaseTestNumeric { public static final double POS_ZERO = 1E-4; diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/EvalFactory.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/EvalFactory.java index 345b4fb80c..f58beac4da 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/EvalFactory.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/EvalFactory.java @@ -32,9 +32,7 @@ import org.apache.poi.ss.formula.ptg.RefPtg; import org.apache.poi.ss.util.AreaReference; /** - * Test helper class for creating mock <code>Eval</code> objects - * - * @author Josh Micich + * Test helper class for creating mock {@code Eval} objects */ public final class EvalFactory { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestBin2Dec.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestBin2Dec.java index e873ba227c..934f532c8c 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestBin2Dec.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestBin2Dec.java @@ -31,8 +31,6 @@ import org.junit.jupiter.api.Test; /** * Tests for {@link Bin2Dec} - * - * @author cedric dot walter @ gmail dot com */ final class TestBin2Dec { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestCode.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestCode.java index 32dd466ba8..03ed1785bf 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestCode.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestCode.java @@ -25,8 +25,6 @@ import org.junit.jupiter.api.Test; /** * Tests for {@link Code} - * - * @author cedric dot walter @ gmail dot com */ class TestCode { private static ValueEval invokeValue(String number1) { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestComplex.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestComplex.java index 018e2222f3..3c1bb4413b 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestComplex.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestComplex.java @@ -25,8 +25,6 @@ import org.junit.jupiter.api.Test; /** * Tests for {@link Complex} - * - * @author cedric dot walter @ gmail dot com */ class TestComplex { private static ValueEval invokeValue(String real_num, String i_num, String suffix) { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDate.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDate.java index 82d0e82742..ea7a162b77 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDate.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDate.java @@ -29,9 +29,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -/** - * @author Pavel Krupets (pkrupets at palmtreebusiness dot com) - */ final class TestDate { private HSSFCell cell11; diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDateValue.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDateValue.java index fe487b6815..9738546998 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDateValue.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDateValue.java @@ -37,8 +37,6 @@ import org.junit.jupiter.api.Test; /** * Tests for Excel function DATEVALUE() - * - * @author Milosz Rembisz */ final class TestDateValue { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDays360.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDays360.java index b796a4d5b9..161b7b98b0 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDays360.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDays360.java @@ -80,7 +80,7 @@ final class TestDays360 { } /** - * The <tt>method</tt> parameter only makes a difference when the second parameter + * The {@code method} parameter only makes a difference when the second parameter * is the last day of the month that does <em>not</em> have 30 days. */ @Test diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDec2Bin.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDec2Bin.java index d745603a5a..4b6d5ca2c8 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDec2Bin.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDec2Bin.java @@ -34,8 +34,6 @@ import org.junit.jupiter.api.Test; /** * Tests for {@link Dec2Bin} - * - * @author cedric dot walter @ gmail dot com */ final class TestDec2Bin { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDec2Hex.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDec2Hex.java index 125f9c4396..aac4cfd751 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDec2Hex.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDec2Hex.java @@ -34,8 +34,6 @@ import org.junit.jupiter.api.Test; /** * Tests for {@link Dec2Hex} - * - * @author cedric dot walter @ gmail dot com */ final class TestDec2Hex { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDelta.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDelta.java index 83aee557f3..f6a735d290 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDelta.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDelta.java @@ -27,8 +27,6 @@ import org.junit.jupiter.api.Test; /** * Tests for {@link org.apache.poi.ss.formula.functions.Delta} - * - * @author cedric dot walter @ gmail dot com */ final class TestDelta { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestFinanceLib.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestFinanceLib.java index e0d2aca4c5..5f61c88da0 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestFinanceLib.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestFinanceLib.java @@ -23,10 +23,6 @@ package org.apache.poi.ss.formula.functions; import org.junit.jupiter.api.Test; -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * - */ class TestFinanceLib extends BaseTestNumeric { @Test @@ -39,7 +35,7 @@ class TestFinanceLib extends BaseTestNumeric { f = FinanceLib.fv(r, n, y, p, t); x = -2; assertDouble("fv ", x, f); - + r = 0.12/12; n = 12; y = -1000; p = 0; t = false; f = FinanceLib.fv(r, n, y, p, t); x = 12682.50301319; diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestFrequency.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestFrequency.java index 6dd04d13c1..550ad3c779 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestFrequency.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestFrequency.java @@ -32,8 +32,6 @@ import org.junit.jupiter.api.Test; /** * Testcase for the function FREQUENCY(data, bins) - * - * @author Yegor Kozlov */ class TestFrequency { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestHex2Dec.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestHex2Dec.java index ba5bae0b1f..4afa0e37cb 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestHex2Dec.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestHex2Dec.java @@ -31,8 +31,6 @@ import org.junit.jupiter.api.Test; /** * Tests for {@link Hex2Dec} - * - * @author cedric dot walter @ gmail dot com */ final class TestHex2Dec { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestIndex.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestIndex.java index b39e396c04..9141f92b6f 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestIndex.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestIndex.java @@ -144,7 +144,7 @@ final class TestIndex { /** * Confirms that the result is an area ref with the specified coordinates - * @return <tt>ve</tt> cast to {@link AreaEval} if it is valid + * @return {@code ve} cast to {@link AreaEval} if it is valid */ private static AreaEval confirmAreaEval(String refText, ValueEval ve) { CellRangeAddress cra = CellRangeAddress.valueOf(refText); diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestIndirectFunctionFromSpreadsheet.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestIndirectFunctionFromSpreadsheet.java index f3a8cccb4f..36b9dc2050 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestIndirectFunctionFromSpreadsheet.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestIndirectFunctionFromSpreadsheet.java @@ -25,7 +25,7 @@ import org.junit.jupiter.params.provider.Arguments; * Tests INDIRECT() as loaded from a test data spreadsheet.<p> * * Tests for bug fixes and specific/tricky behaviour can be found in the corresponding test class - * (<tt>TestXxxx</tt>) of the target (<tt>Xxxx</tt>) implementor, where execution can be observed + * ({@code TestXxxx}) of the target ({@code Xxxx}) implementor, where execution can be observed * more easily. */ final class TestIndirectFunctionFromSpreadsheet extends BaseTestFunctionsFromSpreadsheet { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestIntercept.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestIntercept.java index 03dac3cef2..2ff1df501c 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestIntercept.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestIntercept.java @@ -33,8 +33,6 @@ import org.junit.jupiter.api.Test; /** * Test for Excel function INTERCEPT() - * - * @author Johan Karlsteen */ final class TestIntercept { private static final Function INTERCEPT = new Intercept(); diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestIsBlank.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestIsBlank.java index 9f6ece060c..6477f7692a 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestIsBlank.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestIsBlank.java @@ -31,8 +31,6 @@ import org.junit.jupiter.api.Test; /** * Tests for Excel function ISBLANK() - * - * @author Josh Micich */ final class TestIsBlank { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestLeftRight.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestLeftRight.java index 4bf92c7196..287d7efca7 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestLeftRight.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestLeftRight.java @@ -29,8 +29,6 @@ import org.junit.jupiter.api.Test; * * Test cases for {@link TextFunction#LEFT} and {@link TextFunction#RIGHT} * - * @author Brendan Nolan - * */ class TestLeftRight { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestLen.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestLen.java index b4d8aa7a13..176242b18f 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestLen.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestLen.java @@ -29,8 +29,6 @@ import org.junit.jupiter.api.Test; /** * Tests for Excel function LEN() - * - * @author Josh Micich */ final class TestLen { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestLookupFunctionsFromSpreadsheet.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestLookupFunctionsFromSpreadsheet.java index 84d3674b70..57e7e0eb80 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestLookupFunctionsFromSpreadsheet.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestLookupFunctionsFromSpreadsheet.java @@ -27,7 +27,7 @@ import org.junit.jupiter.params.provider.Arguments; * functions have more complex test cases and test data setup. * * Tests for bug fixes and specific/tricky behaviour can be found in the corresponding test class - * (<tt>TestXxxx</tt>) of the target (<tt>Xxxx</tt>) implementor, where execution can be observed + * ({@code TestXxxx}) of the target ({@code Xxxx}) implementor, where execution can be observed * more easily. */ final class TestLookupFunctionsFromSpreadsheet extends BaseTestFunctionsFromSpreadsheet { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMatch.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMatch.java index 3721c688df..d6a1ac849e 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMatch.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMatch.java @@ -237,7 +237,7 @@ final class TestMatch { /** - * Ensures that the match_type argument can be an <tt>AreaEval</tt>.<br> + * Ensures that the match_type argument can be an {@code AreaEval}.<br> * Bugzilla 44421 */ @Test diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMatchFunctionsFromSpreadsheet.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMatchFunctionsFromSpreadsheet.java index 7f6f8ca2e6..d6e56d5dec 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMatchFunctionsFromSpreadsheet.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMatchFunctionsFromSpreadsheet.java @@ -25,7 +25,7 @@ import org.junit.jupiter.params.provider.Arguments; * Tests Match functions as loaded from a test data spreadsheet.<p> * * Tests for bug fixes and specific/tricky behaviour can be found in the corresponding test class - * (<tt>TestXxxx</tt>) of the target (<tt>Xxxx</tt>) implementor, where execution can be observed + * ({@code TestXxxx}) of the target ({@code Xxxx}) implementor, where execution can be observed * more easily. */ final class TestMatchFunctionsFromSpreadsheet extends BaseTestFunctionsFromSpreadsheet { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMathX.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMathX.java index e408fceb7e..b7fd5bbf6e 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMathX.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMathX.java @@ -26,10 +26,6 @@ import org.apache.poi.ss.formula.functions.XYNumericFunction.Accumulator; import org.junit.jupiter.api.Test; -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * - */ public class TestMathX extends BaseTestNumeric { @Test diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMid.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMid.java index 866c65fb4a..47be2014b4 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMid.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMid.java @@ -31,8 +31,6 @@ import org.junit.jupiter.api.Test; /** * Tests for Excel function MID() - * - * @author Josh Micich */ final class TestMid { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMirr.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMirr.java index f640cb54ee..84843e6b44 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMirr.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestMirr.java @@ -35,8 +35,6 @@ import org.junit.jupiter.api.Test; /** * Tests for {@link org.apache.poi.ss.formula.functions.Mirr} * - * @author Carlos Delgado (carlos dot del dot est at gmail dot com) - * @author Cedric Walter (cedric dot walter at gmail dot com) * @see org.apache.poi.ss.formula.functions.TestIrr */ final class TestMirr { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestOct2Dec.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestOct2Dec.java index 89c19277d2..0afac10eed 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestOct2Dec.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestOct2Dec.java @@ -27,8 +27,6 @@ import org.junit.jupiter.api.Test; /** * Tests for {@link org.apache.poi.ss.formula.functions.Oct2Dec} - * - * @author cedric dot walter @ gmail dot com */ final class TestOct2Dec { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestOffset.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestOffset.java index fd2ada7b97..8c6264ecda 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestOffset.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestOffset.java @@ -36,8 +36,6 @@ import org.junit.jupiter.params.provider.CsvSource; /** * Tests for OFFSET function implementation - * - * @author Josh Micich */ final class TestOffset { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestPoisson.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestPoisson.java index 35ee88c29d..6f8fc2685f 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestPoisson.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestPoisson.java @@ -27,7 +27,6 @@ import org.junit.jupiter.api.Test; /** * Tests for Excel function POISSON(x,mean,cumulative) - * @author Kalpesh Parmar */ class TestPoisson { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestQuotient.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestQuotient.java index 15968199b5..838beb576a 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestQuotient.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestQuotient.java @@ -26,8 +26,6 @@ import org.junit.jupiter.api.Test; /** * Tests for {@link Quotient} - * - * @author cedric dot walter @ gmail dot com */ class TestQuotient { private static ValueEval invokeValue(String numerator, String denominator) { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestRoundFuncs.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestRoundFuncs.java index 4450528822..431719f9e4 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestRoundFuncs.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestRoundFuncs.java @@ -28,8 +28,6 @@ import org.junit.jupiter.api.Test; /** * Test cases for ROUND(), ROUNDUP(), ROUNDDOWN() - * - * @author Josh Micich */ final class TestRoundFuncs { // github-43 diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestSlope.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestSlope.java index 5c8bc1eb33..2ccd3977f3 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestSlope.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestSlope.java @@ -28,8 +28,6 @@ import org.junit.jupiter.api.Test; /** * Test for Excel function SLOPE() - * - * @author Johan Karlsteen */ final class TestSlope { private static final Function SLOPE = new Slope(); diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestSumproduct.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestSumproduct.java index 35ee48d26c..f357af6875 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestSumproduct.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestSumproduct.java @@ -30,8 +30,6 @@ import org.junit.jupiter.api.Test; /** * Test cases for SUMPRODUCT() - * - * @author Josh Micich */ final class TestSumproduct { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestTFunc.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestTFunc.java index 03cb480e47..08bd4c1dd8 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestTFunc.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestTFunc.java @@ -33,8 +33,6 @@ import org.junit.jupiter.api.Test; /** * Test cases for Excel function T() - * - * @author Josh Micich */ final class TestTFunc { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestTrim.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestTrim.java index efee41b996..ec71ae0656 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestTrim.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestTrim.java @@ -29,8 +29,6 @@ import org.junit.jupiter.api.Test; /** * Tests for Excel function TRIM() - * - * @author Josh Micich */ final class TestTrim { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestTrunc.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestTrunc.java index 6e1d5d8cac..782461ef24 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestTrunc.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestTrunc.java @@ -27,8 +27,6 @@ import org.junit.jupiter.api.Test; /** * Test case for TRUNC() - * - * @author Stephen Wolke (smwolke at geistig.com) */ final class TestTrunc extends BaseTestNumeric { private static final NumericFunction F = null; diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestXYNumericFunction.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestXYNumericFunction.java index b97e80171e..54f50049c2 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestXYNumericFunction.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestXYNumericFunction.java @@ -26,8 +26,6 @@ import org.junit.jupiter.api.Test; /** * Tests for Excel functions SUMX2MY2(), SUMX2PY2(), SUMXMY2() - * - * @author Josh Micich */ final class TestXYNumericFunction { private static final Function SUM_SQUARES = new Sumx2py2(); diff --git a/poi/src/test/java/org/apache/poi/ss/formula/ptg/TestArrayPtg.java b/poi/src/test/java/org/apache/poi/ss/formula/ptg/TestArrayPtg.java index c5a1b44bd0..278034d165 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/ptg/TestArrayPtg.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/ptg/TestArrayPtg.java @@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianInput; import org.junit.jupiter.api.Test; /** - * Tests for <tt>ArrayPtg</tt> + * Tests for {@code ArrayPtg} */ final class TestArrayPtg { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/ptg/TestExternalFunctionFormulas.java b/poi/src/test/java/org/apache/poi/ss/formula/ptg/TestExternalFunctionFormulas.java index fedc639764..ccdc392661 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/ptg/TestExternalFunctionFormulas.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/ptg/TestExternalFunctionFormulas.java @@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test; final class TestExternalFunctionFormulas { /** - * tests <tt>NameXPtg.toFormulaString(Workbook)</tt> and logic in Workbook below that + * tests {@code NameXPtg.toFormulaString(Workbook)} and logic in Workbook below that */ @Test void testReadFormulaContainingExternalFunction() throws Exception { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/ptg/TestExternalNameReference.java b/poi/src/test/java/org/apache/poi/ss/formula/ptg/TestExternalNameReference.java index 0c582c5cf7..5b014725be 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/ptg/TestExternalNameReference.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/ptg/TestExternalNameReference.java @@ -39,7 +39,7 @@ final class TestExternalNameReference { double NEW_QUANT = 7.0d; double NEW_PART_COST = 15.3d; /** - * tests <tt>NameXPtg for external cell reference by name</tt> and logic in Workbook below that + * tests {@code NameXPtg for external cell reference by name} and logic in Workbook below that */ @Test void testReadCalcSheet() { diff --git a/poi/src/test/java/org/apache/poi/ss/formula/ptg/TestFuncVarPtg.java b/poi/src/test/java/org/apache/poi/ss/formula/ptg/TestFuncVarPtg.java index 2eb91217cb..ebf1d3a260 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/ptg/TestFuncVarPtg.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/ptg/TestFuncVarPtg.java @@ -24,17 +24,15 @@ import org.apache.poi.hssf.model.HSSFFormulaParser; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.junit.jupiter.api.Test; -/** - * @author Josh Micich - */ final class TestFuncVarPtg { /** * The first fix for bugzilla 44675 broke the encoding of SUM formulas (and probably others). * The operand classes of the parameters to SUM() should be coerced to 'reference' not 'value'. * In the case of SUM, Excel evaluates the formula to '#VALUE!' if a parameter operand class is - * wrong. In other cases Excel seems to tolerate bad operand classes.</p> - * This functionality is related to the setParameterRVA() methods of <tt>FormulaParser</tt> + * wrong. In other cases Excel seems to tolerate bad operand classes.<p> + * + * This functionality is related to the setParameterRVA() methods of {@code FormulaParser} */ @Test void testOperandClass() { diff --git a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestDataValidation.java b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestDataValidation.java index ccfd8293c0..ba68155194 100644 --- a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestDataValidation.java +++ b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestDataValidation.java @@ -29,8 +29,6 @@ import org.junit.jupiter.api.Test; /** * Class for testing Excel's data validation mechanism - * - * @author Dragos Buleandra ( dragos.buleandra@trade2b.ro ) */ public abstract class BaseTestDataValidation { private final ITestDataProvider _testDataProvider; diff --git a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestFont.java b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestFont.java index d0d2b0c535..d8e1e6dde3 100644 --- a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestFont.java +++ b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestFont.java @@ -32,9 +32,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -/** - * @author Yegor Kozlov - */ public abstract class BaseTestFont { private final ITestDataProvider _testDataProvider; diff --git a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestHyperlink.java b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestHyperlink.java index 44a33c3f20..e5ef5312d9 100644 --- a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestHyperlink.java +++ b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestHyperlink.java @@ -29,9 +29,7 @@ import org.apache.poi.ss.ITestDataProvider; import org.junit.jupiter.api.Test; /** - * Test diffrent types of Excel hyperlinks - * - * @author Yegor Kozlov + * Test different types of Excel hyperlinks */ public abstract class BaseTestHyperlink { diff --git a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestSheetAutosizeColumn.java b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestSheetAutosizeColumn.java index 3afec95478..5e8a41c1c4 100644 --- a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestSheetAutosizeColumn.java +++ b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestSheetAutosizeColumn.java @@ -35,8 +35,6 @@ import org.junit.jupiter.api.Test; /** * Common superclass for testing automatic sizing of sheet columns - * - * @author Yegor Kozlov */ public abstract class BaseTestSheetAutosizeColumn { diff --git a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java index 67d351bffc..6c8e2f2a93 100644 --- a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java +++ b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestSheetShiftRows.java @@ -41,9 +41,6 @@ import org.junit.jupiter.api.Test; /** * Tests row shifting capabilities. - * - * @author Shawn Laubach (slaubach at apache dot com) - * @author Toshiaki Kamoshida (kamoshida.toshiaki at future dot co dot jp) */ public abstract class BaseTestSheetShiftRows { diff --git a/poi/src/test/java/org/apache/poi/ss/usermodel/TestHSSFBorderStyle.java b/poi/src/test/java/org/apache/poi/ss/usermodel/TestHSSFBorderStyle.java index 202ffae308..5d3123d3bb 100644 --- a/poi/src/test/java/org/apache/poi/ss/usermodel/TestHSSFBorderStyle.java +++ b/poi/src/test/java/org/apache/poi/ss/usermodel/TestHSSFBorderStyle.java @@ -19,9 +19,6 @@ package org.apache.poi.ss.usermodel; import org.apache.poi.hssf.HSSFITestDataProvider; -/** - * @author Yegor Kozlov - */ final class TestHSSFBorderStyle extends BaseTestBorderStyle { public TestHSSFBorderStyle() { diff --git a/poi/src/test/java/org/apache/poi/ss/usermodel/TestIndexedColors.java b/poi/src/test/java/org/apache/poi/ss/usermodel/TestIndexedColors.java index d336ea95cd..ac260b73e9 100644 --- a/poi/src/test/java/org/apache/poi/ss/usermodel/TestIndexedColors.java +++ b/poi/src/test/java/org/apache/poi/ss/usermodel/TestIndexedColors.java @@ -22,9 +22,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import org.junit.jupiter.api.Test; -/** - * @author Yegor Kozlov - */ final class TestIndexedColors { @Test diff --git a/poi/src/test/java/org/apache/poi/ss/util/NumberComparingSpreadsheetGenerator.java b/poi/src/test/java/org/apache/poi/ss/util/NumberComparingSpreadsheetGenerator.java index d8664487ce..8c241a6464 100644 --- a/poi/src/test/java/org/apache/poi/ss/util/NumberComparingSpreadsheetGenerator.java +++ b/poi/src/test/java/org/apache/poi/ss/util/NumberComparingSpreadsheetGenerator.java @@ -37,8 +37,6 @@ import org.apache.poi.util.HexDump; * (along with their expected results) that get encoded into rows of the spreadsheet. * Each example is checked with a formula (in column I) that displays either "OK" or * "ERROR" depending on whether actual results match those expected. - * - * @author Josh Micich */ public class NumberComparingSpreadsheetGenerator { diff --git a/poi/src/test/java/org/apache/poi/ss/util/NumberComparisonExamples.java b/poi/src/test/java/org/apache/poi/ss/util/NumberComparisonExamples.java index 925f968b37..398649c361 100644 --- a/poi/src/test/java/org/apache/poi/ss/util/NumberComparisonExamples.java +++ b/poi/src/test/java/org/apache/poi/ss/util/NumberComparisonExamples.java @@ -22,9 +22,7 @@ import java.util.Collections; import java.util.List; /** - * Contains specific examples of <tt>double</tt> value pairs and their comparison result according to Excel. - * - * @author Josh Micich + * Contains specific examples of {@code double} value pairs and their comparison result according to Excel. */ final class NumberComparisonExamples { @@ -116,29 +114,27 @@ final class NumberComparisonExamples { addStepTransition(temp, 0x001000000000001BL); addStepTransition(temp, 0x001000000000002FL); - Collections.addAll(temp, new ComparisonExample[]{ - // negative, and exponents differ by more than 1 - ce(0xBF30000000000000L, 0xBE60000000000000L, -1), - - // negative zero *is* less than positive zero, but not easy to get out of calculations - ce(0x0000000000000000L, 0x8000000000000000L, +1), - // subnormal numbers compare without rounding for some reason - ce(0x0000000000000000L, 0x0000000000000001L, -1), - ce(0x0008000000000000L, 0x0008000000000001L, -1), - ce(0x000FFFFFFFFFFFFFL, 0x000FFFFFFFFFFFFEL, +1), - ce(0x000FFFFFFFFFFFFBL, 0x000FFFFFFFFFFFFCL, -1), - ce(0x000FFFFFFFFFFFFBL, 0x000FFFFFFFFFFFFEL, -1), - - // across subnormal threshold (some mistakes when close) - ce(0x000FFFFFFFFFFFFFL, 0x0010000000000000L, +1), - ce(0x000FFFFFFFFFFFFBL, 0x0010000000000007L, +1), - ce(0x000FFFFFFFFFFFFAL, 0x0010000000000007L, 0), - - // when a bit further apart - normal results - ce(0x000FFFFFFFFFFFF9L, 0x0010000000000007L, -1), - ce(0x000FFFFFFFFFFFFAL, 0x0010000000000008L, -1), - ce(0x000FFFFFFFFFFFFBL, 0x0010000000000008L, -1), - }); + Collections.addAll(temp, // negative, and exponents differ by more than 1 + ce(0xBF30000000000000L, 0xBE60000000000000L, -1), + + // negative zero *is* less than positive zero, but not easy to get out of calculations + ce(0x0000000000000000L, 0x8000000000000000L, +1), + // subnormal numbers compare without rounding for some reason + ce(0x0000000000000000L, 0x0000000000000001L, -1), + ce(0x0008000000000000L, 0x0008000000000001L, -1), + ce(0x000FFFFFFFFFFFFFL, 0x000FFFFFFFFFFFFEL, +1), + ce(0x000FFFFFFFFFFFFBL, 0x000FFFFFFFFFFFFCL, -1), + ce(0x000FFFFFFFFFFFFBL, 0x000FFFFFFFFFFFFEL, -1), + + // across subnormal threshold (some mistakes when close) + ce(0x000FFFFFFFFFFFFFL, 0x0010000000000000L, +1), + ce(0x000FFFFFFFFFFFFBL, 0x0010000000000007L, +1), + ce(0x000FFFFFFFFFFFFAL, 0x0010000000000007L, 0), + + // when a bit further apart - normal results + ce(0x000FFFFFFFFFFFF9L, 0x0010000000000007L, -1), + ce(0x000FFFFFFFFFFFFAL, 0x0010000000000008L, -1), + ce(0x000FFFFFFFFFFFFBL, 0x0010000000000008L, -1)); ComparisonExample[] result = new ComparisonExample[temp.size()]; temp.toArray(result); @@ -150,11 +146,10 @@ final class NumberComparisonExamples { } private static void addStepTransition(List<ComparisonExample> temp, long rawBits) { - Collections.addAll(temp, new ComparisonExample[]{ - ce(rawBits - 1, rawBits + 0, 0), - ce(rawBits + 0, rawBits + 1, -1), - ce(rawBits + 1, rawBits + 2, 0), - }); + Collections.addAll(temp, + ce(rawBits - 1, rawBits + 0, 0), + ce(rawBits + 0, rawBits + 1, -1), + ce(rawBits + 1, rawBits + 2, 0)); } diff --git a/poi/src/test/java/org/apache/poi/ss/util/NumberRenderingSpreadsheetGenerator.java b/poi/src/test/java/org/apache/poi/ss/util/NumberRenderingSpreadsheetGenerator.java index 0014a1f539..c2ef0dfdc1 100644 --- a/poi/src/test/java/org/apache/poi/ss/util/NumberRenderingSpreadsheetGenerator.java +++ b/poi/src/test/java/org/apache/poi/ss/util/NumberRenderingSpreadsheetGenerator.java @@ -41,8 +41,6 @@ import org.apache.poi.util.HexRead; /** * Creates a spreadsheet that demonstrates Excel's rendering of various IEEE double values. - * - * @author Josh Micich */ public class NumberRenderingSpreadsheetGenerator { @@ -80,7 +78,7 @@ public class NumberRenderingSpreadsheetGenerator { } /** 0x7ff8000000000000 encoded in little endian order */ private static final byte[] JAVA_NAN_BYTES = HexRead.readFromString("00 00 00 00 00 00 F8 7F"); - + private static void writeHeaderCell(HSSFRow row, int i, String text, HSSFCellStyle style) { HSSFCell cell = row.createCell(i); cell.setCellValue(new HSSFRichTextString(text)); @@ -104,22 +102,22 @@ public class NumberRenderingSpreadsheetGenerator { writeHeaderCell(row, 2, "JDK Double Rendering", style); writeHeaderCell(row, 3, "Actual Rendering", style); writeHeaderCell(row, 4, "Expected Rendering", style); - writeHeaderCell(row, 5, "Match", style); + writeHeaderCell(row, 5, "Match", style); writeHeaderCell(row, 6, "Java Metadata", style); } static void writeDataRow(HSSFSheet sheet, int rowIx, long rawLongBits, String expectedExcelRendering) { double d = Double.longBitsToDouble(rawLongBits); HSSFRow row = sheet.createRow(rowIx); - + int rowNum = rowIx + 1; String cel0ref = "A" + rowNum; String rawBitsText = formatLongAsHex(rawLongBits); String jmExpr = "'ec(" + rawBitsText + ", ''\" & C" + rowNum + " & \"'', ''\" & D" + rowNum + " & \"''),'"; - + // The 'Match' column will contain 'OK' if the metadata (from NumberToTextConversionExamples) // matches Excel's rendering. String matchExpr = "if(D" + rowNum + "=E" + rowNum + ", \"OK\", \"ERROR\")"; - + row.createCell(0).setCellValue(d); row.createCell(1).setCellValue(new HSSFRichTextString(rawBitsText)); row.createCell(2).setCellValue(new HSSFRichTextString(Double.toString(d))); @@ -134,22 +132,22 @@ public class NumberRenderingSpreadsheetGenerator { // row.createCell(8).setCellFormula(cel0ref + " / 1.0001"); // } } - + private static String formatLongAsHex(long l) { return HexDump.longToHex(l) + 'L'; } public static void main(String[] args) { writeJavaDoc(); - + HSSFWorkbook wb = new HSSFWorkbook(); SheetWriter sw = new SheetWriter(wb); - + ExampleConversion[] exampleValues = NumberToTextConversionExamples.getExampleConversions(); for (ExampleConversion example : exampleValues) { sw.addTestRow(example.getRawDoubleBits(), example.getExcelRendering()); } - + ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { wb.write(baos); @@ -158,10 +156,10 @@ public class NumberRenderingSpreadsheetGenerator { } byte[] fileContent = baos.toByteArray(); replaceNaNs(fileContent, sw.getReplacementNaNs()); - - + + File outputFile = new File("ExcelNumberRendering.xls"); - + try { FileOutputStream os = new FileOutputStream(outputFile); os.write(fileContent); @@ -173,20 +171,20 @@ public class NumberRenderingSpreadsheetGenerator { } public static void writeJavaDoc() { - + ExampleConversion[] exampleConversions = NumberToTextConversionExamples.getExampleConversions(); for (ExampleConversion ec : exampleConversions) { - String line = " * <tr><td>" + String line = " * <tr><td>" + formatLongAsHex(ec.getRawDoubleBits()) - + "</td><td>" + Double.toString(ec.getDoubleValue()) + + "</td><td>" + Double.toString(ec.getDoubleValue()) + "</td><td>" + ec.getExcelRendering() + "</td></tr>"; - + System.out.println(line); } } - - + + private static void replaceNaNs(byte[] fileContent, long[] replacementNaNs) { int countFound = 0; for(int i=0; i<fileContent.length; i++) { @@ -198,7 +196,7 @@ public class NumberRenderingSpreadsheetGenerator { if (countFound < replacementNaNs.length) { throw new RuntimeException("wrong repl count"); } - + } private static void writeLong(byte[] bb, int i, long val) { @@ -215,7 +213,7 @@ public class NumberRenderingSpreadsheetGenerator { // String newVal = interpretLong(bb, i); // System.out.println("changed offset " + i + " from " + oldVal + " to " + newVal); // } - + } private static String interpretLong(byte[] fileContent, int offset) { diff --git a/poi/src/test/java/org/apache/poi/ss/util/NumberToTextConversionExamples.java b/poi/src/test/java/org/apache/poi/ss/util/NumberToTextConversionExamples.java index 1dcedc97a2..68f1f5c15c 100644 --- a/poi/src/test/java/org/apache/poi/ss/util/NumberToTextConversionExamples.java +++ b/poi/src/test/java/org/apache/poi/ss/util/NumberToTextConversionExamples.java @@ -20,7 +20,7 @@ package org.apache.poi.ss.util; import java.util.Locale; /** - * Contains specific examples of <tt>double</tt> values and their rendering in Excel. + * Contains specific examples of {@code double} values and their rendering in Excel. */ final class NumberToTextConversionExamples { diff --git a/poi/src/test/java/org/apache/poi/ss/util/TestAreaReference.java b/poi/src/test/java/org/apache/poi/ss/util/TestAreaReference.java index e8419d5306..9f944e3918 100644 --- a/poi/src/test/java/org/apache/poi/ss/util/TestAreaReference.java +++ b/poi/src/test/java/org/apache/poi/ss/util/TestAreaReference.java @@ -28,8 +28,6 @@ import org.junit.jupiter.api.Test; /** * Test for {@link AreaReference} handling of max rows. - * - * @author David North */ class TestAreaReference { @Test diff --git a/poi/src/test/java/org/apache/poi/ss/util/TestNumberToTextConverter.java b/poi/src/test/java/org/apache/poi/ss/util/TestNumberToTextConverter.java index 387980d870..0a197ab0c5 100644 --- a/poi/src/test/java/org/apache/poi/ss/util/TestNumberToTextConverter.java +++ b/poi/src/test/java/org/apache/poi/ss/util/TestNumberToTextConverter.java @@ -21,6 +21,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; import org.apache.poi.hssf.record.FormulaRecord; +import org.apache.poi.hssf.record.NumberRecord; import org.apache.poi.ss.formula.constant.ConstantValueParser; import org.apache.poi.ss.formula.ptg.NumberPtg; import org.apache.poi.ss.util.NumberToTextConversionExamples.ExampleConversion; @@ -31,8 +32,8 @@ import org.junit.jupiter.api.Test; */ final class TestNumberToTextConverter { /** - * Confirms that <tt>ExcelNumberToTextConverter.toText(d)</tt> produces the right results. - * As part of preparing this test class, the <tt>ExampleConversion</tt> instances should be set + * Confirms that {@code ExcelNumberToTextConverter.toText(d)} produces the right results. + * As part of preparing this test class, the {@code ExampleConversion} instances should be set * up to contain the rendering as produced by Excel. */ @Test @@ -60,14 +61,14 @@ final class TestNumberToTextConverter { * values as a plain number. That is the unusual functionality that this method is testing.<p> * * There are multiple encodings (bit patterns) for NaN, and CPUs and applications can convert - * to a preferred NaN encoding (Java prefers <tt>0x7FF8000000000000L</tt>). Besides the - * special encoding in {@link FormulaRecord.SpecialCachedValue}, it is not known how/whether + * to a preferred NaN encoding (Java prefers {@code 0x7FF8000000000000L}). Besides the + * special encoding in {@code FormulaRecord.SpecialCachedValue}, it is not known how/whether * Excel attempts to encode NaN values. * * Observed NaN behaviour on HotSpot/Windows: - * <tt>Double.longBitsToDouble()</tt> will set one bit 51 (the NaN signaling flag) if it isn't - * already. <tt>Double.doubleToLongBits()</tt> will return a double with bit pattern - * <tt>0x7FF8000000000000L</tt> for any NaN bit pattern supplied.<br> + * {@code Double.longBitsToDouble()} will set one bit 51 (the NaN signaling flag) if it isn't + * already. {@code Double.doubleToLongBits()} will return a double with bit pattern + * {@code 0x7FF8000000000000L} for any NaN bit pattern supplied.<br> * Differences are likely to be observed with other architectures.<p> * * <p> diff --git a/poi/src/test/java/org/apache/poi/util/TestIntList.java b/poi/src/test/java/org/apache/poi/util/TestIntList.java index 3483933ce4..4c4317ad0e 100644 --- a/poi/src/test/java/org/apache/poi/util/TestIntList.java +++ b/poi/src/test/java/org/apache/poi/util/TestIntList.java @@ -29,8 +29,6 @@ import org.junit.jupiter.api.Test; /** * Class to test IntList - * - * @author Marc Johnson */ final class TestIntList { @Test |