Remove unnecessary local variables
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1808518 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7937da6a10
commit
5341a131de
@ -139,8 +139,7 @@ public String[][] getParameterInfo() {
|
||||
System.out.println(field);
|
||||
field = uc.getHeaderField(i);
|
||||
}
|
||||
BufferedInputStream is = new BufferedInputStream(uc.getInputStream());
|
||||
return is;
|
||||
return new BufferedInputStream(uc.getInputStream());
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,8 +40,7 @@ public final class Word2Forrest
|
||||
@SuppressWarnings("unused")
|
||||
public Word2Forrest(HWPFDocument doc, OutputStream stream) throws IOException
|
||||
{
|
||||
OutputStreamWriter out = new OutputStreamWriter (stream, Charset.forName("UTF-8"));
|
||||
_out = out;
|
||||
_out = new OutputStreamWriter (stream, Charset.forName("UTF-8"));
|
||||
_doc = doc;
|
||||
|
||||
init ();
|
||||
|
@ -76,10 +76,7 @@ public class CalculateMortgage implements FreeRefFunction {
|
||||
double i = r / 12 ;
|
||||
double n = y * 12 ;
|
||||
|
||||
double principalAndInterest =
|
||||
p * (( i * Math.pow((1 + i),n ) ) / ( Math.pow((1 + i),n) - 1)) ;
|
||||
|
||||
return principalAndInterest ;
|
||||
return p * (( i * Math.pow((1 + i),n ) ) / ( Math.pow((1 + i),n) - 1));
|
||||
}
|
||||
/**
|
||||
* Excel does not support infinities and NaNs, rather, it gives a #NUM! error in these cases
|
||||
|
@ -154,9 +154,8 @@ public class ExcelAntWorkbookUtil extends Typedef {
|
||||
}
|
||||
|
||||
UDFFinder udff1 = new DefaultUDFFinder(names, functions);
|
||||
UDFFinder udff = new AggregatingUDFFinder(udff1);
|
||||
|
||||
return udff;
|
||||
return new AggregatingUDFFinder(udff1);
|
||||
|
||||
}
|
||||
|
||||
|
@ -78,10 +78,7 @@ public class CalculateMortgageFunction implements FreeRefFunction {
|
||||
double i = r / 12 ;
|
||||
double n = y * 12 ;
|
||||
|
||||
double principalAndInterest =
|
||||
p * (( i * Math.pow((1 + i),n ) ) / ( Math.pow((1 + i),n) - 1)) ;
|
||||
|
||||
return principalAndInterest ;
|
||||
return p * (( i * Math.pow((1 + i),n ) ) / ( Math.pow((1 + i),n) - 1));
|
||||
}
|
||||
/**
|
||||
* Excel does not support infinities and NaNs, rather, it gives a #NUM! error in these cases
|
||||
|
@ -218,12 +218,11 @@ public class EscherColorRef {
|
||||
}
|
||||
|
||||
public int[] getRGB() {
|
||||
int rgb[] = {
|
||||
return new int[]{
|
||||
FLAG_RED.getValue(colorRef),
|
||||
FLAG_GREEN.getValue(colorRef),
|
||||
FLAG_BLUE.getValue(colorRef)
|
||||
};
|
||||
return rgb;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -391,8 +391,7 @@ public class PropertySet {
|
||||
*/
|
||||
try {
|
||||
final byte[] buffer = IOUtils.peekFirstNBytes(stream, BUFFER_SIZE);
|
||||
final boolean isPropertySetStream = isPropertySetStream(buffer, 0, buffer.length);
|
||||
return isPropertySetStream;
|
||||
return isPropertySetStream(buffer, 0, buffer.length);
|
||||
} catch (EmptyFileException e) {
|
||||
return false;
|
||||
}
|
||||
|
@ -955,8 +955,7 @@ public class Section {
|
||||
for (int i = 0; i < pa.length; i++) {
|
||||
hashCode += pa[i].hashCode();
|
||||
}
|
||||
final int returnHashCode = (int) (hashCode & 0x0ffffffffL);
|
||||
return returnHashCode;
|
||||
return (int) (hashCode & 0x0ffffffffL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -198,9 +198,8 @@ public final class Thumbnail {
|
||||
*/
|
||||
public long getClipboardFormatTag()
|
||||
{
|
||||
long clipboardFormatTag = LittleEndian.getInt(getThumbnail(),
|
||||
return (long) LittleEndian.getInt(getThumbnail(),
|
||||
OFFSET_CFTAG);
|
||||
return clipboardFormatTag;
|
||||
}
|
||||
|
||||
|
||||
|
@ -143,12 +143,9 @@ public class HPSFPropertiesExtractor extends POIOLE2TextExtractor {
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
for (String file : args) {
|
||||
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(
|
||||
new NPOIFSFileSystem(new File(file)));
|
||||
try {
|
||||
try (HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(
|
||||
new NPOIFSFileSystem(new File(file)))) {
|
||||
System.out.println(ext.getText());
|
||||
} finally {
|
||||
ext.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -422,8 +422,7 @@ public final class BiffViewer {
|
||||
} else {
|
||||
boolean dumpInterpretedRecords = cmdArgs.shouldDumpRecordInterpretations();
|
||||
boolean dumpHex = cmdArgs.shouldDumpBiffHex();
|
||||
boolean zeroAlignHexDump = dumpInterpretedRecords; // TODO - fix non-zeroAlign
|
||||
runBiffViewer(pw, is, dumpInterpretedRecords, dumpHex, zeroAlignHexDump,
|
||||
runBiffViewer(pw, is, dumpInterpretedRecords, dumpHex, dumpInterpretedRecords,
|
||||
cmdArgs.suppressHeader());
|
||||
}
|
||||
} finally {
|
||||
|
@ -491,10 +491,8 @@ public final class InternalWorkbook {
|
||||
"There are only " + numfonts
|
||||
+ " font records, you asked for " + idx);
|
||||
}
|
||||
FontRecord retval =
|
||||
( FontRecord ) records.get((records.getFontpos() - (numfonts - 1)) + index);
|
||||
|
||||
return retval;
|
||||
return ( FontRecord ) records.get((records.getFontpos() - (numfonts - 1)) + index);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -867,10 +865,8 @@ public final class InternalWorkbook {
|
||||
int xfptr = records.getXfpos() - (numxfs - 1);
|
||||
|
||||
xfptr += index;
|
||||
ExtendedFormatRecord retval =
|
||||
( ExtendedFormatRecord ) records.get(xfptr);
|
||||
|
||||
return retval;
|
||||
return ( ExtendedFormatRecord ) records.get(xfptr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,8 +36,7 @@ public abstract class CFHeaderBase extends StandardRecord implements Cloneable {
|
||||
protected CFHeaderBase() {
|
||||
}
|
||||
protected CFHeaderBase(CellRangeAddress[] regions, int nRules) {
|
||||
CellRangeAddress[] unmergedRanges = regions;
|
||||
CellRangeAddress[] mergeCellRanges = CellRangeUtil.mergeCellRanges(unmergedRanges);
|
||||
CellRangeAddress[] mergeCellRanges = CellRangeUtil.mergeCellRanges(regions);
|
||||
setCellRanges(mergeCellRanges);
|
||||
field_1_numcf = nRules;
|
||||
}
|
||||
|
@ -77,8 +77,7 @@ public final class EndSubRecord extends SubRecord implements Cloneable {
|
||||
|
||||
@Override
|
||||
public EndSubRecord clone() {
|
||||
EndSubRecord rec = new EndSubRecord();
|
||||
|
||||
return rec;
|
||||
return new EndSubRecord();
|
||||
}
|
||||
}
|
||||
|
@ -522,8 +522,7 @@ public final class EscherAggregate extends AbstractEscherHolderRecord {
|
||||
}
|
||||
|
||||
for (NoteRecord noteRecord : tailRec.values()) {
|
||||
Record rec = noteRecord;
|
||||
pos += rec.serialize(pos, data);
|
||||
pos += noteRecord.serialize(pos, data);
|
||||
}
|
||||
int bytesWritten = pos - offset;
|
||||
if (bytesWritten != getRecordSize())
|
||||
|
@ -128,8 +128,7 @@ public final class FormatRecord extends StandardRecord implements Cloneable {
|
||||
throw new IllegalArgumentException("Bad requested string length (" + requestedLength + ")");
|
||||
}
|
||||
char[] buf = null;
|
||||
boolean isCompressedEncoding = pIsCompressedEncoding;
|
||||
int availableChars = isCompressedEncoding ? ris.remaining() : ris.remaining() / LittleEndianConsts.SHORT_SIZE;
|
||||
int availableChars = pIsCompressedEncoding ? ris.remaining() : ris.remaining() / LittleEndianConsts.SHORT_SIZE;
|
||||
//everything worked out. Great!
|
||||
int remaining = ris.remaining();
|
||||
if (requestedLength == availableChars) {
|
||||
@ -142,7 +141,7 @@ public final class FormatRecord extends StandardRecord implements Cloneable {
|
||||
}
|
||||
for (int i = 0; i < buf.length; i++) {
|
||||
char ch;
|
||||
if (isCompressedEncoding) {
|
||||
if (pIsCompressedEncoding) {
|
||||
ch = (char) ris.readUByte();
|
||||
} else {
|
||||
ch = (char) ris.readShort();
|
||||
|
@ -82,8 +82,7 @@ public final class MergeCellsRecord extends StandardRecord implements Cloneable
|
||||
|
||||
@Override
|
||||
public void serialize(LittleEndianOutput out) {
|
||||
int nItems = _numberOfRegions;
|
||||
out.writeShort(nItems);
|
||||
out.writeShort(_numberOfRegions);
|
||||
for (int i = 0; i < _numberOfRegions; i++) {
|
||||
_regions[_startIndex + i].serialize(out);
|
||||
}
|
||||
|
@ -84,22 +84,21 @@ public final class NameCommentRecord extends StandardRecord {
|
||||
* @param ris the RecordInputstream to read the record from
|
||||
*/
|
||||
public NameCommentRecord(final RecordInputStream ris) {
|
||||
final LittleEndianInput in = ris;
|
||||
field_1_record_type = in.readShort();
|
||||
field_2_frt_cell_ref_flag = in.readShort();
|
||||
field_3_reserved = in.readLong();
|
||||
final int field_4_name_length = in.readShort();
|
||||
final int field_5_comment_length = in.readShort();
|
||||
field_1_record_type = ris.readShort();
|
||||
field_2_frt_cell_ref_flag = ris.readShort();
|
||||
field_3_reserved = ris.readLong();
|
||||
final int field_4_name_length = ris.readShort();
|
||||
final int field_5_comment_length = ris.readShort();
|
||||
|
||||
if (in.readByte() == 0) {
|
||||
field_6_name_text = StringUtil.readCompressedUnicode(in, field_4_name_length);
|
||||
if (ris.readByte() == 0) {
|
||||
field_6_name_text = StringUtil.readCompressedUnicode(ris, field_4_name_length);
|
||||
} else {
|
||||
field_6_name_text = StringUtil.readUnicodeLE(in, field_4_name_length);
|
||||
field_6_name_text = StringUtil.readUnicodeLE(ris, field_4_name_length);
|
||||
}
|
||||
if (in.readByte() == 0) {
|
||||
field_7_comment_text = StringUtil.readCompressedUnicode(in, field_5_comment_length);
|
||||
if (ris.readByte() == 0) {
|
||||
field_7_comment_text = StringUtil.readCompressedUnicode(ris, field_5_comment_length);
|
||||
} else {
|
||||
field_7_comment_text = StringUtil.readUnicodeLE(in, field_5_comment_length);
|
||||
field_7_comment_text = StringUtil.readUnicodeLE(ris, field_5_comment_length);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,13 +103,12 @@ public final class RecordFactoryInputStream {
|
||||
}
|
||||
|
||||
public RecordInputStream createDecryptingStream(InputStream original) {
|
||||
FilePassRecord fpr = _filePassRec;
|
||||
String userPassword = Biff8EncryptionKey.getCurrentUserPassword();
|
||||
if (userPassword == null) {
|
||||
userPassword = Decryptor.DEFAULT_PASSWORD;
|
||||
}
|
||||
|
||||
EncryptionInfo info = fpr.getEncryptionInfo();
|
||||
EncryptionInfo info = _filePassRec.getEncryptionInfo();
|
||||
try {
|
||||
if (!info.getDecryptor().verifyPassword(userPassword)) {
|
||||
throw new EncryptedDocumentException(
|
||||
|
@ -363,12 +363,11 @@ public final class ColumnInfoRecordsAggregate extends RecordAggregate implements
|
||||
attemptMergeColInfoRecords(k);
|
||||
} else {
|
||||
//split to 3 records
|
||||
ColumnInfoRecord ciStart = ci;
|
||||
ColumnInfoRecord ciMid = copyColInfo(ci);
|
||||
ColumnInfoRecord ciEnd = copyColInfo(ci);
|
||||
int lastcolumn = ci.getLastColumn();
|
||||
|
||||
ciStart.setLastColumn(targetColumnIx - 1);
|
||||
ci.setLastColumn(targetColumnIx - 1);
|
||||
|
||||
ciMid.setFirstColumn(targetColumnIx);
|
||||
ciMid.setLastColumn(targetColumnIx);
|
||||
|
@ -46,13 +46,12 @@ public final class MergedCellsTable extends RecordAggregate {
|
||||
* @param rs
|
||||
*/
|
||||
public void read(RecordStream rs) {
|
||||
List<CellRangeAddress> temp = _mergedRegions;
|
||||
while (rs.peekNextClass() == MergeCellsRecord.class) {
|
||||
MergeCellsRecord mcr = (MergeCellsRecord) rs.getNext();
|
||||
int nRegions = mcr.getNumAreas();
|
||||
for (int i = 0; i < nRegions; i++) {
|
||||
CellRangeAddress cra = mcr.getAreaAt(i);
|
||||
temp.add(cra);
|
||||
_mergedRegions.add(cra);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -67,10 +66,9 @@ public final class MergedCellsTable extends RecordAggregate {
|
||||
int nMergedCellsRecords = nRegions / MAX_MERGED_REGIONS;
|
||||
int nLeftoverMergedRegions = nRegions % MAX_MERGED_REGIONS;
|
||||
|
||||
int result = nMergedCellsRecords
|
||||
return nMergedCellsRecords
|
||||
* (4 + CellRangeAddressList.getEncodedSize(MAX_MERGED_REGIONS)) + 4
|
||||
+ CellRangeAddressList.getEncodedSize(nLeftoverMergedRegions);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void visitContainedRecords(RecordVisitor rv) {
|
||||
|
@ -172,8 +172,7 @@ public final class SharedValueManager {
|
||||
_groupsCache.put(getKeyForCache(group._firstCell),group);
|
||||
}
|
||||
}
|
||||
SharedFormulaGroup sfg = _groupsCache.get(getKeyForCache(cellRef));
|
||||
return sfg;
|
||||
return _groupsCache.get(getKeyForCache(cellRef));
|
||||
}
|
||||
|
||||
private Integer getKeyForCache(final CellReference cellRef) {
|
||||
|
@ -66,8 +66,7 @@ public final class BeginRecord extends StandardRecord implements Cloneable {
|
||||
|
||||
@Override
|
||||
public BeginRecord clone() {
|
||||
BeginRecord br = new BeginRecord();
|
||||
// No data so nothing to copy
|
||||
return br;
|
||||
return new BeginRecord();
|
||||
}
|
||||
}
|
||||
|
@ -67,8 +67,7 @@ public final class EndRecord extends StandardRecord implements Cloneable {
|
||||
|
||||
@Override
|
||||
public EndRecord clone() {
|
||||
EndRecord er = new EndRecord();
|
||||
// No data so nothing to copy
|
||||
return er;
|
||||
return new EndRecord();
|
||||
}
|
||||
}
|
||||
|
@ -64,8 +64,6 @@ public final class PlotAreaRecord extends StandardRecord {
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
PlotAreaRecord rec = new PlotAreaRecord();
|
||||
|
||||
return rec;
|
||||
return new PlotAreaRecord();
|
||||
}
|
||||
}
|
||||
|
@ -151,9 +151,8 @@ public class EscherGraphics extends Graphics
|
||||
@Override
|
||||
public Graphics create()
|
||||
{
|
||||
EscherGraphics g = new EscherGraphics(escherGroup, workbook,
|
||||
return new EscherGraphics(escherGroup, workbook,
|
||||
foreground, font, verticalPointsPerPixel );
|
||||
return g;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -127,8 +127,7 @@ public final class EscherGraphics2d extends Graphics2D {
|
||||
|
||||
public Graphics create()
|
||||
{
|
||||
EscherGraphics2d g2d = new EscherGraphics2d(_escherGraphics);
|
||||
return g2d;
|
||||
return new EscherGraphics2d(_escherGraphics);
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
|
@ -108,8 +108,7 @@ public final class HSSFRichTextString implements Comparable<HSSFRichTextString>,
|
||||
private UnicodeString cloneStringIfRequired() {
|
||||
if (_book == null)
|
||||
return _string;
|
||||
UnicodeString s = (UnicodeString)_string.clone();
|
||||
return s;
|
||||
return (UnicodeString)_string.clone();
|
||||
}
|
||||
|
||||
private void addToSSTIfRequired() {
|
||||
|
@ -570,7 +570,6 @@ public class CryptoFunctions {
|
||||
/*
|
||||
* SET Intermediate3 TO Intermediate1 BITWISE OR Intermediate2
|
||||
*/
|
||||
short intermediate3 = (short)(intermediate1 | intermediate2);
|
||||
return intermediate3;
|
||||
return (short)(intermediate1 | intermediate2);
|
||||
}
|
||||
}
|
||||
|
@ -125,8 +125,7 @@ public class BinaryRC4Decryptor extends Decryptor implements Cloneable {
|
||||
|
||||
hash = new byte[5];
|
||||
System.arraycopy(hashAlg.digest(), 0, hash, 0, 5);
|
||||
SecretKey skey = new SecretKeySpec(hash, ver.getCipherAlgorithm().jceId);
|
||||
return skey;
|
||||
return new SecretKeySpec(hash, ver.getCipherAlgorithm().jceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -82,8 +82,7 @@ public class BinaryRC4Encryptor extends Encryptor implements Cloneable {
|
||||
@Override
|
||||
public OutputStream getDataStream(DirectoryNode dir)
|
||||
throws IOException, GeneralSecurityException {
|
||||
OutputStream countStream = new BinaryRC4CipherOutputStream(dir);
|
||||
return countStream;
|
||||
return new BinaryRC4CipherOutputStream(dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -134,8 +134,7 @@ public class CryptoAPIDecryptor extends Decryptor implements Cloneable {
|
||||
MessageDigest hashAlg = CryptoFunctions.getMessageDigest(hashAlgo);
|
||||
hashAlg.update(ver.getSalt());
|
||||
byte hash[] = hashAlg.digest(StringUtil.getToUnicodeLE(password));
|
||||
SecretKey skey = new SecretKeySpec(hash, ver.getCipherAlgorithm().jceId);
|
||||
return skey;
|
||||
return new SecretKeySpec(hash, ver.getCipherAlgorithm().jceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -98,8 +98,7 @@ public class StandardDecryptor extends Decryptor implements Cloneable {
|
||||
|
||||
byte[] key = Arrays.copyOf(x3, keySize);
|
||||
|
||||
SecretKey skey = new SecretKeySpec(key, ver.getCipherAlgorithm().jceId);
|
||||
return skey;
|
||||
return new SecretKeySpec(key, ver.getCipherAlgorithm().jceId);
|
||||
}
|
||||
|
||||
protected static byte[] fillAndXor(byte hash[], byte fillByte) {
|
||||
|
@ -256,9 +256,8 @@ public class POIFSDocumentPath
|
||||
}
|
||||
String[] parentComponents = new String[ length ];
|
||||
System.arraycopy(components, 0, parentComponents, 0, length);
|
||||
POIFSDocumentPath parent = new POIFSDocumentPath(parentComponents);
|
||||
|
||||
return parent;
|
||||
return new POIFSDocumentPath(parentComponents);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,10 +38,9 @@ public final class SmallBlockTableReader {
|
||||
blockList.fetchBlocks(root.getStartBlock(), -1);
|
||||
|
||||
// Turn that into a list
|
||||
BlockList list =new SmallDocumentBlockList(
|
||||
SmallDocumentBlock.extract(bigBlockSize, smallBlockBlocks));
|
||||
|
||||
return list;
|
||||
return new SmallDocumentBlockList(
|
||||
SmallDocumentBlock.extract(bigBlockSize, smallBlockBlocks));
|
||||
}
|
||||
private static BlockAllocationTableReader prepareReader(
|
||||
final POIFSBigBlockSize bigBlockSize,
|
||||
|
@ -256,9 +256,8 @@ public class DrawPaint {
|
||||
LOG.log(POILogger.ERROR, "Can't load image data");
|
||||
return null;
|
||||
}
|
||||
Paint paint = new java.awt.TexturePaint(image, textAnchor);
|
||||
|
||||
return paint;
|
||||
return new java.awt.TexturePaint(image, textAnchor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -174,8 +174,7 @@ public enum AutoNumberingScheme {
|
||||
public String format(int value) {
|
||||
String index = formatIndex(value);
|
||||
String cased = formatCase(index);
|
||||
String seperated = formatSeperator(cased);
|
||||
return seperated;
|
||||
return formatSeperator(cased);
|
||||
}
|
||||
|
||||
private String formatSeperator(String cased) {
|
||||
|
@ -245,13 +245,12 @@ public class CellNumberFormatter extends CellFormatter {
|
||||
} else {
|
||||
StringBuffer fmtBuf = new StringBuffer();
|
||||
boolean first = true;
|
||||
List<Special> specialList = integerSpecials;
|
||||
if (integerSpecials.size() == 1) {
|
||||
// If we don't do this, we get ".6e5" instead of "6e4"
|
||||
fmtBuf.append("0");
|
||||
first = false;
|
||||
} else
|
||||
for (Special s : specialList) {
|
||||
for (Special s : integerSpecials) {
|
||||
if (isDigitFmt(s)) {
|
||||
fmtBuf.append(first ? '#' : '0');
|
||||
first = false;
|
||||
|
@ -132,13 +132,12 @@ public abstract class BaseFormulaEvaluator implements FormulaEvaluator, Workbook
|
||||
if (cell == null) {
|
||||
return null;
|
||||
}
|
||||
Cell result = cell;
|
||||
if (cell.getCellTypeEnum() == CellType.FORMULA) {
|
||||
CellValue cv = evaluateFormulaCellValue(cell);
|
||||
setCellValue(cell, cv);
|
||||
setCellType(cell, cv); // cell will no longer be a formula cell
|
||||
}
|
||||
return result;
|
||||
return cell;
|
||||
}
|
||||
|
||||
protected abstract CellValue evaluateFormulaCellValue(Cell cell);
|
||||
|
@ -421,13 +421,12 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
||||
return getMeaningfulValues(region, false, new ValueFunction() {
|
||||
@Override
|
||||
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
||||
List<ValueAndFormat> values = allValues;
|
||||
final ConditionFilterData conf = rule.getFilterConfiguration();
|
||||
|
||||
if (! conf.getBottom()) {
|
||||
Collections.sort(values, Collections.reverseOrder());
|
||||
Collections.sort(allValues, Collections.reverseOrder());
|
||||
} else {
|
||||
Collections.sort(values);
|
||||
Collections.sort(allValues);
|
||||
}
|
||||
|
||||
int limit = (int) conf.getRank();
|
||||
@ -447,15 +446,14 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
||||
return getMeaningfulValues(region, true, new ValueFunction() {
|
||||
@Override
|
||||
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
||||
List<ValueAndFormat> values = allValues;
|
||||
Collections.sort(values);
|
||||
Collections.sort(allValues);
|
||||
|
||||
final Set<ValueAndFormat> unique = new HashSet<>();
|
||||
|
||||
for (int i=0; i < values.size(); i++) {
|
||||
final ValueAndFormat v = values.get(i);
|
||||
for (int i = 0; i < allValues.size(); i++) {
|
||||
final ValueAndFormat v = allValues.get(i);
|
||||
// skip this if the current value matches the next one, or is the last one and matches the previous one
|
||||
if ( (i < values.size()-1 && v.equals(values.get(i+1)) ) || ( i > 0 && i == values.size()-1 && v.equals(values.get(i-1)) ) ) {
|
||||
if ( (i < allValues.size()-1 && v.equals(allValues.get(i+1)) ) || ( i > 0 && i == allValues.size()-1 && v.equals(allValues.get(i-1)) ) ) {
|
||||
// current value matches next value, skip both
|
||||
i++;
|
||||
continue;
|
||||
@ -472,15 +470,14 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
||||
return getMeaningfulValues(region, true, new ValueFunction() {
|
||||
@Override
|
||||
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
||||
List<ValueAndFormat> values = allValues;
|
||||
Collections.sort(values);
|
||||
Collections.sort(allValues);
|
||||
|
||||
final Set<ValueAndFormat> dup = new HashSet<>();
|
||||
|
||||
for (int i=0; i < values.size(); i++) {
|
||||
final ValueAndFormat v = values.get(i);
|
||||
for (int i = 0; i < allValues.size(); i++) {
|
||||
final ValueAndFormat v = allValues.get(i);
|
||||
// skip this if the current value matches the next one, or is the last one and matches the previous one
|
||||
if ( (i < values.size()-1 && v.equals(values.get(i+1)) ) || ( i > 0 && i == values.size()-1 && v.equals(values.get(i-1)) ) ) {
|
||||
if ( (i < allValues.size()-1 && v.equals(allValues.get(i+1)) ) || ( i > 0 && i == allValues.size()-1 && v.equals(allValues.get(i-1)) ) ) {
|
||||
// current value matches next value, add one
|
||||
dup.add(v);
|
||||
i++;
|
||||
@ -499,19 +496,18 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
||||
List<ValueAndFormat> values = new ArrayList<>(getMeaningfulValues(region, false, new ValueFunction() {
|
||||
@Override
|
||||
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
||||
List<ValueAndFormat> values = allValues;
|
||||
double total = 0;
|
||||
ValueEval[] pop = new ValueEval[values.size()];
|
||||
for (int i = 0; i < values.size(); i++) {
|
||||
ValueAndFormat v = values.get(i);
|
||||
ValueEval[] pop = new ValueEval[allValues.size()];
|
||||
for (int i = 0; i < allValues.size(); i++) {
|
||||
ValueAndFormat v = allValues.get(i);
|
||||
total += v.value.doubleValue();
|
||||
pop[i] = new NumberEval(v.value.doubleValue());
|
||||
}
|
||||
|
||||
final Set<ValueAndFormat> avgSet = new LinkedHashSet<>(1);
|
||||
avgSet.add(new ValueAndFormat(new Double(values.size() == 0 ? 0 : total / values.size()), null));
|
||||
avgSet.add(new ValueAndFormat(new Double(allValues.size() == 0 ? 0 : total / allValues.size()), null));
|
||||
|
||||
final double stdDev = values.size() <= 1 ? 0 : ((NumberEval) AggregateFunction.STDEV.evaluate(pop, 0, 0)).getNumberValue();
|
||||
final double stdDev = allValues.size() <= 1 ? 0 : ((NumberEval) AggregateFunction.STDEV.evaluate(pop, 0, 0)).getNumberValue();
|
||||
avgSet.add(new ValueAndFormat(new Double(stdDev), null));
|
||||
return avgSet;
|
||||
}
|
||||
|
@ -125,8 +125,7 @@ public final class WorkbookEvaluator {
|
||||
}
|
||||
|
||||
/* package */ EvaluationName getName(String name, int sheetIndex) {
|
||||
EvaluationName evalName = _workbook.getName(name, sheetIndex);
|
||||
return evalName;
|
||||
return _workbook.getName(name, sheetIndex);
|
||||
}
|
||||
|
||||
private static boolean isDebugLogEnabled() {
|
||||
|
@ -342,8 +342,7 @@ public final class DStarRunner implements Function3Arg {
|
||||
// Construct double from condition.
|
||||
double conditionValue = 0.0;
|
||||
try {
|
||||
int intValue = Integer.parseInt(condition);
|
||||
conditionValue = intValue;
|
||||
conditionValue = Integer.parseInt(condition);
|
||||
} catch (NumberFormatException e) { // It's not an int.
|
||||
try {
|
||||
conditionValue = Double.parseDouble(condition);
|
||||
|
@ -40,8 +40,7 @@ public class Finance {
|
||||
*/
|
||||
// http://arachnoid.com/lutusp/finance.html
|
||||
static public double pmt(double r, int nper, double pv, double fv, int type) {
|
||||
double pmt = -r * (pv * Math.pow(1 + r, nper) + fv) / ((1 + r*type) * (Math.pow(1 + r, nper) - 1));
|
||||
return pmt;
|
||||
return -r * (pv * Math.pow(1 + r, nper) + fv) / ((1 + r*type) * (Math.pow(1 + r, nper) - 1));
|
||||
}
|
||||
|
||||
|
||||
@ -153,8 +152,7 @@ public class Finance {
|
||||
*/
|
||||
//http://en.wikipedia.org/wiki/Future_value
|
||||
static public double fv(double r, int nper, double pmt, double pv, int type) {
|
||||
double fv = -(pv * Math.pow(1 + r, nper) + pmt * (1+r*type) * (Math.pow(1 + r, nper) - 1) / r);
|
||||
return fv;
|
||||
return -(pv * Math.pow(1 + r, nper) + pmt * (1+r*type) * (Math.pow(1 + r, nper) - 1) / r);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,18 +93,17 @@ public final class Index implements Function2Arg, Function3Arg, Function4Arg {
|
||||
}
|
||||
|
||||
private static TwoDEval convertFirstArg(ValueEval arg0) {
|
||||
ValueEval firstArg = arg0;
|
||||
if (firstArg instanceof RefEval) {
|
||||
if (arg0 instanceof RefEval) {
|
||||
// convert to area ref for simpler code in getValueFromArea()
|
||||
return ((RefEval)firstArg).offset(0, 0, 0, 0);
|
||||
return ((RefEval) arg0).offset(0, 0, 0, 0);
|
||||
}
|
||||
if((firstArg instanceof TwoDEval)) {
|
||||
return (TwoDEval) firstArg;
|
||||
if((arg0 instanceof TwoDEval)) {
|
||||
return (TwoDEval) arg0;
|
||||
}
|
||||
// else the other variation of this function takes an array as the first argument
|
||||
// it seems like interface 'ArrayEval' does not even exist yet
|
||||
throw new RuntimeException("Incomplete code - cannot handle first arg of type ("
|
||||
+ firstArg.getClass().getName() + ")");
|
||||
+ arg0.getClass().getName() + ")");
|
||||
|
||||
}
|
||||
|
||||
|
@ -365,11 +365,10 @@ public abstract class NumericFunction implements Function {
|
||||
double d0 = NumericFunction.singleOperandEvaluate(arg0, srcRowIndex, srcColumnIndex);
|
||||
double d1 = NumericFunction.singleOperandEvaluate(arg1, srcRowIndex, srcColumnIndex);
|
||||
double logE = Math.log(d0);
|
||||
double base = d1;
|
||||
if (Double.compare(base, Math.E) == 0) {
|
||||
if (Double.compare(d1, Math.E) == 0) {
|
||||
result = logE;
|
||||
} else {
|
||||
result = logE / Math.log(base);
|
||||
result = logE / Math.log(d1);
|
||||
}
|
||||
NumericFunction.checkValue(result);
|
||||
} catch (EvaluationException e) {
|
||||
|
@ -78,8 +78,7 @@ public final class AttrPtg extends ControlPtg {
|
||||
_options = in.readByte();
|
||||
_data = in.readShort();
|
||||
if (isOptimizedChoose()) {
|
||||
int nCases = _data;
|
||||
int[] jumpTable = new int[nCases];
|
||||
int[] jumpTable = new int[(int) _data];
|
||||
for (int i = 0; i < jumpTable.length; i++) {
|
||||
jumpTable[i] = in.readUShort();
|
||||
}
|
||||
|
@ -79,9 +79,8 @@ public final class NameXPtg extends OperandPtg implements WorkbookDependentFormu
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
String retValue = "NameXPtg:[sheetRefIndex:" + _sheetRefIndex +
|
||||
" , nameNumber:" + _nameNumber + "]" ;
|
||||
return retValue;
|
||||
return "NameXPtg:[sheetRefIndex:" + _sheetRefIndex +
|
||||
" , nameNumber:" + _nameNumber + "]";
|
||||
}
|
||||
|
||||
public byte getDefaultOperandClass() {
|
||||
|
@ -153,7 +153,7 @@ public class CellCopyPolicy {
|
||||
}
|
||||
|
||||
public Builder createBuilder() {
|
||||
final Builder builder = new Builder()
|
||||
return new Builder()
|
||||
.cellValue(copyCellValue)
|
||||
.cellStyle(copyCellStyle)
|
||||
.cellFormula(copyCellFormula)
|
||||
@ -162,7 +162,6 @@ public class CellCopyPolicy {
|
||||
.rowHeight(copyRowHeight)
|
||||
.condenseRows(condenseRows)
|
||||
.mergedRegions(copyMergedRegions);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -299,10 +299,9 @@ public abstract class CellRangeAddressBase {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int code = (getMinColumn() +
|
||||
return (getMinColumn() +
|
||||
(getMaxColumn() << 8) +
|
||||
(getMinRow() << 16) +
|
||||
(getMaxRow() << 24));
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
@ -397,8 +397,7 @@ public class CellReference {
|
||||
String col = matcher.group(1);
|
||||
String row = matcher.group(2);
|
||||
|
||||
CellRefParts cellRefParts = new CellRefParts(sheetName, row, col);
|
||||
return cellRefParts;
|
||||
return new CellRefParts(sheetName, row, col);
|
||||
}
|
||||
|
||||
private static String parseSheetName(String reference, int indexOfSheetNameDelimiter) {
|
||||
|
@ -62,8 +62,7 @@ final class ExpandedDouble {
|
||||
_significand = frac.shiftLeft(expAdj);
|
||||
_binaryExponent = (biasedExp & 0x07FF) - 1023 - expAdj;
|
||||
} else {
|
||||
BigInteger frac = getFrac(rawBits);
|
||||
_significand = frac;
|
||||
_significand = getFrac(rawBits);
|
||||
_binaryExponent = (biasedExp & 0x07FF) - 1023;
|
||||
}
|
||||
}
|
||||
|
@ -210,12 +210,10 @@ public class ImageUtils {
|
||||
anchor.setRow2(row2);
|
||||
anchor.setDy2(dy2);
|
||||
|
||||
Dimension dim = new Dimension(
|
||||
return new Dimension(
|
||||
(int)Math.round(scaledWidth*EMU_PER_PIXEL),
|
||||
(int)Math.round(scaledHeight*EMU_PER_PIXEL)
|
||||
);
|
||||
|
||||
return dim;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -209,8 +209,7 @@ public final class PackagingURIHelper {
|
||||
public static URI getPath(URI uri) {
|
||||
if (uri != null) {
|
||||
String path = uri.getPath();
|
||||
int len = path.length();
|
||||
int num2 = len;
|
||||
int num2 = path.length();
|
||||
while (--num2 >= 0) {
|
||||
char ch1 = path.charAt(num2);
|
||||
if (ch1 == PackagingURIHelper.FORWARD_SLASH_CHAR) {
|
||||
|
@ -41,8 +41,7 @@ public final class FileHelper {
|
||||
public static File getDirectory(File f) {
|
||||
if (f != null) {
|
||||
String path = f.getPath();
|
||||
int len = path.length();
|
||||
int num2 = len;
|
||||
int num2 = path.length();
|
||||
while (--num2 >= 0) {
|
||||
char ch1 = path.charAt(num2);
|
||||
if (ch1 == File.separatorChar) {
|
||||
|
@ -220,8 +220,7 @@ public class AgileEncryptor extends Encryptor implements Cloneable {
|
||||
public OutputStream getDataStream(DirectoryNode dir)
|
||||
throws IOException, GeneralSecurityException {
|
||||
// TODO: initialize headers
|
||||
AgileCipherOutputStream countStream = new AgileCipherOutputStream(dir);
|
||||
return countStream;
|
||||
return new AgileCipherOutputStream(dir);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -357,8 +357,7 @@ public class SignatureInfo implements SignatureConfigurable {
|
||||
digestInfoValueBuf.write(signatureConfig.getHashMagic());
|
||||
digestInfoValueBuf.write(digest);
|
||||
byte[] digestInfoValue = digestInfoValueBuf.toByteArray();
|
||||
byte[] signatureValue = cipher.doFinal(digestInfoValue);
|
||||
return signatureValue;
|
||||
return cipher.doFinal(digestInfoValue);
|
||||
} catch (Exception e) {
|
||||
throw new EncryptedDocumentException(e);
|
||||
}
|
||||
|
@ -78,8 +78,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.NotesMasterDocument;
|
||||
try {
|
||||
try {
|
||||
NotesMasterDocument doc = NotesMasterDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
|
||||
CTNotesMaster slide = doc.getNotesMaster();
|
||||
return slide;
|
||||
return doc.getNotesMaster();
|
||||
} finally {
|
||||
is.close();
|
||||
}
|
||||
|
@ -90,8 +90,7 @@ public class XSLFShadow extends XSLFShape implements Shadow<XSLFShape,XSLFTextPa
|
||||
public Color getFillColor() {
|
||||
SolidPaint ps = getFillStyle();
|
||||
if (ps == null) return null;
|
||||
Color col = DrawPaint.applyColorTransform(ps.getSolidColor());
|
||||
return col;
|
||||
return DrawPaint.applyColorTransform(ps.getSolidColor());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -485,8 +485,7 @@ public abstract class XSLFTextShape extends XSLFSimpleShape
|
||||
|
||||
@Override
|
||||
public Insets2D getInsets() {
|
||||
Insets2D insets = new Insets2D(getTopInset(), getLeftInset(), getBottomInset(), getRightInset());
|
||||
return insets;
|
||||
return new Insets2D(getTopInset(), getLeftInset(), getBottomInset(), getRightInset());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -223,8 +223,7 @@ public class XSSFComment implements Comment {
|
||||
for (String s : position.split(",")) {
|
||||
pos[i++] = Integer.parseInt(s.trim());
|
||||
}
|
||||
XSSFClientAnchor ca = new XSSFClientAnchor(pos[1]*EMU_PER_PIXEL, pos[3]*EMU_PER_PIXEL, pos[5]*EMU_PER_PIXEL, pos[7]*EMU_PER_PIXEL, pos[0], pos[2], pos[4], pos[6]);
|
||||
return ca;
|
||||
return new XSSFClientAnchor(pos[1]*EMU_PER_PIXEL, pos[3]*EMU_PER_PIXEL, pos[5]*EMU_PER_PIXEL, pos[7]*EMU_PER_PIXEL, pos[0], pos[2], pos[4], pos[6]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -122,8 +122,7 @@ public class XSSFFont implements Font {
|
||||
*/
|
||||
public int getCharSet() {
|
||||
CTIntProperty charset = _ctFont.sizeOfCharsetArray() == 0 ? null : _ctFont.getCharsetArray(0);
|
||||
int val = charset == null ? FontCharset.ANSI.getValue() : FontCharset.valueOf(charset.getVal()).getValue();
|
||||
return val;
|
||||
return charset == null ? FontCharset.ANSI.getValue() : FontCharset.valueOf(charset.getVal()).getValue();
|
||||
}
|
||||
|
||||
|
||||
@ -214,8 +213,7 @@ public class XSSFFont implements Font {
|
||||
private double getFontHeightRaw() {
|
||||
CTFontSize size = _ctFont.sizeOfSzArray() == 0 ? null : _ctFont.getSzArray(0);
|
||||
if (size != null) {
|
||||
double fontHeight = size.getVal();
|
||||
return fontHeight;
|
||||
return size.getVal();
|
||||
}
|
||||
return DEFAULT_FONT_SIZE;
|
||||
}
|
||||
|
@ -225,8 +225,7 @@ public class XSSFPivotTable extends POIXMLDocumentPart {
|
||||
|
||||
protected AreaReference getPivotArea() {
|
||||
final Workbook wb = getDataSheet().getWorkbook();
|
||||
AreaReference pivotArea = getPivotCacheDefinition().getPivotArea(wb);
|
||||
return pivotArea;
|
||||
return getPivotCacheDefinition().getPivotArea(wb);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -612,8 +612,7 @@ public class XSSFTextParagraph implements Iterable<XSSFTextRun>{
|
||||
};
|
||||
fetchParagraphProperty(fetcher);
|
||||
|
||||
double spcBef = fetcher.getValue() == null ? 0 : fetcher.getValue();
|
||||
return spcBef;
|
||||
return fetcher.getValue() == null ? 0 : fetcher.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,8 +74,7 @@ public class XSSFSingleXmlCell {
|
||||
public String getXpath(){
|
||||
CTXmlCellPr xmlCellPr = singleXmlCell.getXmlCellPr();
|
||||
CTXmlPr xmlPr = xmlCellPr.getXmlPr();
|
||||
String xpath = xmlPr.getXpath();
|
||||
return xpath;
|
||||
return xmlPr.getXpath();
|
||||
}
|
||||
|
||||
public long getMapId(){
|
||||
|
@ -1431,8 +1431,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
|
||||
public XWPFPictureData getPictureDataByID(String blipID) {
|
||||
POIXMLDocumentPart relatedPart = getRelationById(blipID);
|
||||
if (relatedPart instanceof XWPFPictureData) {
|
||||
XWPFPictureData xwpfPicData = (XWPFPictureData) relatedPart;
|
||||
return xwpfPicData;
|
||||
return (XWPFPictureData) relatedPart;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1378,9 +1378,8 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
|
||||
* a new instance.
|
||||
*/
|
||||
private CTPPr getCTPPr() {
|
||||
CTPPr pr = paragraph.getPPr() == null ? paragraph.addNewPPr()
|
||||
return paragraph.getPPr() == null ? paragraph.addNewPPr()
|
||||
: paragraph.getPPr();
|
||||
return pr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -106,8 +106,7 @@ public class PkiTestUtils {
|
||||
SecureRandom random = new SecureRandom();
|
||||
keyPairGenerator.initialize(new RSAKeyGenParameterSpec(1024,
|
||||
RSAKeyGenParameterSpec.F4), random);
|
||||
KeyPair keyPair = keyPairGenerator.generateKeyPair();
|
||||
return keyPair;
|
||||
return keyPairGenerator.generateKeyPair();
|
||||
}
|
||||
|
||||
static X509Certificate generateCertificate(PublicKey subjectPublicKey,
|
||||
@ -218,8 +217,7 @@ public class PkiTestUtils {
|
||||
documentBuilderFactory.setNamespaceAware(true);
|
||||
DocumentBuilder documentBuilder = documentBuilderFactory
|
||||
.newDocumentBuilder();
|
||||
Document document = documentBuilder.parse(inputSource);
|
||||
return document;
|
||||
return documentBuilder.parse(inputSource);
|
||||
}
|
||||
|
||||
static String toString(Node dom) throws TransformerException {
|
||||
@ -310,8 +308,7 @@ public class PkiTestUtils {
|
||||
|
||||
|
||||
OCSPRespBuilder ocspRespBuilder = new OCSPRespBuilder();
|
||||
OCSPResp ocspResp = ocspRespBuilder.build(OCSPRespBuilder.SUCCESSFUL, basicOCSPResp);
|
||||
|
||||
return ocspResp;
|
||||
return ocspRespBuilder.build(OCSPRespBuilder.SUCCESSFUL, basicOCSPResp);
|
||||
}
|
||||
}
|
||||
|
@ -341,8 +341,7 @@ public class TestXSSFDataValidation extends BaseTestDataValidation {
|
||||
DataValidationHelper dataValidationHelper = sheet.getDataValidationHelper();
|
||||
|
||||
DataValidationConstraint constraint = dataValidationHelper.createCustomConstraint("true");
|
||||
final XSSFDataValidation validation = (XSSFDataValidation) dataValidationHelper.createValidation(constraint, new CellRangeAddressList(0, 0, 0, 0));
|
||||
return validation;
|
||||
return (XSSFDataValidation) dataValidationHelper.createValidation(constraint, new CellRangeAddressList(0, 0, 0, 0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -722,8 +722,7 @@ public final class TestXSSFSheet extends BaseTestXSheet {
|
||||
|
||||
// Now check the low level stuff, and check that's all
|
||||
// been set correctly
|
||||
XSSFSheet xs = sheet;
|
||||
CTWorksheet cts = xs.getCTWorksheet();
|
||||
CTWorksheet cts = sheet.getCTWorksheet();
|
||||
|
||||
assertEquals(1, cts.sizeOfColsArray());
|
||||
CTCols cols = cts.getColsArray(0);
|
||||
|
@ -166,8 +166,6 @@ public final class SlideIdListing {
|
||||
long type = LittleEndian.getUShort(fileContents, pos+2);
|
||||
long rlen = LittleEndian.getUInt(fileContents, pos+4);
|
||||
|
||||
Record r = Record.createRecordForType(type,fileContents,pos,(int)rlen+8);
|
||||
|
||||
return r;
|
||||
return Record.createRecordForType(type,fileContents,pos,(int)rlen+8);
|
||||
}
|
||||
}
|
||||
|
@ -124,8 +124,6 @@ public final class UserEditAndPersistListing {
|
||||
long type = LittleEndian.getUShort(fileContents, pos+2);
|
||||
long rlen = LittleEndian.getUInt(fileContents, pos+4);
|
||||
|
||||
Record r = Record.createRecordForType(type,fileContents,pos,(int)rlen+8);
|
||||
|
||||
return r;
|
||||
return Record.createRecordForType(type,fileContents,pos,(int)rlen+8);
|
||||
}
|
||||
}
|
||||
|
@ -144,8 +144,7 @@ public final class QuickButCruddyTextExtractor {
|
||||
|
||||
// Start walking the file, looking for the records
|
||||
while(walkPos != -1) {
|
||||
int newPos = findTextRecords(walkPos,textV);
|
||||
walkPos = newPos;
|
||||
walkPos = findTextRecords(walkPos,textV);
|
||||
}
|
||||
|
||||
// Return what we find
|
||||
|
@ -182,8 +182,7 @@ public final class ColorSchemeAtom extends RecordAtom {
|
||||
byte[] with_zero = new byte[4];
|
||||
System.arraycopy(rgb,0,with_zero,0,3);
|
||||
with_zero[3] = 0;
|
||||
int ret = LittleEndian.getInt(with_zero,0);
|
||||
return ret;
|
||||
return LittleEndian.getInt(with_zero,0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -137,8 +137,7 @@ public abstract class Record
|
||||
}
|
||||
|
||||
// Turn the vector into an array, and return
|
||||
Record[] cRecords = children.toArray( new Record[children.size()] );
|
||||
return cRecords;
|
||||
return children.toArray( new Record[children.size()] );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -192,8 +192,7 @@ public final class TextRulerAtom extends RecordAtom {
|
||||
0x00, 0x00, (byte)0xA6, 0x0F, 0x0A, 0x00, 0x00, 0x00,
|
||||
0x10, 0x03, 0x00, 0x00, (byte)0xF9, 0x00, 0x41, 0x01, 0x41, 0x01
|
||||
};
|
||||
TextRulerAtom ruler = new TextRulerAtom(data, 0, data.length);
|
||||
return ruler;
|
||||
return new TextRulerAtom(data, 0, data.length);
|
||||
}
|
||||
|
||||
public void setParagraphIndent(short tetxOffset, short bulletOffset){
|
||||
|
@ -221,14 +221,13 @@ implements HSLFShapeContainer, GroupShape<HSLFShape,HSLFTextParagraph> {
|
||||
x2 = clientAnchor.getDx1();
|
||||
y2 = clientAnchor.getRow1();
|
||||
}
|
||||
Rectangle2D anchor= new Rectangle2D.Double(
|
||||
|
||||
return new Rectangle2D.Double(
|
||||
(x1 == -1 ? -1 : Units.masterToPoints(x1)),
|
||||
(y1 == -1 ? -1 : Units.masterToPoints(y1)),
|
||||
(x2 == -1 ? -1 : Units.masterToPoints(x2-x1)),
|
||||
(y2 == -1 ? -1 : Units.masterToPoints(y2-y1))
|
||||
);
|
||||
|
||||
return anchor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -168,14 +168,13 @@ public abstract class HSLFShape implements Shape<HSLFShape,HSLFTextParagraph> {
|
||||
}
|
||||
|
||||
// TODO: find out where this -1 value comes from at #57820 (link to ms docs?)
|
||||
Rectangle2D anchor = new Rectangle2D.Double(
|
||||
|
||||
return new Rectangle2D.Double(
|
||||
(x1 == -1 ? -1 : Units.masterToPoints(x1)),
|
||||
(y1 == -1 ? -1 : Units.masterToPoints(y1)),
|
||||
(x2 == -1 ? -1 : Units.masterToPoints(x2-x1)),
|
||||
(y2 == -1 ? -1 : Units.masterToPoints(y2-y1))
|
||||
);
|
||||
|
||||
return anchor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -131,8 +131,7 @@ public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShape<H
|
||||
public double getLineWidth(){
|
||||
AbstractEscherOptRecord opt = getEscherOptRecord();
|
||||
EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH);
|
||||
double width = (prop == null) ? DEFAULT_LINE_WIDTH : Units.toPoints(prop.getPropertyValue());
|
||||
return width;
|
||||
return (prop == null) ? DEFAULT_LINE_WIDTH : Units.toPoints(prop.getPropertyValue());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -402,8 +402,7 @@ implements HSLFShapeContainer, TableShape<HSLFShape,HSLFTextParagraph> {
|
||||
}
|
||||
|
||||
// TODO: check for merged cols
|
||||
double width = cells[0][col].getAnchor().getWidth();
|
||||
return width;
|
||||
return cells[0][col].getAnchor().getWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1212,8 +1212,7 @@ public final class HSLFTextParagraph implements TextParagraph<HSLFShape,HSLFText
|
||||
* representation
|
||||
*/
|
||||
protected static String toInternalString(String s) {
|
||||
String ns = s.replaceAll("\\r?\\n", "\r");
|
||||
return ns;
|
||||
return s.replaceAll("\\r?\\n", "\r");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -415,8 +415,7 @@ public final class HSLFTextRun implements TextRun {
|
||||
return null;
|
||||
}
|
||||
Color color = HSLFTextParagraph.getColorFromColorIndexStruct(tp.getValue(), parentParagraph.getSheet());
|
||||
SolidPaint ps = DrawPaint.createSolidPaint(color);
|
||||
return ps;
|
||||
return DrawPaint.createSolidPaint(color);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -723,8 +723,7 @@ implements TextShape<HSLFShape,HSLFTextParagraph> {
|
||||
|
||||
@Override
|
||||
public Insets2D getInsets() {
|
||||
Insets2D insets = new Insets2D(getTopInset(), getLeftInset(), getBottomInset(), getRightInset());
|
||||
return insets;
|
||||
return new Insets2D(getTopInset(), getLeftInset(), getBottomInset(), getRightInset());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -185,11 +185,10 @@ public class AbstractExcelUtils
|
||||
{
|
||||
CellRangeAddress[] mergedRangeRowInfo = rowNumber < mergedRanges.length ? mergedRanges[rowNumber]
|
||||
: null;
|
||||
CellRangeAddress cellRangeAddress = mergedRangeRowInfo != null
|
||||
|
||||
return mergedRangeRowInfo != null
|
||||
&& columnNumber < mergedRangeRowInfo.length ? mergedRangeRowInfo[columnNumber]
|
||||
: null;
|
||||
|
||||
return cellRangeAddress;
|
||||
}
|
||||
|
||||
static boolean isEmpty( String str )
|
||||
|
@ -154,8 +154,7 @@ public class ExcelToHtmlConverter extends AbstractExcelConverter
|
||||
XMLHelper.getDocumentBuilderFactory().newDocumentBuilder()
|
||||
.newDocument() );
|
||||
excelToHtmlConverter.processWorkbook( workbook );
|
||||
Document doc = excelToHtmlConverter.getDocument();
|
||||
return doc;
|
||||
return excelToHtmlConverter.getDocument();
|
||||
}
|
||||
|
||||
private String cssClassContainerCell;
|
||||
|
@ -597,8 +597,7 @@ public final class HSSFChart {
|
||||
|
||||
private PlotAreaRecord createPlotAreaRecord()
|
||||
{
|
||||
PlotAreaRecord r = new PlotAreaRecord( );
|
||||
return r;
|
||||
return new PlotAreaRecord( );
|
||||
}
|
||||
|
||||
private AxisLineFormatRecord createAxisLineFormatRecord( short format )
|
||||
|
@ -667,7 +667,6 @@ public final class HWPFDocument extends HWPFDocumentCore {
|
||||
|
||||
// get fcMin and fcMac because we will be writing the actual text with the
|
||||
// complex table.
|
||||
int fcMin = mainOffset;
|
||||
|
||||
/*
|
||||
* clx (encoding of the sprm lists for a complex file and piece table
|
||||
@ -736,7 +735,7 @@ public final class HWPFDocument extends HWPFDocumentCore {
|
||||
|
||||
// write out the CHPBinTable.
|
||||
_fib.setFcPlcfbteChpx(tableOffset);
|
||||
_cbt.writeTo(wordDocumentStream, tableStream, fcMin, _cft.getTextPieceTable());
|
||||
_cbt.writeTo(wordDocumentStream, tableStream, mainOffset, _cft.getTextPieceTable());
|
||||
_fib.setLcbPlcfbteChpx(tableStream.size() - tableOffset);
|
||||
tableOffset = tableStream.size();
|
||||
|
||||
@ -892,7 +891,7 @@ public final class HWPFDocument extends HWPFDocumentCore {
|
||||
tableOffset = tableStream.size();
|
||||
|
||||
// set some variables in the FileInformationBlock.
|
||||
_fib.getFibBase().setFcMin(fcMin);
|
||||
_fib.getFibBase().setFcMin(mainOffset);
|
||||
_fib.getFibBase().setFcMac(fcMac);
|
||||
_fib.setCbMac(wordDocumentStream.size());
|
||||
|
||||
|
@ -194,8 +194,7 @@ public abstract class AbstractWordConverter
|
||||
original.bold = characterRun.isBold();
|
||||
original.italic = characterRun.isItalic();
|
||||
original.fontName = characterRun.getFontName();
|
||||
Triplet updated = getFontReplacer().update( original );
|
||||
return updated;
|
||||
return getFontReplacer().update( original );
|
||||
}
|
||||
|
||||
public abstract Document getDocument();
|
||||
|
@ -111,8 +111,7 @@ public class HtmlDocumentFacade
|
||||
stringBuilder.append( "}\n" );
|
||||
}
|
||||
}
|
||||
final String stylesheetText = stringBuilder.toString();
|
||||
return stylesheetText;
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
public Element createBlock()
|
||||
@ -179,8 +178,7 @@ public class HtmlDocumentFacade
|
||||
|
||||
public Element createSelect()
|
||||
{
|
||||
Element result = document.createElement( "select" );
|
||||
return result;
|
||||
return document.createElement( "select" );
|
||||
}
|
||||
|
||||
public Element createTable()
|
||||
|
@ -118,8 +118,7 @@ public class RecordUtil
|
||||
|
||||
for ( int x = 0; x < parentSize; x++ )
|
||||
{
|
||||
int temp = mask;
|
||||
numBits += ( temp >> x ) & 0x1;
|
||||
numBits += ( mask >> x ) & 0x1;
|
||||
}
|
||||
|
||||
if ( numBits == 1 )
|
||||
|
@ -226,8 +226,7 @@ public class CHPBinTable
|
||||
final int boundary = objBoundary.intValue();
|
||||
|
||||
final int startInclusive = lastTextRunStart;
|
||||
final int endExclusive = boundary;
|
||||
lastTextRunStart = endExclusive;
|
||||
lastTextRunStart = boundary;
|
||||
|
||||
int startPosition = binarySearch( oldChpxSortedByStartPos, boundary );
|
||||
startPosition = Math.abs( startPosition );
|
||||
@ -246,7 +245,7 @@ public class CHPBinTable
|
||||
break;
|
||||
|
||||
int left = Math.max( startInclusive, chpx.getStart() );
|
||||
int right = Math.min( endExclusive, chpx.getEnd() );
|
||||
int right = Math.min(boundary, chpx.getEnd() );
|
||||
|
||||
if ( left < right )
|
||||
{
|
||||
@ -258,10 +257,10 @@ public class CHPBinTable
|
||||
{
|
||||
logger.log( POILogger.WARN, "Text piece [",
|
||||
Integer.valueOf( startInclusive ), "; ",
|
||||
Integer.valueOf( endExclusive ),
|
||||
Integer.valueOf(boundary),
|
||||
") has no CHPX. Creating new one." );
|
||||
// create it manually
|
||||
CHPX chpx = new CHPX( startInclusive, endExclusive,
|
||||
CHPX chpx = new CHPX( startInclusive, boundary,
|
||||
new SprmBuffer( 0 ) );
|
||||
newChpxs.add( chpx );
|
||||
continue;
|
||||
@ -272,7 +271,7 @@ public class CHPBinTable
|
||||
// can we reuse existing?
|
||||
CHPX existing = chpxs.get( 0 );
|
||||
if ( existing.getStart() == startInclusive
|
||||
&& existing.getEnd() == endExclusive )
|
||||
&& existing.getEnd() == boundary)
|
||||
{
|
||||
newChpxs.add( existing );
|
||||
continue;
|
||||
@ -286,7 +285,7 @@ public class CHPBinTable
|
||||
{
|
||||
sprmBuffer.append( chpx.getGrpprl(), 0 );
|
||||
}
|
||||
CHPX newChpx = new CHPX( startInclusive, endExclusive, sprmBuffer );
|
||||
CHPX newChpx = new CHPX( startInclusive, boundary, sprmBuffer );
|
||||
newChpxs.add( newChpx );
|
||||
|
||||
continue;
|
||||
|
@ -72,9 +72,8 @@ public final class CHPX extends BytePropertyNode<CHPX>
|
||||
}
|
||||
|
||||
CharacterProperties baseStyle = ss.getCharacterStyle( istd );
|
||||
CharacterProperties props = CharacterSprmUncompressor.uncompressCHP(
|
||||
return CharacterSprmUncompressor.uncompressCHP(
|
||||
ss, baseStyle, getGrpprl(), 0 );
|
||||
return props;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -151,8 +151,7 @@ public final class ListTables
|
||||
return null;
|
||||
}
|
||||
if(level < lst.numLevels()) {
|
||||
ListLevel lvl = lst.getLevels()[level];
|
||||
return lvl;
|
||||
return lst.getLevels()[level];
|
||||
}
|
||||
if (log.check(POILogger.WARN)) {
|
||||
log.log(POILogger.WARN, "Requested level " + level + " which was greater than the maximum defined (" + lst.numLevels() + ")");
|
||||
|
@ -361,8 +361,6 @@ public final class PAPFormattedDiskPage extends FormattedDiskPage {
|
||||
{
|
||||
int pheOffset = _offset + 1 + (((_crun + 1) * 4) + (index * 13));
|
||||
|
||||
ParagraphHeight phe = new ParagraphHeight(_fkp, pheOffset);
|
||||
|
||||
return phe;
|
||||
return new ParagraphHeight(_fkp, pheOffset);
|
||||
}
|
||||
}
|
||||
|
@ -151,8 +151,7 @@ public final class PAPX extends BytePropertyNode<PAPX> {
|
||||
|
||||
short istd = getIstd();
|
||||
ParagraphProperties baseStyle = ss.getParagraphStyle(istd);
|
||||
ParagraphProperties props = ParagraphSprmUncompressor.uncompressPAP(baseStyle, getGrpprl(), 2);
|
||||
return props;
|
||||
return ParagraphSprmUncompressor.uncompressPAP(baseStyle, getGrpprl(), 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,8 +64,7 @@ public class PlexOfField
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String str = String.format(Locale.ROOT, "[%d, %d) - FLD - 0x%x; 0x%x"
|
||||
return String.format(Locale.ROOT, "[%d, %d) - FLD - 0x%x; 0x%x"
|
||||
, getFcStart(), getFcEnd(), fld.getBoundaryType(), fld.getFlt());
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
@ -89,14 +89,13 @@ public class SectionTable
|
||||
// Some files seem to lie about their unicode status, which
|
||||
// is very very pesky. Try to work around these, but this
|
||||
// is getting on for black magic...
|
||||
int mainEndsAt = mainLength;
|
||||
boolean matchAt = false;
|
||||
boolean matchHalf = false;
|
||||
for (int i=0; i<_sections.size(); i++) {
|
||||
SEPX s = _sections.get(i);
|
||||
if (s.getEnd() == mainEndsAt) {
|
||||
if (s.getEnd() == mainLength) {
|
||||
matchAt = true;
|
||||
} else if(s.getEnd() == mainEndsAt || s.getEnd() == mainEndsAt-1) {
|
||||
} else if(s.getEnd() == mainLength || s.getEnd() == mainLength -1) {
|
||||
matchHalf = true;
|
||||
}
|
||||
}
|
||||
|
@ -107,11 +107,10 @@ public final class StyleDescription implements HDFType
|
||||
_name = StringUtil.getFromUnicodeLE(std, nameStart, (nameLength*multiplier)/2);
|
||||
|
||||
//length then null terminator.
|
||||
int grupxStart = ((nameLength + 1) * multiplier) + nameStart;
|
||||
|
||||
// the spec only refers to two possible upxs but it mentions
|
||||
// that more may be added in the future
|
||||
int varOffset = grupxStart;
|
||||
int varOffset = ((nameLength + 1) * multiplier) + nameStart;
|
||||
int countOfUPX = _stdfBase.getCupx();
|
||||
_upxs = new UPX[countOfUPX];
|
||||
for(int x = 0; x < countOfUPX; x++)
|
||||
|
@ -73,12 +73,11 @@ public class TextPiece extends PropertyNode<TextPiece> {
|
||||
* Create the StringBuilder from the text and unicode flag
|
||||
*/
|
||||
private static StringBuilder buildInitSB(byte[] text, PieceDescriptor pd) {
|
||||
byte[] textBuffer = text;
|
||||
if (StringUtil.BIG5.equals(pd.getCharset())) {
|
||||
return new StringBuilder(CodePageUtil.cp950ToString(text, 0, text.length));
|
||||
}
|
||||
|
||||
String str = new String(textBuffer, 0, textBuffer.length, (pd.isUnicode()) ? StringUtil.UTF16LE : pd.getCharset());
|
||||
String str = new String(text, 0, text.length, (pd.isUnicode()) ? StringUtil.UTF16LE : pd.getCharset());
|
||||
return new StringBuilder(str);
|
||||
}
|
||||
|
||||
|
@ -657,8 +657,7 @@ public final class CharacterRun extends Range
|
||||
getPicOffset() );
|
||||
FFData ffData = new FFData( data.getBinData(), 0 );
|
||||
|
||||
String[] values = ffData.getDropList();
|
||||
return values;
|
||||
return ffData.getDropList();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -54,7 +54,7 @@ public final class DateAndTime
|
||||
|
||||
public Calendar getDate() {
|
||||
// TODO Discover if the timezone is stored somewhere else or not
|
||||
Calendar cal = LocaleUtil.getLocaleCalendar(
|
||||
return LocaleUtil.getLocaleCalendar(
|
||||
_years.getValue(_info2)+1900,
|
||||
_months.getValue(_info2)-1,
|
||||
_dom.getValue(_info),
|
||||
@ -62,7 +62,6 @@ public final class DateAndTime
|
||||
_minutes.getValue(_info),
|
||||
0
|
||||
);
|
||||
return cal;
|
||||
}
|
||||
|
||||
public void serialize(byte[] buf, int offset)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user