From 66471836f584d5c73be18367e1db4c4783b0cb48 Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Mon, 23 Dec 2019 00:15:55 +0000 Subject: [PATCH] Replace custom hashCode code with Objects.hash() / Arrays.deepHashCode() git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1871913 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/ddf/EscherComplexProperty.java | 2 +- .../apache/poi/ddf/EscherSimpleProperty.java | 10 +- .../org/apache/poi/hpsf/CustomProperty.java | 14 +- src/java/org/apache/poi/hpsf/Property.java | 27 +-- src/java/org/apache/poi/hpsf/Section.java | 19 +- .../poi/hssf/record/ExtendedFormatRecord.java | 25 ++- .../apache/poi/hssf/record/FontRecord.java | 28 +-- .../apache/poi/hssf/record/common/ExtRst.java | 15 +- .../apache/poi/hssf/record/common/PhRun.java | 7 + .../poi/hssf/record/common/UnicodeString.java | 10 +- .../poi/hssf/usermodel/HSSFComment.java | 18 +- .../apache/poi/hssf/usermodel/HSSFFont.java | 16 +- .../org/apache/poi/hssf/util/HSSFColor.java | 6 +- .../EvaluationConditionalFormatRule.java | 210 +++++++++--------- .../org/apache/poi/ss/util/CellReference.java | 17 +- .../openxml4j/opc/PackageRelationship.java | 7 +- .../openxml4j/opc/internal/ContentType.java | 15 +- .../poi/xssf/binary/XSSFHyperlinkRecord.java | 9 +- .../model/textproperties/HSLFTabStop.java | 7 +- .../HSLFTabStopPropCollection.java | 3 +- .../textproperties/TextPropCollection.java | 9 +- .../hwpf/model/BookmarkFirstDescriptor.java | 11 +- .../org/apache/poi/hwpf/model/FibBase.java | 24 +- .../org/apache/poi/hwpf/model/FibRgW97.java | 27 +-- .../model/FootnoteReferenceDescriptor.java | 10 +- .../apache/poi/hwpf/model/Hyphenation.java | 13 +- .../org/apache/poi/hwpf/model/LFOData.java | 6 +- .../org/apache/poi/hwpf/model/ListData.java | 11 +- .../hwpf/model/ListFormatOverrideLevel.java | 11 +- .../org/apache/poi/hwpf/model/ListTables.java | 10 +- .../src/org/apache/poi/hwpf/model/PICF.java | 40 +--- .../poi/hwpf/model/PieceDescriptor.java | 8 +- .../src/org/apache/poi/hwpf/model/PlfLfo.java | 14 +- .../poi/hwpf/model/PropertyModifier.java | 10 +- .../apache/poi/hwpf/model/PropertyNode.java | 3 +- .../apache/poi/hwpf/model/SavedByEntry.java | 10 +- .../org/apache/poi/hwpf/model/StdfBase.java | 14 +- .../apache/poi/hwpf/model/StdfPost2000.java | 13 +- .../src/org/apache/poi/hwpf/model/Stshif.java | 19 +- .../poi/hwpf/model/StyleDescription.java | 8 +- .../apache/poi/hwpf/model/TextPieceTable.java | 2 +- .../src/org/apache/poi/hwpf/model/Xst.java | 11 +- .../poi/hwpf/model/types/CHPAbstractType.java | 123 +++------- .../model/types/FFDataBaseAbstractType.java | 24 +- .../model/types/FibRgLw95AbstractType.java | 31 +-- .../model/types/FibRgLw97AbstractType.java | 41 +--- .../hwpf/model/types/GrfhicAbstractType.java | 16 +- .../poi/hwpf/model/types/LFOAbstractType.java | 24 +- .../model/types/LFOLVLBaseAbstractType.java | 17 +- .../hwpf/model/types/LSTFAbstractType.java | 18 +- .../hwpf/model/types/LVLFAbstractType.java | 26 +-- .../hwpf/model/types/SHD80AbstractType.java | 16 +- .../poi/hwpf/model/types/SHDAbstractType.java | 18 +- .../poi/hwpf/usermodel/BookmarksImpl.java | 8 +- .../poi/hwpf/usermodel/DropCapSpecifier.java | 5 +- .../TableAutoformatLookSpecifier.java | 11 +- 56 files changed, 411 insertions(+), 716 deletions(-) diff --git a/src/java/org/apache/poi/ddf/EscherComplexProperty.java b/src/java/org/apache/poi/ddf/EscherComplexProperty.java index e24610bcdc..47e8582ae3 100644 --- a/src/java/org/apache/poi/ddf/EscherComplexProperty.java +++ b/src/java/org/apache/poi/ddf/EscherComplexProperty.java @@ -197,7 +197,7 @@ public class EscherComplexProperty extends EscherProperty { @Override public int hashCode() { - return getId() * 11; + return Arrays.deepHashCode(new Object[]{complexData, getId()}); } @Override diff --git a/src/java/org/apache/poi/ddf/EscherSimpleProperty.java b/src/java/org/apache/poi/ddf/EscherSimpleProperty.java index 1c9fb8e418..c445c0a90e 100644 --- a/src/java/org/apache/poi/ddf/EscherSimpleProperty.java +++ b/src/java/org/apache/poi/ddf/EscherSimpleProperty.java @@ -18,6 +18,7 @@ package org.apache.poi.ddf; import java.util.Map; +import java.util.Objects; import java.util.function.Supplier; import org.apache.poi.util.GenericRecordUtil; @@ -35,7 +36,7 @@ public class EscherSimpleProperty extends EscherProperty /** * The id is distinct from the actual property number. The id includes the property number the blip id * flag and an indicator whether the property is complex or not. - * + * * @param id the property id * @param propertyValue the property value */ @@ -57,7 +58,7 @@ public class EscherSimpleProperty extends EscherProperty /** * Constructs a new escher property. The three parameters are combined to form a property id. - * + * * @param propertyNumber the property number * @param isComplex true, if its a complex property * @param isBlipId true, if its a blip @@ -142,9 +143,8 @@ public class EscherSimpleProperty extends EscherProperty * require the use of such things. */ @Override - public int hashCode() - { - return propertyValue; + public int hashCode() { + return Objects.hash(propertyValue, getId()); } @Override diff --git a/src/java/org/apache/poi/hpsf/CustomProperty.java b/src/java/org/apache/poi/hpsf/CustomProperty.java index 9602cf8f49..60b5dc5da3 100644 --- a/src/java/org/apache/poi/hpsf/CustomProperty.java +++ b/src/java/org/apache/poi/hpsf/CustomProperty.java @@ -17,6 +17,8 @@ package org.apache.poi.hpsf; +import java.util.Objects; + /** * This class represents custom properties in the document summary * information stream. The difference to normal properties is that custom @@ -39,7 +41,7 @@ public class CustomProperty extends Property /** * Creates a {@link CustomProperty} without a name by copying the * underlying {@link Property}' attributes. - * + * * @param property the property to copy */ public CustomProperty(final Property property) { @@ -48,7 +50,7 @@ public class CustomProperty extends Property /** * Creates a {@link CustomProperty} with a name. - * + * * @param property This property's attributes are copied to the new custom * property. * @param name The new custom property's name. @@ -81,11 +83,11 @@ public class CustomProperty extends Property * Compares two custom properties for equality. The method returns * {@code true} if all attributes of the two custom properties are * equal. - * + * * @param o The custom property to compare with. * @return {@code true} if both custom properties are equal, else * {@code false}. - * + * * @see java.util.AbstractSet#equals(java.lang.Object) */ public boolean equalsContents(final Object o) { @@ -108,11 +110,11 @@ public class CustomProperty extends Property */ @Override public int hashCode() { - return (int) this.getID(); + return Objects.hash(name, getID()); } @Override public boolean equals(Object o) { - return (o instanceof CustomProperty) ? equalsContents(o) : false; + return (o instanceof CustomProperty) && equalsContents(o); } } diff --git a/src/java/org/apache/poi/hpsf/Property.java b/src/java/org/apache/poi/hpsf/Property.java index 740530b6c0..4c0dc06a49 100644 --- a/src/java/org/apache/poi/hpsf/Property.java +++ b/src/java/org/apache/poi/hpsf/Property.java @@ -25,6 +25,7 @@ import java.nio.charset.Charset; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Locale; +import java.util.Objects; import java.util.concurrent.TimeUnit; import org.apache.poi.hpsf.wellknown.PropertyIDMap; @@ -67,10 +68,10 @@ public class Property { /** * Default codepage for {@link CodePageString CodePageStrings} */ - public static final int DEFAULT_CODEPAGE = CodePageUtil.CP_WINDOWS_1252; - + public static final int DEFAULT_CODEPAGE = CodePageUtil.CP_WINDOWS_1252; + private static final POILogger LOG = POILogFactory.getLogger(Property.class); - + /** The property's ID. */ private long id; @@ -369,13 +370,7 @@ public class Property { */ @Override public int hashCode() { - long hashCode = 0; - hashCode += id; - hashCode += type; - if (value != null) { - hashCode += value.hashCode(); - } - return (int) (hashCode & 0x0ffffffffL ); + return Objects.hash(id,type,value); } @@ -388,7 +383,7 @@ public class Property { public String toString() { return toString(Property.DEFAULT_CODEPAGE, null); } - + public String toString(int codepage, PropertyIDMap idMap) { final StringBuilder b = new StringBuilder(); b.append("Property["); @@ -419,7 +414,7 @@ public class Property { } catch (Exception e) { LOG.log(POILogger.WARN, "can't serialize string", e); } - + // skip length field if(bos.size() > 2*LittleEndianConsts.INT_SIZE) { final String hex = HexDump.dump(bos.toByteArray(), -2*LittleEndianConsts.INT_SIZE, 2*LittleEndianConsts.INT_SIZE); @@ -448,7 +443,7 @@ public class Property { final long sec = tu.toSeconds(l); l -= TimeUnit.SECONDS.toNanos(sec); final long ms = tu.toMillis(l); - + String str = String.format(Locale.ROOT, "%02d:%02d:%02d.%03d",hr,min,sec,ms); b.append(str); } else { @@ -461,7 +456,7 @@ public class Property { b.append("null"); } else { b.append(value); - + String decoded = decodeValueFromID(); if (decoded != null) { b.append(" ("); @@ -479,7 +474,7 @@ public class Property { } return Variant.getVariantName(getType()); } - + private String decodeValueFromID() { try { switch((int)getID()) { @@ -493,7 +488,7 @@ public class Property { } return null; } - + /** * Writes the property to an output stream. * diff --git a/src/java/org/apache/poi/hpsf/Section.java b/src/java/org/apache/poi/hpsf/Section.java index 5c78402701..89802a017a 100644 --- a/src/java/org/apache/poi/hpsf/Section.java +++ b/src/java/org/apache/poi/hpsf/Section.java @@ -21,6 +21,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; +import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.HashSet; @@ -219,7 +220,7 @@ public class Section { if (id == PropertyIDMap.PID_CODEPAGE) { continue; } - + int pLen = propLen(offset2Id, off, size); leis.setReadIndex(Math.toIntExact(this._offset + off)); @@ -241,7 +242,7 @@ public class Section { setProperty(new Property(id, leis, pLen, codepage)); } } - + sectionBytes.write(src, Math.toIntExact(_offset), size); padSectionBytes(); } @@ -621,7 +622,7 @@ public class Section { dic = PropertyIDMap.getDocumentSummaryInformationProperties(); } } - + return (dic != null && dic.containsKey(pid)) ? dic.get(pid) : PropertyIDMap.UNDEFINED; } @@ -940,17 +941,9 @@ public class Section { */ @Override public int hashCode() { - long hashCode = 0; - hashCode += getFormatID().hashCode(); - final Property[] pa = getProperties(); - for (Property aPa : pa) { - hashCode += aPa.hashCode(); - } - return Math.toIntExact(hashCode & 0x0ffffffffL); + return Arrays.deepHashCode(new Object[]{getFormatID(),getProperties()}); } - - /** * @see Object#toString() */ @@ -958,7 +951,7 @@ public class Section { public String toString() { return toString(null); } - + public String toString(PropertyIDMap idMap) { final StringBuilder b = new StringBuilder(); final Property[] pa = getProperties(); diff --git a/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java b/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java index 5c9b0f1663..91425e9b8c 100644 --- a/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/ExtendedFormatRecord.java @@ -18,6 +18,8 @@ package org.apache.poi.hssf.record; +import java.util.Objects; + import org.apache.poi.util.BitField; import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.LittleEndianOutput; @@ -1799,18 +1801,17 @@ public final class ExtendedFormatRecord extends StandardRecord { @Override public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + field_1_font_index; - result = prime * result + field_2_format_index; - result = prime * result + field_3_cell_options; - result = prime * result + field_4_alignment_options; - result = prime * result + field_5_indention_options; - result = prime * result + field_6_border_options; - result = prime * result + field_7_palette_options; - result = prime * result + field_8_adtl_palette_options; - result = prime * result + field_9_fill_palette_options; - return result; + return Objects.hash( + field_1_font_index + , field_2_format_index + , field_3_cell_options + , field_4_alignment_options + , field_5_indention_options + , field_6_border_options + , field_7_palette_options + , field_8_adtl_palette_options + , field_9_fill_palette_options + ); } /** diff --git a/src/java/org/apache/poi/hssf/record/FontRecord.java b/src/java/org/apache/poi/hssf/record/FontRecord.java index 2a3cc2f29f..36166a6f7d 100644 --- a/src/java/org/apache/poi/hssf/record/FontRecord.java +++ b/src/java/org/apache/poi/hssf/record/FontRecord.java @@ -458,22 +458,18 @@ public final class FontRecord extends StandardRecord { } public int hashCode() { - final int prime = 31; - int result = 1; - result = prime - * result - + ((field_11_font_name == null) ? 0 : field_11_font_name - .hashCode()); - result = prime * result + field_1_font_height; - result = prime * result + field_2_attributes; - result = prime * result + field_3_color_palette_index; - result = prime * result + field_4_bold_weight; - result = prime * result + field_5_super_sub_script; - result = prime * result + field_6_underline; - result = prime * result + field_7_family; - result = prime * result + field_8_charset; - result = prime * result + field_9_zero; - return result; + return Objects.hash( + field_1_font_height + , field_2_attributes + , field_3_color_palette_index + , field_4_bold_weight + , field_5_super_sub_script + , field_6_underline + , field_7_family + , field_8_charset + , field_9_zero + , field_11_font_name + ); } /** diff --git a/src/java/org/apache/poi/hssf/record/common/ExtRst.java b/src/java/org/apache/poi/hssf/record/common/ExtRst.java index efdb5b1eac..f954ce8f2e 100644 --- a/src/java/org/apache/poi/hssf/record/common/ExtRst.java +++ b/src/java/org/apache/poi/hssf/record/common/ExtRst.java @@ -222,20 +222,7 @@ public class ExtRst implements Comparable { @Override public int hashCode() { - int hash = reserved; - hash = 31*hash+formattingFontIndex; - hash = 31*hash+formattingOptions; - hash = 31*hash+numberOfRuns; - hash = 31*hash+phoneticText.hashCode(); - - if (phRuns != null) { - for (PhRun ph : phRuns) { - hash = 31*hash+ph.phoneticTextFirstCharacterOffset; - hash = 31*hash+ph.realTextFirstCharacterOffset; - hash = 31*hash+ph.realTextLength; - } - } - return hash; + return Arrays.deepHashCode(new Object[]{reserved, formattingFontIndex, formattingOptions, numberOfRuns, phoneticText, phRuns}); } public ExtRst copy() { diff --git a/src/java/org/apache/poi/hssf/record/common/PhRun.java b/src/java/org/apache/poi/hssf/record/common/PhRun.java index 0f33254b46..2f5a9229da 100644 --- a/src/java/org/apache/poi/hssf/record/common/PhRun.java +++ b/src/java/org/apache/poi/hssf/record/common/PhRun.java @@ -17,6 +17,8 @@ package org.apache.poi.hssf.record.common; +import java.util.Objects; + import org.apache.poi.hssf.record.cont.ContinuableRecordOutput; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndianInput; @@ -52,4 +54,9 @@ public class PhRun { out.writeShort(realTextFirstCharacterOffset); out.writeShort(realTextLength); } + + @Override + public int hashCode() { + return Objects.hash(phoneticTextFirstCharacterOffset, realTextFirstCharacterOffset, realTextLength); + } } diff --git a/src/java/org/apache/poi/hssf/record/common/UnicodeString.java b/src/java/org/apache/poi/hssf/record/common/UnicodeString.java index fedaf31b22..91a55e6f18 100644 --- a/src/java/org/apache/poi/hssf/record/common/UnicodeString.java +++ b/src/java/org/apache/poi/hssf/record/common/UnicodeString.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; import org.apache.poi.common.Duplicatable; @@ -103,13 +104,8 @@ public class UnicodeString implements Comparable, Duplicatable { } } - public int hashCode() - { - int stringHash = 0; - if (field_3_string != null) { - stringHash = field_3_string.hashCode(); - } - return field_1_charCount + stringHash; + public int hashCode() { + return Objects.hash(field_1_charCount, field_3_string); } /** diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java b/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java index b8bde9a1a0..22c9296978 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java @@ -16,6 +16,8 @@ ==================================================================== */ package org.apache.poi.hssf.usermodel; +import java.util.Objects; + import org.apache.poi.ddf.DefaultEscherRecordFactory; import org.apache.poi.ddf.EscherBSERecord; import org.apache.poi.ddf.EscherContainerRecord; @@ -162,18 +164,18 @@ public class HSSFComment extends HSSFTextbox implements Comment { public boolean isVisible() { return _note.getFlags() == NoteRecord.NOTE_VISIBLE; } - + @Override public CellAddress getAddress() { return new CellAddress(getRow(), getColumn()); } - + @Override public void setAddress(CellAddress address) { setRow(address.getRow()); setColumn(address.getColumn()); } - + @Override public void setAddress(int row, int col) { setRow(row); @@ -246,7 +248,7 @@ public class HSSFComment extends HSSFTextbox implements Comment { protected NoteRecord getNoteRecord() { return _note; } - + /** * Do we know which cell this comment belongs to? */ @@ -288,14 +290,14 @@ public class HSSFComment extends HSSFTextbox implements Comment { NoteRecord note = (NoteRecord) getNoteRecord().cloneViaReserialise(); return new HSSFComment(spContainer, obj, txo, note); } - + public void setBackgroundImage(int pictureIndex){ setPropertyValue(new EscherSimpleProperty( EscherPropertyTypes.FILL__PATTERNTEXTURE, false, true, pictureIndex)); setPropertyValue(new EscherSimpleProperty( EscherPropertyTypes.FILL__FILLTYPE, false, false, FILL_TYPE_PICTURE)); EscherBSERecord bse = getPatriarch().getSheet().getWorkbook().getWorkbook().getBSERecord(pictureIndex); bse.setRef(bse.getRef() + 1); } - + public void resetBackgroundImage(){ EscherSimpleProperty property = getOptRecord().lookup(EscherPropertyTypes.FILL__PATTERNTEXTURE); if (null != property){ @@ -305,7 +307,7 @@ public class HSSFComment extends HSSFTextbox implements Comment { } setPropertyValue(new EscherSimpleProperty( EscherPropertyTypes.FILL__FILLTYPE, false, false, FILL_TYPE_SOLID)); } - + public int getBackgroundImageId(){ EscherSimpleProperty property = getOptRecord().lookup(EscherPropertyTypes.FILL__PATTERNTEXTURE); return property == null ? 0 : property.getPropertyValue(); @@ -332,6 +334,6 @@ public class HSSFComment extends HSSFTextbox implements Comment { @Override public int hashCode() { - return ((getRow()*17) + getColumn())*31; + return Objects.hash(getRow(),getColumn()); } } diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java b/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java index 722dc0b748..bea407049e 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java @@ -17,13 +17,15 @@ package org.apache.poi.hssf.usermodel; +import java.util.Objects; + import org.apache.poi.hssf.record.FontRecord; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.Font; /** * Represents a Font used in a workbook. - * + * * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createFont() * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(int) * @see org.apache.poi.hssf.usermodel.HSSFCellStyle#setFont(HSSFFont) @@ -207,7 +209,7 @@ public final class HSSFFont implements Font { { return font.getColorPaletteIndex(); } - + /** * get the color value for the font */ @@ -216,7 +218,7 @@ public final class HSSFFont implements Font { HSSFPalette pallette = wb.getCustomPalette(); return pallette.getColor( getColor() ); } - + /** * sets the font to be bold or not */ @@ -227,7 +229,7 @@ public final class HSSFFont implements Font { else font.setBoldWeight(BOLDWEIGHT_NORMAL); } - + /** * get if the font is bold or not */ @@ -344,11 +346,7 @@ public final class HSSFFont implements Font { } public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((font == null) ? 0 : font.hashCode()); - result = prime * result + index; - return result; + return Objects.hash(font,index); } public boolean equals(Object obj) { diff --git a/src/java/org/apache/poi/hssf/util/HSSFColor.java b/src/java/org/apache/poi/hssf/util/HSSFColor.java index 51d4af7d6f..a7d53da928 100644 --- a/src/java/org/apache/poi/hssf/util/HSSFColor.java +++ b/src/java/org/apache/poi/hssf/util/HSSFColor.java @@ -22,6 +22,7 @@ import java.util.EnumMap; import java.util.HashMap; import java.util.Locale; import java.util.Map; +import java.util.Objects; import org.apache.poi.ss.usermodel.Color; import org.apache.poi.util.Removal; @@ -348,10 +349,7 @@ public class HSSFColor implements Color { @Override public int hashCode() { - int result = color != null ? color.hashCode() : 0; - result = 31 * result + index; - result = 31 * result + index2; - return result; + return Objects.hash(color,index,index2); } /** diff --git a/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java b/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java index a478982021..afb4a09f9d 100644 --- a/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java +++ b/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java @@ -17,11 +17,18 @@ package org.apache.poi.ss.formula; -import java.text.CollationKey; -import java.text.Collator; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.Set; import org.apache.poi.ss.formula.eval.BlankEval; import org.apache.poi.ss.formula.eval.BoolEval; @@ -66,25 +73,25 @@ public class EvaluationConditionalFormatRule implements Comparable> meaningfulRegionValues = new HashMap<>(); - + private final int priority; private final int formattingIndex; private final int ruleIndex; private final String formula1; private final String formula2; private final String text; - // cached for performance, used with cell text comparisons, which are case insensitive and need to be Locale aware (contains, starts with, etc.) + // cached for performance, used with cell text comparisons, which are case insensitive and need to be Locale aware (contains, starts with, etc.) private final String lowerText; private final OperatorEnum operator; @@ -93,7 +100,7 @@ public class EvaluationConditionalFormatRule implements Comparable * HSSF priority is based on definition/persistence order. - * + * * @param o * @return comparison based on sheet name, formatting index, and rule priority */ @@ -265,7 +272,7 @@ public class EvaluationConditionalFormatRule implements Comparable 0) { eval2 = unwrapEval(workbookEvaluator.evaluate(f2, ConditionalFormattingEvaluator.getRef(cell), region)); } - + // we assume the cell has been evaluated, and the current formula value stored - if (DataValidationEvaluator.isType(cell, CellType.BOOLEAN) - && (eval == BlankEval.instance || eval instanceof BoolEval) - && (eval2 == BlankEval.instance || eval2 instanceof BoolEval) + if (DataValidationEvaluator.isType(cell, CellType.BOOLEAN) + && (eval == BlankEval.instance || eval instanceof BoolEval) + && (eval2 == BlankEval.instance || eval2 instanceof BoolEval) ) { return operator.isValid(cell.getBooleanCellValue(), eval == BlankEval.instance ? null : ((BoolEval) eval).getBooleanValue(), eval2 == BlankEval.instance ? null : ((BoolEval) eval2).getBooleanValue()); } - if (DataValidationEvaluator.isType(cell, CellType.NUMERIC) + if (DataValidationEvaluator.isType(cell, CellType.NUMERIC) && (eval == BlankEval.instance || eval instanceof NumberEval ) - && (eval2 == BlankEval.instance || eval2 instanceof NumberEval) + && (eval2 == BlankEval.instance || eval2 instanceof NumberEval) ) { return operator.isValid(cell.getNumericCellValue(), eval == BlankEval.instance ? null : ((NumberEval) eval).getNumberValue(), eval2 == BlankEval.instance ? null : ((NumberEval) eval2).getNumberValue()); } if (DataValidationEvaluator.isType(cell, CellType.STRING) && (eval == BlankEval.instance || eval instanceof StringEval ) - && (eval2 == BlankEval.instance || eval2 instanceof StringEval) + && (eval2 == BlankEval.instance || eval2 instanceof StringEval) ) { return operator.isValid(cell.getStringCellValue(), eval == BlankEval.instance ? null : ((StringEval) eval).getStringValue(), eval2 == BlankEval.instance ? null : ((StringEval) eval2).getStringValue()); } - + return operator.isValidForIncompatibleTypes(); } - + private ValueEval unwrapEval(ValueEval eval) { ValueEval comp = eval; - + while (comp instanceof RefEval) { RefEval ref = (RefEval) comp; comp = ref.getInnerValueEval(ref.getFirstSheetIndex()); @@ -402,7 +406,7 @@ public class EvaluationConditionalFormatRule implements Comparable evaluate(List allValues) { final ConditionFilterData conf = rule.getFilterConfiguration(); - + if (! conf.getBottom()) { allValues.sort(Collections.reverseOrder()); } else { Collections.sort(allValues); } - + int limit = Math.toIntExact(conf.getRank()); if (conf.getPercent()) { limit = allValues.size() * limit / 100; @@ -473,9 +477,9 @@ public class EvaluationConditionalFormatRule implements Comparable evaluate(List allValues) { Collections.sort(allValues); - + final Set unique = new HashSet<>(); - + 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 @@ -486,7 +490,7 @@ public class EvaluationConditionalFormatRule implements Comparable evaluate(List allValues) { Collections.sort(allValues); - + final Set dup = new HashSet<>(); - + 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 @@ -515,7 +519,7 @@ public class EvaluationConditionalFormatRule implements Comparable 0 ? (avg + (conf.getAboveAverage() ? 1 : -1) * stdDev * conf.getStdDev()) : avg) ; - + final OperatorEnum op; if (conf.getAboveAverage()) { if (conf.getEqualAverage()) { @@ -611,11 +615,11 @@ public class EvaluationConditionalFormatRule implements Comparable allValues = new ArrayList<>((region.getLastColumn() - region.getFirstColumn() + 1) * (region.getLastRow() - region.getFirstRow() + 1)); - + for (int r=region.getFirstRow(); r <= region.getLastRow(); r++) { final Row row = sheet.getRow(r); if (row == null) { @@ -640,10 +644,10 @@ public class EvaluationConditionalFormatRule implements Comparable evaluate(List values); } - + /** * Not calling it OperatorType to avoid confusion for now with other classes. * Definition order matches OOXML type ID indexes. - * Note that this has NO_COMPARISON as the first item, unlike the similar + * Note that this has NO_COMPARISON as the first item, unlike the similar * DataValidation operator enum. Thanks, Microsoft. */ public static enum OperatorEnum { @@ -731,7 +735,7 @@ public class EvaluationConditionalFormatRule implements Comparable 0; } - + public boolean isValidForIncompatibleTypes() { return true; } @@ -767,7 +771,7 @@ public class EvaluationConditionalFormatRule implements Comparable> boolean isValid(C cellValue, C v1, C v2); - + /** * Called when the cell and comparison values are of different data types * Needed for negation operators, which should return true. @@ -852,43 +856,43 @@ public class EvaluationConditionalFormatRule implements Comparable { - + private final Double value; private final String string; private final String format; private final DecimalFormat decimalTextFormat; - + public ValueAndFormat(Double value, String format, DecimalFormat df) { this.value = value; this.format = format; string = null; decimalTextFormat = df; } - + public ValueAndFormat(String value, String format) { this.value = null; this.format = format; string = value; decimalTextFormat = null; } - + public boolean isNumber() { return value != null; } - + public Double getValue() { return value; } - + public String getString() { return string; } - + public String toString() { if(isNumber()) { return decimalTextFormat.format(getValue().doubleValue()); @@ -896,7 +900,7 @@ public class EvaluationConditionalFormatRule implements Comparable - * + * *

Use 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 + * when the concept of relative/absolute does not apply (such as the anchor location * of a cell comment). * CellReferences have a concept of "sheet", while CellAddresses do not.

*/ @@ -370,7 +371,7 @@ public class CellReference { private static final class CellRefParts { final String sheetName; final String rowRef; - final String colRef; + final String colRef; private CellRefParts(String sheetName, String rowRef, String colRef) { this.sheetName = sheetName; @@ -381,7 +382,7 @@ public class CellReference { /** * Separates the sheet name, row, and columns from a cell reference string. - * + * * @param reference is a string that identifies a cell within the sheet or workbook * reference may not refer to a cell in an external workbook * reference may be absolute or relative. @@ -584,12 +585,6 @@ public class CellReference { @Override public int hashCode() { - int result = 17; - result = 31 * result + _rowIndex; - result = 31 * result + _colIndex; - result = 31 * result + (_isRowAbs ? 1 : 0); - result = 31 * result + (_isColAbs ? 1 : 0); - result = 31 * result + (_sheetName == null ? 0 : _sheetName.hashCode()); - return result; + return Objects.hash(_rowIndex,_colIndex,_isRowAbs,_isColAbs,_sheetName); } } diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java index 9f82d512fa..c6edc81db2 100644 --- a/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java +++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java @@ -19,6 +19,7 @@ package org.apache.poi.openxml4j.opc; import java.net.URI; import java.net.URISyntaxException; +import java.util.Objects; /** * A part relationship. @@ -129,11 +130,7 @@ public final class PackageRelationship { @Override public int hashCode() { - return this.id.hashCode() - + this.relationshipType.hashCode() - + (this.source == null ? 0 : this.source.hashCode()) - + this.targetMode.hashCode() - + this.targetUri.hashCode(); + return Objects.hash(id,relationshipType,source,targetMode,targetUri); } /* Getters */ diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentType.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentType.java index ec4a1a2080..2933a70ccf 100644 --- a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentType.java +++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentType.java @@ -21,6 +21,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; +import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -128,9 +129,9 @@ public final class ContentType { * quoted-pair = "\" CHAR */ - patternTypeSubType = Pattern.compile("^(" + token + "+)/(" + + patternTypeSubType = Pattern.compile("^(" + token + "+)/(" + token + "+)$"); - patternTypeSubTypeParams = Pattern.compile("^(" + token + "+)/(" + + patternTypeSubTypeParams = Pattern.compile("^(" + token + "+)/(" + token + "+)(;" + parameter + ")*$"); patternParams = Pattern.compile(";" + parameter); } @@ -160,7 +161,7 @@ public final class ContentType { if (mMediaType.groupCount() >= 2) { this.type = mMediaType.group(1); this.subType = mMediaType.group(2); - + // Parameters this.parameters = new HashMap<>(); // Java RegExps are unhelpful, and won't do multiple group captures @@ -175,7 +176,7 @@ public final class ContentType { // missing media type and subtype this.type = ""; this.subType = ""; - this.parameters = Collections.emptyMap(); + this.parameters = Collections.emptyMap(); } } @@ -212,7 +213,7 @@ public final class ContentType { @Override public int hashCode() { - return this.toString().hashCode(); + return Objects.hash(type,subType,parameters); } /* Getters */ @@ -234,14 +235,14 @@ public final class ContentType { public String getType() { return this.type; } - + /** * Does this content type have any parameters associated with it? */ public boolean hasParameters() { return (parameters != null) && !parameters.isEmpty(); } - + /** * Return the parameter keys */ diff --git a/src/ooxml/java/org/apache/poi/xssf/binary/XSSFHyperlinkRecord.java b/src/ooxml/java/org/apache/poi/xssf/binary/XSSFHyperlinkRecord.java index e2ac4df127..080048af45 100644 --- a/src/ooxml/java/org/apache/poi/xssf/binary/XSSFHyperlinkRecord.java +++ b/src/ooxml/java/org/apache/poi/xssf/binary/XSSFHyperlinkRecord.java @@ -17,6 +17,8 @@ package org.apache.poi.xssf.binary; +import java.util.Objects; + import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.util.Internal; @@ -97,12 +99,7 @@ public class XSSFHyperlinkRecord { @Override public int hashCode() { - int result = cellRangeAddress != null ? cellRangeAddress.hashCode() : 0; - result = 31 * result + (relId != null ? relId.hashCode() : 0); - result = 31 * result + (location != null ? location.hashCode() : 0); - result = 31 * result + (toolTip != null ? toolTip.hashCode() : 0); - result = 31 * result + (display != null ? display.hashCode() : 0); - return result; + return Objects.hash(cellRangeAddress,relId,location,toolTip,display); } @Override diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStop.java b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStop.java index deb6d67ab7..0c340b067e 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStop.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStop.java @@ -18,6 +18,7 @@ package org.apache.poi.hslf.model.textproperties; import java.util.Map; +import java.util.Objects; import java.util.function.Supplier; import org.apache.poi.common.Duplicatable; @@ -100,11 +101,7 @@ public class HSLFTabStop implements TabStop, Duplicatable, GenericRecord { @Override public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + position; - result = prime * result + ((type == null) ? 0 : type.hashCode()); - return result; + return Objects.hash(position, type); } @Override diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStopPropCollection.java b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStopPropCollection.java index abafe05db6..071ceeb188 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStopPropCollection.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/HSLFTabStopPropCollection.java @@ -21,6 +21,7 @@ import java.io.OutputStream; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Supplier; import org.apache.poi.sl.usermodel.TabStop.TabStopType; @@ -123,7 +124,7 @@ public class HSLFTabStopPropCollection extends TextProp { @Override public int hashCode() { - return 31 * super.hashCode() + tabStops.hashCode(); + return Objects.hash(super.hashCode(), tabStops); } @Override diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java index 8f33257552..db041719a8 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPropCollection.java @@ -26,6 +26,7 @@ import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Supplier; import org.apache.poi.common.Duplicatable; @@ -334,13 +335,7 @@ public class TextPropCollection implements GenericRecord, Duplicatable { } public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + charactersCovered; - result = prime * result + maskSpecial; - result = prime * result + indentLevel; - result = prime * result + textProps.hashCode(); - return result; + return Objects.hash(charactersCovered,maskSpecial,indentLevel,textProps); } /** * compares most properties apart of the covered characters length diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java b/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java index 401fe5ccb5..a0eafbb129 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java @@ -16,6 +16,8 @@ ==================================================================== */ package org.apache.poi.hwpf.model; +import java.util.Objects; + import org.apache.poi.hwpf.model.types.BKFAbstractType; import org.apache.poi.util.Internal; @@ -63,13 +65,8 @@ public final class BookmarkFirstDescriptor extends BKFAbstractType implements } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_1_ibkl; - result = prime * result + field_2_bkf_flags; - return result; + public int hashCode() { + return Objects.hash(field_1_ibkl,field_2_bkf_flags); } public boolean isEmpty() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/FibBase.java b/src/scratchpad/src/org/apache/poi/hwpf/model/FibBase.java index 5f4b6e82bf..8f505b9588 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/FibBase.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/FibBase.java @@ -16,6 +16,8 @@ ==================================================================== */ package org.apache.poi.hwpf.model; +import java.util.Objects; + import org.apache.poi.hwpf.model.types.FibBaseAbstractType; import org.apache.poi.util.Internal; @@ -25,7 +27,7 @@ import org.apache.poi.util.Internal; *

* Class and fields descriptions are quoted from Microsoft Office Word 97-2007 * Binary File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format. - * + * * @author Andrew C. Oliver; Sergey Vladimirov; according to Microsoft Office * Word 97-2007 Binary File Format Specification [*.doc] and [MS-DOC] - * v20110608 Word (.doc) Binary File Format @@ -84,22 +86,8 @@ public class FibBase extends FibBaseAbstractType { @Override @SuppressWarnings( "deprecation" ) public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + field_10_flags2; - result = prime * result + field_11_Chs; - result = prime * result + field_12_chsTables; - result = prime * result + field_13_fcMin; - result = prime * result + field_14_fcMac; - result = prime * result + field_1_wIdent; - result = prime * result + field_2_nFib; - result = prime * result + field_3_unused; - result = prime * result + field_4_lid; - result = prime * result + field_5_pnNext; - result = prime * result + field_6_flags1; - result = prime * result + field_7_nFibBack; - result = prime * result + field_8_lKey; - result = prime * result + field_9_envr; - return result; + return Objects.hash(field_1_wIdent, field_2_nFib, field_3_unused, field_4_lid, field_5_pnNext, field_6_flags1, + field_7_nFibBack, field_8_lKey, field_9_envr, field_10_flags2, field_11_Chs, field_12_chsTables, + field_13_fcMin, field_14_fcMac); } } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/FibRgW97.java b/src/scratchpad/src/org/apache/poi/hwpf/model/FibRgW97.java index fcf3527dea..c3b0f6bd9c 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/FibRgW97.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/FibRgW97.java @@ -16,6 +16,8 @@ ==================================================================== */ package org.apache.poi.hwpf.model; +import java.util.Objects; + import org.apache.poi.hwpf.model.types.FibRgW97AbstractType; import org.apache.poi.util.Internal; @@ -24,7 +26,7 @@ import org.apache.poi.util.Internal; *

* Class and fields descriptions are quoted from Microsoft Office Word 97-2007 * Binary File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format. - * + * * @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary * File Format Specification [*.doc] and [MS-DOC] - v20110608 Word * (.doc) Binary File Format @@ -86,25 +88,10 @@ public class FibRgW97 extends FibRgW97AbstractType @Override @SuppressWarnings( "deprecation" ) - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_10_reserved10; - result = prime * result + field_11_reserved11; - result = prime * result + field_12_reserved12; - result = prime * result + field_13_reserved13; - result = prime * result + field_14_lidFE; - result = prime * result + field_1_reserved1; - result = prime * result + field_2_reserved2; - result = prime * result + field_3_reserved3; - result = prime * result + field_4_reserved4; - result = prime * result + field_5_reserved5; - result = prime * result + field_6_reserved6; - result = prime * result + field_7_reserved7; - result = prime * result + field_8_reserved8; - result = prime * result + field_9_reserved9; - return result; + public int hashCode() { + return Objects.hash(field_1_reserved1, field_2_reserved2, field_3_reserved3, field_4_reserved4, + field_5_reserved5, field_6_reserved6, field_7_reserved7, field_8_reserved8, field_9_reserved9, + field_10_reserved10, field_11_reserved11, field_12_reserved12, field_13_reserved13, field_14_lidFE); } } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java b/src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java index 326cf954f4..3df6bd9d59 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java @@ -16,6 +16,8 @@ ==================================================================== */ package org.apache.poi.hwpf.model; +import java.util.Objects; + import org.apache.poi.hwpf.model.types.FRDAbstractType; import org.apache.poi.util.Internal; @@ -61,12 +63,8 @@ public final class FootnoteReferenceDescriptor extends FRDAbstractType } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_1_nAuto; - return result; + public int hashCode() { + return Objects.hash(field_1_nAuto); } public boolean isEmpty() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java b/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java index 0860a38f76..3987db9ea5 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java @@ -17,6 +17,8 @@ package org.apache.poi.hwpf.model; +import java.util.Objects; + import org.apache.poi.hwpf.model.types.HRESIAbstractType; import org.apache.poi.hwpf.usermodel.CharacterProperties; import org.apache.poi.util.Internal; @@ -24,7 +26,7 @@ import org.apache.poi.util.LittleEndian; /** * Hyphenation. Substructure of the {@link CharacterProperties}. - * + * * @author Sergey Vladimirov ( vlsergey {at} gmail {dot} com ) */ @Internal @@ -79,13 +81,8 @@ public final class Hyphenation extends HRESIAbstractType implements Cloneable } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_1_hres; - result = prime * result + field_2_chHres; - return result; + public int hashCode() { + return Objects.hash(field_1_hres,field_2_chHres); } public boolean isEmpty() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/LFOData.java b/src/scratchpad/src/org/apache/poi/hwpf/model/LFOData.java index 3ee4063211..78d2bc40f8 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/LFOData.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/LFOData.java @@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndian; /** * The LFOData structure contains the Main Document CP of the corresponding LFO, * as well as an array of LVL override data. - * + * * @author Sergey Vladimirov (vlsergey {at} gmail {dot} com) */ @Internal @@ -104,8 +104,6 @@ public class LFOData @Override public int hashCode() { - int result = _cp; - result = 31 * result + Arrays.hashCode(_rgLfoLvl); - return result; + return Arrays.deepHashCode(_rgLfoLvl); } } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/ListData.java b/src/scratchpad/src/org/apache/poi/hwpf/model/ListData.java index 9893504012..a6d817a72f 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/ListData.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/ListData.java @@ -80,7 +80,7 @@ public final class ListData /** * Gets the level associated to a particular List at a particular index. - * + * * @param index * 1-based index * @return a list level @@ -106,13 +106,8 @@ public final class ListData } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + Arrays.hashCode( _levels ); - result = prime * result + ( ( _lstf == null ) ? 0 : _lstf.hashCode() ); - return result; + public int hashCode() { + return Arrays.deepHashCode(new Object[]{_levels,_lstf}); } public int numLevels() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/ListFormatOverrideLevel.java b/src/scratchpad/src/org/apache/poi/hwpf/model/ListFormatOverrideLevel.java index bcffbe8b3d..fa5d505d89 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/ListFormatOverrideLevel.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/ListFormatOverrideLevel.java @@ -16,6 +16,8 @@ ==================================================================== */ package org.apache.poi.hwpf.model; +import java.util.Objects; + import org.apache.poi.util.Internal; /** @@ -81,13 +83,8 @@ public final class ListFormatOverrideLevel } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + _base.hashCode(); - result = prime * result + ( _lvl != null ? _lvl.hashCode() : 0 ); - return result; + public int hashCode() { + return Objects.hash(_base,_lvl); } public boolean isFormatting() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java b/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java index c9d689564a..c46981e4fe 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java @@ -21,6 +21,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.LinkedHashMap; import java.util.NoSuchElementException; +import java.util.Objects; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; @@ -162,13 +163,8 @@ public final class ListTables } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + _listMap.hashCode(); - result = prime * result + ( ( _plfLfo == null ) ? 0 : _plfLfo.hashCode() ); - return result; + public int hashCode() { + return Objects.hash(_listMap,_plfLfo); } @Override diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/PICF.java b/src/scratchpad/src/org/apache/poi/hwpf/model/PICF.java index ee7a11a8c8..44ab74078b 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/PICF.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/PICF.java @@ -27,7 +27,7 @@ import org.apache.poi.util.Internal; *

* Class and fields descriptions are quoted from Microsoft Office Word 97-2007 * Binary File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format - * + * * @author Sergey Vladimirov (vlsergey {at} gmail {dot} com) */ @Internal @@ -111,38 +111,12 @@ public class PICF extends PICFAbstractType } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_10_padding2; - result = prime * result + field_11_dxaGoal; - result = prime * result + field_12_dyaGoal; - result = prime * result + field_13_mx; - result = prime * result + field_14_my; - result = prime * result + field_15_dxaReserved1; - result = prime * result + field_16_dyaReserved1; - result = prime * result + field_17_dxaReserved2; - result = prime * result + field_18_dyaReserved2; - result = prime * result + field_19_fReserved; - result = prime * result + field_1_lcb; - result = prime * result + field_20_bpp; - result = prime * result + Arrays.hashCode( field_21_brcTop80 ); - result = prime * result + Arrays.hashCode( field_22_brcLeft80 ); - result = prime * result + Arrays.hashCode( field_23_brcBottom80 ); - result = prime * result + Arrays.hashCode( field_24_brcRight80 ); - result = prime * result + field_25_dxaReserved3; - result = prime * result + field_26_dyaReserved3; - result = prime * result + field_27_cProps; - result = prime * result + field_2_cbHeader; - result = prime * result + field_3_mm; - result = prime * result + field_4_xExt; - result = prime * result + field_5_yExt; - result = prime * result + field_6_swHMF; - result = prime * result + field_7_grf; - result = prime * result + field_8_padding; - result = prime * result + field_9_mmPM; - return result; + public int hashCode() { + return Arrays.deepHashCode(new Object[]{field_1_lcb, field_2_cbHeader, field_3_mm, field_4_xExt, field_5_yExt, + field_6_swHMF, field_7_grf, field_8_padding, field_9_mmPM, field_10_padding2, field_11_dxaGoal, + field_12_dyaGoal, field_13_mx, field_14_my, field_15_dxaReserved1, field_16_dyaReserved1, field_17_dxaReserved2, + field_18_dyaReserved2, field_19_fReserved, field_20_bpp, field_21_brcTop80, field_22_brcLeft80, + field_23_brcBottom80, field_24_brcRight80, field_25_dxaReserved3, field_26_dyaReserved3, field_27_cProps}); } } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java b/src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java index a54a06059b..43c919554e 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java @@ -18,6 +18,7 @@ package org.apache.poi.hwpf.model; import java.nio.charset.Charset; +import java.util.Objects; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; @@ -89,12 +90,7 @@ public final class PieceDescriptor { @Override public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + descriptor; - result = prime * result + ( ( prm == null ) ? 0 : prm.hashCode() ); - result = prime * result + ( unicode ? 1231 : 1237 ); - return result; + return Objects.hash(descriptor,prm,unicode); } /** diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/PlfLfo.java b/src/scratchpad/src/org/apache/poi/hwpf/model/PlfLfo.java index 90d0b3cef3..41917d83db 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/PlfLfo.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/PlfLfo.java @@ -32,7 +32,7 @@ import org.apache.poi.util.POILogger; *

* Documentation quoted from Page 424 of 621. [MS-DOC] -- v20110315 Word (.doc) * Binary File Format - * + * * @author Sergey Vladimirov (vlsergey {at} gmail {dot} com) */ public class PlfLfo @@ -49,7 +49,7 @@ public class PlfLfo private LFOData[] _rgLfoData; - + PlfLfo( byte[] tableStream, int fcPlfLfo, int lcbPlfLfo ) { /* @@ -192,14 +192,8 @@ public class PlfLfo } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + _lfoMac; - result = prime * result + Arrays.hashCode( _rgLfo ); - result = prime * result + Arrays.hashCode( _rgLfoData ); - return result; + public int hashCode() { + return Arrays.deepHashCode(new Object[]{_lfoMac, _rgLfo, _rgLfoData}); } void writeTo( FileInformationBlock fib, ByteArrayOutputStream outputStream ) diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java b/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java index 4ea4aceb03..a87f33fea3 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java @@ -16,6 +16,8 @@ ==================================================================== */ package org.apache.poi.hwpf.model; +import java.util.Objects; + import org.apache.poi.util.BitField; import org.apache.poi.util.Internal; @@ -103,12 +105,8 @@ public final class PropertyModifier implements Cloneable } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + value; - return result; + public int hashCode() { + return Objects.hash(value); } public boolean isComplex() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java b/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java index a0e0fec6e4..a776c7aa77 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java @@ -19,6 +19,7 @@ package org.apache.poi.hwpf.model; import java.util.Arrays; import java.util.Comparator; +import java.util.Objects; import org.apache.poi.util.Internal; import org.apache.poi.util.POILogFactory; @@ -147,7 +148,7 @@ public abstract class PropertyNode> implements Compara @Override public int hashCode() { - return this._cpStart * 31 + this._buf.hashCode(); + return Objects.hash(_cpStart,_buf); } public boolean equals(Object o) { diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/SavedByEntry.java b/src/scratchpad/src/org/apache/poi/hwpf/model/SavedByEntry.java index 2e15092a9d..b6a5796a3d 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/SavedByEntry.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/SavedByEntry.java @@ -17,6 +17,8 @@ package org.apache.poi.hwpf.model; +import java.util.Objects; + import org.apache.poi.util.Internal; @@ -67,12 +69,8 @@ public final class SavedByEntry * * @return the hash code. */ - public int hashCode() - { - int hash = 29; - hash = hash * 13 + userName.hashCode(); - hash = hash * 13 + saveLocation.hashCode(); - return hash; + public int hashCode() { + return Objects.hash(userName,saveLocation); } /** diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/StdfBase.java b/src/scratchpad/src/org/apache/poi/hwpf/model/StdfBase.java index e4c18b7b4d..395d129b3a 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/StdfBase.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/StdfBase.java @@ -16,6 +16,8 @@ ==================================================================== */ package org.apache.poi.hwpf.model; +import java.util.Objects; + import org.apache.poi.hwpf.model.types.StdfBaseAbstractType; import org.apache.poi.util.Internal; @@ -59,16 +61,8 @@ class StdfBase extends StdfBaseAbstractType } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_1_info1; - result = prime * result + field_2_info2; - result = prime * result + field_3_info3; - result = prime * result + field_4_bchUpe; - result = prime * result + field_5_grfstd; - return result; + public int hashCode() { + return Objects.hash(field_1_info1, field_2_info2, field_3_info3, field_4_bchUpe, field_5_grfstd); } public byte[] serialize() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/StdfPost2000.java b/src/scratchpad/src/org/apache/poi/hwpf/model/StdfPost2000.java index 4792718199..b0eaede7a1 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/StdfPost2000.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/StdfPost2000.java @@ -16,6 +16,8 @@ ==================================================================== */ package org.apache.poi.hwpf.model; +import java.util.Objects; + import org.apache.poi.hwpf.model.types.StdfPost2000AbstractType; import org.apache.poi.util.Internal; @@ -55,15 +57,8 @@ class StdfPost2000 extends StdfPost2000AbstractType } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_1_info1; - result = prime * result - + (int) ( field_2_rsid ^ ( field_2_rsid >>> 32 ) ); - result = prime * result + field_3_info3; - return result; + public int hashCode() { + return Objects.hash(field_1_info1, field_2_rsid, field_3_info3); } public byte[] serialize() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/Stshif.java b/src/scratchpad/src/org/apache/poi/hwpf/model/Stshif.java index 448da7b3b5..bb1cced65a 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/Stshif.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/Stshif.java @@ -16,6 +16,8 @@ ==================================================================== */ package org.apache.poi.hwpf.model; +import java.util.Objects; + import org.apache.poi.hwpf.model.types.StshifAbstractType; import org.apache.poi.util.Internal; @@ -67,20 +69,9 @@ class Stshif extends StshifAbstractType } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_1_cstd; - result = prime * result + field_2_cbSTDBaseInFile; - result = prime * result + field_3_info3; - result = prime * result + field_4_stiMaxWhenSaved; - result = prime * result + field_5_istdMaxFixedWhenSaved; - result = prime * result + field_6_nVerBuiltInNamesWhenSaved; - result = prime * result + field_7_ftcAsci; - result = prime * result + field_8_ftcFE; - result = prime * result + field_9_ftcOther; - return result; + public int hashCode() { + return Objects.hash(field_1_cstd, field_2_cbSTDBaseInFile, field_3_info3, field_4_stiMaxWhenSaved, + field_5_istdMaxFixedWhenSaved, field_6_nVerBuiltInNamesWhenSaved, field_7_ftcAsci, field_8_ftcFE, field_9_ftcOther); } public byte[] serialize() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java b/src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java index f357181a7b..a1f9d9623d 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java @@ -220,13 +220,7 @@ public final class StyleDescription { @Override public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((_name == null) ? 0 : _name.hashCode()); - result = prime * result - + ((_stdfBase == null) ? 0 : _stdfBase.hashCode()); - result = prime * result + Arrays.hashCode(_upxs); - return result; + return Arrays.deepHashCode(new Object[]{_name,_stdfBase,_upxs}); } @Override diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java index 9ed1aa497a..fe79951db2 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java @@ -316,7 +316,7 @@ public class TextPieceTable implements CharIndexTranslator { @Override public int hashCode() { - return _textPieces.size(); + return _textPieces.hashCode(); } public boolean isIndexInTable(int bytePos) { diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/Xst.java b/src/scratchpad/src/org/apache/poi/hwpf/model/Xst.java index 69e30af573..3aef1dd90e 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/Xst.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/Xst.java @@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndian; *

* Documentation quoted from Page 424 of 621. [MS-DOC] -- v20110315 Word (.doc) * Binary File Format - * + * * @author Sergey Vladimirov (vlsergey {at} gmail {dot} com) */ public class Xst @@ -118,13 +118,8 @@ public class Xst } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + _cch; - result = prime * result + Arrays.hashCode( _rgtchar ); - return result; + public int hashCode() { + return Arrays.deepHashCode(new Object[]{_cch,_rgtchar}); } public void serialize( byte[] data, int startOffset ) diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/CHPAbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/CHPAbstractType.java index 92e001ae4a..ae3fe81a7e 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/types/CHPAbstractType.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/CHPAbstractType.java @@ -34,7 +34,7 @@ import org.apache.poi.util.Internal; * NOTE: This source is automatically generated please do not modify this file. Either subclass or * remove the record in src/types/definitions. *

- * This class is internal. It content or properties may change without notice + * This class is internal. It content or properties may change without notice * due to changes in our knowledge of internal Microsoft Word binary structures. * @author S. Ryan Ackley @@ -423,89 +423,20 @@ public abstract class CHPAbstractType } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_1_grpfChp; - result = prime * result + field_2_hps; - result = prime * result + field_3_ftcAscii; - result = prime * result + field_4_ftcFE; - result = prime * result + field_5_ftcOther; - result = prime * result + field_6_ftcBi; - result = prime * result + field_7_dxaSpace; - result = prime * result - + ((field_8_cv == null) ? 0 : field_8_cv.hashCode()); - result = prime * result + field_9_ico; - result = prime * result + field_10_pctCharWidth; - result = prime * result + field_11_lidDefault; - result = prime * result + field_12_lidFE; - result = prime * result + field_13_kcd; - result = prime * result + ( field_14_fUndetermine? 1231 : 1237 ); - result = prime * result + field_15_iss; - result = prime * result + ( field_16_fSpecSymbol? 1231 : 1237 ); - result = prime * result + field_17_idct; - result = prime * result + field_18_idctHint; - result = prime * result + field_19_kul; - result = prime * result - + ((field_20_hresi == null) ? 0 : field_20_hresi.hashCode()); - result = prime * result + field_21_hpsKern; - result = prime * result + field_22_hpsPos; - result = prime * result - + ((field_23_shd == null) ? 0 : field_23_shd.hashCode()); - result = prime * result - + ((field_24_brc == null) ? 0 : field_24_brc.hashCode()); - result = prime * result + field_25_ibstRMark; - result = prime * result + field_26_sfxtText; - result = prime * result + ( field_27_fDblBdr? 1231 : 1237 ); - result = prime * result + ( field_28_fBorderWS? 1231 : 1237 ); - result = prime * result + field_29_ufel; - result = prime * result + field_30_copt; - result = prime * result + field_31_hpsAsci; - result = prime * result + field_32_hpsFE; - result = prime * result + field_33_hpsBi; - result = prime * result + field_34_ftcSym; - result = prime * result + field_35_xchSym; - result = prime * result + field_36_fcPic; - result = prime * result + field_37_fcObj; - result = prime * result + field_38_lTagObj; - result = prime * result + field_39_fcData; - result = prime * result - + ((field_40_hresiOld == null) ? 0 : field_40_hresiOld.hashCode()); - result = prime * result + field_41_ibstRMarkDel; - result = prime * result - + ((field_42_dttmRMark == null) ? 0 : field_42_dttmRMark.hashCode()); - result = prime * result - + ((field_43_dttmRMarkDel == null) ? 0 : field_43_dttmRMarkDel.hashCode()); - result = prime * result + field_44_istd; - result = prime * result + field_45_idslRMReason; - result = prime * result + field_46_idslReasonDel; - result = prime * result + field_47_cpg; - result = prime * result + field_48_Highlight; - result = prime * result + field_49_CharsetFlags; - result = prime * result + field_50_chse; - result = prime * result + ( field_51_fPropRMark? 1231 : 1237 ); - result = prime * result + field_52_ibstPropRMark; - result = prime * result - + ((field_53_dttmPropRMark == null) ? 0 : field_53_dttmPropRMark.hashCode()); - result = prime * result + ( field_54_fConflictOrig? 1231 : 1237 ); - result = prime * result + ( field_55_fConflictOtherDel? 1231 : 1237 ); - result = prime * result + field_56_wConflict; - result = prime * result + field_57_IbstConflict; - result = prime * result - + ((field_58_dttmConflict == null) ? 0 : field_58_dttmConflict.hashCode()); - result = prime * result + ( field_59_fDispFldRMark? 1231 : 1237 ); - result = prime * result + field_60_ibstDispFldRMark; - result = prime * result - + ((field_61_dttmDispFldRMark == null) ? 0 : field_61_dttmDispFldRMark.hashCode()); - result = prime * result + Arrays.hashCode( field_62_xstDispFldRMark ); - result = prime * result + field_63_fcObjp; - result = prime * result + field_64_lbrCRJ; - result = prime * result + ( field_65_fSpecVanish? 1231 : 1237 ); - result = prime * result + ( field_66_fHasOldProps? 1231 : 1237 ); - result = prime * result + ( field_67_fSdtVanish? 1231 : 1237 ); - result = prime * result + field_68_wCharScale; - return result; + public int hashCode() { + return Arrays.deepHashCode(new Object[]{field_1_grpfChp, field_2_hps, field_3_ftcAscii, field_4_ftcFE, field_5_ftcOther, + field_6_ftcBi, field_7_dxaSpace, field_8_cv, field_9_ico, field_10_pctCharWidth, field_11_lidDefault, + field_12_lidFE, field_13_kcd, field_14_fUndetermine, field_15_iss, field_16_fSpecSymbol, field_17_idct, + field_18_idctHint, field_19_kul, field_20_hresi, field_21_hpsKern, field_22_hpsPos, field_23_shd, + field_24_brc, field_25_ibstRMark, field_26_sfxtText, field_27_fDblBdr, field_28_fBorderWS, field_29_ufel, + field_30_copt, field_31_hpsAsci, field_32_hpsFE, field_33_hpsBi, field_34_ftcSym, field_35_xchSym, + field_36_fcPic, field_37_fcObj, field_38_lTagObj, field_39_fcData, field_40_hresiOld, field_41_ibstRMarkDel, + field_42_dttmRMark, field_43_dttmRMarkDel, field_44_istd, field_45_idslRMReason, field_46_idslReasonDel, + field_47_cpg, field_48_Highlight, field_49_CharsetFlags, field_50_chse, field_51_fPropRMark, + field_52_ibstPropRMark, field_53_dttmPropRMark, field_54_fConflictOrig, field_55_fConflictOtherDel, + field_56_wConflict, field_57_IbstConflict, field_58_dttmConflict, field_59_fDispFldRMark, + field_60_ibstDispFldRMark, field_61_dttmDispFldRMark, field_62_xstDispFldRMark, field_63_fcObjp, + field_64_lbrCRJ, field_65_fSpecVanish, field_66_fHasOldProps, field_67_fSdtVanish, field_68_wCharScale}); } public String toString() @@ -922,7 +853,7 @@ public abstract class CHPAbstractType /** * Emphasis mark. * - * @return One of + * @return One of *

  • {@link #KCD_NON} *
  • {@link #KCD_DOT} *
  • {@link #KCD_COMMA} @@ -939,7 +870,7 @@ public abstract class CHPAbstractType * Emphasis mark. * * @param field_13_kcd - * One of + * One of *
  • {@link #KCD_NON} *
  • {@link #KCD_DOT} *
  • {@link #KCD_COMMA} @@ -973,7 +904,7 @@ public abstract class CHPAbstractType /** * Superscript/subscript indices. * - * @return One of + * @return One of *
  • {@link #ISS_NONE} *
  • {@link #ISS_SUPERSCRIPTED} *
  • {@link #ISS_SUBSCRIPTED} @@ -988,7 +919,7 @@ public abstract class CHPAbstractType * Superscript/subscript indices. * * @param field_15_iss - * One of + * One of *
  • {@link #ISS_NONE} *
  • {@link #ISS_SUPERSCRIPTED} *
  • {@link #ISS_SUBSCRIPTED} @@ -1056,7 +987,7 @@ public abstract class CHPAbstractType /** * Underline code. * - * @return One of + * @return One of *
  • {@link #KUL_NONE} *
  • {@link #KUL_SINGLE} *
  • {@link #KUL_BY_WORD} @@ -1088,7 +1019,7 @@ public abstract class CHPAbstractType * Underline code. * * @param field_19_kul - * One of + * One of *
  • {@link #KUL_NONE} *
  • {@link #KUL_SINGLE} *
  • {@link #KUL_BY_WORD} @@ -1227,7 +1158,7 @@ public abstract class CHPAbstractType /** * Text animation. * - * @return One of + * @return One of *
  • {@link #SFXTTEXT_NO} *
  • {@link #SFXTTEXT_LAS_VEGAS_LIGHTS} *
  • {@link #SFXTTEXT_BACKGROUND_BLINK} @@ -1246,7 +1177,7 @@ public abstract class CHPAbstractType * Text animation. * * @param field_26_sfxtText - * One of + * One of *
  • {@link #SFXTTEXT_NO} *
  • {@link #SFXTTEXT_LAS_VEGAS_LIGHTS} *
  • {@link #SFXTTEXT_BACKGROUND_BLINK} @@ -1930,7 +1861,7 @@ public abstract class CHPAbstractType /** * Line BReak code for xchCRJ. * - * @return One of + * @return One of *
  • {@link #LBRCRJ_NONE} *
  • {@link #LBRCRJ_LEFT} *
  • {@link #LBRCRJ_RIGHT} @@ -1946,7 +1877,7 @@ public abstract class CHPAbstractType * Line BReak code for xchCRJ. * * @param field_64_lbrCRJ - * One of + * One of *
  • {@link #LBRCRJ_NONE} *
  • {@link #LBRCRJ_LEFT} *
  • {@link #LBRCRJ_RIGHT} @@ -2692,7 +2623,7 @@ public abstract class CHPAbstractType /** * Sets the itypFELayout field value. - * + * */ @Internal public void setItypFELayout( short value ) @@ -2701,7 +2632,7 @@ public abstract class CHPAbstractType } /** - * + * * @return the itypFELayout field value. */ @Internal diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/FFDataBaseAbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/FFDataBaseAbstractType.java index 20c4106142..ff15f3e28f 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/types/FFDataBaseAbstractType.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/FFDataBaseAbstractType.java @@ -18,6 +18,8 @@ package org.apache.poi.hwpf.model.types; +import java.util.Objects; + import org.apache.poi.util.BitField; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; @@ -28,18 +30,18 @@ import org.apache.poi.util.LittleEndian; descriptions are quoted from [MS-DOC] -- v20121003 Word (.doc) Binary File Format; Copyright (c) 2012 Microsoft Corporation; Release: October 8, 2012 - + *

    * NOTE: This source is automatically generated please do not modify this file. Either subclass or * remove the record in src/types/definitions. *

    - * This class is internal. It content or properties may change without notice + * This class is internal. It content or properties may change without notice * due to changes in our knowledge of internal Microsoft Word binary structures. * @author Sergey Vladimirov; according to [MS-DOC] -- v20121003 Word (.doc) Binary File Format; Copyright (c) 2012 Microsoft Corporation; Release: October 8, 2012 - + */ @Internal public abstract class FFDataBaseAbstractType @@ -134,16 +136,8 @@ public abstract class FFDataBaseAbstractType } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result - + (int) ( field_1_version ^ ( field_1_version >>> 32 ) ); - result = prime * result + field_2_bits; - result = prime * result + field_3_cch; - result = prime * result + field_4_hps; - return result; + public int hashCode() { + return Objects.hash(field_1_version, field_2_bits, field_3_cch, field_4_hps); } public String toString() @@ -247,7 +241,7 @@ public abstract class FFDataBaseAbstractType /** * Sets the iType field value. - * An unsigned integer that specifies the type of the form field. + * An unsigned integer that specifies the type of the form field. */ @Internal public void setIType( byte value ) @@ -256,7 +250,7 @@ public abstract class FFDataBaseAbstractType } /** - * An unsigned integer that specifies the type of the form field. + * An unsigned integer that specifies the type of the form field. * @return the iType field value. */ @Internal diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/FibRgLw95AbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/FibRgLw95AbstractType.java index d1a03a6b85..45b97641d5 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/types/FibRgLw95AbstractType.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/FibRgLw95AbstractType.java @@ -18,21 +18,23 @@ package org.apache.poi.hwpf.model.types; +import java.util.Objects; + import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; /** * The FibRgLw95 structure is the third section of the FIB for Word95. - + *

    * NOTE: This source is automatically generated please do not modify this file. Either subclass or * remove the record in src/types/definitions. *

    - * This class is internal. It content or properties may change without notice + * This class is internal. It content or properties may change without notice * due to changes in our knowledge of internal Microsoft Word binary structures. * @author Sergey Vladimirov - + */ @Internal public abstract class FibRgLw95AbstractType @@ -155,25 +157,10 @@ public abstract class FibRgLw95AbstractType } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_1_cbMac; - result = prime * result + field_2_reserved1; - result = prime * result + field_3_reserved2; - result = prime * result + field_4_reserved3; - result = prime * result + field_5_reserved4; - result = prime * result + field_6_ccpText; - result = prime * result + field_7_ccpFtn; - result = prime * result + field_8_ccpHdd; - result = prime * result + field_9_ccpMcr; - result = prime * result + field_10_ccpAtn; - result = prime * result + field_11_ccpEdn; - result = prime * result + field_12_ccpTxbx; - result = prime * result + field_13_ccpHdrTxbx; - result = prime * result + field_14_reserved5; - return result; + public int hashCode() { + return Objects.hash(field_1_cbMac, field_2_reserved1, field_3_reserved2, field_4_reserved3, field_5_reserved4, + field_6_ccpText, field_7_ccpFtn, field_8_ccpHdd, field_9_ccpMcr, field_10_ccpAtn, field_11_ccpEdn, + field_12_ccpTxbx, field_13_ccpHdrTxbx, field_14_reserved5); } public String toString() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/FibRgLw97AbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/FibRgLw97AbstractType.java index f81c9bc86f..48bfcebfd6 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/types/FibRgLw97AbstractType.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/FibRgLw97AbstractType.java @@ -16,6 +16,8 @@ ==================================================================== */ package org.apache.poi.hwpf.model.types; +import java.util.Objects; + import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; @@ -23,17 +25,17 @@ import org.apache.poi.util.LittleEndian; * The FibRgLw97 structure is the third section of the FIB. This contains an array of 4-byte values.

    Class and fields descriptions are quoted from Microsoft Office Word 97-2007 Binary File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format - + *

    * NOTE: This source is automatically generated please do not modify this file. Either subclass or * remove the record in src/types/definitions. *

    - * This class is internal. It content or properties may change without notice + * This class is internal. It content or properties may change without notice * due to changes in our knowledge of internal Microsoft Word binary structures. * @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary File Format Specification [*.doc] and [MS-DOC] - v20110608 Word (.doc) Binary File Format - + */ @Internal public abstract class FibRgLw97AbstractType @@ -205,33 +207,12 @@ public abstract class FibRgLw97AbstractType } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_1_cbMac; - result = prime * result + field_2_reserved1; - result = prime * result + field_3_reserved2; - result = prime * result + field_4_ccpText; - result = prime * result + field_5_ccpFtn; - result = prime * result + field_6_ccpHdd; - result = prime * result + field_7_reserved3; - result = prime * result + field_8_ccpAtn; - result = prime * result + field_9_ccpEdn; - result = prime * result + field_10_ccpTxbx; - result = prime * result + field_11_ccpHdrTxbx; - result = prime * result + field_12_reserved4; - result = prime * result + field_13_reserved5; - result = prime * result + field_14_reserved6; - result = prime * result + field_15_reserved7; - result = prime * result + field_16_reserved8; - result = prime * result + field_17_reserved9; - result = prime * result + field_18_reserved10; - result = prime * result + field_19_reserved11; - result = prime * result + field_20_reserved12; - result = prime * result + field_21_reserved13; - result = prime * result + field_22_reserved14; - return result; + public int hashCode() { + return Objects.hash(field_1_cbMac, field_2_reserved1, field_3_reserved2, field_4_ccpText, field_5_ccpFtn, + field_6_ccpHdd, field_7_reserved3, field_8_ccpAtn, field_9_ccpEdn, field_10_ccpTxbx, field_11_ccpHdrTxbx, + field_12_reserved4, field_13_reserved5, field_14_reserved6, field_15_reserved7, field_16_reserved8, + field_17_reserved9, field_18_reserved10, field_19_reserved11, field_20_reserved12, field_21_reserved13, + field_22_reserved14); } public String toString() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/GrfhicAbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/GrfhicAbstractType.java index 8aace00d85..a6433f8597 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/types/GrfhicAbstractType.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/GrfhicAbstractType.java @@ -18,6 +18,8 @@ package org.apache.poi.hwpf.model.types; +import java.util.Objects; + import org.apache.poi.util.BitField; import org.apache.poi.util.Internal; @@ -27,17 +29,17 @@ import org.apache.poi.util.Internal; an LVL or LVLF and HTML lists. The values do not define list properties.

    Class and fields descriptions are quoted from [MS-DOC] -- v20110315 Word (.doc) Binary File Format specification - + *

    * NOTE: This source is automatically generated please do not modify this file. Either subclass or * remove the record in src/types/definitions. *

    - * This class is internal. It content or properties may change without notice + * This class is internal. It content or properties may change without notice * due to changes in our knowledge of internal Microsoft Word binary structures. * @author Sergey Vladimirov; according to [MS-DOC] -- v20110315 Word (.doc) Binary File Format specification - + */ @Internal public abstract class GrfhicAbstractType @@ -98,12 +100,8 @@ public abstract class GrfhicAbstractType } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_1_grfhic; - return result; + public int hashCode() { + return Objects.hash(field_1_grfhic); } public String toString() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/LFOAbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/LFOAbstractType.java index 879bfe0bea..7f37e95a27 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/types/LFOAbstractType.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/LFOAbstractType.java @@ -16,6 +16,8 @@ ==================================================================== */ package org.apache.poi.hwpf.model.types; +import java.util.Objects; + import org.apache.poi.hwpf.model.Grfhic; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; @@ -23,17 +25,17 @@ import org.apache.poi.util.LittleEndian; /** * List Format Override (LFO).

    Class and fields descriptions are quoted from [MS-DOC] --v20110315; Word (.doc) Binary File Format - + *

    * NOTE: This source is automatically generated please do not modify this file. Either subclass or * remove the record in src/types/definitions. *

    - * This class is internal. It content or properties may change without notice + * This class is internal. It content or properties may change without notice * due to changes in our knowledge of internal Microsoft Word binary structures. * @author Sergey Vladimirov; according to [MS-DOC] --v20110315; Word (.doc) Binary File Format; Copyright (c) Microsoft Corporation - + */ @Internal public abstract class LFOAbstractType @@ -122,19 +124,9 @@ public abstract class LFOAbstractType } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_1_lsid; - result = prime * result + field_2_unused1; - result = prime * result + field_3_unused2; - result = prime * result + field_4_clfolvl; - result = prime * result + field_5_ibstFltAutoNum; - result = prime * result - + ((field_6_grfhic == null) ? 0 : field_6_grfhic.hashCode()); - result = prime * result + field_7_unused3; - return result; + public int hashCode() { + return Objects.hash(field_1_lsid, field_2_unused1, field_3_unused2, field_4_clfolvl, field_5_ibstFltAutoNum, + field_6_grfhic, field_7_unused3); } public String toString() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/LFOLVLBaseAbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/LFOLVLBaseAbstractType.java index 6826b3d055..81bc72a117 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/types/LFOLVLBaseAbstractType.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/LFOLVLBaseAbstractType.java @@ -16,6 +16,8 @@ ==================================================================== */ package org.apache.poi.hwpf.model.types; +import java.util.Objects; + import org.apache.poi.util.BitField; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; @@ -25,17 +27,17 @@ import org.apache.poi.util.LittleEndian; information of a corresponding LVL.

    Class and fields descriptions are quoted from Microsoft Office Word 97-2007 Binary File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format - + *

    * NOTE: This source is automatically generated please do not modify this file. Either subclass or * remove the record in src/types/definitions. *

    - * This class is internal. It content or properties may change without notice + * This class is internal. It content or properties may change without notice * due to changes in our knowledge of internal Microsoft Word binary structures. * @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary File Format Specification [*.doc] and [MS-DOC] - v20110608 Word (.doc) Binary File Format - + */ @Internal public abstract class LFOLVLBaseAbstractType @@ -99,13 +101,8 @@ public abstract class LFOLVLBaseAbstractType } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_1_iStartAt; - result = prime * result + field_2_flags; - return result; + public int hashCode() { + return Objects.hash(field_1_iStartAt,field_2_flags); } public String toString() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/LSTFAbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/LSTFAbstractType.java index 8500073c3c..2565e1e306 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/types/LSTFAbstractType.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/LSTFAbstractType.java @@ -27,17 +27,17 @@ import org.apache.poi.util.LittleEndian; * The LSTF structure contains formatting properties that apply to an entire list.

    Class and fields descriptions are quoted from Microsoft Office Word 97-2007 Binary File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format - + *

    * NOTE: This source is automatically generated please do not modify this file. Either subclass or * remove the record in src/types/definitions. *

    - * This class is internal. It content or properties may change without notice + * This class is internal. It content or properties may change without notice * due to changes in our knowledge of internal Microsoft Word binary structures. * @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary File Format Specification [*.doc] and [MS-DOC] - v20110608 Word (.doc) Binary File Format - + */ @Internal public abstract class LSTFAbstractType @@ -123,16 +123,8 @@ public abstract class LSTFAbstractType } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_1_lsid; - result = prime * result + field_2_tplc; - result = prime * result + Arrays.hashCode( field_3_rgistdPara ); - result = prime * result + field_4_flags; - result = prime * result + field_5_grfhic.hashCode(); - return result; + public int hashCode() { + return Arrays.deepHashCode(new Object[]{field_1_lsid, field_2_tplc, field_3_rgistdPara, field_4_flags, field_5_grfhic}); } public String toString() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/LVLFAbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/LVLFAbstractType.java index 785854313a..e101fe9e2e 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/types/LVLFAbstractType.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/LVLFAbstractType.java @@ -28,17 +28,17 @@ import org.apache.poi.util.LittleEndian; * The LVLF structure contains formatting properties for an individual level in a list.

    Class and fields descriptions are quoted from Microsoft Office Word 97-2007 Binary File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format - + *

    * NOTE: This source is automatically generated please do not modify this file. Either subclass or * remove the record in src/types/definitions. *

    - * This class is internal. It content or properties may change without notice + * This class is internal. It content or properties may change without notice * due to changes in our knowledge of internal Microsoft Word binary structures. * @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary File Format Specification [*.doc] and [MS-DOC] - v20110608 Word (.doc) Binary File Format - + */ @Internal public abstract class LVLFAbstractType @@ -155,22 +155,10 @@ public abstract class LVLFAbstractType } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_1_iStartAt; - result = prime * result + field_2_nfc; - result = prime * result + field_3_info; - result = prime * result + Arrays.hashCode( field_4_rgbxchNums ); - result = prime * result + field_5_ixchFollow; - result = prime * result + field_6_dxaIndentSav; - result = prime * result + field_7_unused2; - result = prime * result + field_8_cbGrpprlChpx; - result = prime * result + field_9_cbGrpprlPapx; - result = prime * result + field_10_ilvlRestartLim; - result = prime * result + field_11_grfhic.hashCode(); - return result; + public int hashCode() { + return Arrays.deepHashCode(new Object[]{field_1_iStartAt, field_2_nfc, field_3_info, field_4_rgbxchNums, + field_5_ixchFollow, field_6_dxaIndentSav, field_7_unused2, field_8_cbGrpprlChpx, field_9_cbGrpprlPapx, + field_10_ilvlRestartLim, field_11_grfhic}); } public String toString() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHD80AbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHD80AbstractType.java index 1a617073d0..9c5f28d164 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHD80AbstractType.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHD80AbstractType.java @@ -17,6 +17,8 @@ package org.apache.poi.hwpf.model.types; +import java.util.Objects; + import org.apache.poi.util.BitField; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; @@ -26,16 +28,16 @@ import org.apache.poi.util.LittleEndian; shading. As an exception to the constraints that are specified by Ico and Ipat, a Shd80 can be set to Shd80Nil and specifies that no shading is applied.

    Class and fields descriptions are quoted from Word (.doc) Binary File Format by Microsoft Corporation - + *

    * NOTE: This source is automatically generated please do not modify this file. Either subclass or * remove the record in src/types/definitions. *

    - * This class is internal. It content or properties may change without notice + * This class is internal. It content or properties may change without notice * due to changes in our knowledge of internal Microsoft Word binary structures. * @author Sergey Vladimirov; according to Word (.doc) Binary File Format by Microsoft Corporation. - + */ @Internal public abstract class SHD80AbstractType @@ -91,12 +93,8 @@ public abstract class SHD80AbstractType } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_1_value; - return result; + public int hashCode() { + return Objects.hash(field_1_value); } public String toString() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHDAbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHDAbstractType.java index 13603ae7b2..4865f676f6 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHDAbstractType.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHDAbstractType.java @@ -18,6 +18,8 @@ package org.apache.poi.hwpf.model.types; +import java.util.Objects; + import org.apache.poi.hwpf.model.Colorref; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; @@ -26,16 +28,16 @@ import org.apache.poi.util.LittleEndian; * The Shd structure specifies the colors and pattern that are used for background shading.

    Class and fields descriptions are quoted from Word (.doc) Binary File Format by Microsoft Corporation - + *

    * NOTE: This source is automatically generated please do not modify this file. Either subclass or * remove the record in src/types/definitions. *

    - * This class is internal. It content or properties may change without notice + * This class is internal. It content or properties may change without notice * due to changes in our knowledge of internal Microsoft Word binary structures. * @author Sergey Vladimirov; according to Word (.doc) Binary File Format by Microsoft Corporation. - + */ @Internal public abstract class SHDAbstractType @@ -100,14 +102,8 @@ public abstract class SHDAbstractType } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_1_cvFore.hashCode(); - result = prime * result + field_2_cvBack.hashCode(); - result = prime * result + field_3_ipat; - return result; + public int hashCode() { + return Objects.hash(field_1_cvFore,field_2_cvBack,field_3_ipat); } public String toString() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BookmarksImpl.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BookmarksImpl.java index 24a7c8ff8d..9c0652f378 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BookmarksImpl.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BookmarksImpl.java @@ -24,6 +24,7 @@ import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Objects; import org.apache.poi.hwpf.model.BookmarksTables; import org.apache.poi.hwpf.model.GenericPropertyNode; @@ -31,7 +32,7 @@ import org.apache.poi.hwpf.model.PropertyNode; /** * Implementation of user-friendly interface for document bookmarks - * + * * @author Sergey Vladimirov (vlsergey {at} gmail {doc} com) */ public class BookmarksImpl implements Bookmarks @@ -100,9 +101,8 @@ public class BookmarksImpl implements Bookmarks } @Override - public int hashCode() - { - return 31 + ( first == null ? 0 : first.hashCode() ); + public int hashCode() { + return Objects.hash(first); } public void setName( String name ) diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DropCapSpecifier.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DropCapSpecifier.java index 5ba4e0728e..a735435388 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DropCapSpecifier.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DropCapSpecifier.java @@ -25,7 +25,7 @@ import org.apache.poi.util.LittleEndian; * This data structure is used by a paragraph to determine how it should drop * its first letter. I think its the visual effect that will show a giant first * letter to a paragraph. I've seen this used in the first paragraph of a book - * + * * @author Ryan Ackley */ public final class DropCapSpecifier implements Cloneable @@ -81,8 +81,7 @@ public final class DropCapSpecifier implements Cloneable } @Override - public int hashCode() - { + public int hashCode() { return _fdct; } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableAutoformatLookSpecifier.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableAutoformatLookSpecifier.java index fbe68d4eac..d99c2ac53f 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableAutoformatLookSpecifier.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableAutoformatLookSpecifier.java @@ -16,6 +16,8 @@ ==================================================================== */ package org.apache.poi.hwpf.usermodel; +import java.util.Objects; + import org.apache.poi.hwpf.model.types.TLPAbstractType; public class TableAutoformatLookSpecifier extends TLPAbstractType implements @@ -65,13 +67,8 @@ public class TableAutoformatLookSpecifier extends TLPAbstractType implements } @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + field_1_itl; - result = prime * result + field_2_tlp_flags; - return result; + public int hashCode() { + return Objects.hash(field_1_itl,field_2_tlp_flags); } public boolean isEmpty() -- 2.39.5