diff options
author | PJ Fanning <fanningpj@apache.org> | 2020-12-06 14:10:44 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2020-12-06 14:10:44 +0000 |
commit | 10652e33feb2ee164437ae265f98d8443a94aa19 (patch) | |
tree | 376676b36f73823133fcba5d724f763c79accfed /src/java | |
parent | 92e8e798226a5e2b54a9d52d6d6924068fb5a008 (diff) | |
download | poi-10652e33feb2ee164437ae265f98d8443a94aa19.tar.gz poi-10652e33feb2ee164437ae265f98d8443a94aa19.zip |
tidy up code in FontGroupRange
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1884152 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/org/apache/poi/common/usermodel/fonts/FontGroup.java | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/java/org/apache/poi/common/usermodel/fonts/FontGroup.java b/src/java/org/apache/poi/common/usermodel/fonts/FontGroup.java index 1cfdc3aeca..78065fbffe 100644 --- a/src/java/org/apache/poi/common/usermodel/fonts/FontGroup.java +++ b/src/java/org/apache/poi/common/usermodel/fonts/FontGroup.java @@ -17,6 +17,8 @@ limitations under the License. package org.apache.poi.common.usermodel.fonts; +import org.apache.poi.util.Removal; + import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -44,19 +46,29 @@ public enum FontGroup { public static class FontGroupRange { - private int len; - private FontGroup fontGroup; + private final FontGroup fontGroup; + private int len = 0; + + FontGroupRange(FontGroup fontGroup) { + this.fontGroup = fontGroup; + } + public int getLength() { return len; } + public FontGroup getFontGroup( ) { return fontGroup; } + + void increaseLength(int len) { + this.len += len; + } } private static class Range { - int upper; - FontGroup fontGroup; + final int upper; + final FontGroup fontGroup; Range(int upper, FontGroup fontGroup) { this.upper = upper; this.fontGroup = fontGroup; @@ -130,11 +142,10 @@ public enum FontGroup { } if (ttrLast == null || ttrLast.fontGroup != tt) { - ttrLast = new FontGroupRange(); - ttrLast.fontGroup = tt; + ttrLast = new FontGroupRange(tt); ttrList.add(ttrLast); } - ttrLast.len += charCount; + ttrLast.increaseLength(charCount); } return ttrList; } |