From fcf4a2274f179176eb603942e614a83af5d2586a Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Tue, 19 Oct 2010 21:01:54 +0000 Subject: [PATCH] Fix more HSLF generics warnings git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1024411 13f79535-47bb-0310-9956-ffa450edef68 --- .../textproperties/TextPropCollection.java | 14 +++--- .../poi/hslf/record/StyleTextPropAtom.java | 46 ++++++++----------- .../apache/poi/hslf/usermodel/SoundData.java | 4 +- 3 files changed, 28 insertions(+), 36 deletions(-) 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 f90179b9cc..c538f01a54 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 @@ -33,7 +33,7 @@ import org.apache.poi.util.LittleEndian; public class TextPropCollection { private int charactersCovered; private short reservedField; - private LinkedList textPropList; + private LinkedList textPropList; private int maskSpecial = 0; public int getSpecialMask() { return maskSpecial; } @@ -41,12 +41,12 @@ public class TextPropCollection { /** Fetch the number of characters this styling applies to */ public int getCharactersCovered() { return charactersCovered; } /** Fetch the TextProps that define this styling */ - public LinkedList getTextPropList() { return textPropList; } + public LinkedList getTextPropList() { return textPropList; } /** Fetch the TextProp with this name, or null if it isn't present */ public TextProp findByName(String textPropName) { for(int i=0; i curProp.getMask()) { pos++; } @@ -137,7 +137,7 @@ public class TextPropCollection { public TextPropCollection(int charactersCovered, short reservedField) { this.charactersCovered = charactersCovered; this.reservedField = reservedField; - textPropList = new LinkedList(); + textPropList = new LinkedList(); } /** @@ -147,7 +147,7 @@ public class TextPropCollection { public TextPropCollection(int textSize) { charactersCovered = textSize; reservedField = -1; - textPropList = new LinkedList(); + textPropList = new LinkedList(); } /** @@ -187,7 +187,7 @@ public class TextPropCollection { // Then the contents of all the properties for(int i=0; i paragraphStyles; + public LinkedList getParagraphStyles() { return paragraphStyles; } /** * Updates the link list of TextPropCollections which make up the * paragraph stylings */ - public void setParagraphStyles(LinkedList ps) { paragraphStyles = ps; } + public void setParagraphStyles(LinkedList ps) { paragraphStyles = ps; } /** * The list of all the different character stylings we code for. * Each entry is a TextPropCollection, which tells you how many * Characters the character styling covers, and also contains the * TextProps that actually define the styling of the characters. */ - private LinkedList charStyles; - public LinkedList getCharacterStyles() { return charStyles; } + private LinkedList charStyles; + public LinkedList getCharacterStyles() { return charStyles; } /** * Updates the link list of TextPropCollections which make up the * character stylings */ - public void setCharacterStyles(LinkedList cs) { charStyles = cs; } + public void setCharacterStyles(LinkedList cs) { charStyles = cs; } /** * Returns how many characters the paragraph's @@ -110,12 +109,9 @@ public final class StyleTextPropAtom extends RecordAtom public int getCharacterTextLengthCovered() { return getCharactersCovered(charStyles); } - private int getCharactersCovered(LinkedList styles) { + private int getCharactersCovered(LinkedList styles) { int length = 0; - Iterator it = styles.iterator(); - while(it.hasNext()) { - TextPropCollection tpc = - (TextPropCollection)it.next(); + for(TextPropCollection tpc : styles) { length += tpc.getCharactersCovered(); } return length; @@ -199,8 +195,8 @@ public final class StyleTextPropAtom extends RecordAtom reserved = new byte[0]; // Set empty linked lists, ready for when they call setParentTextSize - paragraphStyles = new LinkedList(); - charStyles = new LinkedList(); + paragraphStyles = new LinkedList(); + charStyles = new LinkedList(); } @@ -218,8 +214,8 @@ public final class StyleTextPropAtom extends RecordAtom LittleEndian.putInt(_header,4,10); // Set empty paragraph and character styles - paragraphStyles = new LinkedList(); - charStyles = new LinkedList(); + paragraphStyles = new LinkedList(); + charStyles = new LinkedList(); TextPropCollection defaultParagraphTextProps = new TextPropCollection(parentTextSize, (short)0); @@ -366,13 +362,13 @@ public final class StyleTextPropAtom extends RecordAtom // First up, we need to serialise the paragraph properties for(int i=0; i lst = new ArrayList(); Record[] ch = document.getChildRecords(); for (int i = 0; i < ch.length; i++) { if(ch[i].getRecordType() == RecordTypes.SoundCollection.typeID){ @@ -89,6 +89,6 @@ public final class SoundData { } } - return (SoundData[])lst.toArray(new SoundData[lst.size()]); + return lst.toArray(new SoundData[lst.size()]); } } -- 2.39.5