foray-commit Mailing List for FOray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(139) |
Apr
(98) |
May
(250) |
Jun
(394) |
Jul
(84) |
Aug
(13) |
Sep
(420) |
Oct
(186) |
Nov
(1) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(108) |
Feb
(202) |
Mar
(291) |
Apr
(247) |
May
(374) |
Jun
(227) |
Jul
(231) |
Aug
(60) |
Sep
(31) |
Oct
(45) |
Nov
(18) |
Dec
|
| 2008 |
Jan
(38) |
Feb
(71) |
Mar
(142) |
Apr
|
May
(59) |
Jun
(6) |
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
(12) |
Feb
(4) |
Mar
(88) |
Apr
(121) |
May
(17) |
Jun
(30) |
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2010 |
Jan
(11) |
Feb
(76) |
Mar
(11) |
Apr
|
May
(11) |
Jun
|
Jul
|
Aug
(44) |
Sep
(14) |
Oct
(7) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(168) |
| 2017 |
Jan
(77) |
Feb
(11) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(88) |
Mar
(118) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(141) |
| 2021 |
Jan
(170) |
Feb
(20) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(62) |
Nov
(189) |
Dec
(162) |
| 2022 |
Jan
(201) |
Feb
(118) |
Mar
(8) |
Apr
|
May
(2) |
Jun
(47) |
Jul
(19) |
Aug
(14) |
Sep
(3) |
Oct
|
Nov
(28) |
Dec
(235) |
| 2023 |
Jan
(112) |
Feb
(23) |
Mar
(2) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
(70) |
Sep
(92) |
Oct
(20) |
Nov
(1) |
Dec
(1) |
| 2024 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
(14) |
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(10) |
Feb
(29) |
Mar
|
Apr
(162) |
May
(245) |
Jun
(83) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
1
(5) |
|
2
|
3
|
4
|
5
|
6
|
7
(1) |
8
(25) |
|
9
|
10
|
11
|
12
|
13
|
14
|
15
(7) |
|
16
|
17
(1) |
18
(8) |
19
(9) |
20
|
21
|
22
(7) |
|
23
(21) |
24
|
25
|
26
|
27
|
28
|
29
|
|
30
|
31
|
|
|
|
|
|
|
From: <vic...@us...> - 2006-07-23 23:52:26
|
Revision: 7832 Author: victormote Date: 2006-07-23 16:52:22 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7832&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/scripts/checkstyle-config.xml Modified: trunk/foray/scripts/checkstyle-config.xml =================================================================== --- trunk/foray/scripts/checkstyle-config.xml 2006-07-23 23:50:24 UTC (rev 7831) +++ trunk/foray/scripts/checkstyle-config.xml 2006-07-23 23:52:22 UTC (rev 7832) @@ -41,5 +41,8 @@ <module name="TabCharacter"> <property name="severity" value="error"/> </module> + <module name="FinalLocalVariable"> + <property name="tokens" value="VARIABLE_DEF,PARAMETER_DEF"/> + </module> </module> </module> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-23 23:50:33
|
Revision: 7831 Author: victormote Date: 2006-07-23 16:50:24 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7831&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-text/src/java/org/foray/text/TextServer.java trunk/foray/foray-text/src/java/org/foray/text/line/EagerLineBreaker.java trunk/foray/foray-text/src/java/org/foray/text/line/LineBreaker.java trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java Modified: trunk/foray/foray-text/src/java/org/foray/text/TextServer.java =================================================================== --- trunk/foray/foray-text/src/java/org/foray/text/TextServer.java 2006-07-23 23:42:47 UTC (rev 7830) +++ trunk/foray/foray-text/src/java/org/foray/text/TextServer.java 2006-07-23 23:50:24 UTC (rev 7831) @@ -51,7 +51,8 @@ * @param logger The logger instance that should be used to log * user messages. */ - public TextServer(Log logger, HyphenationServer hyphenationServer) { + public TextServer(final Log logger, + final HyphenationServer hyphenationServer) { this.logger = logger; this.hyphenationServer = hyphenationServer; } @@ -67,8 +68,9 @@ /** * {@inheritDoc} */ - public EagerLineBreaker provideEagerLineBreaker(LineBreakControl control, - LineBreakHandler handler, FontConsumer fontConsumer) { + public EagerLineBreaker provideEagerLineBreaker( + final LineBreakControl control, final LineBreakHandler handler, + final FontConsumer fontConsumer) { return new SolitaryLineBreaker(this, control, handler, fontConsumer); } @@ -76,8 +78,8 @@ * {@inheritDoc} */ public PatientLineBreaker providePatientLineBreaker( - LineBreakControl control, LineBreakHandler handler, - FontConsumer fontConsumer) { + final LineBreakControl control, final LineBreakHandler handler, + final FontConsumer fontConsumer) { /* We don't have access to any yet. */ return null; } Modified: trunk/foray/foray-text/src/java/org/foray/text/line/EagerLineBreaker.java =================================================================== --- trunk/foray/foray-text/src/java/org/foray/text/line/EagerLineBreaker.java 2006-07-23 23:42:47 UTC (rev 7830) +++ trunk/foray/foray-text/src/java/org/foray/text/line/EagerLineBreaker.java 2006-07-23 23:50:24 UTC (rev 7831) @@ -47,20 +47,21 @@ * Constructor. * @param control */ - public EagerLineBreaker(TextServer server, LineBreakControl control, - LineBreakHandler handler, FontConsumer fontConsumer) { + public EagerLineBreaker(final TextServer server, + final LineBreakControl control, + final LineBreakHandler handler, final FontConsumer fontConsumer) { super(server, control, handler, fontConsumer); } /** * @throws TextException */ - protected int processInput(LineContent lineContent, int start, int end) - throws TextException { + protected int processInput(final LineContent lineContent, final int start, + final int end) throws TextException { int status = 0; if (lineContent instanceof LineText) { - LineText lineText = (LineText) lineContent; - char[] text = lineText.inlineText(); + final LineText lineText = (LineText) lineContent; + final char[] text = lineText.inlineText(); if (text.length < 1) { return -1; } @@ -70,7 +71,7 @@ int subsetStart = start; this.inLowerCase = isLowerCase(text[start]); for (int i = start; i < end; i++) { - char c = text[i]; + final char c = text[i]; boolean shouldSwitch = false; if (isLowerCase(c) && ! inLowerCase) { shouldSwitch = true; @@ -108,10 +109,10 @@ * if there is not enough room on the line for it. * @throws TextException */ - protected int processLineNonText(LineNonText nonTextItem) + protected int processLineNonText(final LineNonText nonTextItem) throws TextException { - int lineLength = getCurrentLine().capacityTotal(); - int itemSize = nonTextItem.inlineSizeOptimum(lineLength); + final int lineLength = getCurrentLine().capacityTotal(); + final int itemSize = nonTextItem.inlineSizeOptimum(lineLength); if (itemSize > currentLineWidthRemaining()) { // It doesn't fit on the current line. if (getCurrentLine().capacityUsed() == 0) { @@ -138,8 +139,8 @@ - getCurrentLine().capacityUsed(); } - public int addLineContent(LineContent content, int start, int end, - LineOutput output) throws TextException { + public int addLineContent(final LineContent content, final int start, + final int end, final LineOutput output) throws TextException { this.currentOutput = output; return processInput(content, start, end); } Modified: trunk/foray/foray-text/src/java/org/foray/text/line/LineBreaker.java =================================================================== --- trunk/foray/foray-text/src/java/org/foray/text/line/LineBreaker.java 2006-07-23 23:42:47 UTC (rev 7830) +++ trunk/foray/foray-text/src/java/org/foray/text/line/LineBreaker.java 2006-07-23 23:50:24 UTC (rev 7831) @@ -105,8 +105,9 @@ */ protected boolean inLowerCase = false; - protected LineBreaker(TextServer server, LineBreakControl control, - LineBreakHandler handler, FontConsumer fontConsumer) { + protected LineBreaker(final TextServer server, + final LineBreakControl control, + final LineBreakHandler handler, final FontConsumer fontConsumer) { this.server = server; this.control = control; this.handler = handler; @@ -122,7 +123,8 @@ * @param contentItem The LineContent implementation that should be laid * out. */ - public void addLineContent(LineContent contentItem) throws TextException { + public void addLineContent(final LineContent contentItem) + throws TextException { if (eagerMode) { throw new TextException("Line-Breaking running in \"eager\" mode" + "can't switch to \"patient\"."); @@ -147,8 +149,9 @@ * its text (char []) to the first character that was <em>not</em> * successfully added to the line. */ - public int processLineContent(LineContent contentItem, int start, int end, - LineOutput output) throws TextException { + public int processLineContent(final LineContent contentItem, + final int start, final int end, final LineOutput output) + throws TextException { validateEagerContent(contentItem, output); content.add(contentItem); this.currentOutput = output; @@ -161,8 +164,8 @@ * @param output * @throws TextException */ - private void validateEagerContent(LineContent contentItem, - LineOutput output) throws TextException { + private void validateEagerContent(final LineContent contentItem, + final LineOutput output) throws TextException { if (patientMode) { throw new TextException("Line-Breaking running in \"patient\" mode" + "can't switch to \"eager\"."); @@ -179,9 +182,9 @@ protected abstract int addLineContent(LineContent contentItem, int start, int end, LineOutput output) throws TextException; - public int getCharWidth(LineText lineText, int codePoint) { - FontUse fontUse = lineText.inlinePrimaryFont(); - Font font = fontUse.getFont(); + public int getCharWidth(final LineText lineText, int codePoint) { + final FontUse fontUse = lineText.inlinePrimaryFont(); + final Font font = fontUse.getFont(); int fontSize = lineText.inlineFontSize(); if (lineText.inlineIsFauxSmallCaps() && isLowerCase(codePoint)) { @@ -193,11 +196,11 @@ + lineText.inlineLetterSpacingOptimum(); } - public boolean isLowerCase(int codePoint) { + public boolean isLowerCase(final int codePoint) { if (codePoint > Character.MAX_VALUE) { return false; } - char c = (char) codePoint; + final char c = (char) codePoint; if (java.lang.Character.isLetter(c) && java.lang.Character.isLowerCase(c)) { return true; @@ -205,8 +208,8 @@ return false; } - public int getHyphenWidth(LineText lineText) { - char hyphenChar = lineText.inlineHyphenationCharacter(); + public int getHyphenWidth(final LineText lineText) { + final char hyphenChar = lineText.inlineHyphenationCharacter(); return getCharWidth(lineText, hyphenChar); } @@ -215,7 +218,7 @@ * space with normal behaviour. Normal behaviour means that * it's not non-breaking */ - public static boolean isSpace(int codePoint) { + public static boolean isSpace(final int codePoint) { if (codePoint == ' ' || codePoint == '\u2000' // en quad || codePoint == '\u2001' // em quad @@ -238,7 +241,7 @@ * Method to determine if the character is a nonbreaking * space. */ - public static boolean isNonBreakingSpace(int codePoint) { + public static boolean isNonBreakingSpace(final int codePoint) { if (codePoint == '\u00A0' || codePoint == '\u202F' // narrow no-break space || codePoint == '\u3000' // ideographic space @@ -253,7 +256,7 @@ * @param codePoint The character to be tested. * @return True iff this character forces a line break. */ - public static boolean forcesLineBreak(int codePoint) { + public static boolean forcesLineBreak(final int codePoint) { if (codePoint == '\u2028' // Unicode line separator || codePoint == '\n') { // linefeed return true; @@ -266,7 +269,7 @@ * @param codePoint The character to be tested. * @return True iff this character allows (but does not force) a line break. */ - public static boolean allowsLineBreak(int codePoint) { + public static boolean allowsLineBreak(final int codePoint) { if (isWhitespace(codePoint)) { return true; } @@ -277,7 +280,7 @@ return false; } - public static boolean isWhitespace(int codePoint) { + public static boolean isWhitespace(final int codePoint) { if (isSpace(codePoint) || (codePoint == '\n') || (codePoint == '\r') @@ -288,7 +291,7 @@ return false; } - public static boolean isZeroWidthSpace(int codePoint) { + public static boolean isZeroWidthSpace(final int codePoint) { if ((codePoint == '\u200B') || codePoint == '\uFEFF') { return true; @@ -296,8 +299,8 @@ return false; } - protected int charWidth(LineText lineText, int codePoint, - int whitespaceWidth) { + protected int charWidth(final LineText lineText, final int codePoint, + final int whitespaceWidth) { if (isZeroWidthSpace(codePoint)) { return getCharWidth(lineText, codePoint); } @@ -329,11 +332,11 @@ * based on the current language property. * @return true if legal to break word in the middle */ - public static boolean canBreakMidWord(String language) { + public static boolean canBreakMidWord(final String language) { if (language == null) { return false; } - String lang = language.toLowerCase(); + final String lang = language.toLowerCase(); if (lang.equals("zh")) { // Chinese?? return true; } @@ -349,7 +352,7 @@ return false; } - public void setCurrentLine(LineOutput line) { + public void setCurrentLine(final LineOutput line) { this.currentOutput = line; } @@ -381,8 +384,8 @@ return; } // Make a new array. - int newSize = this.outputLines.length + 20; - LineOutput[] newArray = new LineOutput[newSize]; + final int newSize = this.outputLines.length + 20; + final LineOutput[] newArray = new LineOutput[newSize]; // Copy the old to the new. System.arraycopy(this.outputLines, 0, newArray, 0, this.outputLines.length); @@ -399,9 +402,9 @@ return this.server; } - public int getWordWidth(LineText lineText, CharSequence word) { - FontUse fontUse = lineText.inlinePrimaryFont(); - Font font = fontUse.getFont(); + public int getWordWidth(final LineText lineText, final CharSequence word) { + final FontUse fontUse = lineText.inlinePrimaryFont(); + final Font font = fontUse.getFont(); fontUse.registerCharsUsed(word); return font.width(word, lineText.inlineFontSize(), Modified: trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java =================================================================== --- trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2006-07-23 23:42:47 UTC (rev 7830) +++ trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2006-07-23 23:50:24 UTC (rev 7831) @@ -98,16 +98,17 @@ * Constructor. * @param control */ - public SolitaryLineBreaker(TextServer server, LineBreakControl control, - LineBreakHandler handler, FontConsumer fontConsumer) { + public SolitaryLineBreaker(final TextServer server, + final LineBreakControl control, + final LineBreakHandler handler, final FontConsumer fontConsumer) { super(server, control, handler, fontConsumer); } - protected int processLineText(LineText lineText, int start, int end) - throws TextException { + protected int processLineText(final LineText lineText, final int start, + final int end) throws TextException { this.currentLineText = lineText; this.currentChars = currentLineText.inlineText(); - String language = lineText.inlineLanguage(); + final String language = lineText.inlineLanguage(); finalWidth = 0; wordWidth = 0; @@ -118,7 +119,7 @@ } else { canEatLeadingSpaces = true; } - int whitespaceWidth = getCharWidth(lineText, ' '); + final int whitespaceWidth = getCharWidth(lineText, ' '); // Bound start and end by the limits of the array. int startIndex = start; @@ -133,9 +134,10 @@ /* iterate over each character */ for (int i = startIndex; i <= endIndex; i++) { /* get the character */ - char c = this.currentChars[i]; - int thisCharStarts = i; - int codePoint = StringUtilPre5.codePointAt(this.currentChars, i); + final char c = this.currentChars[i]; + final int thisCharStarts = i; + final int codePoint = StringUtilPre5.codePointAt(this.currentChars, + i); int charCount = 1; if (StringUtilPre5.isHighSurrogate(c)) { i++; @@ -152,7 +154,8 @@ // If it got this far, it is TEXT. canEatLeadingSpaces = false; - int charWidth = charWidth(lineText, codePoint, whitespaceWidth); + final int charWidth = charWidth(lineText, codePoint, + whitespaceWidth); processTextChar(language, thisCharStarts, charWidth); if ((finalWidth + spaceWidth + wordWidth) @@ -166,7 +169,7 @@ continue; } if (lineText.inlineHyphenate()) { - int ret = tryHyphenation(); + final int ret = tryHyphenation(); if (ret != wordStart) { finalWidth += spaceWidth; finalWidth += wordWidth; @@ -219,15 +222,16 @@ * it is one past endIndex, indicating that all has been laid out. * @throws TextException */ - private int remainingContentOnThisLine(int startIndex, int endIndex) - throws TextException { + private int remainingContentOnThisLine(final int startIndex, + final int endIndex) throws TextException { finalWidth += spaceWidth; finalWidth += wordWidth; createLineContent(startIndex, endIndex, finalWidth, false); return endIndex + 1; } - private int sizeFirstWordNextText(LineText lineText, int start, int end) { + private int sizeFirstWordNextText(final LineText lineText, final int start, + final int end) { int size = 0; LineText nextText = lineText; int whitespaceWidth = getCharWidth(nextText, ' '); @@ -235,7 +239,7 @@ * that faux small-caps breaks up the text item. */ char[] text = nextText.inlineText(); for (int i = end + 1; i < text.length; i++) { - char c = text[i]; + final char c = text[i]; if (forcesLineBreak(c) || allowsLineBreak(c)) { return size; } @@ -249,7 +253,7 @@ text = nextText.inlineText(); whitespaceWidth = getCharWidth(nextText, ' '); for (int i = 0; i < text.length; i++) { - char c = text[i]; + final char c = text[i]; if (forcesLineBreak(c) || allowsLineBreak(c)) { return size; } @@ -263,7 +267,8 @@ * @param i * @param charWidth */ - private void processTextChar(String language, int i, int charWidth) { + private void processTextChar(final String language, final int i, + final int charWidth) { if (previousCharacter == CONNECTOR) { // Current is TEXT, previous is WHITESPACE. wordWidth = charWidth; @@ -296,7 +301,8 @@ * @param lineText * @param codePoint */ - private void processLineBreakPossibility(LineText lineText, int codePoint) { + private void processLineBreakPossibility(final LineText lineText, + final int codePoint) { if (previousCharacter == TEXT) { // Current is WHITESPACE and previous TEXT. /* @@ -322,10 +328,12 @@ * considered part of this line. * @param sizeInline The size, in millipoints, of the content being created. */ - private void createLineContent(int startIndex, int endIndex, int sizeInline, - boolean isHyphenated) throws TextException { - LineText lineText = (LineText) this.currentLineContent; - boolean everythingWritten = endIndex >= lineText.inlineText().length; + private void createLineContent(final int startIndex, final int endIndex, + final int sizeInline, final boolean isHyphenated) + throws TextException { + final LineText lineText = (LineText) this.currentLineContent; + final boolean everythingWritten = endIndex >= + lineText.inlineText().length; boolean isLastItemOnLine = true; if (everythingWritten) { /* If everything was written, this may not be the last item on @@ -351,23 +359,25 @@ * backward at any text in the same LineText item, and then to prior * LineText items to find the beginning of the word. */ - HyphenationServer server = this.getTextServer().getHyphenationServer(); - String language = this.currentLineText.inlineLanguage(); - String country = this.currentLineText.inlineCountry(); + final HyphenationServer server = + this.getTextServer().getHyphenationServer(); + final String language = this.currentLineText.inlineLanguage(); + final String country = this.currentLineText.inlineCountry(); // Count the number of chars at the beginning that should be ignored. - int actualWordStart = server.wordStarts(this.currentChars, wordStart, - language, country); + final int actualWordStart = server.wordStarts(this.currentChars, + wordStart, language, country); if (actualWordStart < 0) { return this.wordStart; } - int nonWordChars = actualWordStart - wordStart; + final int nonWordChars = actualWordStart - wordStart; // Extract the word that should be evaluated by the hyphenation system. - int wordSize = server.wordSize(this.currentChars, actualWordStart, + final int wordSize = server.wordSize(this.currentChars, actualWordStart, language, country); - String wordToHyphenate = new String(this.currentChars, actualWordStart, + final String wordToHyphenate = new String(this.currentChars, + actualWordStart, wordSize); // See if there are discretionary hyphenation points. - Hyphenation hyph = server.hyphenate(wordToHyphenate, 0, + final Hyphenation hyph = server.hyphenate(wordToHyphenate, 0, wordToHyphenate.length(), language, country, this.currentLineText.inlineHyphenationRemainCount(), this.currentLineText.inlineHyphenationPushCount(), false); @@ -376,14 +386,14 @@ return this.wordStart; } // Select a hyphenation point. - int index = selectDiscretionaryHyphenationPoint(this.currentLineText, - wordToHyphenate, hyph); + final int index = selectDiscretionaryHyphenationPoint( + this.currentLineText, wordToHyphenate, hyph); // If none fit, then the word cannot be hyphenated. if (index < 0) { return wordStart; } // Compute the number of characters that should be included. - int charsToInclude = hyph.getPoints()[index]; + final int charsToInclude = hyph.getPoints()[index]; // Add it and the non-word characters to the count to be returned. return wordStart + nonWordChars + charsToInclude; } @@ -391,26 +401,26 @@ /** * extracts from a hyphenated word the best (most greedy) fit */ - private int selectDiscretionaryHyphenationPoint(LineText lineText, - String word, Hyphenation hyph) throws TextException { - int remainingWidth = this.currentLineWidthRemaining() - finalWidth + private int selectDiscretionaryHyphenationPoint(final LineText lineText, + final String word, final Hyphenation hyph) throws TextException { + final int remainingWidth = this.currentLineWidthRemaining() - finalWidth - spaceWidth - getHyphenWidth(this.currentLineText); - int[] hyphenationPoints = hyph.getPoints(); - byte[] hyphenationWeights = hyph.getWeights(); + final int[] hyphenationPoints = hyph.getPoints(); + final byte[] hyphenationWeights = hyph.getWeights(); int index = -1; String wordBegin = ""; for (int i = 0; i < hyphenationPoints.length; i++) { - byte hyphenationWeight = hyphenationWeights[i]; + final byte hyphenationWeight = hyphenationWeights[i]; if (hyphenationWeight < 1) { /* If the weight is zero or less, it is not a suitable * hyphenation point. */ continue; } wordBegin = word.substring(0, hyphenationPoints[i]); - int provisionalWordWidth = getWordWidth(lineText, wordBegin); + final int provisionalWordWidth = getWordWidth(lineText, wordBegin); if (provisionalWordWidth > remainingWidth) { break; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-23 23:43:08
|
Revision: 7830 Author: victormote Date: 2006-07-23 16:42:47 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7830&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-render/src/java/org/foray/render/awt/AWTPrintRenderer.java trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/Command.java trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/GoToPageDialog.java trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/IconToolBar.java trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/LoadableProperties.java trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/MessageException.java trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/MessagesDialog.java trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/PreviewDialog.java trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/PreviewDialogAboutBox.java trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/SecureResourceBundle.java trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/UserMessage.java trunk/foray/foray-render/src/java/org/foray/render/pcl/PCLRenderer.java trunk/foray/foray-render/src/java/org/foray/render/pcl/PCLStream.java trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/AWTPrintRenderer.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/awt/AWTPrintRenderer.java 2006-07-23 23:17:34 UTC (rev 7829) +++ trunk/foray/foray-render/src/java/org/foray/render/awt/AWTPrintRenderer.java 2006-07-23 23:42:47 UTC (rev 7830) @@ -46,8 +46,8 @@ private int mode = EVEN_AND_ALL; private PrinterJob printerJob; - public AWTPrintRenderer(Log logger, OutputConfig renderConfig, - PrinterJob printerJob) { + public AWTPrintRenderer(final Log logger, final OutputConfig renderConfig, + final PrinterJob printerJob) { super(logger, renderConfig); this.printerJob = printerJob; @@ -57,11 +57,11 @@ printerJob.setPageable(this); mode = EVEN_AND_ALL; - String str = System.getProperty("even"); + final String str = System.getProperty("even"); if (str != null) { try { mode = Boolean.valueOf(str).booleanValue() ? EVEN : ODD; - } catch (Exception e) {} + } catch (final Exception e) {} } @@ -75,14 +75,14 @@ endNumber = getPageCount(); } - ArrayList numbers = getInvalidPageNumbers(); + final ArrayList numbers = getInvalidPageNumbers(); for (int i = numbers.size() - 1; i > -1; i--) { removePage(Integer.parseInt((String)numbers.get(i))); } try { printerJob.print(); - } catch (PrinterException e) { + } catch (final PrinterException e) { e.printStackTrace(); throw new IOException( "Unable to print: " + e.getClass().getName() + @@ -90,15 +90,15 @@ } } - public void renderPage(PageArea page) { + public void renderPage(final PageArea page) { pageWidth = (int)(page.getWidth() / 1000f); pageHeight = (int)(page.getHeight() / 1000f); super.renderPage(page); } private ArrayList getInvalidPageNumbers() { - ArrayList vec = new ArrayList(); - int max = getPageCount(); + final ArrayList vec = new ArrayList(); + final int max = getPageCount(); boolean isValid; for (int i = 0; i < max; i++) { isValid = true; @@ -120,12 +120,12 @@ return vec; } - int getIntProperty(String name, int def) { - String propValue = System.getProperty(name); + int getIntProperty(final String name, final int def) { + final String propValue = System.getProperty(name); if(propValue != null) { try { return Integer.parseInt(propValue); - } catch (Exception e) { + } catch (final Exception e) { return def; } } Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java 2006-07-23 23:17:34 UTC (rev 7829) +++ trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java 2006-07-23 23:42:47 UTC (rev 7830) @@ -150,7 +150,7 @@ */ protected Component parent; - public AWTRenderer(Log logger, OutputConfig renderConfig) { + public AWTRenderer(final Log logger, final OutputConfig renderConfig) { super(logger, renderConfig); } @@ -160,7 +160,7 @@ * in order to generate valid font measures. * @param parent the live AWT component reference */ - public void setComponent(Component parent) { + public void setComponent(final Component parent) { this.parent = parent; } @@ -168,11 +168,11 @@ return pageNumber; } - public void setPageNumber(int aValue) { + public void setPageNumber(final int aValue) { pageNumber = aValue; } - public void setScaleFactor(double newScaleFactor) { + public void setScaleFactor(final double newScaleFactor) { scaleFactor = newScaleFactor; } @@ -187,8 +187,9 @@ /** * {@inheritDoc} */ - protected void drawLine(int x1, int y1, int x2, int y2, int th, - int ruleStyle, Color strokeColor) { + protected void drawLine(final int x1, final int y1, final int x2, + final int y2, final int th, final int ruleStyle, + final Color strokeColor) { graphics.setColor(strokeColor); int x = x1; int y = y1; @@ -231,11 +232,11 @@ /** * {@inheritDoc} */ - protected void drawRectangle(int x, int y, int w, int h, - boolean stroke, Color strokeColor, boolean fill, - Color fillColor) { - int startx = (x + 500) / 1000; - int starty = pageHeight - ((y + 500) / 1000); + protected void drawRectangle(final int x, final int y, final int w, + final int h, final boolean stroke, final Color strokeColor, + final boolean fill, final Color fillColor) { + final int startx = (x + 500) / 1000; + final int starty = pageHeight - ((y + 500) / 1000); int endx = (x + w + 500) / 1000; int endy = pageHeight - ((y + h + 500) / 1000); if (stroke) { @@ -268,8 +269,8 @@ */ // changed by aml/rlc to use helper function that // corrects for integer roundoff, and to remove 3D effect - protected void addRect(int x, int y, int w, int h, float r, float g, - float b) { + protected void addRect(final int x, final int y, final int w, final int h, + final float r, final float g, final float b) { graphics.setColor(new Color(r, g, b)); // graphics.setColor(Color.green); addRect(x, y, w, h, true); @@ -292,8 +293,9 @@ // changed by aml/rlc to use helper function that // corrects for integer roundoff - protected void addRect(int x, int y, int w, int h, float r, float g, - float b, float fr, float fg, float fb) { + protected void addRect(final int x, final int y, final int w, final int h, + final float r, final float g, final float b, final float fr, + final float fg, final float fb) { graphics.setColor(new Color(r, g, b)); addRect(x, y, w, h, true); graphics.setColor(new Color(fr, fg, fb)); @@ -312,10 +314,10 @@ // helper function by aml/rlc to correct integer roundoff problems // - protected void addRect(int x, int y, int w, int h, - boolean drawAsOutline) { - int startx = (x + 500) / 1000; - int starty = pageHeight - ((y + 500) / 1000); + protected void addRect(final int x, final int y, final int w, final int h, + final boolean drawAsOutline) { + final int startx = (x + 500) / 1000; + final int starty = pageHeight - ((y + 500) / 1000); int endx = (x + w + 500) / 1000; int endy = pageHeight - ((y + h + 500) / 1000); if (drawAsOutline) { @@ -332,11 +334,11 @@ } } - protected void addFilledRect(int x, int y, int w, int h, - Color col) { - float r = col.getRed() / 255f; - float g = col.getGreen() / 255f; - float b = col.getBlue() / 255f; + protected void addFilledRect(final int x, final int y, final int w, + final int h, final Color col) { + final float r = col.getRed() / 255f; + final float g = col.getGreen() / 255f; + final float b = col.getBlue() / 255f; addRect(x, y, w, h, r, g, b, r, g, b); } @@ -347,18 +349,18 @@ * Zoom factor * Page format / Landscape or Portrait */ - public void transform(Graphics2D g2d, double zoomPercent, double angle) { - AffineTransform at = g2d.getTransform(); + public void transform(final Graphics2D g2d, final double zoomPercent, + final double angle) { + final AffineTransform at = g2d.getTransform(); at.rotate(angle); at.scale(zoomPercent / 100.0, zoomPercent / 100.0); g2d.setTransform(at); } protected void drawFrame() { + final int width = pageWidth; + final int height = pageHeight; - int width = pageWidth; - int height = pageHeight; - graphics.setColor(Color.white); graphics.fillRect(0, 0, width, height); graphics.setColor(Color.black); @@ -379,18 +381,18 @@ return pageList.size(); } - public void removePage(int page) { + public void removePage(final int page) { pageList.removeElementAt(page); } - public void render(int aPageNumber) { + public void render(final int aPageNumber) { if(aPageNumber >= pageList.size()) { return; } try { render((PageArea) pageList.get(aPageNumber)); - } catch(IOException e) { + } catch(final IOException e) { e.printStackTrace(); // This exception can't occur because we are not dealing with // any files @@ -398,11 +400,12 @@ } - public void render(PageArea page, OutputStream stream) throws IOException { + public void render(final PageArea page, final OutputStream stream) + throws IOException { pageList.add(page); } - public void render(PageArea page) throws IOException { + public void render(final PageArea page) throws IOException { pageWidth = (int)(page.getWidth() / 1000f + .5); pageHeight = (int)(page.getHeight() / 1000f + .5); @@ -425,7 +428,7 @@ renderPage(page); } - public void renderPage(PageArea page) { + public void renderPage(final PageArea page) { this.currentFont = null; this.currentFontSize = 0; @@ -439,11 +442,11 @@ */ } - protected void markBorder(Area area) { - int rx = area.brOriginX(); - int ry = area.brOriginY(); - int w = area.brIPD(); - int h = area.brBPD(); + protected void markBorder(final Area area) { + final int rx = area.brOriginX(); + final int ry = area.brOriginY(); + final int w = area.brIPD(); + final int h = area.brBPD(); if (area.getBorderTopWidth() != 0) { drawLine(rx, ry, rx + w, ry, -area.getBorderTopWidth(), @@ -468,7 +471,7 @@ - protected Rectangle2D getBounds(Area area) { + protected Rectangle2D getBounds(final Area area) { return new Rectangle2D.Double(area.rrOriginX(), area.rrOriginY(), area.rrIPD(), area.rrBPD()); } @@ -476,26 +479,26 @@ /** * {@inheritDoc} */ - protected void drawImage(GraphicArea area, Graphic image, - Rectangle contentRectangle, Rectangle clipRectangle) { + protected void drawImage(final GraphicArea area, final Graphic image, + final Rectangle contentRectangle, final Rectangle clipRectangle) { // TODO: implement this } /** * {@inheritDoc} */ - protected void drawSVG(GraphicArea area, SVGGraphic graphic, - Rectangle contentRectangle, Rectangle clipRectangle) { + protected void drawSVG(final GraphicArea area, final SVGGraphic graphic, + final Rectangle contentRectangle, final Rectangle clipRectangle) { /* TODO: Implement this. */ } - public void render(ExternalGraphicArea area) { - int x = area.rrOriginX(); - int y = area.rrOriginY(); - int w = area.rrIPD(); - int h = area.rrBPD(); + public void render(final ExternalGraphicArea area) { + final int x = area.rrOriginX(); + final int y = area.rrOriginY(); + final int w = area.rrIPD(); + final int h = area.rrBPD(); - Graphic img = area.getGraphic(); + final Graphic img = area.getGraphic(); if (img == null) { getLogger().error("Error while loading image : area.getImage() " @@ -507,8 +510,8 @@ addRect(x, y, w, h, true); // use helper function - java.awt.Font f = graphics.getFont(); - java.awt.Font smallFont = new java.awt.Font(f.getFontName(), + final java.awt.Font f = graphics.getFont(); + final java.awt.Font smallFont = new java.awt.Font(f.getFontName(), f.getStyle(), 8); graphics.setFont(smallFont); @@ -525,34 +528,34 @@ } else { if (img instanceof SVGGraphic) { try { - SVGDocument svg = ((SVGGraphic) img).getSVGDocument(); + final SVGDocument svg = ((SVGGraphic) img).getSVGDocument(); renderSVGDocument(area, svg); - } catch (GraphicException e) {} + } catch (final GraphicException e) {} } else { - String urlString = img.getURL().toString(); + final String urlString = img.getURL().toString(); try { - URL url = URLFactory.createURL(urlString); + final URL url = URLFactory.createURL(urlString); - ImageIcon icon = new ImageIcon(url); - Image image = icon.getImage(); + final ImageIcon icon = new ImageIcon(url); + final Image image = icon.getImage(); // correct integer roundoff aml/rlc // graphics.drawImage(image, x / 1000, // pageHeight - y / 1000, w / 1000, h / 1000, // null); - int startx = (x + 500) / 1000; - int starty = pageHeight - ((y + 500) / 1000); - int endx = (x + w + 500) / 1000; - int endy = pageHeight - ((y + h + 500) / 1000); + final int startx = (x + 500) / 1000; + final int starty = pageHeight - ((y + 500) / 1000); + final int endx = (x + w + 500) / 1000; + final int endy = pageHeight - ((y + h + 500) / 1000); // reverse start and end y because h is positive graphics.drawImage(image, startx, starty, endx - startx, starty - endy, null); - } catch (MalformedURLException mue) { + } catch (final MalformedURLException mue) { /* cannot normally occur because, if URL is wrong, * constructing Graphic will already have failed earlier. */ } @@ -561,16 +564,17 @@ } } - protected void createBasicLink(BasicLinkArea area) { + protected void createBasicLink(final BasicLinkArea area) { } - public void renderTextSegment(GeneralInlineArea area, char[] text) { - FontUse font = area.getPrimaryFont(); - int size = area.traitFontSize(); + public void renderTextSegment(final GeneralInlineArea area, + final char[] text) { + final FontUse font = area.getPrimaryFont(); + final int size = area.traitFontSize(); - float red = area.getColor().getRed() / 255f; - float green = area.getColor().getGreen() / 255f; - float blue = area.getColor().getBlue() / 255f; + final float red = area.getColor().getRed() / 255f; + final float green = area.getColor().getGreen() / 255f; + final float blue = area.getColor().getBlue() / 255f; if ((font != this.currentFont) || (size != this.currentFontSize)) { @@ -585,15 +589,16 @@ this.currentBlue = blue; } - int rx = area.rrOriginX(); - int bl = area.rrOriginY(); + final int rx = area.rrOriginX(); + final int bl = area.rrOriginY(); - String s = String.copyValueOf(text); + final String s = String.copyValueOf(text); - Color oldColor = graphics.getColor(); - java.awt.Font oldFont = graphics.getFont(); + final Color oldColor = graphics.getColor(); + final java.awt.Font oldFont = graphics.getFont(); - java.awt.Font f = area.getPrimaryFont().getFont().getAWTFont(size); + final java.awt.Font f = area.getPrimaryFont().getFont().getAWTFont( + size); if (saveColor != null) { if (saveColor.getRed() != red || saveColor.getGreen() != green @@ -613,14 +618,14 @@ graphics.setFont(f); // correct starting location for integer roundoff - int newx = (rx + 500) / 1000; - int newy = pageHeight - (bl + 500) / 1000; + final int newx = (rx + 500) / 1000; + final int newy = pageHeight - (bl + 500) / 1000; // draw text, corrected for integer roundoff graphics.drawString(s, newx, newy); - FontMetrics fm = graphics.getFontMetrics(f); - int tdwidth = (int)fm.getStringBounds(s, graphics).getWidth(); + final FontMetrics fm = graphics.getFontMetrics(f); + final int tdwidth = (int)fm.getStringBounds(s, graphics).getWidth(); // text decorations renderTextDecoration(rx, bl, tdwidth, f, " ", @@ -637,20 +642,19 @@ graphics.setColor(oldColor); } - protected void renderTextDecoration(int x, int bl, int width, - java.awt.Font font, String text, - boolean underline, - boolean overline, - boolean linethrough) { + protected void renderTextDecoration(final int x, final int bl, + final int width, final java.awt.Font font, final String text, + final boolean underline, final boolean overline, + final boolean linethrough) { if (!(underline || overline || linethrough)) { return; } - int newx = (x + 500) / 1000; - int newy = pageHeight - (bl + 500) / 1000; + final int newx = (x + 500) / 1000; + final int newy = pageHeight - (bl + 500) / 1000; // text decorations - FontMetrics fm = graphics.getFontMetrics(font); - LineMetrics lm = fm.getLineMetrics(text, graphics); + final FontMetrics fm = graphics.getFontMetrics(font); + final LineMetrics lm = fm.getLineMetrics(text, graphics); int ulthick = (int)lm.getUnderlineThickness(); if (ulthick < 1) { @@ -659,12 +663,12 @@ if (underline) { // nothing in awt specifies underline location, // descent/2 seems to match my word processor - int deltay = fm.getDescent() / 2; + final int deltay = fm.getDescent() / 2; graphics.fillRect(newx, newy + deltay, width, ulthick); } if (overline) { // todo: maybe improve positioning of overline - int deltay = -(int)(lm.getAscent() * 0.8); + final int deltay = -(int)(lm.getAscent() * 0.8); graphics.fillRect(newx, newy + deltay, width, ulthick); } if (linethrough) { @@ -672,7 +676,7 @@ if (ltthick < 1) { ltthick = 1; // don't allow it to disappear } - int deltay = (int)lm.getStrikethroughOffset(); + final int deltay = (int)lm.getStrikethroughOffset(); graphics.fillRect(newx, newy + deltay, width, ltthick); } } @@ -686,15 +690,15 @@ // call to addRect corrected by aml/rlc - public void render(LeaderArea area) { - int rx = area.rrOriginX(); - int ry = area.rrOriginY(); - int w = area.rrIPD(); - int th = area.traitRuleThickness(); - float r = area.getColor().getRed() / 255f; - float g = area.getColor().getGreen() / 255f; - float b = area.getColor().getBlue() / 255f; - Color oldColor = graphics.getColor(); + public void render(final LeaderArea area) { + final int rx = area.rrOriginX(); + final int ry = area.rrOriginY(); + final int w = area.rrIPD(); + final int th = area.traitRuleThickness(); + final float r = area.getColor().getRed() / 255f; + final float g = area.getColor().getGreen() / 255f; + final float b = area.getColor().getBlue() / 255f; + final Color oldColor = graphics.getColor(); graphics.setColor(new Color(r, g, b)); @@ -708,34 +712,34 @@ graphics.setColor(oldColor); } - public void render(TextArea area) { + public void render(final TextArea area) { renderTextSegment(area, area.getText()); } - public void render(SVGArea area) { - Document doc = area.getSVGDocument(); + public void render(final SVGArea area) { + final Document doc = area.getSVGDocument(); renderSVGDocument(area, doc); } - protected void renderSVGDocument(Area area, Document doc) { - int x = area.rrOriginX(); - int y = area.rrOriginY(); - int w = area.rrIPD(); - int h = area.rrBPD(); - GraphicsNode root = getGraphicsNode(area, doc); + protected void renderSVGDocument(final Area area, final Document doc) { + final int x = area.rrOriginX(); + final int y = area.rrOriginY(); + final int w = area.rrIPD(); + final int h = area.rrBPD(); + final GraphicsNode root = getGraphicsNode(area, doc); if (root == null) { return; } graphics.translate((x + 500) / 1000, pageHeight - (y + 500) / 1000); - SVGSVGElement svg = ((SVGDocument)doc).getRootElement(); - AffineTransform at = ViewBox.getPreserveAspectRatioTransform(svg, + final SVGSVGElement svg = ((SVGDocument)doc).getRootElement(); + final AffineTransform at = ViewBox.getPreserveAspectRatioTransform(svg, w / 1000f, h / 1000f); AffineTransform inverse = null; try { inverse = at.createInverse(); - } catch(NoninvertibleTransformException e) { + } catch (final NoninvertibleTransformException e) { } if(!at.isIdentity()) { graphics.transform(at); @@ -743,7 +747,7 @@ try { root.paint(graphics); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } @@ -754,12 +758,13 @@ } - protected GraphicsNode getGraphicsNode(Area area, Document doc) { - BridgeContext ctx = makeBridgeContextAWT(); - GVTBuilder builder = new GVTBuilder(); + protected GraphicsNode getGraphicsNode(final Area area, + final Document doc) { + final BridgeContext ctx = makeBridgeContextAWT(); + final GVTBuilder builder = new GVTBuilder(); try { return builder.build(ctx, doc); - } catch (Exception e) { + } catch (final Exception e) { getLogger().error("svg graphic could not be built: " + e.getMessage()); getLogger().error(e.getMessage()); @@ -767,17 +772,17 @@ } } - public void render(BookmarkTreeArea area) { + public void render(final BookmarkTreeArea area) { return; } - public int print(Graphics g, PageFormat pageFormat, - int pageIndex) throws PrinterException { + public int print(final Graphics g, final PageFormat pageFormat, + final int pageIndex) throws PrinterException { if (pageIndex >= pageList.size()) { return NO_SUCH_PAGE; } - Graphics2D oldGraphics = graphics; + final Graphics2D oldGraphics = graphics; graphics = (Graphics2D)g; @@ -787,7 +792,7 @@ graphics.setRenderingHint (RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); - PageArea aPage = (PageArea)pageList.get(pageIndex); + final PageArea aPage = (PageArea)pageList.get(pageIndex); renderPage(aPage); graphics = oldGraphics; @@ -798,18 +803,18 @@ return pageList.size(); } - public PageFormat getPageFormat(int pageIndex) + public PageFormat getPageFormat(final int pageIndex) throws IndexOutOfBoundsException { if (pageIndex >= pageList.size()) { return null; } - PageArea page = (PageArea)pageList.get(pageIndex); - PageFormat pageFormat = new PageFormat(); - Paper paper = new Paper(); + final PageArea page = (PageArea)pageList.get(pageIndex); + final PageFormat pageFormat = new PageFormat(); + final Paper paper = new Paper(); - double width = page.getWidth(); - double height = page.getHeight(); + final double width = page.getWidth(); + final double height = page.getHeight(); // if the width is greater than the height assume lanscape mode // and swap the width and height values in the paper format @@ -826,12 +831,12 @@ return pageFormat; } - public Printable getPrintable(int pageIndex) + public Printable getPrintable(final int pageIndex) throws IndexOutOfBoundsException { return this; } - public void setProgressListener(ProgressListener l) { + public void setProgressListener(final ProgressListener l) { progressListener = l; } @@ -874,7 +879,7 @@ * } */ - public void render(ForeignObjectArea area) { + public void render(final ForeignObjectArea area) { render(area.getContainedForeignObject()); } Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/Command.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/Command.java 2006-07-23 23:17:34 UTC (rev 7829) +++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/Command.java 2006-07-23 23:42:47 UTC (rev 7830) @@ -56,20 +56,22 @@ public static String IMAGE_DIR = "/org/foray/render/awt/viewer/images/"; PreviewDialog parent; - public Command(PreviewDialog dialog, String name) { + public Command(final PreviewDialog dialog, final String name) { this(dialog, name, (ImageIcon)null); } - public Command(PreviewDialog dialog, String name, ImageIcon anIcon) { + public Command(final PreviewDialog dialog, final String name, + final ImageIcon anIcon) { super(name, anIcon); this.parent = dialog; } - public Command(PreviewDialog dialog, String name, String iconName) { + public Command(final PreviewDialog dialog, final String name, + final String iconName) { super(name); this.parent = dialog; - String path = IMAGE_DIR + iconName + ".gif"; - URL url = getClass().getResource(path); + final String path = IMAGE_DIR + iconName + ".gif"; + final URL url = getClass().getResource(path); if (url == null) { getLogger().error("Icon not found: " + path); } else { @@ -77,7 +79,7 @@ } } - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { doit(); } Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/GoToPageDialog.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/GoToPageDialog.java 2006-07-23 23:17:34 UTC (rev 7829) +++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/GoToPageDialog.java 2006-07-23 23:42:47 UTC (rev 7830) @@ -62,14 +62,14 @@ int pageNumber = -1; - public GoToPageDialog(Frame frame, String title, boolean modal, - Translator resource, Log logger) { + public GoToPageDialog(final Frame frame, final String title, + final boolean modal, final Translator resource, final Log logger) { super(frame, title, modal); try { res = resource; jbInit(); pack(); - } catch (Exception ex) { + } catch (final Exception ex) { logger.error("GoToPageDialog: Konstruktor: " + ex.getMessage()); } @@ -81,7 +81,7 @@ okButton.setText(res.getString("Ok")); okButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { okButton_actionPerformed(e); } @@ -89,7 +89,7 @@ cancelButton.setText(res.getString("Cancel")); cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { cancelButton_actionPerformed(e); } @@ -118,17 +118,17 @@ new Insets(0, 10, 10, 10), 0, 0)); } - void okButton_actionPerformed(ActionEvent e) { + void okButton_actionPerformed(final ActionEvent e) { try { pageNumber = Integer.parseInt(pgNbField.getText()); dispose(); - } catch (Exception ex) { + } catch (final Exception ex) { pgNbField.setText("???"); } } - void cancelButton_actionPerformed(ActionEvent e) { + void cancelButton_actionPerformed(final ActionEvent e) { pageNumber = -1; dispose(); } Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/IconToolBar.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/IconToolBar.java 2006-07-23 23:17:34 UTC (rev 7829) +++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/IconToolBar.java 2006-07-23 23:42:47 UTC (rev 7830) @@ -42,24 +42,22 @@ public class IconToolBar extends JToolBar { static final long serialVersionUID = 726305148932931753L; - public JButton add(Action a) { - String name = (String)a.getValue(Action.NAME); - Icon icon = (Icon)a.getValue(Action.SMALL_ICON); + public JButton add(final Action a) { + final String name = (String)a.getValue(Action.NAME); + final Icon icon = (Icon)a.getValue(Action.SMALL_ICON); return add(a, name, icon); } - public JButton add(Action a, String name, Icon icon) { - JButton b = new JButton(icon); + public JButton add(final Action a, final String name, final Icon icon) { + final JButton b = new JButton(icon); b.setToolTipText(name); b.setEnabled(a.isEnabled()); b.addActionListener(a); add(b); - PropertyChangeListener actionPropertyChangeListener = + final PropertyChangeListener actionPropertyChangeListener = createActionChangeListener(b); a.addPropertyChangeListener(actionPropertyChangeListener); return b; } } - - Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/LoadableProperties.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/LoadableProperties.java 2006-07-23 23:17:34 UTC (rev 7829) +++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/LoadableProperties.java 2006-07-23 23:42:47 UTC (rev 7830) @@ -47,16 +47,16 @@ SecureResourceBundle parent; - public LoadableProperties(SecureResourceBundle bundle) { + public LoadableProperties(final SecureResourceBundle bundle) { super(); this.parent = bundle; } - public void load(InputStream inStream) throws IOException { + public void load(final InputStream inStream) throws IOException { - BufferedReader in = new BufferedReader(new InputStreamReader(inStream, - "UTF-8")); + final BufferedReader in = new BufferedReader(new InputStreamReader( + inStream, "UTF-8")); String aKey; String aValue; @@ -75,7 +75,7 @@ } - private boolean isValid(String str) { + private boolean isValid(final String str) { if (str == null) { return false; } @@ -87,7 +87,7 @@ return false; } - int index = str.indexOf("="); + final int index = str.indexOf("="); if (index > 0 && str.length() > index) { return true; } @@ -97,10 +97,10 @@ return false; } - private String getNextLine(BufferedReader br) { + private String getNextLine(final BufferedReader br) { try { return br.readLine(); - } catch (Exception e) { + } catch (final Exception e) { return null; } Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/MessageException.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/MessageException.java 2006-07-23 23:17:34 UTC (rev 7829) +++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/MessageException.java 2006-07-23 23:42:47 UTC (rev 7830) @@ -62,16 +62,17 @@ this("UNKNOWN_EXCEPTION"); } - public MessageException(String aMessageId) { + public MessageException(final String aMessageId) { this(aMessageId, null); } - public MessageException(String aMessageId, String[] aParameterList) { + public MessageException(final String aMessageId, + final String[] aParameterList) { this(aMessageId, aParameterList, null); } - public MessageException(String aMessageId, String[] aParameterList, - Exception anException) { + public MessageException(final String aMessageId, + final String[] aParameterList, final Exception anException) { super(aMessageId); messageId = aMessageId; parameterList = aParameterList; Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/MessagesDialog.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/MessagesDialog.java 2006-07-23 23:17:34 UTC (rev 7829) +++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/MessagesDialog.java 2006-07-23 23:42:47 UTC (rev 7830) @@ -50,7 +50,7 @@ static Translator res; - public static void setTranslator(Translator aRes) { + public static void setTranslator(final Translator aRes) { res = aRes; iniConstants(); } @@ -116,15 +116,16 @@ // MessagesDialog.showConfirmDialog(null,preparedMes,title, // optionTypeIndex,messageTypeIndex); - public MessagesDialog(Object message, int messageType, int optionType, - Icon icon, Object[] options, Object initialValue) { + public MessagesDialog(final Object message, final int messageType, + final int optionType, final Icon icon, final Object[] options, + final Object initialValue) { super(message, messageType, optionType, icon, options, initialValue); setMinimumSize(new Dimension(240, 96)); } - public static int showConfirmDialog(Component parentComponent, - Object message, String title, - int optionType, int messageType) { + public static int showConfirmDialog(final Component parentComponent, + final Object message, final String title, final int optionType, + final int messageType) { Object[] options; switch (optionType) { @@ -141,20 +142,20 @@ options = defaultOption; } - MessagesDialog pane = new MessagesDialog(message, messageType, + final MessagesDialog pane = new MessagesDialog(message, messageType, JOptionPane.DEFAULT_OPTION, null, options, options[0]); pane.setInitialValue(options[0]); - JDialog dialog = pane.createDialog(parentComponent, title); + final JDialog dialog = pane.createDialog(parentComponent, title); pane.setDialog(dialog); pane.selectInitialValue(); dialog.setVisible(true); - Object selectedValue = pane.getValue(); + final Object selectedValue = pane.getValue(); if (selectedValue == null) { return CLOSED_OPTION; @@ -182,11 +183,11 @@ * erscheint die übergebene Detailinformation in einem scrollbaren Bereich * des Dialogs. */ - public static int showDetailDialog(Component parentComponent, - Object message, String title, - int optionType, int messageType, - Icon icon, - String newDetailInformation) { + public static int showDetailDialog(final Component parentComponent, + final Object message, final String title, + final int optionType, final int messageType, + final Icon icon, + final String newDetailInformation) { Object[] options; switch (optionType) { @@ -203,21 +204,21 @@ options = defaultDetailOption; } - MessagesDialog pane = new MessagesDialog(message, messageType, + final MessagesDialog pane = new MessagesDialog(message, messageType, JOptionPane.DEFAULT_OPTION, icon, options, options[0]); pane.setDetailInformation(newDetailInformation); pane.setInitialValue(options[0]); - JDialog dialog = pane.createDialog(parentComponent, title); + final JDialog dialog = pane.createDialog(parentComponent, title); pane.setDialog(dialog); pane.selectInitialValue(); dialog.setVisible(true); - Object selectedValue = pane.getValue(); + final Object selectedValue = pane.getValue(); if (selectedValue == null) { return CLOSED_OPTION; @@ -249,12 +250,12 @@ * @param dialog Der Dialog, in den die Textkomponente eingefügt werden * soll */ - protected void displayDetails(JDialog dialog) { + protected void displayDetails(final JDialog dialog) { if (getDetailInformation() != null && dialog != null && showsDetails == false) { showsDetails = true; - JScrollPane aScrollPane = new JScrollPane(); - JTextArea aTextArea = new JTextArea(); + final JScrollPane aScrollPane = new JScrollPane(); + final JTextArea aTextArea = new JTextArea(); aTextArea.setText(getDetailInformation()); aTextArea.setEditable(false); @@ -268,7 +269,7 @@ // Zugriff - public void setValue(Object aValue) { + public void setValue(final Object aValue) { if (aValue != null && DETAIL_OPTION.equals(aValue)) { displayDetails(getDialog()); } else { @@ -280,7 +281,7 @@ return detailInformation; } - public void setDetailInformation(String aValue) { + public void setDetailInformation(final String aValue) { detailInformation = aValue; } @@ -288,7 +289,7 @@ return dialog; } - public void setDialog(JDialog aValue) { + public void setDialog(final JDialog aValue) { dialog = aValue; } Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/PreviewDialog.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/PreviewDialog.java 2006-07-23 23:17:34 UTC (rev 7829) +++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/PreviewDialog.java 2006-07-23 23:42:47 UTC (rev 7830) @@ -117,8 +117,8 @@ * @param aRes The Translator translator. * @param logger The logger to use. */ - public PreviewDialog(AWTRenderer aRenderer, Translator aRes, - Log logger) { + public PreviewDialog(final AWTRenderer aRenderer, final Translator aRes, + final Log logger) { this(aRenderer, aRes); this.logger = logger; } @@ -129,7 +129,7 @@ * @param aRenderer the to use renderer * @param aRes the to use translator */ - public PreviewDialog(AWTRenderer aRenderer, Translator aRes) { + public PreviewDialog(final AWTRenderer aRenderer, final Translator aRes) { res = aRes; renderer = aRenderer; @@ -198,7 +198,7 @@ scale.setPreferredSize(new Dimension(80, 24)); scale.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { scale_actionPerformed(e); } }); @@ -396,11 +396,11 @@ * * @param e a value of type 'ActionEvent' */ - public void startHelpAbout(ActionEvent e) { - PreviewDialogAboutBox dlg = new PreviewDialogAboutBox(this); - Dimension dlgSize = dlg.getPreferredSize(); - Dimension frmSize = getSize(); - Point loc = getLocation(); + public void startHelpAbout(final ActionEvent e) { + final PreviewDialogAboutBox dlg = new PreviewDialogAboutBox(this); + final Dimension dlgSize = dlg.getPreferredSize(); + final Dimension frmSize = getSize(); + final Point loc = getLocation(); dlg.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y); dlg.setModal(true); @@ -412,7 +412,7 @@ * * @param number the page number to go to */ - private void goToPage(int number) { + private void goToPage(final int number) { currentPage = number; renderer.setPageNumber(number); showPage(); @@ -421,7 +421,7 @@ /** * Shows the previous page. */ - private void goToPreviousPage(ActionEvent e) { + private void goToPreviousPage(final ActionEvent e) { if (currentPage <= 0) { return; } @@ -432,7 +432,7 @@ /** * Shows the next page. */ - private void goToNextPage(ActionEvent e) { + private void goToNextPage(final ActionEvent e) { if (currentPage >= pageCount - 1) { return; } @@ -443,7 +443,7 @@ /** * Shows the last page. */ - private void goToLastPage(ActionEvent e) { + private void goToLastPage(final ActionEvent e) { if (currentPage == pageCount - 1) { return; } @@ -454,7 +454,7 @@ /** * Reloads and reformats document. */ - private synchronized void reload(ActionEvent e) { + private synchronized void reload(final ActionEvent e) { if (reloader == null || !reloader.isAlive()) { reloader = new Reloader(); reloader.start(); @@ -495,8 +495,8 @@ /** * Shows a page by number. */ - private void goToPage(ActionEvent e) { - GoToPageDialog d = new GoToPageDialog(this, + private void goToPage(final ActionEvent e) { + final GoToPageDialog d = new GoToPageDialog(this, res.getString("Go to Page"), true, res, getLogger()); @@ -517,7 +517,7 @@ /** * Shows the first page. */ - private void goToFirstPage(ActionEvent e) { + private void goToFirstPage(final ActionEvent e) { if (currentPage == 0) { return; } @@ -526,7 +526,7 @@ } private void print() { - PrinterJob pj = PrinterJob.getPrinterJob(); + final PrinterJob pj = PrinterJob.getPrinterJob(); // Not necessary, Pageable gets a Printable. // pj.setPrintable(renderer); pj.setPageable(renderer); @@ -534,13 +534,13 @@ if (pj.printDialog()) { try { pj.print(); - } catch (PrinterException pe) { + } catch (final PrinterException pe) { pe.printStackTrace(); } } } - public void setScale(double scaleFactor) { + public void setScale(final double scaleFactor) { if (scaleFactor == 25.0) { scale.setSelectedIndex(0); } else if (scaleFactor == 50.0) { @@ -559,15 +559,15 @@ showPage(); } - void scale_actionPerformed(ActionEvent e) { + void scale_actionPerformed(final ActionEvent e) { setScale(new Double((String)scale.getSelectedItem()).doubleValue()); } - public void progress(int percentage) { + public void progress(final int percentage) { progress(new String(percentage + "%")); } - public void progress(int percentage, String message) { + public void progress(final int percentage, final String message) { progress(new String(message + " " + percentage + "%")); } @@ -576,7 +576,7 @@ * needs to be done in the EventThread. Here we make sure * it is done. */ - public void progress(String message) { + public void progress(final String message) { SwingUtilities.invokeLater(new showProgress(message, false)); } @@ -601,7 +601,8 @@ * @param message message to display * @param isErrorMessage show in status bar or in JOptionPane */ - public showProgress(Object message, boolean isErrorMessage) { + public showProgress(final Object message, + final boolean isErrorMessage) { this.message = message; this.isErrorMessage = isErrorMessage; } @@ -617,7 +618,7 @@ } public void showPage() { - showPageImage viewer = new showPageImage(); + final showPageImage viewer = new showPageImage(); if (SwingUtilities.isEventDispatchThread()) { viewer.run(); @@ -660,8 +661,8 @@ } } - public void reportException(Exception e) { - String msg = res.getString("An exception has occured"); + public void reportException(final Exception e) { + final String msg = res.getString("An exception has occured"); progress(msg); JOptionPane.showMessageDialog( getContentPane(), Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/PreviewDialogAboutBox.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/PreviewDialogAboutBox.java 2006-07-23 23:17:34 UTC (rev 7829) +++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/PreviewDialogAboutBox.java 2006-07-23 23:42:47 UTC (rev 7830) @@ -76,12 +76,13 @@ String copyright; String comments = ""; // "Print Preview"; - public PreviewDialogAboutBox(PreviewDialog parent) { + public PreviewDialogAboutBox(final PreviewDialog parent) { super(parent); - Renderer renderer = parent.getRenderer(); - String product = renderer.getApplicationNameShort() + " AWT-Preview"; - String version = "Version: " + renderer.getApplicationVersion(); - String copyright = "See " + renderer.getDeveloperURLShort(); + final Renderer renderer = parent.getRenderer(); + final String product = renderer.getApplicationNameShort() + + " AWT-Preview"; + final String version = "Version: " + renderer.getApplicationVersion(); + final String copyright = "See " + renderer.getDeveloperURLShort(); enableEvents(AWTEvent.WINDOW_EVENT_MASK); /* imageIcon = new ImageIcon(getClass().getResource("Hier der @@ -117,7 +118,7 @@ pack(); } - protected void processWindowEvent(WindowEvent e) { + protected void processWindowEvent(final WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_CLOSING) { cancel(); } @@ -128,7 +129,7 @@ dispose(); } - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { if (e.getSource() == button1) { cancel(); } Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/SecureResourceBundle.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/SecureResourceBundle.java 2006-07-23 23:17:34 UTC (rev 7829) +++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/SecureResourceBundle.java 2006-07-23 23:42:47 UTC (rev 7830) @@ -51,7 +51,7 @@ private boolean isSourceFound = true; - public void setMissingEmphasized(boolean flag) { + public void setMissingEmphasized(final boolean flag) { isMissingEmphasized = flag; } private Log logger; @@ -60,11 +60,11 @@ * Kreiert ein ResourceBundle mit der Quelle in <strong>in</strong>. */ - public SecureResourceBundle(InputStream in, Log logger) { + public SecureResourceBundle(final InputStream in, final Log logger) { this.logger = logger; try { lookup.load(in); - } catch (Exception ex) { + } catch (final Exception ex) { logger.info("Exception caught: " + ex.getMessage()); isSourceFound = false; } @@ -95,11 +95,11 @@ * </UL> * */ - public Object handleGetObject(String key) { + public Object handleGetObject(final String key) { if (key == null) { return "Key is null"; } - Object obj = lookup.get(key); + final Object obj = lookup.get(key); if (obj != null) { return obj; } @@ -113,12 +113,12 @@ /** * Stellt fest, ob es den Key gibt. */ - public boolean contains(String key) { + public boolean contains(final String key) { return (key == null || lookup.get(key) == null) ? false : true; } - private String getMissedRepresentation(String str) { + private String getMissedRepresentation(final String str) { return "<!" + str + "!>"; } Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/UserMessage.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/UserMessage.java 2006-07-23 23:17:34 UTC (rev 7829) +++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/UserMessage.java 2006-07-23 23:42:47 UTC (rev 7830) @@ -40,11 +40,11 @@ private Translator res = null; private Log logger; - public UserMessage(Log logger) { + public UserMessage(final Log logger) { this.logger = logger; } - public void setTranslator(Translator aRes) { + public void setTranslator(final Translator aRes) { res = aRes; if (res == null) { logger.info("UserMessage: setTranslator(null) !"); @@ -149,7 +149,7 @@ /** * Ersetzt die eventuellen Platzhalter durch die übergebenen Parameter */ - String prepareMessage(String rawText, String[] par) { + String prepareMessage(String rawText, final String[] par) { logger.info("prepareMessage(): " + rawText + ", parameter: " + par); int index = rawText.indexOf(PARAMETER_TAG); @@ -176,7 +176,7 @@ index = rawText.indexOf(PARAMETER_TAG); try { composedMess += rawText.substring(0, index) + par[tagCount]; - } catch (ArrayIndexOutOfBoundsException ex) { + } catch (final ArrayIndexOutOfBoundsException ex) { logger.info("Anzahl der übergebenen Parameter zu der Meldung " + actMessId + " ist weniger als erwartet."); @@ -200,9 +200,9 @@ * Dieser wird durch die Dialogart festgelegt * (erster Teil in der MeldungsDefinition in der Properties-Datei). */ - String getTitle(String strVal) { + String getTitle(final String strVal) { String title = null; - int choice = getValue(strVal); + final int choice = getValue(strVal); switch (choice) { case INFO: title = "Info"; @@ -226,9 +226,9 @@ /** * Liefert den Wert der über den Nemen übergebenen Klassenvariablen. */ - int getValue(String fieldName) { + int getValue(final String fieldName) { - int val = -1; + final int val = -1; if (fieldName.equals("INFO")) { return INFO; } Modified: trunk/foray/foray-render/src/java/org/foray/render/pcl/PCLRenderer.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/pcl/PCLRenderer.java 2006-07-23 23:17:34 UTC (rev 7829) +++ trunk/foray/foray-render/src/java/org/foray/render/pcl/PCLRenderer.java 2006-07-23 23:42:47 UTC (rev 7830) @@ -83,7 +83,7 @@ /** * Create the PCL renderer */ - public PCLRenderer(Log logger, OutputConfig renderConfig) { + public PCLRenderer(final Log logger, final OutputConfig renderConfig) { super(logger, renderConfig); } @@ -98,8 +98,8 @@ * @param rs the rule style * @param strokeColor the line color */ - protected void drawLine(int x1, int y1, int x2, int y2, int th, int rs, - Color strokeColor) { + protected void drawLine(final int x1, final int y1, final int x2, + final int y2, final int th, final int rs, final Color strokeColor) { int dashon = 0; int dashoff = 0; // if ( rs != null && rs.length() > 5 @@ -158,9 +158,9 @@ /** * {@inheritDoc} */ - protected void drawRectangle(int x, int y, int w, int h, - boolean stroke, Color strokeColor, boolean fill, - Color fillColor) { + protected void drawRectangle(final int x, final int y, int w, int h, + final boolean stroke, final Color strokeColor, + final boolean fill, final Color fillColor) { if ((h >= 0 && h < 720) || (h < 0 && h > -720) || w < 720) { if (w < 720) { w = 720; @@ -189,8 +189,8 @@ * @param fill the fill color/gradient * @param stroke the stroke color/gradient */ - protected void addRect(int x, int y, int w, int h, Color stroke, - Color fill) { + protected void addRect(final int x, int y, final int w, int h, + final Color stroke, final Color fill) { if ((w == 0) || (h == 0)) { return; } @@ -200,10 +200,10 @@ y += h; } - int lineshade = (int)(100 - ((0.3f * stroke.getRed() + final int lineshade = (int)(100 - ((0.3f * stroke.getRed() + 0.59f * stroke.getGreen() + 0.11f * stroke.getBlue()) * 100f)); - int fillshade = (int)(100 - ((0.3f * fill.getRed() + final int fillshade = (int)(100 - ((0.3f * fill.getRed() + 0.59f * fill.getGreen() + 0.11f * fill.getBlue()) * 100f)); @@ -236,36 +236,36 @@ /** * {@inheritDoc} */ - protected void drawImage(GraphicArea area, Graphic image, - Rectangle contentRectangle, Rectangle clipRectangle) { + protected void drawImage(final GraphicArea area, final Graphic image, + final Rectangle contentRectangle, final Rectangle clipRectangle) { // TODO: implement this } /** * {@inheritDoc} */ - protected void drawSVG(GraphicArea area, SVGGraphic graphic, - Rectangle contentRectangle, Rectangle clipRectangle) { + protected void drawSVG(final GraphicArea area, final SVGGraphic graphic, + final Rectangle contentRectangle, final Rectangle clipRectangle) { /* TODO: Implement this. */ } - boolean printBMP(Graphic img, int x, int y, int w, - int h) throws GraphicException { + boolean printBMP(final Graphic img, final int x, final int y, final int w, + final int h) throws GraphicException { // Print the passed image file in PCL. - byte imgmap[] = img.getContent(); + final byte imgmap[] = img.getContent(); int ix = 0; int iy = 0; int indx = 0; - int iw = img.pixelWidth(); - int ih = img.pixelHeight(); + final int iw = img.pixelWidth(); + final int ih = img.pixelHeight(); int bytewidth = (iw / 8); if ((iw % 8) != 0) { bytewidth++; } byte ib; - char ic[] = new char[bytewidth * 2]; - char icu[] = new char[bytewidth]; + final char ic[] = new char[bytewidth * 2]; + final char icu[] = new char[bytewidth]; int lastcount = -1; byte lastbyte = 0; int icwidth = 0; @@ -273,10 +273,10 @@ int cg = 0; int cb = 0; int grey = 0; - boolean iscolor = img.getColorSpace().getType() + final boolean iscolor = img.getColorSpace().getType() != ColorSpace.TYPE_GRAY; - int xres = (iw * 72000) / w; - int yres = (ih * 72000) / h; + final int xres = (iw * 72000) / w; + final int yres = (ih * 72000) / h; int resolution = xres; if (yres > xres) { resolution = yres; @@ -372,13 +372,13 @@ * * @param area the image area to render */ - public void render(ExternalGraphicArea area) { - int x = area.rrOriginX(); - int y = area.rrOriginY(); - int w = area.rrIPD(); - int h = area.rrBPD(); + public void render(final ExternalGraphicArea area) { + final int x = area.rrOriginX(); + final int y = area.rrOriginY(); + final int w = area.rrIPD(); + final int h = area.rrBPD(); - Graphic img = area.getGraphic(); + final Graphic img = area.getGraphic(); int xpos = xoffset + (x / 100); if (xpos < 0) { @@ -391,7 +391,7 @@ try { printBMP(img, x, y, w, h); - } catch (GraphicException e) { + } catch (final GraphicException e) { getLogger().error("PCLRenderer.renderImageArea() Error printing " + "BMP (" + e.toString() + ")"); } @@ -400,7 +400,7 @@ /** * render a foreign object area */ - public void render(ForeignObjectArea area) { + public void render(final ForeignObjectArea area) { // if n... [truncated message content] |
|
From: <vic...@us...> - 2006-07-23 23:17:54
|
Revision: 7829 Author: victormote Date: 2006-07-23 16:17:34 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7829&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-render/src/java/org/foray/render/PrintRenderer.java trunk/foray/foray-render/src/java/org/foray/render/Renderer.java trunk/foray/foray-render/src/java/org/foray/render/TempImage.java trunk/foray/foray-render/src/java/org/foray/render/ps/ASCII85OutputStream.java trunk/foray/foray-render/src/java/org/foray/render/ps/FlateEncodeOutputStream.java trunk/foray/foray-render/src/java/org/foray/render/ps/PSFont.java trunk/foray/foray-render/src/java/org/foray/render/ps/PSGraphics2D.java trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java trunk/foray/foray-render/src/java/org/foray/render/ps/PSStream.java trunk/foray/foray-render/src/java/org/foray/render/ps/RunLengthEncodeOutputStream.java trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java trunk/foray/foray-render/src/java/org/foray/render/svg/SVGUtilities.java trunk/foray/foray-render/src/java/org/foray/render/txt/TXTRenderer.java trunk/foray/foray-render/src/java/org/foray/render/txt/TXTStream.java trunk/foray/foray-render/src/java/org/foray/render/xml/XMLRenderer.java Modified: trunk/foray/foray-render/src/java/org/foray/render/PrintRenderer.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/PrintRenderer.java 2006-07-23 22:40:26 UTC (rev 7828) +++ trunk/foray/foray-render/src/java/org/foray/render/PrintRenderer.java 2006-07-23 23:17:34 UTC (rev 7829) @@ -43,23 +43,23 @@ */ public abstract class PrintRenderer extends Renderer { - public PrintRenderer(Log logger, OutputConfig renderConfig) { + public PrintRenderer(final Log logger, final OutputConfig renderConfig) { super(logger, renderConfig); } /** * @param area */ - protected void markBorder(Area area) { - int w = area.brIPD(); - int h = area.brBPD(); - int rx = area.brOriginX(); - int ry = area.brOriginY(); + protected void markBorder(final Area area) { + final int w = area.brIPD(); + final int h = area.brBPD(); + final int rx = area.brOriginX(); + final int ry = area.brOriginY(); - int left = area.getBorderLeftWidth(); - int right = area.getBorderRightWidth(); - int top = area.getBorderTopWidth(); - int bottom = area.getBorderBottomWidth(); + final int left = area.getBorderLeftWidth(); + final int right = area.getBorderRightWidth(); + final int top = area.getBorderTopWidth(); + final int bottom = area.getBorderBottomWidth(); // If style is solid, use filled rectangles if (top != 0) { drawRectangle(rx, ry, w, top, true, area.traitBorderTopColor(), @@ -82,10 +82,10 @@ } } - protected void renderGenericSpace(GeneralInlineArea area) { - int startX = area.rrOriginX(); + protected void renderGenericSpace(final GeneralInlineArea area) { + final int startX = area.rrOriginX(); int startY; - int endX = area.rrOriginX() + area.rrIPD(); + final int endX = area.rrOriginX() + area.rrIPD(); if (area.traitUnderlineScore()) { startY = getUnderlineYPosition(area); drawLine(startX, startY, endX, startY, getScoreSize(area), @@ -110,7 +110,7 @@ * @return The size, in millipoints, of the score that should be used for * area. */ - protected int getScoreSize(GeneralInlineArea area) { + protected int getScoreSize(final GeneralInlineArea area) { return area.traitFontSize() / 14; } @@ -119,9 +119,10 @@ * @param area The area whose metrics should be used for the computation. * @return The Y position that should be used for the underline stroke. */ - protected int getUnderlineYPosition(GeneralInlineArea area) { - Font font = area.getPrimaryFont().getFont(); - int underlinePosition = font.underlinePosition(area.traitFontSize()); + protected int getUnderlineYPosition(final GeneralInlineArea area) { + final Font font = area.getPrimaryFont().getFont(); + final int underlinePosition = font.underlinePosition( + area.traitFontSize()); return area.baselineY() + underlinePosition; } @@ -130,9 +131,10 @@ * @param area The area whose metrics should be used for the computation. * @return The Y position that should be used for the overline stroke. */ - protected int getOverlineYPosition(GeneralInlineArea area) { - Font font = area.getPrimaryFont().getFont(); - int overlinePosition = font.overlinePosition(area.traitFontSize()); + protected int getOverlineYPosition(final GeneralInlineArea area) { + final Font font = area.getPrimaryFont().getFont(); + final int overlinePosition = font.overlinePosition( + area.traitFontSize()); return area.baselineY() + overlinePosition; } @@ -141,9 +143,10 @@ * @param area The area whose metrics should be used for the computation. * @return The Y position that should be used for the through stroke. */ - protected int getThroughYPosition(GeneralInlineArea area) { - Font font = area.getPrimaryFont().getFont(); - int strikeoutPosition = font.strikeoutPosition(area.traitFontSize()); + protected int getThroughYPosition(final GeneralInlineArea area) { + final Font font = area.getPrimaryFont().getFont(); + final int strikeoutPosition = font.strikeoutPosition( + area.traitFontSize()); return area.baselineY() + strikeoutPosition; } @@ -152,7 +155,7 @@ * * @param area area to render */ - public void render(LeaderArea area) { + public void render(final LeaderArea area) { // Handle text decoration. renderGenericSpace(area); @@ -160,7 +163,7 @@ return; } if (area.traitLeaderPattern() == Constants.FOVAL_DOTS) { - char[] text = area.dotLeaderText(); + final char[] text = area.dotLeaderText(); if (text == null) { return; } @@ -168,11 +171,11 @@ renderTextSegment(area, text); return; } - int rx = area.rrOriginX(); - int ry = area.rrOriginY(); - int w = area.rrIPD(); - int th = area.traitRuleThickness(); - int st = area.traitRuleStyle(); + final int rx = area.rrOriginX(); + final int ry = area.rrOriginY(); + final int w = area.rrIPD(); + final int th = area.traitRuleThickness(); + final int st = area.traitRuleStyle(); // checks whether thickness is = 0, because of bug in pdf (or where?), // a line with thickness 0 is still displayed @@ -200,8 +203,8 @@ } } - public void render(TextArea area) { - char[] text = area.getText(); + public void render(final TextArea area) { + final char[] text = area.getText(); renderGenericSpace(area); renderTextSegment(area, text); } Modified: trunk/foray/foray-render/src/java/org/foray/render/Renderer.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/Renderer.java 2006-07-23 22:40:26 UTC (rev 7828) +++ trunk/foray/foray-render/src/java/org/foray/render/Renderer.java 2006-07-23 23:17:34 UTC (rev 7829) @@ -92,11 +92,11 @@ /** * Constructor. */ - public Renderer(Log logger, OutputConfig renderConfig) { + public Renderer(final Log logger, final OutputConfig renderConfig) { super(logger, renderConfig); } - public void setAreaTree(AreaTree areaTree) { + public void setAreaTree(final AreaTree areaTree) { this.areaTree = areaTree; } @@ -112,7 +112,7 @@ * Renders an area's background. * @param area The area whose background should be rendered. */ - protected void markBackground(BackgroundArea area) { + protected void markBackground(final BackgroundArea area) { markBackgroundColor(area); markBackgroundImage(area); } @@ -120,21 +120,21 @@ /** * @param area */ - private void markBackgroundColor(BackgroundArea area) { + private void markBackgroundColor(final BackgroundArea area) { /* * Per XSL-FO Spec 1.0, Section 4.9.4, the background is rendered * inside the padding-rectangle. */ - int x = area.prOriginX(); - int y = area.prOriginY(); - int w = area.prIPD(); - int h = area.prBPD(); + final int x = area.prOriginX(); + final int y = area.prOriginY(); + final int w = area.prIPD(); + final int h = area.prBPD(); if (h == 0 || w == 0) { return; } - Color backgroundColor = area.traitBackgroundColor(); + final Color backgroundColor = area.traitBackgroundColor(); if (backgroundColor.getAlpha() == 255) { this.drawRectangle(x, y, w, -h, false, null, true, backgroundColor); } @@ -143,8 +143,8 @@ /** * @param area */ - private void markBackgroundImage(BackgroundArea area) { - Graphic backgroundImage = area.traitBackgroundImage(); + private void markBackgroundImage(final BackgroundArea area) { + final Graphic backgroundImage = area.traitBackgroundImage(); if (backgroundImage == null) { return; } @@ -152,10 +152,10 @@ * Per XSL-FO Spec 1.0, Section 4.9.4, the background is rendered * inside the padding-rectangle. */ - int x = area.prOriginX(); - int y = area.prOriginY(); - int w = area.prIPD(); - int h = area.prBPD(); + final int x = area.prOriginX(); + final int y = area.prOriginY(); + final int w = area.prIPD(); + final int h = area.prBPD(); if (h == 0 || w == 0) { return; @@ -167,7 +167,7 @@ imgW = backgroundImage.absoluteWidth(getPixelsPerInch()); imgH = backgroundImage.absoluteHeight(getPixelsPerInch()); } - catch (GraphicException fie) { + catch (final GraphicException fie) { getLogger().error("Error obtaining bg image width and height"); getLogger().error(fie.getMessage()); return; @@ -175,13 +175,13 @@ int currentX = x; int currentY = y; - int endX = x + w; - int endY = y - h; - int clipW = w % imgW; - int clipH = h % imgH; + final int endX = x + w; + final int endY = y - h; + final int clipW = w % imgW; + final int clipH = h % imgH; - boolean repeatX = area.backgroundRepeatX(); - boolean repeatY = area.backgroundRepeatY(); + final boolean repeatX = area.backgroundRepeatX(); + final boolean repeatY = area.backgroundRepeatY(); Rectangle contentRectangle = null; Rectangle clipRectangle = null; @@ -294,10 +294,10 @@ * @param clipRectangle The rectangle to which the content should be clipped * after any scaling. */ - protected void drawGraphic(GraphicArea area, Graphic graphic, - Rectangle contentRectangle, Rectangle clipRectangle) { + protected void drawGraphic(final GraphicArea area, final Graphic graphic, + final Rectangle contentRectangle, final Rectangle clipRectangle) { if (graphic instanceof SVGGraphic) { - SVGGraphic svg = (SVGGraphic) graphic; + final SVGGraphic svg = (SVGGraphic) graphic; drawSVG(area, svg, contentRectangle, clipRectangle); return; } @@ -318,7 +318,7 @@ protected abstract void drawSVG(GraphicArea area, SVGGraphic graphic, Rectangle contentRectangle, Rectangle clipRectangle) ; - public void render(AreaNode node) { + public void render(final AreaNode node) { renderChildren(node); } @@ -327,7 +327,7 @@ * * @param page the page whose regions to render */ - protected void renderRegions(PageArea page) { + protected void renderRegions(final PageArea page) { render(page.getRegionBody()); if (page.getRegionBefore() != null) { render(page.getRegionBefore()); @@ -348,13 +348,13 @@ * * @param area the area container to render */ - public void render(BlockContainerArea area) { + public void render(final BlockContainerArea area) { markBorder(area); markBackground(area); renderChildren(area); } - public void render(RegionBodyArea area) { + public void render(final RegionBodyArea area) { markBackground(area); renderChildren(area); } @@ -364,7 +364,7 @@ * * @param area the region area container to render */ - public void render(RegionArea area) { + public void render(final RegionArea area) { markBackground(area); renderChildren(area); } @@ -372,18 +372,18 @@ /** * render the given span area */ - public void render(SpanArea area) { + public void render(final SpanArea area) { renderChildren(area); } - public void render(NormalFlowArea area) { + public void render(final NormalFlowArea area) { renderChildren(area); } - public void renderChildren(AreaNode area) { - List children = area.getChildren(); + public void renderChildren(final AreaNode area) { + final List children = area.getChildren(); for (int i = 0; i < children.size(); i++) { - AreaNode child = (AreaNode)children.get(i); + final AreaNode child = (AreaNode)children.get(i); child.render(this); } } @@ -393,7 +393,7 @@ * * @param area the block area to render */ - public void render(NormalBlockArea area) { + public void render(final NormalBlockArea area) { markBorder(area); markBackground(area); renderChildren(area); @@ -412,13 +412,13 @@ /** * render the given image area */ - public void render(ExternalGraphicArea area) { - Graphic graphic = area.getGraphic(); + public void render(final ExternalGraphicArea area) { + final Graphic graphic = area.getGraphic(); if (graphic == null) { getLogger().error("(Render) ImageArea contains no graphic."); return; } - Rectangle contentRect = new Rectangle(area.rrOriginX(), + final Rectangle contentRect = new Rectangle(area.rrOriginX(), area.rrOriginY(), area.rrIPD(), area.rrBPD()); drawGraphic(area, graphic, contentRect, null); } @@ -427,13 +427,13 @@ * Render a table-reference-area. * @param area The TableRA instance to render. */ - public void render(TableArea area) { + public void render(final TableArea area) { /* Render background Areas for the table-related background-only * areas. */ - BackgroundArea[] backgroundAreas = area.getBackgroundAreas(); + final BackgroundArea[] backgroundAreas = area.getBackgroundAreas(); if (backgroundAreas != null) { for (int i = 0; i < backgroundAreas.length; i++) { - BackgroundArea bga = backgroundAreas[i]; + final BackgroundArea bga = backgroundAreas[i]; markBackground(bga); } } @@ -449,7 +449,7 @@ * * @param area the area container to render */ - public void render(TableCellArea area) { + public void render(final TableCellArea area) { markBorder(area); markBackground(area); renderChildren(area); @@ -470,7 +470,7 @@ * Render a line-area. * @param area area to render */ - public void render(LineArea area) { + public void render(final LineArea area) { area.optimizeLine(); renderChildren(area); } @@ -484,34 +484,34 @@ public abstract void render(BookmarkTreeArea area); - public void render(FootnoteArea area) { + public void render(final FootnoteArea area) { renderChildren(area); } - public void render(BeforeFloatArea area) { + public void render(final BeforeFloatArea area) { renderChildren(area); } - public void render(MainReferenceArea area) { + public void render(final MainReferenceArea area) { renderChildren(area); } - public void render(PageNumberCitationArea area) { + public void render(final PageNumberCitationArea area) { renderTextSegment(area, area.resolve().toCharArray()); } - public void render(PageNumberArea area) { + public void render(final PageNumberArea area) { renderTextSegment(area, area.resolve().toCharArray()); } - public void render(BasicLinkArea area) { + public void render(final BasicLinkArea area) { createBasicLink(area); renderChildren(area); } protected abstract void createBasicLink(BasicLinkArea area) ; - public void render(InlineArea area) { + public void render(final InlineArea area) { markBorder(area); markBackground(area); renderChildren(area); @@ -523,9 +523,9 @@ * includes items like Destinations and Bookmarks. */ protected void renderDocumentNodes() { - List children = this.areaTree.getChildren(); + final List children = this.areaTree.getChildren(); for (int i = 0; i < children.size(); i++) { - AreaNode atNode = (AreaNode) children.get(i); + final AreaNode atNode = (AreaNode) children.get(i); if (! (atNode instanceof PageCollection)) { atNode.render(this); } @@ -544,7 +544,7 @@ * @return A Batik BridgeContext instance. */ public BridgeContext makeBridgeContext() { - SVGUserAgent userAgent = new SVGUserAgent(new AffineTransform()); + final SVGUserAgent userAgent = new SVGUserAgent(new AffineTransform()); userAgent.setLogger(getLogger()); return new BridgeContext(userAgent); } @@ -555,7 +555,7 @@ * @return A Batik BridgeContext instance. */ public BridgeContext makeBridgeContextAWT() { - MUserAgent userAgent = new MUserAgent(new AffineTransform()); + final MUserAgent userAgent = new MUserAgent(new AffineTransform()); userAgent.setLogger(getLogger()); return new BridgeContext(userAgent); } @@ -566,7 +566,7 @@ * @return A new rectangle whose dimensions are stored as points. */ public static Rectangle2D.Float convertMillipointRectangle( - Rectangle input) { + final Rectangle input) { if (input == null) { return null; } Modified: trunk/foray/foray-render/src/java/org/foray/render/TempImage.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/TempImage.java 2006-07-23 22:40:26 UTC (rev 7828) +++ trunk/foray/foray-render/src/java/org/foray/render/TempImage.java 2006-07-23 23:17:34 UTC (rev 7829) @@ -47,8 +47,8 @@ Color transparent = new Color(255, 255, 255); URL url; - public TempImage(URL url, int width, int height, byte[] result, - byte[] mask) throws GraphicException { + public TempImage(final URL url, final int width, final int height, + final byte[] result, final byte[] mask) throws GraphicException { this.url = url; this.m_height = height; this.m_width = width; @@ -164,14 +164,14 @@ /** * {@inheritDoc} */ - public int absoluteWidth(int pixelsPerInch) throws GraphicException { + public int absoluteWidth(final int pixelsPerInch) throws GraphicException { return -1; } /** * {@inheritDoc} */ - public int absoluteHeight(int pixelsPerInch) throws GraphicException { + public int absoluteHeight(final int pixelsPerInch) throws GraphicException { return -1; } Modified: trunk/foray/foray-render/src/java/org/foray/render/ps/ASCII85OutputStream.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/ps/ASCII85OutputStream.java 2006-07-23 22:40:26 UTC (rev 7828) +++ trunk/foray/foray-render/src/java/org/foray/render/ps/ASCII85OutputStream.java 2006-07-23 23:17:34 UTC (rev 7829) @@ -60,12 +60,12 @@ private int bw = 0; - public ASCII85OutputStream(OutputStream out) { + public ASCII85OutputStream(final OutputStream out) { super(out); } - public void write(int b) throws IOException { + public void write(final int b) throws IOException { if (pos == 0) { buffer += (b << 24) & 0xff000000L; } else if (pos == 1) { @@ -84,30 +84,32 @@ } } - private void checkedWrite(byte[] buf) throws IOException { + private void checkedWrite(final byte[] buf) throws IOException { checkedWrite(buf, buf.length, false); } - private void checkedWrite(byte[] buf, boolean nosplit) throws IOException { + private void checkedWrite(final byte[] buf, final boolean nosplit) + throws IOException { checkedWrite(buf, buf.length, nosplit); } - private void checkedWrite(byte[] buf , int len) throws IOException { + private void checkedWrite(final byte[] buf, final int len) + throws IOException { checkedWrite(buf, len, false); } - private void checkedWrite(byte[] buf , int len, boolean nosplit) - throws IOException { + private void checkedWrite(final byte[] buf, final int len, + final boolean nosplit) throws IOException { if (posinline + len > 80) { - int firstpart = (nosplit ? 0 : len - (posinline + len - 80)); + final int firstpart = (nosplit ? 0 : len - (posinline + len - 80)); if (firstpart > 0) { out.write(buf, 0, firstpart); } out.write(EOL); bw++; - int rest = len - firstpart; + final int rest = len - firstpart; if (rest > 0) { out.write(buf, firstpart, rest); } @@ -138,21 +140,21 @@ if (word < 0) { word = -word; } - byte c1 = (byte)((word / base85_1) & 0xFF); - byte c2 = (byte)(((word - (c1 * base85_1)) / base85_2) & 0xFF); - byte c3 = + final byte c1 = (byte)((word / base85_1) & 0xFF); + final byte c2 = (byte)(((word - (c1 * base85_1)) / base85_2) & 0xFF); + final byte c3 = (byte)(((word - (c1 * base85_1) - (c2 * base85_2)) / base85_3) & 0xFF); - byte c4 = + final byte c4 = (byte)(((word - (c1 * base85_1) - (c2 * base85_2) - (c3 * base85_3)) / base85_4) & 0xFF); - byte c5 = + final byte c5 = (byte)(((word - (c1 * base85_1) - (c2 * base85_2) - (c3 * base85_3) - (c4 * base85_4))) & 0xFF); - byte[] ret = { + final byte[] ret = { (byte)(c1 + START), (byte)(c2 + START), (byte)(c3 + START), (byte)(c4 + START), (byte)(c5 + START) @@ -175,7 +177,7 @@ // then convert like normal (except not applying the special zero rule) // and write out the first n+1 bytes from the result if (pos > 0) { - int rest = pos; + final int rest = pos; /* byte[] lastdata = new byte[4]; int i = 0; Modified: trunk/foray/foray-render/src/java/org/foray/render/ps/FlateEncodeOutputStream.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/ps/FlateEncodeOutputStream.java 2006-07-23 22:40:26 UTC (rev 7828) +++ trunk/foray/foray-render/src/java/org/foray/render/ps/FlateEncodeOutputStream.java 2006-07-23 23:17:34 UTC (rev 7829) @@ -42,7 +42,7 @@ implements Finalizable { - public FlateEncodeOutputStream(OutputStream out) { + public FlateEncodeOutputStream(final OutputStream out) { super(out); } Modified: trunk/foray/foray-render/src/java/org/foray/render/ps/PSFont.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/ps/PSFont.java 2006-07-23 22:40:26 UTC (rev 7828) +++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSFont.java 2006-07-23 23:17:34 UTC (rev 7829) @@ -48,7 +48,7 @@ * @param fontUse The FontUse instance which is the basis for this * PostScript font. */ - public PSFont(FontUse fontUse, int count) { + public PSFont(final FontUse fontUse, final int count) { super(); this.fontUse = fontUse; this.fontCount = count; Modified: trunk/foray/foray-render/src/java/org/foray/render/ps/PSGraphics2D.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/ps/PSGraphics2D.java 2006-07-23 22:40:26 UTC (rev 7828) +++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSGraphics2D.java 2006-07-23 23:17:34 UTC (rev 7829) @@ -112,8 +112,8 @@ * This is used to create a Graphics object for use inside an already * existing document. */ - public PSGraphics2D(boolean textAsShapes, PSRenderer ren, - String font, int size, int xpos, int ypos) { + public PSGraphics2D(final boolean textAsShapes, final PSRenderer ren, + final String font, final int size, final int xpos, final int ypos) { super(textAsShapes); psRenderer = ren; currentFontName = font; @@ -122,18 +122,18 @@ currentXPosition = xpos; } - public PSGraphics2D(boolean textAsShapes) { + public PSGraphics2D(final boolean textAsShapes) { super(textAsShapes); } - public void setGraphicContext(GraphicContext c) { + public void setGraphicContext(final GraphicContext c) { gc = c; } /** * This constructor supports the create method */ - public PSGraphics2D(PSGraphics2D g) { + public PSGraphics2D(final PSGraphics2D g) { super(g); } @@ -172,17 +172,18 @@ * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, * int, int, int) */ - public boolean drawImage(Image img, int x, int y, ImageObserver observer) { + public boolean drawImage(final Image img, final int x, final int y, + final ImageObserver observer) { final int width = img.getWidth(observer); final int height = img.getHeight(observer); if (width == -1 || height == -1) { return false; } - Dimension size = new Dimension(width, height); - BufferedImage buf = buildBufferedImage(size); + final Dimension size = new Dimension(width, height); + final BufferedImage buf = buildBufferedImage(size); - Graphics2D g = buf.createGraphics(); + final Graphics2D g = buf.createGraphics(); g.setComposite(AlphaComposite.SrcOver); g.setBackground(new Color(1, 1, 1, 0)); g.setPaint(new Color(1, 1, 1, 0)); @@ -197,13 +198,13 @@ final byte[] result = new byte[buf.getWidth() * buf.getHeight() * 3]; final byte[] mask = new byte[buf.getWidth() * buf.getHeight()]; - Raster raster = buf.getData(); - DataBuffer bd = raster.getDataBuffer(); + final Raster raster = buf.getData(); + final DataBuffer bd = raster.getDataBuffer(); int count = 0; switch (bd.getDataType()) { case DataBuffer.TYPE_INT: - int[][] idata = ((DataBufferInt)bd).getBankData(); + final int[][] idata = ((DataBufferInt)bd).getBankData(); for (int i = 0; i < idata.length; i++) { for (int j = 0; j < idata[i].length; j++) { // mask[maskpos++] = (byte)((idata[i][j] >> 24) & 0xFF); @@ -225,12 +226,13 @@ } try { - Graphic graphic = new TempImage(null, width, height, result, mask); - AffineTransform at = getTransform(); - double[] matrix = new double[6]; + final Graphic graphic = new TempImage(null, width, height, result, + mask); + final AffineTransform at = getTransform(); + final double[] matrix = new double[6]; at.getMatrix(matrix); psRenderer.write("gsave"); - Shape imclip = getClip(); + final Shape imclip = getClip(); writeClip(imclip); psRenderer.write("1000 -1000 scale"); // psRenderer.write("" + matrix[0] + " " + matrix[1] + @@ -238,13 +240,13 @@ // matrix[4] + " " + matrix[5] + " cm\n"); psRenderer.renderBitmap(graphic, x, -y, width, height); psRenderer.write("grestore"); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } return true; } - public BufferedImage buildBufferedImage(Dimension size) { + public BufferedImage buildBufferedImage(final Dimension size) { return new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB); } @@ -283,8 +285,8 @@ * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, * int, int, int) */ - public boolean drawImage(Image img, int x, int y, int width, int height, - ImageObserver observer) { + public boolean drawImage(final Image img, final int x, final int y, + final int width, final int height, final ImageObserver observer) { return true; } @@ -335,11 +337,11 @@ * @see AbstractGraphics2D#clip * @see AbstractGraphics2D#setComposite */ - public void draw(Shape s) { + public void draw(final Shape s) { psRenderer.write("gsave"); - Shape imclip = getClip(); + final Shape imclip = getClip(); writeClip(imclip); - Color c = getColor(); + final Color c = getColor(); psRenderer.write(c.getRed() + " " + c.getGreen() + " " + c.getBlue() + " setrgbcolor"); @@ -347,10 +349,10 @@ applyStroke(getStroke()); psRenderer.write("newpath"); - PathIterator iter = s.getPathIterator(getTransform()); + final PathIterator iter = s.getPathIterator(getTransform()); while (!iter.isDone()) { - double vals[] = new double[6]; - int type = iter.currentSegment(vals); + final double vals[] = new double[6]; + final int type = iter.currentSegment(vals); switch (type) { case PathIterator.SEG_CUBICTO: psRenderer.write(PSReal.doubleOut(1000 * vals[0]) + " " @@ -389,12 +391,12 @@ psRenderer.write("grestore"); } - protected void writeClip(Shape s) { - PathIterator iter = s.getPathIterator(getTransform()); + protected void writeClip(final Shape s) { + final PathIterator iter = s.getPathIterator(getTransform()); psRenderer.write("newpath"); while (!iter.isDone()) { - double vals[] = new double[6]; - int type = iter.currentSegment(vals); + final double vals[] = new double[6]; + final int type = iter.currentSegment(vals); switch (type) { case PathIterator.SEG_CUBICTO: psRenderer.write(PSReal.doubleOut(1000 * vals[0]) + " " @@ -433,39 +435,39 @@ psRenderer.write("clippath"); } - protected void applyPaint(Paint paint, boolean fill) { + protected void applyPaint(final Paint paint, final boolean fill) { if (paint instanceof GradientPaint) { - GradientPaint gp = (GradientPaint)paint; - Color c1 = gp.getColor1(); - Color c2 = gp.getColor2(); - Point2D p1 = gp.getPoint1(); - Point2D p2 = gp.getPoint2(); + final GradientPaint gp = (GradientPaint)paint; + final Color c1 = gp.getColor1(); + final Color c2 = gp.getColor2(); + final Point2D p1 = gp.getPoint1(); + final Point2D p2 = gp.getPoint2(); - ArrayList theCoords = new ArrayList(); + final ArrayList theCoords = new ArrayList(); theCoords.add(new Double(p1.getX())); theCoords.add(new Double(p1.getY())); theCoords.add(new Double(p2.getX())); theCoords.add(new Double(p2.getY())); - ArrayList theExtend = new ArrayList(); + final ArrayList theExtend = new ArrayList(); theExtend.add(new Boolean(true)); theExtend.add(new Boolean(true)); - ArrayList theDomain = new ArrayList(); + final ArrayList theDomain = new ArrayList(); theDomain.add(new Double(0)); theDomain.add(new Double(1)); - ArrayList theEncode = new ArrayList(); + final ArrayList theEncode = new ArrayList(); theEncode.add(new Double(0)); theEncode.add(new Double(1)); theEncode.add(new Double(0)); theEncode.add(new Double(1)); - ArrayList theBounds = new ArrayList(); + final ArrayList theBounds = new ArrayList(); theBounds.add(new Double(0)); theBounds.add(new Double(1)); - ArrayList someColors = new ArrayList(); + final ArrayList someColors = new ArrayList(); someColors.add(c1); someColors.add(c2); @@ -473,11 +475,11 @@ } else if (paint instanceof TexturePaint) {} } - protected void applyStroke(Stroke stroke) { + protected void applyStroke(final Stroke stroke) { if (stroke instanceof BasicStroke) { - BasicStroke bs = (BasicStroke)stroke; + final BasicStroke bs = (BasicStroke)stroke; - float[] da = bs.getDashArray(); + final float[] da = bs.getDashArray(); if (da != null) { psRenderer.write("["); for (int count = 0; count < da.length; count++) { @@ -487,10 +489,10 @@ } } psRenderer.write("] "); - float offset = bs.getDashPhase(); + final float offset = bs.getDashPhase(); psRenderer.write((1000 * (int)offset) + " setdash"); } - int ec = bs.getEndCap(); + final int ec = bs.getEndCap(); switch (ec) { case BasicStroke.CAP_BUTT: psRenderer.write(0 + " setlinecap"); @@ -503,7 +505,7 @@ break; } - int lj = bs.getLineJoin(); + final int lj = bs.getLineJoin(); switch (lj) { case BasicStroke.JOIN_MITER: psRenderer.write(0 + " setlinejoin"); @@ -515,11 +517,11 @@ psRenderer.write(2 + " setlinejoin"); break; } - float lw = bs.getLineWidth(); + final float lw = bs.getLineWidth(); psRenderer.write(PSReal.doubleOut(1000 * lw) + " setlinewidth"); - float ml = bs.getMiterLimit(); + final float ml = bs.getMiterLimit(); psRenderer.write(PSReal.doubleOut(1000 * ml) + " setmiterlimit"); } @@ -544,7 +546,8 @@ * @see AbstractGraphics2D#setComposite * @see AbstractGraphics2D#clip */ - public void drawRenderedImage(RenderedImage img, AffineTransform xform) { + public void drawRenderedImage(final RenderedImage img, + final AffineTransform xform) { } @@ -579,8 +582,8 @@ * @see AbstractGraphics2D#setClip(java.awt.Shape) * @see #drawRenderedImage */ - public void drawRenderableImage(RenderableImage img, - AffineTransform xform) { + public void drawRenderableImage(final RenderableImage img, + final AffineTransform xform) { } /** @@ -607,17 +610,17 @@ * @see AbstractGraphics2D#setComposite * @see AbstractGraphics2D#setClip(java.awt.Shape) */ - public void drawString(String s, float x, float y) { + public void drawString(final String s, final float x, final float y) { psRenderer.write("BT"); - Shape imclip = getClip(); + final Shape imclip = getClip(); writeClip(imclip); - Color c = getColor(); + final Color c = getColor(); psRenderer.write(c.getRed() + " " + c.getGreen() + " " + c.getBlue() + " setrgbcolor"); - AffineTransform trans = getTransform(); + final AffineTransform trans = getTransform(); trans.translate(x, y); - double[] vals = new double[6]; + final double[] vals = new double[6]; trans.getMatrix(vals); psRenderer.write(PSReal.doubleOut(vals[0]) + " " @@ -654,18 +657,18 @@ * @see AbstractGraphics2D#setComposite * @see AbstractGraphics2D#setClip(java.awt.Shape) */ - public void drawString(AttributedCharacterIterator iterator, float x, - float y) { + public void drawString(final AttributedCharacterIterator iterator, + final float x, final float y) { psRenderer.getLogger().error("drawString(AttributedCharacterIterator)"); psRenderer.write("BT"); - Shape imclip = getClip(); + final Shape imclip = getClip(); writeClip(imclip); psRenderer.write(PSColor.toPS(getColor(), true, "\n")); psRenderer.write(PSColor.toPS(getBackground(), true, "\n")); - AffineTransform trans = getTransform(); + final AffineTransform trans = getTransform(); trans.translate(x, y); - double[] vals = new double[6]; + final double[] vals = new double[6]; trans.getMatrix(vals); for (char ch = iterator.first(); ch != CharacterIterator.DONE; @@ -698,21 +701,21 @@ * @see AbstractGraphics2D#clip * @see AbstractGraphics2D#setClip(java.awt.Shape) */ - public void fill(Shape s) { + public void fill(final Shape s) { psRenderer.write("gsave"); - Shape imclip = getClip(); + final Shape imclip = getClip(); writeClip(imclip); - Color c = getColor(); + final Color c = getColor(); psRenderer.write(c.getRed() + " " + c.getGreen() + " " + c.getBlue() + " setrgbcolor"); applyPaint(getPaint(), true); psRenderer.write("newpath"); - PathIterator iter = s.getPathIterator(getTransform()); + final PathIterator iter = s.getPathIterator(getTransform()); while (!iter.isDone()) { - double vals[] = new double[6]; - int type = iter.currentSegment(vals); + final double vals[] = new double[6]; + final int type = iter.currentSegment(vals); switch (type) { case PathIterator.SEG_CUBICTO: psRenderer.write(PSReal.doubleOut(1000 * vals[0]) + " " @@ -752,7 +755,8 @@ psRenderer.write("grestore"); } - protected void doDrawing(boolean fill, boolean stroke, boolean nonzero) { + protected void doDrawing(final boolean fill, final boolean stroke, + final boolean nonzero) { if (fill) { if (stroke) { if (!nonzero) { @@ -788,7 +792,8 @@ private Graphics2D fmg; { - BufferedImage bi = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); + final BufferedImage bi = new BufferedImage(1, 1, + BufferedImage.TYPE_INT_ARGB); fmg = bi.createGraphics(); } @@ -800,7 +805,7 @@ * @see java.awt.FontMetrics * @see java.awt.Graphics#getFontMetrics() */ - public FontMetrics getFontMetrics(Font f) { + public FontMetrics getFontMetrics(final Font f) { return fmg.getFontMetrics(f); } @@ -819,7 +824,7 @@ * drawn twice, then all pixels are restored to their original values. * @param c1 the XOR alternation color */ - public void setXORMode(Color c1) { + public void setXORMode(final Color c1) { } @@ -842,8 +847,8 @@ * @param dx the horizontal distance to copy the pixels. * @param dy the vertical distance to copy the pixels. */ - public void copyArea(int x, int y, int width, int height, int dx, - int dy) { + public void copyArea(final int x, final int y, final int width, + final int height, final int dx, final int dy) { } } Modified: trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2006-07-23 22:40:26 UTC (rev 7828) +++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2006-07-23 23:17:34 UTC (rev 7829) @@ -156,7 +156,7 @@ */ private HashMap fontMap = new HashMap(); - public PSRenderer(Log logger, OutputConfig renderConfig) { + public PSRenderer(final Log logger, final OutputConfig renderConfig) { super(logger, renderConfig); } @@ -165,7 +165,7 @@ * * @param level You can specify either 2 or 3 for the PostScript Level */ - public void setPSLevel(int level) { + public void setPSLevel(final int level) { switch (level) { case 2: case 3: @@ -182,7 +182,7 @@ return this.psLevel; } - public void setAutoRotateLandscape(boolean value) { + public void setAutoRotateLandscape(final boolean value) { this.autoRotateLandscape = value; } @@ -193,10 +193,10 @@ /** * write out a command */ - protected void write(String cmd) { + protected void write(final String cmd) { try { out.write(cmd); - } catch (IOException e) { + } catch (final IOException e) { if (!ioTrouble) { e.printStackTrace(); } @@ -207,10 +207,10 @@ /** * write out a command */ - protected void writeRaw(String cmd) { + protected void writeRaw(final String cmd) { try { out.writeRaw(cmd); - } catch (IOException e) { + } catch (final IOException e) { if (!ioTrouble) { e.printStackTrace(); } @@ -221,7 +221,7 @@ /** * write out a comment */ - protected void comment(String comment) { + protected void comment(final String comment) { if (this.enableComments) { write(comment); } @@ -303,21 +303,23 @@ } protected void writeFontDict() { - FontUse[] fontUses = getFontConsumer().getUsedFontUses(); + final FontUse[] fontUses = getFontConsumer().getUsedFontUses(); /* Embed fonts. */ for (int i = 0; i < fontUses.length; i++) { - FontUse fontUse = fontUses[i]; - FontPS fontPS = (FontPS) fontUse.getFontOutput("application/ps"); + final FontUse fontUse = fontUses[i]; + final FontPS fontPS = (FontPS) fontUse.getFontOutput( + "application/ps"); /* For now, we don't know how to process TrueType fonts. */ if (! (fontUses[i].getEncoding() instanceof EncodingVector)) { continue; } - Font font = fontUse.getFont(); + final Font font = fontUse.getFont(); if (! font.isEmbeddable()) { continue; } - String fontContents = new String(fontPS.getContentsPostScriptHex()); + final String fontContents = new String( + fontPS.getContentsPostScriptHex()); write(fontContents); } @@ -329,12 +331,12 @@ /* Bind each font to a short resource name. */ for (int i = 0; i < fontUses.length; i++) { - FontUse fontUse = fontUses[i]; + final FontUse fontUse = fontUses[i]; /* For now, we don't know how to process TrueType fonts. */ if (! (fontUses[i].getEncoding() instanceof EncodingVector)) { continue; } - PSFont psFont = getPSFont(fontUse); + final PSFont psFont = getPSFont(fontUse); write("/" + psFont.getName() + " /" + fontUse.getPostscriptName() + " def"); } @@ -342,10 +344,10 @@ write("%%EndResource"); /* Get a List of all EncodingVectors used. */ - ArrayList encodingsUsed = new ArrayList(); + final ArrayList encodingsUsed = new ArrayList(); for (int i = 0; i < fontUses.length; i++) { - Encoding encoding = fontUses[i].getEncoding(); - Font font = fontUses[i].getFont(); + final Encoding encoding = fontUses[i].getEncoding(); + final Font font = fontUses[i].getFont(); /* If the FontUse has the same encoding as the Font, there is no * need to write the encoding again, because it is already defined * in the Font dictionary itself. */ @@ -368,7 +370,7 @@ /* Except PostScript-native encodings, write each encoding vector. */ for (int i = 0; i < encodingsUsed.size(); i++) { - EncodingVector vector = (EncodingVector) encodingsUsed.get(i); + final EncodingVector vector = (EncodingVector) encodingsUsed.get(i); if (! vector.isPredefinedPS()) { writeRaw(vector.asPostScript(null)); } @@ -376,8 +378,8 @@ /* Bind the proper encoding to each font. */ for (int i = 0; i < fontUses.length; i++) { - FontUse fontUse = fontUses[i]; - Font font = fontUse.getFont(); + final FontUse fontUse = fontUses[i]; + final Font font = fontUse.getFont(); EncodingVector vector = null; if (! (fontUse.getEncoding() instanceof EncodingVector)) { /* For now, we don't know how to handle TrueType fonts here. */ @@ -401,21 +403,23 @@ /** * {@inheritDoc} */ - protected void drawLine(int startX, int startY, int endX, int endY, - int thickness, int ruleStyle, Color strokeColor) { + protected void drawLine(final int startX, final int startY, final int endX, + final int endY, final int thickness, final int ruleStyle, + final Color strokeColor) { //TODO: Implement this. } /** * {@inheritDoc} */ - protected void drawRectangle(int x, int y, int w, int h, - boolean stroke, Color strokeColor, boolean fill, - Color fillColor) { + protected void drawRectangle(final int x, final int y, final int w, + final int h, final boolean stroke, final Color strokeColor, + final boolean fill, final Color fillColor) { //TODO: Implement this. } - protected void addFilledRect(int x, int y, int w, int h, Color col) { + protected void addFilledRect(final int x, final int y, final int w, + int h, final Color col) { // XXX: cater for braindead, legacy -ve heights if (h < 0) { h = -h; @@ -438,7 +442,7 @@ /** * render a foreign object area */ - public void render(ForeignObjectArea area) { + public void render(final ForeignObjectArea area) { render(area.getContainedForeignObject()); } @@ -447,9 +451,9 @@ * * @param area the area to render */ - public void render(SVGArea area) { - int x = area.rrOriginX(); - int y = area.rrOriginY(); + public void render(final SVGArea area) { + final int x = area.rrOriginX(); + final int y = area.rrOriginY(); renderSVGDocument(area.getSVGDocument(), x, y, area); } @@ -460,34 +464,34 @@ * @param x the x offset * @param y the y offset */ - protected void renderSVGDocument(Document doc, int x, int y, - GraphicArea area) { + protected void renderSVGDocument(final Document doc, final int x, + final int y, final GraphicArea area) { BridgeContext ctx = makeBridgeContext(); GVTBuilder builder = new GVTBuilder(); GraphicsNode root; try { root = builder.build(ctx, doc); - } catch (Exception e) { + } catch (final Exception e) { getLogger().error("svg graphic could not be built: " + e.getMessage()); getLogger().error(e.getMessage()); return; } // get the 'width' and 'height' attributes of the SVG document - float w = (float)ctx.getDocumentSize().getWidth() * 1000f; - float h = (float)ctx.getDocumentSize().getHeight() * 1000f; + final float w = (float)ctx.getDocumentSize().getWidth() * 1000f; + final float h = (float)ctx.getDocumentSize().getHeight() * 1000f; //log.debug("drawing SVG image: "+x+"/"+y+" "+w+"/"+h); - SVGSVGElement svg = ((SVGDocument) doc).getRootElement(); - AffineTransform at = ViewBox.getPreserveAspectRatioTransform(svg, + final SVGSVGElement svg = ((SVGDocument) doc).getRootElement(); + final AffineTransform at = ViewBox.getPreserveAspectRatioTransform(svg, w/1000f , h/1000f); ctx = null; builder = null; - float sx = 1, sy = -1; - int xOffset = x, yOffset = y; + final float sx = 1, sy = -1; + final int xOffset = x, yOffset = y; comment("% --- SVG Area"); write("gsave"); @@ -508,13 +512,13 @@ + (-at.getTranslateY() * 1000) + " translate"); write(sx * at.getScaleX() + " " + sy * at.getScaleY() + " scale"); - PSGraphics2D graphics = new PSGraphics2D(false, this, + final PSGraphics2D graphics = new PSGraphics2D(false, this, currentPSFont.getName(), currentFontSize, x, y); graphics.setGraphicContext(new GraphicContext()); try { root.paint(graphics); - } catch (Exception e) { + } catch (final Exception e) { getLogger().error("svg graphic could not be rendered: " + e.getMessage()); getLogger().error(e.getMessage()); @@ -528,8 +532,8 @@ /** * {@inheritDoc} */ - protected void drawImage(GraphicArea area, Graphic image, - Rectangle contentRectangle, Rectangle clipRectangle) { + protected void drawImage(final GraphicArea area, final Graphic image, + final Rectangle contentRectangle, final Rectangle clipRectangle) { if (clipRectangle.width > 0 || clipRectangle.height >0) { drawImageClipped(contentRectangle.x, contentRectangle.y, clipRectangle.width, clipRectangle.height, image, area); @@ -539,7 +543,7 @@ try { renderSVGDocument(((SVGGraphic) image).getSVGDocument(), contentRectangle.x, contentRectangle.y, area); - } catch (GraphicException e) { + } catch (final GraphicException e) { getLogger().error("Error rendering SVG image"); getLogger().error(e.getMessage()); } @@ -553,18 +557,19 @@ } } - protected void drawImageClipped(int x, int y, - int clipW, int clipH, Graphic image, GraphicArea area) { + protected void drawImageClipped(final int x, final int y, + final int clipW, final int clipH, final Graphic image, + final GraphicArea area) { write("gsave"); write("0 0 " + clipW + " " + clipH + " re"); write("clippath"); try { - int w = image.pixelWidth() * 1000; - int h = image.pixelHeight() * 1000; - Rectangle rect = new Rectangle(x, y, w, h); + final int w = image.pixelWidth() * 1000; + final int h = image.pixelHeight() * 1000; + final Rectangle rect = new Rectangle(x, y, w, h); drawImage(area, image, rect, null); - } catch (GraphicException e) { + } catch (final GraphicException e) { getLogger().error("Error getting image extents"); getLogger().error(e.getMessage()); } @@ -574,15 +579,16 @@ /** * {@inheritDoc} */ - protected void drawSVG(GraphicArea area, SVGGraphic graphic, - Rectangle contentRectangle, Rectangle clipRectangle) { + protected void drawSVG(final GraphicArea area, final SVGGraphic graphic, + final Rectangle contentRectangle, final Rectangle clipRectangle) { /* TODO: Implement this. */ } - public void renderEPS(EPSGraphic img, int x, int y, int w, int h) { + public void renderEPS(final EPSGraphic img, final int x, final int y, + final int w, final int h) { try { out.writeByteArr(epsToPostScript(img, x, y, w, h)); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); getLogger().error("PSRenderer.renderImageArea(): Error rendering " + "bitmap (" + e.getMessage() + ")"); @@ -590,11 +596,11 @@ } } - public byte[] epsToPostScript(EPSGraphic image, int x, int y, int w, int h) - throws GraphicException { - int[] bbox = image.getBBox(); - int bboxw = bbox[2] - bbox[0]; - int bboxh = bbox[3] - bbox[1]; + public byte[] epsToPostScript(final EPSGraphic image, final int x, + final int y, final int w, final int h) throws GraphicException { + final int[] bbox = image.getBBox(); + final int bboxw = bbox[2] - bbox[0]; + final int bboxh = bbox[3] - bbox[1]; StringBuffer buffer = new StringBuffer(); buffer.append("%%BeginDocument: " + image.getName()); @@ -607,15 +613,16 @@ buffer.append(bbox[0] + " " + bbox[1] + " " + bboxw + " " + bboxh + " rectclip"); buffer.append("newpath"); - String string1 = buffer.toString(); + final String string1 = buffer.toString(); buffer = new StringBuffer(); buffer.append("%%EndDocument"); buffer.append("EndEPSF"); buffer.append(""); - String string2 = buffer.toString(); - byte[] output = new byte[string1.length() + image.getContent().length - + string2.length()]; + final String string2 = buffer.toString(); + final byte[] output = new byte[string1.length() + + image.getContent().length + + string2.length()]; int offset = 0; System.arraycopy(string1.getBytes(), 0, output, offset, string1.getBytes().length); @@ -628,11 +635,12 @@ return output; } - public void renderBitmap(Graphic img, int x, int y, int w, int h) { + public void renderBitmap(final Graphic img, final int x, final int y, + final int w, final int h) { try { - boolean iscolor = img.getColorSpace().getType() + final boolean iscolor = img.getColorSpace().getType() != ColorSpace.TYPE_GRAY; - byte[] imgmap = img.getContent(); + final byte[] imgmap = img.getContent(); write("gsave"); if (img.getColorSpace().getType() == ColorSpace.TYPE_CMYK) { @@ -729,7 +737,7 @@ } else { out.flush(); } - } catch (IOException e) { + } catch (final IOException e) { if (!ioTrouble) { e.printStackTrace(); } @@ -738,7 +746,7 @@ write(""); write("grestore"); - } catch (GraphicException e) { + } catch (final GraphicException e) { getLogger().error("PSRenderer.renderImageArea(): Error rendering " + "bitmap (" + e.getMessage() + ")"); getLogger().error(e.getMessage()); @@ -750,26 +758,26 @@ * * @param area the image area to render */ - public void render(ExternalGraphicArea area) { + public void render(final ExternalGraphicArea area) { // adapted from contribution by BoBoGi int x = area.rrOriginX(); int ploffset = 0; if (area.getParentOut() instanceof LineArea) { ploffset = ((LineArea) area.getParentOut()).getAscender(); } - int y = area.rrOriginY() + ploffset; - int w = area.rrIPD(); - int h = area.rrBPD(); + final int y = area.rrOriginY() + ploffset; + final int w = area.rrIPD(); + final int h = area.rrBPD(); x += w; - Graphic img = area.getGraphic(); + final Graphic img = area.getGraphic(); if (img == null) { getLogger().error("Error while loading image: area.getImage() is " + "null"); } else { - Rectangle rect = new Rectangle(x, y, w, h); + final Rectangle rect = new Rectangle(x, y, w, h); drawImage(area, img, rect, null); } } @@ -806,25 +814,26 @@ comment("% --- ImageArea end"); }*/ - protected void createBasicLink(BasicLinkArea area) { + protected void createBasicLink(final BasicLinkArea area) { } - public void renderTextSegment(GeneralInlineArea area, char[] text) { + public void renderTextSegment(final GeneralInlineArea area, + final char[] text) { if (text == null || text.length < 1) { return; } - FontUse fontUse = area.getPrimaryFont(); - PSFont psFont = (PSFont) this.fontMap.get(fontUse); + final FontUse fontUse = area.getPrimaryFont(); + final PSFont psFont = (PSFont) this.fontMap.get(fontUse); useFont(psFont, area.traitFontSize()); useColor(area.getColor()); write(moveTo(area)); StringBuffer sb = new StringBuffer(); - String s = new String(text); - int l = s.length(); + final String s = new String(text); + final int l = s.length(); for (int i = 0; i < l; i++) { - char ch = s.charAt(i); - int mch = area.getPrimaryFont().encodeCharacter(ch); + final char ch = s.charAt(i); + final int mch = area.getPrimaryFont().encodeCharacter(ch); if (mch > 127) { sb = sb.append("\\" + Integer.toOctalString(mch)); @@ -839,7 +848,7 @@ String psString = null; if (area.actualLetterSpacing() > 0) { - float f = area.actualLetterSpacing(); + final float f = area.actualLetterSpacing(); psString = (new StringBuffer().append(f).append(" 0.0 (") .append(sb.toString()).append(") A")).toString(); } else { @@ -863,18 +872,18 @@ } } - private String moveTo(Area area) { - float xPosition = Math.round(area.crOriginX() / 1000); - float yPosition = Math.round(area.crOriginY() / 1000); + private String moveTo(final Area area) { + final float xPosition = Math.round(area.crOriginX() / 1000); + final float yPosition = Math.round(area.crOriginY() / 1000); return xPosition + " " + yPosition + " M"; } - public void useFont(PSFont psFont, int size) { + pub... [truncated message content] |
|
From: <vic...@us...> - 2006-07-23 22:40:50
|
Revision: 7828 Author: victormote Date: 2006-07-23 15:40:26 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7828&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04Entry.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12Entry.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCII85Filter.java trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCIIHexFilter.java trunk/foray/foray-ps/src/java/org/foray/ps/filter/CCITTFaxFilter.java trunk/foray/foray-ps/src/java/org/foray/ps/filter/DCTFilter.java trunk/foray/foray-ps/src/java/org/foray/ps/filter/EncryptFilter.java trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateFilter.java trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilterException.java trunk/foray/foray-ps/src/java/org/foray/ps/java2d/Java2DSystemDict.java trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoFrame.java trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoPanel.java trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/Main.java trunk/foray/foray-ps/src/java/org/foray/ps/readonly/ReadOnlySystemDict.java Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -29,7 +29,7 @@ */ public abstract class CMap extends Encoding { - public CMap(String name) { + public CMap(final String name) { super(name); } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -35,12 +35,12 @@ private int lastEntryAdded = -1; - public CMap04 (String name, int expectedEntries) { + public CMap04 (final String name, final int expectedEntries) { super(name); this.entries = new CMap04Entry[expectedEntries]; } - public void addEntry(CMap04Entry entry) { + public void addEntry(final CMap04Entry entry) { lastEntryAdded++; if (lastEntryAdded >= entries.length) { // Fails silently. @@ -49,29 +49,29 @@ this.entries[lastEntryAdded] = entry; } - public void addEntry(char unicodeStart, char unicodeEnd, - char glyphStartIndex) { - CMap04Entry newEntry = new CMap04Entry(unicodeStart, unicodeEnd, + public void addEntry(final char unicodeStart, final char unicodeEnd, + final char glyphStartIndex) { + final CMap04Entry newEntry = new CMap04Entry(unicodeStart, unicodeEnd, glyphStartIndex); addEntry(newEntry); } - public void addEntry(char unicodeStart, char unicodeEnd, - char[] glyphIndexes) { - CMap04Entry newEntry = new CMap04Entry(unicodeStart, unicodeEnd, + public void addEntry(final char unicodeStart, final char unicodeEnd, + final char[] glyphIndexes) { + final CMap04Entry newEntry = new CMap04Entry(unicodeStart, unicodeEnd, glyphIndexes); addEntry(newEntry); } - public int encodeCharacter(int c) { - CMap04Entry entry = entryForChar((char) c); + public int encodeCharacter(final int c) { + final CMap04Entry entry = entryForChar((char) c); if (entry == null) { return 0; } return entry.encodeCharacter((char) c); } - private CMap04Entry entryForChar(char c) { + private CMap04Entry entryForChar(final char c) { for (int i = 0; i < entries.length; i++) { if (entries[i].containsChar(c)) { return entries[i]; @@ -83,9 +83,9 @@ /** * {@inheritDoc} */ - public int decodeCharacter(int glyphIndexInput) { + public int decodeCharacter(final int glyphIndexInput) { for (int i = 0; i < entries.length; i++) { - char codePoint = entries[i].decodeCharacter(glyphIndexInput); + final char codePoint = entries[i].decodeCharacter(glyphIndexInput); if (codePoint != Character.MAX_VALUE) { return codePoint; } @@ -96,7 +96,7 @@ /** * {@inheritDoc} */ - public String asPostScript(org.axsl.psR.Encoding baseEncoding) { + public String asPostScript(final org.axsl.psR.Encoding baseEncoding) { return null; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04Entry.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04Entry.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04Entry.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -38,15 +38,15 @@ * characters. */ public char[] glyphIndexes; - public CMap04Entry(char unicodeStart, char unicodeEnd, - char glyphStartIndex) { + public CMap04Entry(final char unicodeStart, final char unicodeEnd, + final char glyphStartIndex) { this.unicodeStart = unicodeStart; this.unicodeEnd = unicodeEnd; this.glyphStartIndex = glyphStartIndex; } - public CMap04Entry(char unicodeStart, char unicodeEnd, - char[] glyphIndexes) { + public CMap04Entry(final char unicodeStart, final char unicodeEnd, + final char[] glyphIndexes) { this.unicodeStart = unicodeStart; this.unicodeEnd = unicodeEnd; this.glyphIndexes = glyphIndexes; @@ -61,11 +61,11 @@ return (char) (glyphStartIndex + unicodeEnd - unicodeStart); } - public boolean containsChar(char c) { + public boolean containsChar(final char c) { return (c >= this.unicodeStart && c <= this.unicodeEnd); } - public char encodeCharacter(char c) { + public char encodeCharacter(final char c) { if (! containsChar(c)) { return 0; } @@ -75,9 +75,9 @@ return this.glyphIndexes[c - this.unicodeStart]; } - public char decodeCharacter(int glyphIndex) { + public char decodeCharacter(final int glyphIndex) { if (this.glyphIndexes == null) { - char codePoint = (char) (glyphIndex - this.glyphStartIndex + final char codePoint = (char) (glyphIndex - this.glyphStartIndex + this.unicodeStart); if (glyphIndex >= this.glyphStartIndex && codePoint <= this.unicodeStart) { Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -35,12 +35,12 @@ private int lastEntryAdded = -1; - public CMap12 (String name, int expectedEntries) { + public CMap12 (final String name, final int expectedEntries) { super(name); this.entries = new CMap12Entry[expectedEntries]; } - public void addEntry(CMap12Entry entry) { + public void addEntry(final CMap12Entry entry) { lastEntryAdded++; if (lastEntryAdded >= entries.length) { // Fails silently. @@ -49,22 +49,22 @@ this.entries[lastEntryAdded] = entry; } - public void addEntry(int unicodeStart, int unicodeEnd, - int glyphStartIndex) { - CMap12Entry newEntry = new CMap12Entry(unicodeStart, unicodeEnd, + public void addEntry(final int unicodeStart, final int unicodeEnd, + final int glyphStartIndex) { + final CMap12Entry newEntry = new CMap12Entry(unicodeStart, unicodeEnd, glyphStartIndex); addEntry(newEntry); } - public int encodeCharacter(int codePoint) { - CMap12Entry entry = entryForChar(codePoint); + public int encodeCharacter(final int codePoint) { + final CMap12Entry entry = entryForChar(codePoint); if (entry == null) { return 0; } return entry.encodeCharacter(codePoint); } - private CMap12Entry entryForChar(int codePoint) { + private CMap12Entry entryForChar(final int codePoint) { for (int i = 0; i < entries.length; i++) { if (entries[i].containsChar(codePoint)) { return entries[i]; @@ -76,9 +76,9 @@ /** * {@inheritDoc} */ - public int decodeCharacter(int glyphIndexInput) { + public int decodeCharacter(final int glyphIndexInput) { for (int i = 0; i < entries.length; i++) { - int codePoint = entries[i].decodeCharacter(glyphIndexInput); + final int codePoint = entries[i].decodeCharacter(glyphIndexInput); if (codePoint != Character.MAX_VALUE) { return codePoint; } @@ -89,7 +89,7 @@ /** * {@inheritDoc} */ - public String asPostScript(org.axsl.psR.Encoding baseEncoding) { + public String asPostScript(final org.axsl.psR.Encoding baseEncoding) { return null; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12Entry.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12Entry.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12Entry.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -33,7 +33,8 @@ public int unicodeEnd; public int glyphStartIndex; - public CMap12Entry(int unicodeStart, int unicodeEnd, int glyphStartIndex) { + public CMap12Entry(final int unicodeStart, final int unicodeEnd, + final int glyphStartIndex) { this.unicodeStart = unicodeStart; this.unicodeEnd = unicodeEnd; this.glyphStartIndex = glyphStartIndex; @@ -48,7 +49,7 @@ return glyphStartIndex + unicodeEnd - unicodeStart; } - public boolean containsChar(int codePoint) { + public boolean containsChar(final int codePoint) { if (codePoint < this.unicodeStart) { return false; } @@ -58,15 +59,16 @@ return true; } - public int encodeCharacter(int codePoint) { + public int encodeCharacter(final int codePoint) { if (! containsChar(codePoint)) { return 0; } return codePoint - this.unicodeStart + this.glyphStartIndex; } - public int decodeCharacter(int glyphIndex) { - int codePoint = glyphIndex - this.glyphStartIndex + this.unicodeStart; + public int decodeCharacter(final int glyphIndex) { + final int codePoint = glyphIndex - this.glyphStartIndex + + this.unicodeStart; if (glyphIndex >= this.glyphStartIndex && codePoint <= this.unicodeStart) { return codePoint; Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -43,7 +43,7 @@ private String name; - public Encoding(String name) { + public Encoding(final String name) { this.name = name; } @@ -73,7 +73,7 @@ return false; } - public boolean canEncode(int codePoint) { + public boolean canEncode(final int codePoint) { return this.encodeCharacter(codePoint) != 0; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -78,8 +78,8 @@ /** * Create a new EncodingParser instance. */ - public EncodingParser (Log logger, RandomReader reader, int columnNum, - int radix, String glyphLists) { + public EncodingParser (final Log logger, final RandomReader reader, + final int columnNum, final int radix, final String glyphLists) { this.logger = logger; this.reader = reader; this.columnNum = columnNum; @@ -91,7 +91,7 @@ * Parses a glyph list */ public void parseList() throws IOException { - int numberOfLines = countLines(); + final int numberOfLines = countLines(); if (numberOfLines < 1) { return; } @@ -108,7 +108,7 @@ reader.seek(0); boolean endOfFile = false; while (! endOfFile) { - String currentLine = reader.readLine(); + final String currentLine = reader.readLine(); if (currentLine == null) { endOfFile = true; break; @@ -130,7 +130,7 @@ endOfFile = false; int arrayIndex = 0; while (! endOfFile) { - String currentLine = reader.readLine(); + final String currentLine = reader.readLine(); this.currentLineNumber++; if (currentLine == null) { endOfFile = true; @@ -144,8 +144,8 @@ } } - private boolean lineHasContent(String line) { - char[] charArray = line.toCharArray(); + private boolean lineHasContent(final String line) { + final char[] charArray = line.toCharArray(); for (int i = 0; i < charArray.length; i++) { if (charArray[i] == '#') { // This is a comment. @@ -160,8 +160,8 @@ return false; } - private boolean lineAppliesToEncoding(String line) { - String [] tokens = tokenizeLine(line); + private boolean lineAppliesToEncoding(final String line) { + final String [] tokens = tokenizeLine(line); if (tokens.length < this.columnNum + 1) { return false; } @@ -171,14 +171,14 @@ return true; } - private void processCurrentLine(String line, int arrayIndex) { - String[] tokens = tokenizeLine(line); + private void processCurrentLine(final String line, final int arrayIndex) { + final String[] tokens = tokenizeLine(line); this.glyphNames[arrayIndex] = tokens[0]; - String numericString = tokens[this.columnNum]; + final String numericString = tokens[this.columnNum]; int index = -1; try { index = Integer.parseInt(numericString, this.radix); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { logger.error("Invalid octal string, line " + this.currentLineNumber + ": " + numericString); } @@ -195,12 +195,12 @@ * @param line * @return The String array containing the line's fields. */ - private String[] tokenizeLine(String line) { - StringTokenizer tokenizer = new StringTokenizer(line); - String[] tokens = new String[tokenizer.countTokens()]; + private String[] tokenizeLine(final String line) { + final StringTokenizer tokenizer = new StringTokenizer(line); + final String[] tokens = new String[tokenizer.countTokens()]; int tokenIndex = 0; while (tokenizer.hasMoreTokens()) { - String token = tokenizer.nextToken(); + final String token = tokenizer.nextToken(); tokens[tokenIndex] = token; tokenIndex++; } @@ -212,14 +212,15 @@ while (anyChanges) { anyChanges = false; for (int i = 0; i < this.glyphNames.length - 1; i++) { - int compareValue = glyphNames[i].compareTo(glyphNames[i + 1]); + final int compareValue = glyphNames[i].compareTo( + glyphNames[i + 1]); if (compareValue > 0) { /* Item at [i + 1] is less than item at [i]. Switch them * and the same elements in codePointsForGlyphNames. */ - String storeString = glyphNames[i]; + final String storeString = glyphNames[i]; glyphNames[i] = glyphNames[i + 1]; glyphNames[i + 1] = storeString; - char storeChar = glyphIndexes[i]; + final char storeChar = glyphIndexes[i]; glyphIndexes[i] = glyphIndexes[i + 1]; glyphIndexes[i + 1] = storeChar; anyChanges = true; @@ -255,13 +256,14 @@ this.codePoints = new char[glyphNames.length]; this.codePointIndexes = new char[codePoints.length]; for (int i = 0; i < glyphNames.length; i++) { - String glyphName = glyphNames[i]; + final String glyphName = glyphNames[i]; for (int j = 0; j < this.glyphListsToCheck.length; j++) { glyphList = this.glyphListsToCheck[j]; - char codePoint = glyphList.mapGlyphNameToCodePoint(glyphName); + final char codePoint = glyphList.mapGlyphNameToCodePoint( + glyphName); if (codePoint != 0xFFFF) { this.codePoints[i] = codePoint; - char glyphIndex = glyphIndexes[i]; + final char glyphIndex = glyphIndexes[i]; this.codePointIndexes[i] = glyphIndex; break; } @@ -281,7 +283,7 @@ * written. * @throws IOException For errors when writing to out. */ - public void writeAsJavaStatics(OutputStream out) throws IOException { + public void writeAsJavaStatics(final OutputStream out) throws IOException { if (out == null) { return; } @@ -322,7 +324,7 @@ s = " public static final short[] glyphIndexes = {\n"; out.write(s.getBytes()); for (int i = 0; i < glyphIndexes.length; i++) { - char index = glyphIndexes[i]; + final char index = glyphIndexes[i]; s = " "; s = s + "0x"; s = s + StringUtil.charToHexString(index, true, 4); @@ -351,7 +353,7 @@ s = " public static final char[] codePoints = {\n"; out.write(s.getBytes()); for (int i = 0; i < codePoints.length; i++) { - char index = codePoints[i]; + final char index = codePoints[i]; s = " "; s = s + "0x"; s = s + StringUtil.charToHexString(index, true, 4); @@ -377,7 +379,7 @@ s = " public static final char[] codePointIndexes = {\n"; out.write(s.getBytes()); for (int i = 0; i < codePointIndexes.length; i++) { - char index = codePointIndexes[i]; + final char index = codePointIndexes[i]; s = " "; s = s + "0x"; s = s + StringUtil.charToHexString(index, true, 4); @@ -393,8 +395,8 @@ out.write(s.getBytes()); } - public static String padSpaces(String string, int desiredColumn, - int minimumPad) { + public static String padSpaces(String string, final int desiredColumn, + final int minimumPad) { /* The String length + 1 is the next column that will be written if * no padding is added. */ int spacesToPad = desiredColumn - (string.length() + 1); @@ -406,7 +408,7 @@ return string; } - public static String formatArrayIndex(int index) { + public static String formatArrayIndex(final int index) { return "[" + Integer.toString(index) + "]"; } @@ -433,10 +435,10 @@ * The Adobe Glyph List is always consulted, but only after any custom ones * listed here. */ - public static void main(String[] args) { - Log logger = Logging.makeDefaultLogger(); - String usage = "Usage: GlyphListParser <input-file> <column-number> " - + "<output-file> <glyph-lists>?\n"; + public static void main(final String[] args) { + final Log logger = Logging.makeDefaultLogger(); + final String usage = "Usage: GlyphListParser <input-file> " + + "<column-number> <output-file> <glyph-lists>?\n"; if (args.length > 5 || args.length < 4) { logger.error("Wrong number of arguments.\n" + usage); System.exit(1); @@ -444,7 +446,7 @@ URL url = null; try { url = URLFactory.createURL(args[0]); - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { logger.error("Unable to create URL for: " + args[0] + "\n"); logger.error(" " + e.getMessage()); System.exit(1); @@ -452,14 +454,14 @@ RandomReader input = null; try { input = new RandomReader(url); - } catch (IOException e1) { + } catch (final IOException e1) { logger.error("Unable to create Reader for: " + args[0] + "\n"); System.exit(1); } int columnNum = 0; try { columnNum = Integer.parseInt(args[1]); - } catch (NumberFormatException e5) { + } catch (final NumberFormatException e5) { logger.error("Unable to parse column number: " + args[1] + "\n"); System.exit(1); @@ -470,13 +472,13 @@ } // Get the radix, which is, in this case a base-10 number :-) - int radix = Integer.parseInt(args[2]); + final int radix = Integer.parseInt(args[2]); // Get the output stream. FileOutputStream output = null; try { output = new FileOutputStream(args[3]); - } catch (FileNotFoundException e2) { + } catch (final FileNotFoundException e2) { logger.error("Unable to create FileOutputStream for: " + args[3] + "\n"); System.exit(1); @@ -487,18 +489,18 @@ if (args.length > 4) { customGlyphLists = args[4]; } - EncodingParser parser = new EncodingParser(logger, input, columnNum, - radix, customGlyphLists); + final EncodingParser parser = new EncodingParser(logger, input, + columnNum, radix, customGlyphLists); try { parser.parseList(); - } catch (IOException e3) { + } catch (final IOException e3) { logger.error("Error parsing: " + args[0] + "\n"); logger.error(" " + e3.getMessage()); System.exit(1); } try { parser.writeAsJavaStatics(output); - } catch (IOException e4) { + } catch (final IOException e4) { logger.error("Error writing to: " + args[2] + "\n"); logger.error(" " + e4.getMessage()); System.exit(1); Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -115,8 +115,8 @@ * codePoints. codePointIndexes[n] should contain the encoded index that * corresponds to the Unicode code point at codePoints[n]. */ - public EncodingVector(String name, GlyphList[] sourceGlyphLists, - char[] codePoints, char[] codePointIndexes) { + public EncodingVector(final String name, final GlyphList[] sourceGlyphLists, + final char[] codePoints, final char[] codePointIndexes) { super(name); this.sourceGlyphLists = sourceGlyphLists; this.codePoints = codePoints; @@ -128,7 +128,7 @@ * predefined encodings * @param name The name of the predefined encoding to be returned. */ - public static EncodingVector getPredefinedEncoding(String name) { + public static EncodingVector getPredefinedEncoding(final String name) { // If already instantiated, return it. EncodingVector encoding = (EncodingVector) predefinedEncodings.get( name); @@ -179,12 +179,13 @@ /** * {@inheritDoc} */ - public int encodeCharacter(int codePoint) { + public int encodeCharacter(final int codePoint) { if (this.codePoints == null || this.codePointIndexes == null) { return 0; } - int index = Arrays.binarySearch(this.codePoints, (char) codePoint); + final int index = Arrays.binarySearch(this.codePoints, + (char) codePoint); if (index < 0) { return 0; } @@ -194,7 +195,7 @@ /** * {@inheritDoc} */ - public int decodeCharacter(int encodedIndex) { + public int decodeCharacter(final int encodedIndex) { /* This is not expected to be used much or at all, so the * codePointIndexes array has not been copied and sorted and * referenced.*/ @@ -210,7 +211,8 @@ return INVALID_UNICODE_CHAR; } - public static void registerEncoding(String name, EncodingVector encoding) { + public static void registerEncoding(final String name, + final EncodingVector encoding) { predefinedEncodings.put(name, encoding); } @@ -225,17 +227,17 @@ * @return The glyph name array for this encoding. */ public String[] getGlyphList() { - int listSize = getLastIndex() + 1; - String[] glyphList = new String[listSize]; + final int listSize = getLastIndex() + 1; + final String[] glyphList = new String[listSize]; // Initialize all items to ".notdef". for (int i = 0; i < glyphList.length; i++) { glyphList[i] = EncodingVector.NOTDEF; } for (int i = 0; i < this.codePoints.length; i++) { - char codePoint = this.codePoints[i]; - String glyphName = GlyphList.mapCodePointToGlyphName( + final char codePoint = this.codePoints[i]; + final String glyphName = GlyphList.mapCodePointToGlyphName( this.sourceGlyphLists, codePoint); - int encodingIndex = this.codePointIndexes[i]; + final int encodingIndex = this.codePointIndexes[i]; glyphList[encodingIndex] = glyphName; } return glyphList; @@ -275,8 +277,8 @@ * @param codePointIndexes The array of encoding indexes that whose elements * correspond to elements in codePoints. */ - public static void sortCodePoints(char[] codePoints, - char[] codePointIndexes) { + public static void sortCodePoints(final char[] codePoints, + final char[] codePointIndexes) { boolean anyChanges = true; while (anyChanges) { anyChanges = false; @@ -299,23 +301,23 @@ /** * {@inheritDoc} */ - public String asPostScript(org.axsl.psR.Encoding baseEncoding) { + public String asPostScript(final org.axsl.psR.Encoding baseEncoding) { /* TODO: The baseEncoding is ignored for now. We need to consider it. */ - int maxCharsPerLine = 80; - String indent = " "; - String[] glyphNames = this.getGlyphList(); + final int maxCharsPerLine = 80; + final String indent = " "; + final String[] glyphNames = this.getGlyphList(); if (glyphNames == null) { return null; } - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append("/Differences\n"); buffer.append("[ 0 \n"); buffer.append(indent); int lineLength = indent.length(); for (int i = 0; i < glyphNames.length; i++) { - String glyphName = glyphNames[i]; + final String glyphName = glyphNames[i]; /* If line length will exceed maxCharsPerLine, add linefeed. */ - int sizeToAdd = glyphName.length() + 2; + final int sizeToAdd = glyphName.length() + 2; if (lineLength + sizeToAdd > maxCharsPerLine) { buffer.append("\n"); buffer.append(indent); @@ -336,7 +338,7 @@ return buffer.toString(); } - public String mapCodePointToGlyphName(int codePoint) { + public String mapCodePointToGlyphName(final int codePoint) { if (this.sourceGlyphLists == null) { return null; } @@ -370,10 +372,11 @@ * @return True iff otherVector encodes all items that this does, and * encodes them the same way. */ - public boolean isSubsetOf(EncodingVector otherVector) { + public boolean isSubsetOf(final EncodingVector otherVector) { for (int i = 0; i < codePoints.length; i++) { - int thisEncodedValue = this.encodeCharacter(codePoints[i]); - int otherEncodedValue = otherVector.encodeCharacter(codePoints[i]); + final int thisEncodedValue = this.encodeCharacter(codePoints[i]); + final int otherEncodedValue = otherVector.encodeCharacter( + codePoints[i]); if (thisEncodedValue != otherEncodedValue) { return false; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -89,9 +89,10 @@ /** * */ - public GlyphList(String name, String[] sortedGlyphNames, - char[][] codePointsForGlyphNames, char[] sortedCodePoints, - short[] glyphNamesForCodePoints) { + public GlyphList(final String name, final String[] sortedGlyphNames, + final char[][] codePointsForGlyphNames, + final char[] sortedCodePoints, + final short[] glyphNamesForCodePoints) { this.name = name; this.sortedGlyphNames = sortedGlyphNames; this.codePointsForGlyphNames = codePointsForGlyphNames; @@ -105,19 +106,20 @@ * @return The glyph name which corresponds to codePoint, or null if there * is none. */ - public String mapCodePointToGlyphName(int codePoint) { + public String mapCodePointToGlyphName(final int codePoint) { if (sortedCodePoints == null || glyphNamesForCodePoints == null || sortedGlyphNames == null) { return null; } - int sortedCodePointIndex = Arrays.binarySearch(sortedCodePoints, + final int sortedCodePointIndex = Arrays.binarySearch(sortedCodePoints, (char) codePoint); if (sortedCodePointIndex < 0 || sortedCodePointIndex >= glyphNamesForCodePoints.length) { return null; } - int glyphNameIndex = glyphNamesForCodePoints[sortedCodePointIndex]; + final int glyphNameIndex = + glyphNamesForCodePoints[sortedCodePointIndex]; if (glyphNameIndex < 0 || glyphNameIndex >= sortedGlyphNames.length) { return null; @@ -131,19 +133,20 @@ * @return The Unicode code point which corresponds to glyphName, or 0xFFFF * if there is none. */ - public char mapGlyphNameToCodePoint(String glyphName) { - char errorValue = 0xFFFF; + public char mapGlyphNameToCodePoint(final String glyphName) { + final char errorValue = 0xFFFF; if (sortedGlyphNames == null || codePointsForGlyphNames == null) { return errorValue; } - int sortedGlyphNameIndex = Arrays.binarySearch(sortedGlyphNames, + final int sortedGlyphNameIndex = Arrays.binarySearch(sortedGlyphNames, glyphName); if (sortedGlyphNameIndex < 0 || sortedGlyphNameIndex >= codePointsForGlyphNames.length) { return errorValue; } - char[] codePointArray = codePointsForGlyphNames[sortedGlyphNameIndex]; + final char[] codePointArray = + codePointsForGlyphNames[sortedGlyphNameIndex]; if (codePointArray == null) { return errorValue; } @@ -155,7 +158,7 @@ * predefined GlyphList, creates it and returns it. * @param name The name of the GlyphList to be returned. */ - public static GlyphList getGlyphList(String name) { + public static GlyphList getGlyphList(final String name) { // If already instantiated, return it. GlyphList list = (GlyphList) glyphListMap.get(name); if (list != null) { @@ -174,7 +177,8 @@ return list; } - public static void registerGlyphList(String name, GlyphList encoding) { + public static void registerGlyphList(final String name, + final GlyphList encoding) { glyphListMap.put(name, encoding); } @@ -192,23 +196,23 @@ * is none. * @see GlyphList#mapCodePointToGlyphName(int) */ - public static String mapCodePointToGlyphName(GlyphList[] glyphLists, - int codePoint) { + public static String mapCodePointToGlyphName(final GlyphList[] glyphLists, + final int codePoint) { if (glyphLists == null) { return null; } for (int i = 0; i < glyphLists.length; i++) { - GlyphList list = glyphLists[i]; + final GlyphList list = glyphLists[i]; if (list == null) { continue; } - String glyphName = list.mapCodePointToGlyphName(codePoint); + final String glyphName = list.mapCodePointToGlyphName(codePoint); if (glyphName == null) { continue; } /* Make sure it maps back. Otherwise it must have come from a * different list. */ - char roundTripCodePoint = mapGlyphNameToCodePoint(glyphLists, + final char roundTripCodePoint = mapGlyphNameToCodePoint(glyphLists, glyphName); if (roundTripCodePoint == codePoint) { return glyphName; @@ -227,17 +231,17 @@ * {@link Encoding#INVALID_UNICODE_CHAR} if there is none. * @see GlyphList#mapGlyphNameToCodePoint(String) */ - public static char mapGlyphNameToCodePoint(GlyphList[] glyphLists, - String glyphName) { + public static char mapGlyphNameToCodePoint(final GlyphList[] glyphLists, + final String glyphName) { if (glyphLists == null) { return Encoding.INVALID_UNICODE_CHAR; } for (int i = 0; i < glyphLists.length; i++) { - GlyphList list = glyphLists[i]; + final GlyphList list = glyphLists[i]; if (list == null) { continue; } - char c = list.mapGlyphNameToCodePoint(glyphName); + final char c = list.mapGlyphNameToCodePoint(glyphName); if (c != Encoding.INVALID_UNICODE_CHAR) { return c; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -64,7 +64,7 @@ /** * Create a new GlyphListParser instance. */ - public GlyphListParser (Log logger, RandomReader reader) { + public GlyphListParser (final Log logger, final RandomReader reader) { this.logger = logger; this.reader = reader; } @@ -73,7 +73,7 @@ * Parses a glyph list */ public void parseList() throws IOException { - int numberOfLines = countLines(); + final int numberOfLines = countLines(); if (numberOfLines < 1) { return; } @@ -91,7 +91,7 @@ reader.seek(0); boolean endOfFile = false; while (! endOfFile) { - String currentLine = reader.readLine(); + final String currentLine = reader.readLine(); if (currentLine == null) { endOfFile = true; break; @@ -112,7 +112,7 @@ endOfFile = false; int arrayIndex = 0; while (! endOfFile) { - String currentLine = reader.readLine(); + final String currentLine = reader.readLine(); this.currentLineNumber++; if (currentLine == null) { endOfFile = true; @@ -125,8 +125,8 @@ } } - private boolean lineHasContent(String line) { - char[] charArray = line.toCharArray(); + private boolean lineHasContent(final String line) { + final char[] charArray = line.toCharArray(); for (int i = 0; i < charArray.length; i++) { if (charArray[i] == '#') { // This is a comment. @@ -141,13 +141,13 @@ return false; } - private void processCurrentLine(String line, int arrayIndex) { - String[] tokens = line.split("[; ]"); + private void processCurrentLine(final String line, final int arrayIndex) { + final String[] tokens = line.split("[; ]"); if (tokens.length < 2) { return; } this.glyphNames[arrayIndex] = tokens[0]; - char[] charArray = new char[tokens.length - 1]; + final char[] charArray = new char[tokens.length - 1]; for (int i = 1; i < tokens.length; i++) { int parsedValue = Integer.parseInt(tokens[i], 16); if (parsedValue < 0) { @@ -170,14 +170,15 @@ while (anyChanges) { anyChanges = false; for (int i = 0; i < this.glyphNames.length - 1; i++) { - int compareValue = glyphNames[i].compareTo(glyphNames[i + 1]); + final int compareValue = glyphNames[i].compareTo( + glyphNames[i + 1]); if (compareValue > 0) { /* Item at [i + 1] is less than item at [i]. Switch them * and the same elements in codePointsForGlyphNames. */ - String storeString = glyphNames[i]; + final String storeString = glyphNames[i]; glyphNames[i] = glyphNames[i + 1]; glyphNames[i + 1] = storeString; - char[] storeCharArray = codePointsForGlyphNames[i]; + final char[] storeCharArray = codePointsForGlyphNames[i]; codePointsForGlyphNames[i] = codePointsForGlyphNames[i + 1]; codePointsForGlyphNames[i + 1] = storeCharArray; anyChanges = true; @@ -209,10 +210,10 @@ if (codePoints[i] > codePoints[i + 1]) { /* Switch the two items and the same elements in * glyphNameIndex. */ - char storeChar = codePoints[i]; + final char storeChar = codePoints[i]; codePoints[i] = codePoints[i + 1]; codePoints[i + 1] = storeChar; - short storeShort = glyphNameIndex[i]; + final short storeShort = glyphNameIndex[i]; glyphNameIndex[i] = glyphNameIndex[i + 1]; glyphNameIndex[i + 1] = storeShort; anyChanges = true; @@ -229,7 +230,7 @@ * written. * @throws IOException For errors when writing to out. */ - public void writeAsJavaStatics(OutputStream out) throws IOException { + public void writeAsJavaStatics(final OutputStream out) throws IOException { if (out == null) { return; } @@ -264,10 +265,10 @@ s = " public static final char[][] charForGlyph = {\n"; out.write(s.getBytes()); for (int i = 0; i < codePointsForGlyphNames.length; i++) { - char[] charArray = codePointsForGlyphNames[i]; + final char[] charArray = codePointsForGlyphNames[i]; s = " { "; for (int j = 0; j < charArray.length; j++) { - char theChar = charArray[j]; + final char theChar = charArray[j]; s = s + "0x"; s = s + Integer.toHexString(theChar); if (j < charArray.length - 1) { @@ -291,7 +292,7 @@ s = " public static final char[] charList = {\n"; out.write(s.getBytes()); for (int i = 0; i < codePoints.length; i++) { - char theChar = codePoints[i]; + final char theChar = codePoints[i]; s = " 0x"; s = s + Integer.toHexString(theChar); if (i < codePoints.length - 1) { @@ -309,7 +310,7 @@ s = " public static final short[] glyphNameIndex = {\n"; out.write(s.getBytes()); for (int i = 0; i < glyphNameIndex.length; i++) { - short theShort = glyphNameIndex[i]; + final short theShort = glyphNameIndex[i]; s = " "; s = s + String.valueOf(theShort); if (i < glyphNameIndex.length - 1) { @@ -329,9 +330,10 @@ * Element 1 is the URL of the file to which the java source code should be * written. */ - public static void main(String[] args) { - Log logger = Logging.makeDefaultLogger(); - String usage = "Usage: GlyphListParser <input-file> <output-file>\n"; + public static void main(final String[] args) { + final Log logger = Logging.makeDefaultLogger(); + final String usage = "Usage: GlyphListParser <input-file> " + + "<output-file>\n"; if (args.length != 2) { logger.error("Wrong number of arguments.\n" + usage); System.exit(1); @@ -339,7 +341,7 @@ URL url = null; try { url = URLFactory.createURL(args[0]); - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { logger.error("Unable to create URL for: " + args[0] + "\n"); logger.error(" " + e.getMessage()); System.exit(1); @@ -347,29 +349,29 @@ RandomReader input = null; try { input = new RandomReader(url); - } catch (IOException e1) { + } catch (final IOException e1) { logger.error("Unable to create Reader for: " + args[0] + "\n"); System.exit(1); } FileOutputStream output = null; try { output = new FileOutputStream(args[1]); - } catch (FileNotFoundException e2) { + } catch (final FileNotFoundException e2) { logger.error("Unable to create FileOutputStream for: " + args[1] + "\n"); System.exit(1); } - GlyphListParser parser = new GlyphListParser(logger, input); + final GlyphListParser parser = new GlyphListParser(logger, input); try { parser.parseList(); - } catch (IOException e3) { + } catch (final IOException e3) { logger.error("Error parsing: " + args[0] + "\n"); logger.error(" " + e3.getMessage()); System.exit(1); } try { parser.writeAsJavaStatics(output); - } catch (IOException e4) { + } catch (final IOException e4) { logger.error("Error writing to: " + args[1] + "\n"); logger.error(" " + e4.getMessage()); System.exit(1); Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCII85Filter.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCII85Filter.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCII85Filter.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -41,9 +41,9 @@ return null; } - public byte[] encode(byte[] data) throws PSFilterException { + public byte[] encode(final byte[] data) throws PSFilterException { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int i; @@ -55,12 +55,12 @@ * Note: must have the L at the end, otherwise you get into weird * signed value problems cause we're using a full 32 bits. */ - long val = ((data[i] << 24) + final long val = ((data[i] << 24) & 0xff000000L) + ((data[i + 1] << 16) & 0xff0000L) + ((data[i + 2] << 8) & 0xff00L) + (data[i + 3] & 0xffL); - byte[] conv = convertWord(val); + final byte[] conv = convertWord(val); buffer.write(conv, 0, conv.length); @@ -71,8 +71,8 @@ // then convert like normal (except not applying the special zero rule) // and write out the first n+1 bytes from the result if (i < data.length) { - int n = data.length - i; - byte[] lastdata = new byte[4]; + final int n = data.length - i; + final byte[] lastdata = new byte[4]; for (int j = 0; j < 4; j++) { if (j < n) { lastdata[j] = data[i++]; @@ -81,7 +81,7 @@ } } - long val = ((lastdata[0] << 24) & 0xff000000L) + final long val = ((lastdata[0] << 24) & 0xff000000L) + ((lastdata[1] << 16) & 0xff0000L) + ((lastdata[2] << 8) & 0xff00L) + (lastdata[3] & 0xffL); @@ -98,7 +98,7 @@ } // finally write the two character end of data marker buffer.write(ASCII85_EOD, 0, ASCII85_EOD.length); - byte[] result = buffer.toByteArray(); + final byte[] result = buffer.toByteArray(); return result; } @@ -117,20 +117,20 @@ word = -word; } if (word == 0) { - byte[] result = { (byte)ASCII85_ZERO }; + final byte[] result = { (byte)ASCII85_ZERO }; return result; } - byte c5 = (byte)((word % base85_4) + ASCII85_START); + final byte c5 = (byte)((word % base85_4) + ASCII85_START); word = word / base85_4; - byte c4 = (byte)((word % base85_4) + ASCII85_START); + final byte c4 = (byte)((word % base85_4) + ASCII85_START); word = word / base85_4; - byte c3 = (byte)((word % base85_4) + ASCII85_START); + final byte c3 = (byte)((word % base85_4) + ASCII85_START); word = word / base85_4; - byte c2 = (byte)((word % base85_4) + ASCII85_START); + final byte c2 = (byte)((word % base85_4) + ASCII85_START); word = word / base85_4; - byte c1 = (byte)((word % base85_4) + ASCII85_START); + final byte c1 = (byte)((word % base85_4) + ASCII85_START); - byte[] ret = { c1 , c2, c3, c4, c5 }; + final byte[] ret = { c1 , c2, c3, c4, c5 }; for (int i = 0; i < ret.length; i++) { if (ret[i] < 33 || ret[i] > 117) { throw new PSFilterException("ASCII85 Filter: Illegal char " @@ -143,7 +143,7 @@ /** * Unimplemented. */ - public byte[] decode(byte[] input) { + public byte[] decode(final byte[] input) { return input; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCIIHexFilter.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCIIHexFilter.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCIIHexFilter.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -65,20 +65,21 @@ return null; } - public byte[] encode(byte[] data) { - byte[] tentative = ASCIIHexFilter.encodeArray(data, 0, data.length, -1); - byte[] returnArray = new byte[tentative.length + 1]; + public byte[] encode(final byte[] data) { + final byte[] tentative = ASCIIHexFilter.encodeArray(data, 0, + data.length, -1); + final byte[] returnArray = new byte[tentative.length + 1]; System.arraycopy(tentative, 0, returnArray, 0, tentative.length); returnArray[returnArray.length - 1] = END_OF_DATA; return returnArray; } - public byte[] decode(byte[] input) throws PSFilterException { + public byte[] decode(final byte[] input) throws PSFilterException { if (eodLocation > -1) { return null; } // Save the leftover byte - byte savedLeftoverByte = leftoverByte; + final byte savedLeftoverByte = leftoverByte; int dataBytes = 0; if (leftoverByte > -1) { dataBytes++; @@ -134,8 +135,8 @@ * Whitespace characters may be added to the output, so it may be somewhat * larger. */ - public static byte[] encodeArray(byte[] input, int start, int size, - int lineBreak) { + public static byte[] encodeArray(final byte[] input, final int start, + final int size, final int lineBreak) { if (input == null || input.length < 1) { return null; } @@ -145,10 +146,10 @@ if (start + size > input.length) { return null; } - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); int lastLineBreak = 0; for (int i = start; i < start + size; i++) { - int val = (input[i] & 0xFF); + final int val = (input[i] & 0xFF); if (val < 16) { buffer.append("0"); } @@ -164,7 +165,7 @@ buffer.append('\n'); try { return buffer.toString().getBytes("US-ASCII"); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { return buffer.toString().getBytes(); } } @@ -188,15 +189,16 @@ * @throws PSFilterException If the input array contains invalid ASCIIHex * characters. */ - public static byte[] decodeArray(byte leftoverByte, byte[] input, - int inputLength, int outputLength) throws PSFilterException { + public static byte[] decodeArray(final byte leftoverByte, + final byte[] input, final int inputLength, final int outputLength) + throws PSFilterException { if (outputLength < 1) { return null; } if (inputLength < 1) { return null; } - byte[] output = new byte[outputLength]; + final byte[] output = new byte[outputLength]; int outputIndex = 0; byte byte1 = 0x00; byte byte2 = 0x00; @@ -242,7 +244,8 @@ return output; } - private static int countDataBytes(byte inputByte) throws PSFilterException { + private static int countDataBytes(final byte inputByte) + throws PSFilterException { switch(inputByte) { case(0x00): // null case(0x20): // space Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/CCITTFaxFilter.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/filter/CCITTFaxFilter.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/CCITTFaxFilter.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -44,18 +44,18 @@ return this.m_decodeParms; } - public void setDecodeParms(String decodeParms) { + public void setDecodeParms(final String decodeParms) { this.m_decodeParms = decodeParms; } - public byte[] encode(byte[] data) { + public byte[] encode(final byte[] data) { return data; } /** * Unimplemented. */ - public byte[] decode(byte[] input) { + public byte[] decode(final byte[] input) { return input; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/DCTFilter.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/filter/DCTFilter.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/DCTFilter.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -41,14 +41,14 @@ return null; } - public byte[] encode(byte[] data) { + public byte[] encode(final byte[] data) { return data; } /** * Unimplemented. */ - public byte[] decode(byte[] input) { + public byte[] decode(final byte[] input) { return input; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/EncryptFilter.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/filter/EncryptFilter.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/EncryptFilter.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -127,7 +127,7 @@ * @param randomBytes The quantity of random bytes that should occur at the * beginning of the sequence to be processed. */ - public EncryptFilter(int encryptionKey, byte randomBytes) { + public EncryptFilter(final int encryptionKey, final byte randomBytes) { this.encryptionKey = encryptionKey; this.randomBytes = randomBytes; this.randomBytesToDiscard = this.randomBytes; @@ -144,7 +144,7 @@ /** * Not yet implemented. */ - public byte[] encode(byte[] input) { + public byte[] encode(final byte[] input) { return input; } @@ -180,8 +180,8 @@ return input; } - private byte decrypt(byte cipherText) { - byte temp = (byte) (encryptionKey >> 8); + private byte decrypt(final byte cipherText) { + final byte temp = (byte) (encryptionKey >> 8); byte plainText = (byte) (cipherText ^ temp); // The trick here is to get cipherText treated as unsigned int unsignedCipherText = cipherText; @@ -205,7 +205,7 @@ return plainText; } - private void resolveFormat(byte[] input) { + private void resolveFormat(final byte[] input) { byte inputIndex = 0; while (first4BytesIndex < 4 && inputIndex < input.length) { first4Bytes[first4BytesIndex] = input[inputIndex]; Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateFilter.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateFilter.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateFilter.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -58,7 +58,7 @@ public String getDecodeParms() { if (_predictor > PREDICTION_NONE) { - StringBuffer sb = new StringBuffer(); + final StringBuffer sb = new StringBuffer(); sb.append("<< /Predictor "); sb.append(_predictor); if (_colors > 0) { @@ -83,16 +83,17 @@ * because these attributes are not supported. So the DecodeParms * should be retrieved after calling this method. */ - public byte[] encode(byte[] data) throws PSFilterException { - ByteArrayOutputStream outArrayStream = new ByteArrayOutputStream(); + public byte[] encode(final byte[] data) throws PSFilterException { + final ByteArrayOutputStream outArrayStream = + new ByteArrayOutputStream(); _predictor = PREDICTION_NONE; try { - DeflaterOutputStream compressedStream = + final DeflaterOutputStream compressedStream = new DeflaterOutputStream(outArrayStream); compressedStream.write(data, 0, data.length); compressedStream.flush(); compressedStream.close(); - } catch (IOException e) { + } catch (final IOException e) { throw new PSFilterException(e.getMessage()); } return outArrayStream.toByteArray(); @@ -101,11 +102,11 @@ /** * Unimplemented. */ - public byte[] decode(byte[] input) { + public byte[] decode(final byte[] input) { return input; } - public void setPredictor(int predictor) throws PSFilterException { + public void setPredictor(final int predictor) throws PSFilterException { _predictor = predictor; } @@ -115,7 +116,7 @@ } - public void setColors(int colors) throws PSFilterException { + public void setColors(final int colors) throws PSFilterException { if (_predictor != PREDICTION_NONE) { _colors = colors; } else { @@ -129,7 +130,7 @@ } - public void setBitsPerComponent(int bits) throws PSFilterException { + public void setBitsPerComponent(final int bits) throws PSFilterException { if (_predictor != PREDICTION_NONE) { _bitsPerComponent = bits; } else { @@ -143,7 +144,7 @@ } - public void setColumns(int columns) throws PSFilterException { + public void setColumns(final int columns) throws PSFilterException { if (_predictor != PREDICTION_NONE) { _columns = columns; } else { Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -56,7 +56,7 @@ * should be set to true and the filter options should be set to * those which the raw data was encoded with. */ - public void setApplied(boolean b) { + public void setApplied(final boolean b) { _applied = b; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilterException.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilterException.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilterException.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -35,7 +35,7 @@ super(); } - public PSFilterException(String message) { + public PSFilterException(final String message) { super(message); } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/java2d/Java2DSystemDict.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/java2d/Java2DSystemDict.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/java2d/Java2DSystemDict.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -37,12 +37,13 @@ ... [truncated message content] |
|
From: <vic...@us...> - 2006-07-23 21:55:52
|
Revision: 7827 Author: victormote Date: 2006-07-23 14:55:19 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7827&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-ps/.project trunk/foray/foray-ps/src/java/org/foray/ps/PSArray.java trunk/foray/foray-ps/src/java/org/foray/ps/PSBoolean.java trunk/foray/foray-ps/src/java/org/foray/ps/PSColor.java trunk/foray/foray-ps/src/java/org/foray/ps/PSColorSpace.java trunk/foray/foray-ps/src/java/org/foray/ps/PSDictionary.java trunk/foray/foray-ps/src/java/org/foray/ps/PSErrorDict.java trunk/foray/foray-ps/src/java/org/foray/ps/PSException.java trunk/foray/foray-ps/src/java/org/foray/ps/PSFile.java trunk/foray/foray-ps/src/java/org/foray/ps/PSFileFilter.java trunk/foray/foray-ps/src/java/org/foray/ps/PSFileReal.java trunk/foray/foray-ps/src/java/org/foray/ps/PSFontID.java trunk/foray/foray-ps/src/java/org/foray/ps/PSGraphicsState.java trunk/foray/foray-ps/src/java/org/foray/ps/PSInputFile.java trunk/foray/foray-ps/src/java/org/foray/ps/PSInteger.java trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java trunk/foray/foray-ps/src/java/org/foray/ps/PSMark.java trunk/foray/foray-ps/src/java/org/foray/ps/PSMatrix.java trunk/foray/foray-ps/src/java/org/foray/ps/PSName.java trunk/foray/foray-ps/src/java/org/foray/ps/PSNumber.java trunk/foray/foray-ps/src/java/org/foray/ps/PSObject.java trunk/foray/foray-ps/src/java/org/foray/ps/PSOperator.java trunk/foray/foray-ps/src/java/org/foray/ps/PSReal.java trunk/foray/foray-ps/src/java/org/foray/ps/PSStack.java trunk/foray/foray-ps/src/java/org/foray/ps/PSStackGS.java trunk/foray/foray-ps/src/java/org/foray/ps/PSStackObject.java trunk/foray/foray-ps/src/java/org/foray/ps/PSString.java trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java Modified: trunk/foray/foray-ps/.project =================================================================== --- trunk/foray/foray-ps/.project 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/.project 2006-07-23 21:55:19 UTC (rev 7827) @@ -7,12 +7,12 @@ </projects> <buildSpec> <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> <arguments> </arguments> </buildCommand> Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSArray.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSArray.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSArray.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -38,8 +38,8 @@ */ int executionStackIteratorIndex = 0; - public PSArray(PSInterpreter interpreter, Object[] value, - boolean executable) { + public PSArray(final PSInterpreter interpreter, final Object[] value, + final boolean executable) { super(interpreter); this.value = value; this.executable = executable; @@ -68,7 +68,8 @@ if (executionStackIteratorIndex > value.length - 1) { return null; } - PSObject nextElement = (PSObject) value[executionStackIteratorIndex]; + final PSObject nextElement = + (PSObject) value[executionStackIteratorIndex]; executionStackIteratorIndex ++; return nextElement; } @@ -77,7 +78,7 @@ return value.length - executionStackIteratorIndex; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSArray) { return true; } @@ -96,7 +97,7 @@ return value.length; } - public PSObject get(int index) { + public PSObject get(final int index) { if (index < 0 || index > value.length - 1) { return null; } @@ -116,7 +117,7 @@ return null; } boolean allNumbers = true; - PSNumber[] newArray = new PSNumber[6]; + final PSNumber[] newArray = new PSNumber[6]; for (int i = 0; i < this.value.length; i++) { if (this.value[i] instanceof PSNumber) { newArray[i] = (PSNumber) this.value[i]; Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSBoolean.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSBoolean.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSBoolean.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -31,7 +31,7 @@ boolean value; - public PSBoolean(PSInterpreter interpreter, boolean value) { + public PSBoolean(final PSInterpreter interpreter, final boolean value) { super(interpreter); this.value = value; } @@ -48,7 +48,7 @@ return PSObject.PSOBJ_BOOLEAN; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSBoolean) { return true; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSColor.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSColor.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSColor.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -40,8 +40,9 @@ * @param fillNotStroke * @return The PostScript code that represents this color. */ - public static String toPS(Color color, boolean fillNotStroke, String eol) { - int colorSpace = color.getColorSpace().getType(); + public static String toPS(final Color color, final boolean fillNotStroke, + final String eol) { + final int colorSpace = color.getColorSpace().getType(); switch (colorSpace) { case ColorSpace.TYPE_RGB: { return toPS_RGB(color, fillNotStroke, eol); @@ -56,9 +57,9 @@ } /* Colorspace is RGB. */ - private static String toPS_RGB(Color color, boolean fillNotStroke, - String eol) { - StringBuffer buffer = new StringBuffer(""); + private static String toPS_RGB(final Color color, + final boolean fillNotStroke, final String eol) { + final StringBuffer buffer = new StringBuffer(""); /* According to pdfspec 12.1 p.399, if the colors are the same then * just use the g or G operator (DeviceGray). */ @@ -67,7 +68,7 @@ && color.getRed() == color.getBlue()) { isGray = true; } - float[] rgbColors = color.getComponents(null); + final float[] rgbColors = color.getComponents(null); // fill if (fillNotStroke) { @@ -94,10 +95,10 @@ } /* Colorspace is CMYK. */ - private static String toPS_CMYK(Color color, boolean fillNotStroke, - String eol) { - StringBuffer buffer = new StringBuffer(""); - float[] cmykColors = color.getComponents(null); + private static String toPS_CMYK(final Color color, + final boolean fillNotStroke, final String eol) { + final StringBuffer buffer = new StringBuffer(""); + final float[] cmykColors = color.getComponents(null); if (fillNotStroke) { // fill buffer.append(PSReal.doubleOut(cmykColors[0]) + " " + PSReal.doubleOut(cmykColors[1]) + " " @@ -113,10 +114,10 @@ } /* Colorspace is DeviceGray. */ - private static String toPS_Gray(Color color, boolean fillNotStroke, - String eol) { - StringBuffer buffer = new StringBuffer(""); - float[] grayColors = color.getComponents(null); + private static String toPS_Gray(final Color color, + final boolean fillNotStroke, final String eol) { + final StringBuffer buffer = new StringBuffer(""); + final float[] grayColors = color.getComponents(null); if (fillNotStroke) { buffer.append(PSReal.doubleOut(grayColors[0]) + " g" + eol); } else { Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSColorSpace.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSColorSpace.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSColorSpace.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -44,12 +44,12 @@ /** * Standard constructor. */ - public PSColorSpace(PSInterpreter interpreter, Object[] value) { + public PSColorSpace(final PSInterpreter interpreter, final Object[] value) { super(interpreter, value, false); } - public static PSColorSpace makeColorSpace(PSInterpreter interpreter, - int type) { + public static PSColorSpace makeColorSpace(final PSInterpreter interpreter, + final int type) { PSName csName = null; switch (type) { case DEVICE_GRAY: { Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSDictionary.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSDictionary.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSDictionary.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -35,7 +35,8 @@ private HashMap dictionary = null; - public PSDictionary(PSInterpreter interpreter, int initialSize) { + public PSDictionary(final PSInterpreter interpreter, + final int initialSize) { super(interpreter); dictionary = new HashMap(initialSize); } @@ -45,8 +46,8 @@ * @param nameObject The PSName instance that should be executed. * @return True if the operation was found and executed, otherwise, false. */ - protected boolean execute(PSName nameObject) throws PSException { - PSObject value = getItem(nameObject); + protected boolean execute(final PSName nameObject) throws PSException { + final PSObject value = getItem(nameObject); // If the item is not in this dictionary, exit if (value == null) { return false; @@ -67,7 +68,8 @@ * be executed * @return True if the operator is found and executed, otherwise, false. */ - protected boolean executeOperator(short operatorEnum) throws PSException { + protected boolean executeOperator(final short operatorEnum) + throws PSException { return false; } @@ -83,7 +85,8 @@ * @param key * @param value */ - public void addItem(PSObject key, PSObject value) throws PSException { + public void addItem(final PSObject key, final PSObject value) + throws PSException { // Per PLRM2, Sec 3.3.9, a key can be any PS object except null. if (key.getPSObjectType() == PSOBJ_NULL) { throw new PSException(this.interpreter, PSErrorDict.TYPECHECK, -1); @@ -95,10 +98,10 @@ dictionary.put(key, value); } - public PSObject getItem(PSObject key) { - Iterator iter = dictionary.keySet().iterator(); + public PSObject getItem(final PSObject key) { + final Iterator iter = dictionary.keySet().iterator(); while (iter.hasNext()) { - PSObject currentKey = (PSObject) iter.next(); + final PSObject currentKey = (PSObject) iter.next(); if (currentKey.equals(key)) { return (PSObject) dictionary.get(currentKey); } @@ -106,10 +109,10 @@ return null; } - public PSObject getItem(String key) { - Iterator iter = dictionary.keySet().iterator(); + public PSObject getItem(final String key) { + final Iterator iter = dictionary.keySet().iterator(); while (iter.hasNext()) { - PSObject currentKey = (PSObject) iter.next(); + final PSObject currentKey = (PSObject) iter.next(); if (currentKey.equals(key)) { return (PSObject) dictionary.get(currentKey); } @@ -131,7 +134,7 @@ * @return True if this is a valid font dictionary, false otherwise. */ public boolean isValidFontDictionary() { - PSInteger fontType = (PSInteger) getItem("FontType"); + final PSInteger fontType = (PSInteger) getItem("FontType"); if (fontType == null) { return false; } @@ -160,7 +163,7 @@ return true; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSDictionary) { return true; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSErrorDict.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSErrorDict.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSErrorDict.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -93,7 +93,7 @@ "vmerror" }; - public PSErrorDict(PSInterpreter interpreter) { + public PSErrorDict(final PSInterpreter interpreter) { super(interpreter, 0); } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSException.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSException.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSException.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -37,38 +37,38 @@ String message; String operandStackImage; - public PSException(PSInterpreter interpreter, int errorCode, - int offendingOperator, String message) { + public PSException(final PSInterpreter interpreter, final int errorCode, + final int offendingOperator, final String message) { super(message); this.lineNumber = interpreter.getCurrentLine(); this.columnNumber = interpreter.getCurrentColumn(); this.errorCode = errorCode; this.offendingOperator = offendingOperator; - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append("Operand Stack:\n"); - PSStackObject operandStack = interpreter.getOperandStack(); + final PSStackObject operandStack = interpreter.getOperandStack(); if (operandStack.size() == 0) { buffer.append(" (empty)"); } for (int i = 0; i < operandStack.size(); i++) { - PSObject object = operandStack.peek(i); + final PSObject object = operandStack.peek(i); buffer.append(" " + object.toString() + "\n"); } this.operandStackImage = buffer.toString(); } - public PSException(PSInterpreter interpreter, int errorCode) { + public PSException(final PSInterpreter interpreter, final int errorCode) { this(interpreter, errorCode, (short) -1, null); } - public PSException(PSInterpreter interpreter, int errorCode, - int offendingOperator) { + public PSException(final PSInterpreter interpreter, final int errorCode, + final int offendingOperator) { this(interpreter, errorCode, offendingOperator, null); } public String getMessage() { - String detailMessage = super.getMessage(); - StringBuffer sb = new StringBuffer(); + final String detailMessage = super.getMessage(); + final StringBuffer sb = new StringBuffer(); if (this.errorCode < 0 || this.errorCode > PSErrorDict.ERROR_NAMES.length - 1) { sb.append("PS Interpeter threw invalid PostScript error: "); Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSFile.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSFile.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSFile.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -50,7 +50,7 @@ /** * Generic constructor. */ - public PSFile(PSInterpreter interpreter) { + public PSFile(final PSInterpreter interpreter) { super(interpreter); } @@ -98,18 +98,18 @@ if (chunk == null) { return null; } - int arraySize = chunk.length - chunkIndex; + final int arraySize = chunk.length - chunkIndex; if (arraySize < 1) { return null; } - byte[] remainingChunk = new byte[arraySize]; + final byte[] remainingChunk = new byte[arraySize]; System.arraycopy(chunk, chunkIndex, remainingChunk, 0, arraySize); // Advance the index past the boundary chunkIndex = chunk.length; return remainingChunk; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSFile) { return true; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSFileFilter.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSFileFilter.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSFileFilter.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -46,8 +46,8 @@ * @param interpreter The PSInterpreter for which this filter is operating. * @param underlyingFile The PSFile which backs this filter. */ - public PSFileFilter(PSInterpreter interpreter, PSFilter filter, - PSFile underlyingFile) { + public PSFileFilter(final PSInterpreter interpreter, final PSFilter filter, + final PSFile underlyingFile) { super(interpreter); this.filter = filter; this.underlyingFile = underlyingFile; @@ -58,8 +58,8 @@ * @param interpreter The PSInterpreter for which this filter is operating. * @param underlyingString The String which backs this filter. */ - public PSFileFilter(PSInterpreter interpreter, PSFilter filter, - PSString underlyingString) { + public PSFileFilter(final PSInterpreter interpreter, final PSFilter filter, + final PSString underlyingString) { super(interpreter); this.filter = filter; this.underlyingString = underlyingString; @@ -78,7 +78,7 @@ } try { return filter.decode(tempChunk); - } catch (PSFilterException e) { + } catch (final PSFilterException e) { // TODO Auto-generated catch block e.printStackTrace(); } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSFileReal.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSFileReal.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSFileReal.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -41,7 +41,7 @@ * @param interpreter * @param file */ - public PSFileReal(PSInterpreter interpreter, File file) { + public PSFileReal(final PSInterpreter interpreter, final File file) { super(interpreter); this.value = file; } @@ -52,7 +52,7 @@ * @param interpreter * @param input */ - public PSFileReal(PSInterpreter interpreter, PSInput input) { + public PSFileReal(final PSInterpreter interpreter, final PSInput input) { super(interpreter); this.input = input; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSFontID.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSFontID.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSFontID.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -31,7 +31,7 @@ public class PSFontID extends PSObject { - public PSFontID(PSInterpreter interpreter) { + public PSFontID(final PSInterpreter interpreter) { super(interpreter); } @@ -47,7 +47,7 @@ return PSObject.PSOBJ_FONTID; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSFontID) { return true; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSGraphicsState.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSGraphicsState.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSGraphicsState.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -89,7 +89,7 @@ private float flatness = 1.0f; byte device; // Bogus datatype. - public PSGraphicsState(PSInterpreter interpreter) { + public PSGraphicsState(final PSInterpreter interpreter) { super(interpreter); this.interpreter = interpreter; this.colorSpaceDeviceGray = PSColorSpace.makeColorSpace( @@ -104,7 +104,7 @@ PSGraphicsState clone; try { clone = (PSGraphicsState) super.clone(); - } catch (CloneNotSupportedException e) { + } catch (final CloneNotSupportedException e) { return null; } return clone; @@ -114,7 +114,7 @@ return (PSGraphicsState) this.clone(); } - public void setColorSpace(int colorSpace) { + public void setColorSpace(final int colorSpace) { switch (colorSpace) { case PSColorSpace.DEVICE_GRAY: { this.colorSpace = this.colorSpaceDeviceGray; @@ -134,7 +134,7 @@ } } - public void setColor(Color newColor) { + public void setColor(final Color newColor) { this.color = newColor; } @@ -146,7 +146,7 @@ return this.colorSpace; } - public void setDash(PSArray dashPattern, float dashOffset) { + public void setDash(final PSArray dashPattern, final float dashOffset) { this.dashPattern = dashPattern; this.dashOffset = dashOffset; } @@ -159,7 +159,7 @@ return this.dashOffset; } - public void setFlatness(float flatness) { + public void setFlatness(final float flatness) { this.flatness = flatness; } @@ -177,7 +177,7 @@ /** * @param lineJoin The lineJoin to set. */ - public void setLineJoin(PSInteger lineJoin) { + public void setLineJoin(final PSInteger lineJoin) { this.lineJoin = lineJoin; } @@ -191,7 +191,7 @@ /** * @param lineCap The lineCap to set. */ - public void setLineCap(PSInteger lineCap) { + public void setLineCap(final PSInteger lineCap) { this.lineCap = lineCap; } @@ -205,7 +205,7 @@ /** * @param lineWidth The lineWidth to set. */ - public void setLineWidth(PSNumber lineWidth) { + public void setLineWidth(final PSNumber lineWidth) { this.lineWidth = lineWidth; } @@ -219,7 +219,7 @@ /** * @param miterLimit The miterLimit to set. */ - public void setMiterLimit(PSNumber miterLimit) { + public void setMiterLimit(final PSNumber miterLimit) { this.miterLimit = miterLimit; } @@ -233,7 +233,7 @@ /** * @param ctm The ctm to set. */ - public void setCTM(PSMatrix ctm) { + public void setCTM(final PSMatrix ctm) { this.ctm = ctm; } @@ -247,7 +247,7 @@ /** * @param font The font to set. */ - public void setFont(PSDictionary font) { + public void setFont(final PSDictionary font) { this.font = font; } @@ -263,7 +263,7 @@ return PSObject.PSOBJ_GSTATE; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSGraphicsState) { return true; } @@ -279,7 +279,7 @@ * requirements of the copy operator. * @param copyFrom */ - protected void copy(PSGraphicsState copyFrom) { + protected void copy(final PSGraphicsState copyFrom) { this.colorSpaceDeviceGray = copyFrom.colorSpaceDeviceGray; this.colorSpaceDeviceRGB = copyFrom.colorSpaceDeviceRGB; this.colorSpaceDeviceCMYK = copyFrom.colorSpaceDeviceCMYK; Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSInputFile.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSInputFile.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSInputFile.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -43,7 +43,7 @@ * to the PSInterpreter. * @throws IOException If the file cannot be opened for use. */ - public PSInputFile(File psFile) throws IOException { + public PSInputFile(final File psFile) throws IOException { this.in = new java.io.BufferedInputStream (new java.io.FileInputStream(psFile)); } @@ -52,12 +52,12 @@ * {@inheritDoc} */ public byte[] providePostScriptInput() throws IOException { - byte[] buf = new byte[2048]; - int bytesRead = in.read(buf); + final byte[] buf = new byte[2048]; + final int bytesRead = in.read(buf); if (bytesRead <= 0) { return null; } - byte[] trimmed = new byte[bytesRead]; + final byte[] trimmed = new byte[bytesRead]; System.arraycopy(buf, 0, trimmed, 0, bytesRead); return trimmed; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSInteger.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSInteger.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSInteger.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -34,7 +34,7 @@ int value; - public PSInteger(PSInterpreter interpreter, int value) { + public PSInteger(final PSInterpreter interpreter, final int value) { super(interpreter); this.value = value; } @@ -47,8 +47,8 @@ * @return A PSInteger instance if value is within the PS architectural * limits, or a PSReal instance otherwise. */ - public static PSNumber makePSNumber(PSInterpreter interpreter, - long value) { + public static PSNumber makePSNumber(final PSInterpreter interpreter, + final long value) { if (value > PS_LARGEST_INTEGER || value < PS_SMALLEST_INTEGER) { return new PSReal(interpreter, value); @@ -63,7 +63,8 @@ * a PSInteger instance. * @return A PSInteger instance, if the input qualifies, otherwise, null. */ - public static PSInteger create(PSInterpreter interpreter, byte[] input) { + public static PSInteger create(final PSInterpreter interpreter, + final byte[] input) { // First char must be a digit or a sign indicator if (!isNumeral(input[0]) && !isMember(PSInterpreter.SIGN_INDICATOR, input[0])) { @@ -105,8 +106,8 @@ * a PSInteger instance. * @return A PSInteger instance, if the input qualifies, otherwise, null. */ - private static PSInteger parseRadixNumber(PSInterpreter interpreter, - byte[] input) { + private static PSInteger parseRadixNumber(final PSInterpreter interpreter, + final byte[] input) { // Every char must be a digit, a letter, or a # sign for (int i = 0; i < input.length; i++) { if (!isNumeral(input[i]) @@ -155,7 +156,7 @@ int value = 0; place = 0; for (int i = input.length - 1; i > delimiterMark; i--) { - byte placeValue = getPlaceValue(base, input[i]); + final byte placeValue = getPlaceValue(base, input[i]); // Make sure the digit is valid for this base if (placeValue < 0) { return null; @@ -176,7 +177,7 @@ * @return The base-10 integral value of this digit in this base, or a -1 * if the digit is not valid in this base. */ - private static byte getPlaceValue(byte base, byte input) { + private static byte getPlaceValue(final byte base, byte input) { // Normalize the letters to be all caps if (input >= 0x61 && input <= 0x7a) { input -= 0x20; @@ -214,14 +215,14 @@ return PSObject.PSOBJ_INTEGER; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSInteger || object instanceof PSReal) { return true; } return false; } - public int compareTo(Object object) { + public int compareTo(final Object object) { PSObject psobject = null; if (object instanceof PSObject) { psobject = (PSObject) object; @@ -232,7 +233,7 @@ return -127; } if (psobject instanceof PSInteger) { - PSInteger psinteger = (PSInteger) psobject; + final PSInteger psinteger = (PSInteger) psobject; if (this.value == psinteger.value) { return 0; } else if (this.value < psinteger.value) { @@ -242,7 +243,7 @@ } } if (psobject instanceof PSReal) { - PSReal psreal = (PSReal) psobject; + final PSReal psreal = (PSReal) psobject; if (this.value == psreal.value) { return 0; } else if (this.value < psreal.value) { @@ -254,7 +255,7 @@ return -127; } - public boolean equals(Object object) { + public boolean equals(final Object object) { if (this.compareTo(object) == 0) { return true; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -156,7 +156,7 @@ * @param input The PSInput instance that should be used as standard input * to the interpreter. */ - public PSInterpreter(Log logger, PSInput input, + public PSInterpreter(final Log logger, final PSInput input, PSSystemDict systemDict) throws PSException { if (input == null) { logger.error("PostScript Error: No standard input."); @@ -230,12 +230,13 @@ */ public void process() throws PSException { while (executionStack.size() != 0) { - PSObject currentExecution = executionStack.peek(); + final PSObject currentExecution = executionStack.peek(); processItem(currentExecution); } } - public void processItem(PSObject currentExecution) throws PSException { + public void processItem(final PSObject currentExecution) + throws PSException { if (currentExecution instanceof PSFile) { executePSFile((PSFile) currentExecution); return; @@ -251,9 +252,9 @@ return; } if (currentExecution instanceof PSOperator) { - PSOperator operator = (PSOperator) currentExecution; + final PSOperator operator = (PSOperator) currentExecution; executionStack.pop(); - boolean completed = operator.execute(); + final boolean completed = operator.execute(); if (! completed) { logger.error("Internal PostScript error: Unsupported operator: " + PSOperator.mapEnumToName(operator.operatorEnum)); @@ -270,7 +271,7 @@ * @param file * @throws PSException */ - private void executePSFile(PSFile file) throws PSException { + private void executePSFile(final PSFile file) throws PSException { if (! file.fileIsOpen) { executionStack.pop(); return; @@ -278,7 +279,7 @@ byte byteToConsume = 0; try { byteToConsume = file.provideInput(); - } catch (IOException e) { + } catch (final IOException e) { file.closeFile(); return; } @@ -292,7 +293,7 @@ * @param array * @throws PSException */ - private void executePSArray(PSArray array) throws PSException { + private void executePSArray(final PSArray array) throws PSException { if (array.qtyUnexecutedItems() < 1) { executionStack.pop(); return; @@ -317,7 +318,8 @@ return; } - private void executePSArrayItem(PSObject arrayItem) throws PSException { + private void executePSArrayItem(final PSObject arrayItem) + throws PSException { if (arrayItem == null) { executionStack.pop(); return; @@ -329,7 +331,7 @@ processToken(arrayItem); } - private void adjustCounters(byte inputByte) { + private void adjustCounters(final byte inputByte) { switch (inputByte) { case CARRIAGE_RETURN: { this.currentLine ++; @@ -353,7 +355,7 @@ * to be processed normally when a self-delimiting character is found. * See PSLRM2 3.2.2, where such characters are listed as self-delimiting. */ - private void autoDelimitByte(byte inputByte) throws PSException { + private void autoDelimitByte(final byte inputByte) throws PSException { if (inCommentLine) { return; } @@ -371,9 +373,9 @@ case RIGHT_CURLY: case SLASH: case PERCENT: - int oldExecutionStackSize = executionStack.size(); + final int oldExecutionStackSize = executionStack.size(); consumeToken(); - int newExecutionStackSize = executionStack.size(); + final int newExecutionStackSize = executionStack.size(); /* * If the execution stack size increased as a result of the * consumeToken(), we need to @@ -381,7 +383,7 @@ if (newExecutionStackSize > oldExecutionStackSize) { assert newExecutionStackSize == oldExecutionStackSize + 1: "More than 1 item added to Execution Stack."; - PSObject currentExecution = executionStack.peek(); + final PSObject currentExecution = executionStack.peek(); // Warning: This is recursive. We are already inside this. processItem(currentExecution); } @@ -392,7 +394,7 @@ } } - public void consumeByte(byte inputByte) throws PSException { + public void consumeByte(final byte inputByte) throws PSException { /* * Uncomment the following line to have the input font sent to std out. * This is useful for debugging filtered or encrypted PostScript input. @@ -421,14 +423,16 @@ case LEFT_PAREN: inString = true; break; - case LEFT_BRACKET: - PSName nameObject = new PSName(this, "[", true, false); + case LEFT_BRACKET: { + final PSName nameObject = new PSName(this, "[", true, false); processToken(nameObject); break; - case RIGHT_BRACKET: - nameObject = new PSName(this, "]", true, false); + } + case RIGHT_BRACKET: { + final PSName nameObject = new PSName(this, "]", true, false); processToken(nameObject); break; + } case LEFT_CURLY: // Check for a nested procedure if (inProcedure) { @@ -441,11 +445,12 @@ break; case RIGHT_CURLY: // Convert procedureBeingBuilt into a PSArray - Object[] procedureArray = new Object[procedureBeingBuilt.size()]; + final Object[] procedureArray = + new Object[procedureBeingBuilt.size()]; for (int i = 0; i < procedureArray.length; i++) { procedureArray[i] = procedureBeingBuilt.get(i); } - PSArray newArray = new PSArray(this, procedureArray, true); + final PSArray newArray = new PSArray(this, procedureArray, true); /* * If there is anything on the procedureStack, pop the top item off * and that is now the procedureBeingBuilt. @@ -477,7 +482,7 @@ } } - private void consumeByteInCommentLine(byte inputByte) { + private void consumeByteInCommentLine(final byte inputByte) { /* See PSLRM2, Section 3.2.2, Subsection "Comments". */ switch (inputByte) { case CARRIAGE_RETURN: @@ -489,7 +494,7 @@ } } - private void consumeByteInString(byte inputByte) throws PSException { + private void consumeByteInString(final byte inputByte) throws PSException { switch (inputByte) { case LEFT_PAREN: qtyNestedParentheses ++; @@ -502,7 +507,7 @@ break; } inString = false; - PSString stringObject = new PSString(this, + final PSString stringObject = new PSString(this, stringBeingBuilt.toString()); processToken(stringObject); stringBeingBuilt = new StringBuffer(); @@ -512,11 +517,11 @@ } } - private void addToString(byte inputByte) { + private void addToString(final byte inputByte) { stringBeingBuilt.append((char) inputByte); } - private void appendToToken(byte inputByte) { + private void appendToToken(final byte inputByte) { /* * TODO: Should probably throw an exception here */ @@ -532,7 +537,7 @@ return; } // Copy the token to a new byte array - byte[] token = new byte[tokenBeingBuiltSize]; + final byte[] token = new byte[tokenBeingBuiltSize]; System.arraycopy(tokenBeingBuilt, 0, token, 0, tokenBeingBuiltSize); // Initialize tokenBeingBuilt and related items for next token tokenBeingBuiltSize = 0; @@ -556,7 +561,7 @@ processToken(object); } - private void processToken(PSObject object) throws PSException { + private void processToken(final PSObject object) throws PSException { if (inProcedure) { procedureBeingBuilt.add(object); return; @@ -573,7 +578,7 @@ operandStack.push(object); } - private void processName(PSName nameObject) throws PSException { + private void processName(final PSName nameObject) throws PSException { // If the name is not executable, just push it onto the stack. if (! nameObject.isExecutable) { operandStack.push(nameObject); @@ -592,11 +597,11 @@ } } - protected PSObject find(PSObject key) { + protected PSObject find(final PSObject key) { PSDictionary currentDict = null; for (int i = 0; i < dictionaryStack.size(); i++) { currentDict = (PSDictionary) (dictionaryStack.peek(i)); - PSObject value = currentDict.getItem(key); + final PSObject value = currentDict.getItem(key); if (value != null) { return value; } @@ -609,7 +614,7 @@ * @param key String containing the name of the item to be found. * @return The PSObject that is stored with key. */ - public PSObject find(String key) { + public PSObject find(final String key) { return find(new PSName(this, key, false, false)); } @@ -626,7 +631,7 @@ } public PSDictionary getFontDirectory() { - PSDictionary systemDict = getSystemDict(); + final PSDictionary systemDict = getSystemDict(); if (systemDict == null) { return null; } @@ -657,7 +662,7 @@ return this.currentGraphicsState; } - public void setGraphicsState(PSGraphicsState graphicsState) { + public void setGraphicsState(final PSGraphicsState graphicsState) { this.currentGraphicsState = graphicsState; } @@ -665,7 +670,7 @@ return this.packingMode; } - public void setPackingMode(boolean newPackingMode) { + public void setPackingMode(final boolean newPackingMode) { this.packingMode = newPackingMode; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSMark.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSMark.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSMark.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -29,7 +29,7 @@ */ public class PSMark extends PSObject { - public PSMark(PSInterpreter interpreter) { + public PSMark(final PSInterpreter interpreter) { super(interpreter); } @@ -45,7 +45,7 @@ return PSObject.PSOBJ_MARK; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSMark) { return true; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSMatrix.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSMatrix.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSMatrix.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -37,8 +37,8 @@ * @param value * @param executable */ - public PSMatrix(PSInterpreter interpreter, PSNumber[] value, - boolean executable) { + public PSMatrix(final PSInterpreter interpreter, final PSNumber[] value, + final boolean executable) { super(interpreter, value, executable); } @@ -46,16 +46,16 @@ return (PSNumber[]) this.value; } - public void setMatrixValue(PSNumber[] newMatrixValue) { + public void setMatrixValue(final PSNumber[] newMatrixValue) { this.value = newMatrixValue; } - protected static PSMatrix identMatrix(PSInterpreter interpreter, - PSMatrix matrix) { - PSReal real1 = new PSReal(interpreter, 1.0); - PSReal real0 = new PSReal(interpreter, 0.0); - PSNumber[] insideArray = new PSReal[] { real1, real0, real0, real1, - real0, real0 }; + protected static PSMatrix identMatrix(final PSInterpreter interpreter, + final PSMatrix matrix) { + final PSReal real1 = new PSReal(interpreter, 1.0); + final PSReal real0 = new PSReal(interpreter, 0.0); + final PSNumber[] insideArray = new PSReal[] { real1, real0, real0, + real1, real0, real0 }; if (matrix == null) { return new PSMatrix(interpreter, insideArray, false); } @@ -68,7 +68,7 @@ * @param point The point to be transformed. * @return The transformed point. */ - public Point2D transform(Point2D point) { + public Point2D transform(final Point2D point) { /* TODO: This is just a stub. This should transform the point and * returned a transformed value instead of just copying the one * given. */ @@ -80,7 +80,7 @@ * @param point The point to be inverse transformed. * @return The transformed point. */ - public Point2D inverseTransform(Point2D point) { + public Point2D inverseTransform(final Point2D point) { /* TODO: This is just a stub. This should transform the point and * returned a transformed value instead of just copying the one * given. */ @@ -92,7 +92,7 @@ * @param distanceVector The distance vector to be delta transformed. * @return The transformed point. */ - public Dimension2D deltaTransform(Dimension2D distanceVector) { + public Dimension2D deltaTransform(final Dimension2D distanceVector) { /* TODO: This is just a stub. This should transform the Dimension and * returned a transformed Dimension instead of just copying the one * given. */ @@ -105,7 +105,7 @@ * @param distanceVector The distance vector to be delta transformed. * @return The transformed point. */ - public Dimension2D inverseDeltaTransform(Dimension2D distanceVector) { + public Dimension2D inverseDeltaTransform(final Dimension2D distanceVector) { /* TODO: This is just a stub. This should transform the Dimension and * returned a transformed Dimension instead of just copying the one * given. */ @@ -121,8 +121,9 @@ * @throws PSException If either matrix1 or matrix2 are not exactly 6 * elements long. */ - public static PSNumber[] concatMatrices(PSInterpreter interpreter, - PSNumber[] matrix1, PSNumber[] matrix2) throws PSException { + public static PSNumber[] concatMatrices(final PSInterpreter interpreter, + final PSNumber[] matrix1, final PSNumber[] matrix2) + throws PSException { if (matrix1.length != 6) { throw new PSException(interpreter, PSErrorDict.RANGECHECK); } @@ -132,9 +133,10 @@ return matrix1; } - public static PSNumber[] makeTranslateMatrix(PSInterpreter interpreter, - PSNumber x, PSNumber y) { - PSNumber[] returnArray = new PSNumber[6]; + public static PSNumber[] makeTranslateMatrix( + final PSInterpreter interpreter, final PSNumber x, + final PSNumber y) { + final PSNumber[] returnArray = new PSNumber[6]; returnArray[0] = new PSInteger(interpreter, 1); returnArray[1] = new PSInteger(interpreter, 0); returnArray[2] = new PSInteger(interpreter, 0); Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSName.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSName.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSName.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -33,8 +33,8 @@ boolean isExecutable; boolean isImmediatelyEvaluated; - public PSName(PSInterpreter interpreter, String value, boolean executable, - boolean immediatelyEvaluated) { + public PSName(final PSInterpreter interpreter, final String value, + final boolean executable, final boolean immediatelyEvaluated) { super(interpreter); this.value = value; this.isExecutable = executable; @@ -48,7 +48,8 @@ * a PSName instance. * @return A PSName instance, if the input qualifies, otherwise, null. */ - public static PSName create(PSInterpreter interpreter, byte[] input) { + public static PSName create(final PSInterpreter interpreter, + final byte[] input) { /* * There is not really much validation work to do here that we know of. * The input should be checked first to see whether it is a valid @@ -56,11 +57,11 @@ */ if (input[0] == PSInterpreter.SLASH && input[1] == PSInterpreter.SLASH) { - String name = new String(input, 2, input.length - 2); + final String name = new String(input, 2, input.length - 2); return new PSName(interpreter, name, false, true); } if (input[0] == PSInterpreter.SLASH) { - String name = new String(input, 1, input.length - 1); + final String name = new String(input, 1, input.length - 1); return new PSName(interpreter, name, false, false); } return new PSName(interpreter, new String(input), true, false); @@ -76,26 +77,26 @@ isImmediatelyEvaluated); } - public boolean equals(Object anObject) { + public boolean equals(final Object anObject) { if (this == anObject) { return true; } if (anObject instanceof PSName) { - PSName psNameObject = (PSName) anObject; + final PSName psNameObject = (PSName) anObject; if (psNameObject.value.equals(this.value)) { return true; } return false; } if (anObject instanceof PSString) { - PSString psStringObject = (PSString) anObject; + final PSString psStringObject = (PSString) anObject; if (psStringObject.value.equals(this.value)) { return true; } return false; } if (anObject instanceof String) { - String string = (String) anObject; + final String string = (String) anObject; if (string.equals(this.value)) { return true; } @@ -112,7 +113,7 @@ return PSObject.PSOBJ_NAME; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSName || object instanceof PSString) { return true; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSNumber.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSNumber.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSNumber.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -34,7 +34,7 @@ /** * @param interpreter */ - public PSNumber(PSInterpreter interpreter) { + public PSNumber(final PSInterpreter interpreter) { super(interpreter); } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSObject.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSObject.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSObject.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -57,7 +57,7 @@ private byte access = ACCESS_UNLIMITED; - protected PSObject(PSInterpreter interpreter) { + protected PSObject(final PSInterpreter interpreter) { this.interpreter = interpreter; } @@ -67,7 +67,7 @@ * @return True if the input byte represents an ASCII numeral, * false otherwise. */ - protected static boolean isNumeral(byte input) { + protected static boolean isNumeral(final byte input) { if (input < 0x30) { return false; } @@ -83,7 +83,7 @@ * @return True if the input byte represents an character in the range A-Z * or a-z, false otherwise. */ - protected static boolean isAlphabetic(byte input) { + protected static boolean isAlphabetic(final byte input) { if (input >= 0x41 && input <= 0x5a) { return true; } @@ -99,7 +99,7 @@ * @param input The byte to be tested. * @return True if input is a member of testSet, otherwise false. */ - protected static boolean isMember(byte[] testSet, byte input) { + protected static boolean isMember(final byte[] testSet, final byte input) { for (int i = 0; i < testSet.length; i++) { if (input == testSet[i]) { return true; @@ -125,7 +125,7 @@ return false; } - protected void setAccess(byte accessLevel) throws PSException { + protected void setAccess(final byte accessLevel) throws PSException { // Can access be changed on this object? if (! isComposite()) { throw new PSException (this.interpreter, PSErrorDict.TYPECHECK, -1); Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSOperator.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSOperator.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSOperator.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -751,8 +751,8 @@ PSDictionary dictionary; short operatorEnum; - public PSOperator(PSInterpreter interpreter, PSDictionary dictionary, - short operatorEnum) { + public PSOperator(final PSInterpreter interpreter, + final PSDictionary dictionary, final short operatorEnum) { super(interpreter); this.dictionary = dictionary; this.operatorEnum = operatorEnum; @@ -775,7 +775,7 @@ * @param name The String to be evaluated. * @return The integer equivalent of <code>name</code>. */ - public static short mapNameToEnum(String name) { + public static short mapNameToEnum(final String name) { return (short) Arrays.binarySearch(operatorNames, name); } @@ -784,7 +784,7 @@ * @param enumeratedOperator The String to be evaluated. * @return The String name of the operator enum. */ - public static String mapEnumToName(short enumeratedOperator) { + public static String mapEnumToName(final short enumeratedOperator) { if (enumeratedOperator < 0 || enumeratedOperator >= operatorNames.length) { return null; @@ -793,11 +793,11 @@ } public boolean execute() throws PSException { - boolean completed = dictionary.executeOperator(operatorEnum); + final boolean completed = dictionary.executeOperator(operatorEnum); return completed; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSOperator) { return true; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSReal.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSReal.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSReal.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -31,7 +31,7 @@ double value; - public PSReal(PSInterpreter interpreter, double value) { + public PSReal(final PSInterpreter interpreter, final double value) { super(interpreter); this.value = value; } @@ -43,7 +43,8 @@ * a PSReal instance. * @return A PSReal instance, if the input qualifies, otherwise, null. */ - public static PSReal create(PSInterpreter interpreter, byte[] input) { + public static PSReal create(final PSInterpreter interpreter, + final byte[] input) { // Every char must be a digit, sign, decimal point, E, or e for (int i = 0; i < input.length; i++) { if (!isNumeral(input[i]) @@ -60,11 +61,11 @@ return null; } // It looks like the java methods might be sufficient here - StringBuffer sb = new StringBuffer(); + final StringBuffer sb = new StringBuffer(); for (int i = 0; i < input.length; i++) { sb.append((char) input[i]); } - double value = Double.valueOf(sb.toString()).doubleValue(); + final double value = Double.valueOf(sb.toString()).doubleValue(); return new PSReal(interpreter, value); } @@ -80,14 +81,14 @@ return PSObject.PSOBJ_REAL; } - public boolean isComparable(PSObject object) { + public boolean isComparable(final PSObject object) { if (object instanceof PSInteger || object instanceof PSReal) { return true; } return false; } - public int compareTo(Object object) { + public int compareTo(final Object object) { PSObject psobject = null; if (object instanceof PSObject) { psobject = (PSObject) object; @@ -98,7 +99,7 @@ return -127; } if (psobject instanceof PSInteger) { - PSInteger psinteger = (PSInteger) psobject; + final PSInteger psinteger = (PSInteger) psobject; if (this.value == psinteger.value) { return 0; } else if (this.value < psinteger.value) { @@ -108,7 +109,7 @@ } } if (psobject instanceof PSReal) { - PSReal psreal = (PSReal) psobject; + final PSReal psreal = (PSReal) psobject; if (this.value == psreal.value) { return 0; } else if (this.value < psreal.value) { @@ -120,7 +121,7 @@ return -127; } - public boolean equals(Object object) { + public boolean equals(final Object object) { if (this.compareTo(object) == 0) { return true; } @@ -147,25 +148,25 @@ return "Real: " + Double.toString(this.value); } - public static String doubleOut(Double doubleDown) { + public static String doubleOut(final Double doubleDown) { return doubleOut(doubleDown.doubleValue()); } public static String doubleOut(double doubleDown) { - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); if (doubleDown < 0) { doubleDown = -doubleDown; p.append("-"); } - double trouble = doubleDown % 1; + final double trouble = doubleDown % 1; if (trouble > 0.950) { p.append((int)doubleDown + 1); } else if (trouble < 0.050) { p.append((int)doubleDown); } else { - String doubleString = Double.toString(doubleDown); - int decimal = doubleString.indexOf("."); + final String doubleString = Double.toString(doubleDown); + final int decimal = doubleString.indexOf("."); if (decimal != -1) { p.append(doubleString.substring(0, decimal)); @@ -181,22 +182,22 @@ return (p.toString()); } - public static String doubleOut(double doubleDown, int dec) { + public static String doubleOut(double doubleDown, final int dec) { - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); if (doubleDown < 0) { doubleDown = -doubleDown; p.append("-"); } - double trouble = doubleDown % 1; + final double trouble = doubleDown % 1; if (trouble > (1.0 - (5.0 / (Math.pow(10.0, dec))))) { p.append((int)doubleDown + 1); } else if (trouble < (5.0 / (Math.pow(10.0, dec)))) { p.append((int)doubleDown); } else { - String doubleString = Double.toString(doubleDown); - int decimal = doubleString.indexOf("."); + final String doubleString = Double.toString(doubleDown); + final int decimal = doubleString.indexOf("."); if (decimal != -1) { p.append(doubleString.substring(0, decimal)); Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSStack.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/PSStack.java 2006-07-23 21:24:31 UTC (rev 7826) +++ trunk/foray/foray-ps/src/java/org/foray/ps/PSStack.java 2006-07-23 21:55:19 UTC (rev 7827) @@ -44,7 +44,8 @@ private byte stackType = -1; - PSStack(PSInterpreter interpreter, int initialSize, byte stackType) { + PSStack(final PSInterpreter interpreter, final int initialSize, + final byte stackType) { this.interpreter = interpreter; this.list = new ArrayList(initialSize); if (stackType < 2 || stackType > 4) { @@ -58,7 +59,7 @@ * Discards the top element from the stack. * @return The top item from the stack, which was just discarded. */ - public Object popObject(int operatorCode) throws PSException { + public Object popObject(final int operatorCode) throws PSException { switch (stackType) { case STACK_DICTIONARY: { // Don't allow the bottom three items to be popped @@ -74,7 +75,7 @@ } } } - PSObject object = (PSObject) list.remove(list.size() - 1); + final PSObject object = (PSObject) list.remove(list.size() - 1); ... [truncated message content] |
|
From: <vic...@us...> - 2006-07-23 21:24:41
|
Revision: 7826 Author: victormote Date: 2006-07-23 14:24:31 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7826&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayXDiff.java trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTD.java trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDElement.java trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDTokenizer.java trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/ElementStack.java Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-07-23 21:15:10 UTC (rev 7825) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-07-23 21:24:31 UTC (rev 7826) @@ -135,7 +135,8 @@ /** * Constructor. */ - public FOrayPretty(InputSource input, OutputStream output, String catalog) { + public FOrayPretty(final InputSource input, final OutputStream output, + final String catalog) { this.input = input; this.output = output; this.entityResolver = getEntityResolver(catalog); @@ -152,13 +153,13 @@ */ public void start() throws IOException, SAXException, ParserConfigurationException { - XMLReader parser = createParser(); + final XMLReader parser = createParser(); /* Bind the LexicalHandler to the XMLReader if possible. */ try { parser.setProperty("http://xml.org/sax/properties/lexical-handler", this); - } catch (SAXNotSupportedException e1) { + } catch (final SAXNotSupportedException e1) { logError("Parser does not support LexicalHandler."); } @@ -166,16 +167,16 @@ try { parser.setProperty("http://xml.org/sax/properties/" + "declaration-handler", this); - } catch (SAXNotSupportedException e) { + } catch (final SAXNotSupportedException e) { logError("Parser does not support Declaration Handler."); } /* Turn on validation if it is available. */ try { parser.setFeature("http://xml.org/sax/features/validation", true); - } catch (SAXNotRecognizedException e1) { + } catch (final SAXNotRecognizedException e1) { logError("Parser does not recognize validation."); - } catch (SAXNotSupportedException e1) { + } catch (final SAXNotSupportedException e1) { logError("Parser unable to validate."); } @@ -189,12 +190,12 @@ try { parser.setFeature("http://apache.org/xml/features/scanner/" + "notify-char-refs", true); - } catch (SAXNotRecognizedException e) { + } catch (final SAXNotRecognizedException e) { /* Make this a fatal error. */ logError("Parser cannot report character entities. Aborting."); cleanup(); return; - } catch (SAXNotSupportedException e) { + } catch (final SAXNotSupportedException e) { /* Make this a fatal error. */ logError("Parser cannot report character entities. Aborting."); cleanup(); @@ -212,24 +213,24 @@ */ public XMLReader createParser() throws SAXException, ParserConfigurationException { - SAXParserFactory spf = + final SAXParserFactory spf = javax.xml.parsers.SAXParserFactory.newInstance(); spf.setNamespaceAware(true); - XMLReader xmlReader = spf.newSAXParser().getXMLReader(); + final XMLReader xmlReader = spf.newSAXParser().getXMLReader(); if (this.entityResolver != null) { xmlReader.setEntityResolver(this.entityResolver); } return xmlReader; } - public void setDocumentLocator(Locator locator) { + public void setDocumentLocator(final Locator locator) { this.locator = locator; } private void cleanup() { try { output.close(); - } catch (IOException e1) { + } catch (final IOException e1) { /* Ignore. */ } } @@ -243,8 +244,8 @@ write(newLine()); } - public void startElement(String uri, String local, String qName, - Attributes attributes) { + public void startElement(final String uri, final String local, + final String qName, final Attributes attributes) { flushCharacters(); ensureTopElementWritten(false); /* Cache the parameters in instance variable for later processing. @@ -254,12 +255,12 @@ this.lastStartedLocal = local; /* Must copy the attributes as they are reset on each callback. */ this.lastStartedAttributes = new AttributesImpl(attributes); - DTDElement element = this.dtd.getElement(local); + final DTDElement element = this.dtd.getElement(local); this.elementStack.push(element); topElementWritten = false; } - private void ensureTopElementWritten(boolean isEmpty) { + private void ensureTopElementWritten(final boolean isEmpty) { if (this.topElementWritten) { return; } @@ -268,8 +269,8 @@ this.topElementWritten = true; } - private void writeElement(String local, Attributes attributes, - boolean isEmpty) { + private void writeElement(final String local, final Attributes attributes, + final boolean isEmpty) { if (local == null) { return; } @@ -280,12 +281,12 @@ } /* Accumulate the tag opener. */ - StringBuffer tagOpenBuffer = new StringBuffer(); + final StringBuffer tagOpenBuffer = new StringBuffer(); tagOpenBuffer.append("<"); tagOpenBuffer.append(local); /* Accumulate the attributes. */ - StringBuffer attributesBuffer = new StringBuffer(); + final StringBuffer attributesBuffer = new StringBuffer(); for (int i = 0; i < attributes.getLength(); i++) { attributesBuffer.append(" "); attributesBuffer.append(attributes.getLocalName(i)); @@ -295,7 +296,7 @@ } /* Accumulate the tag closer. */ - StringBuffer tagCloseBuffer = new StringBuffer(); + final StringBuffer tagCloseBuffer = new StringBuffer(); if (isEmpty) { tagCloseBuffer.append("/>"); } else { @@ -337,7 +338,7 @@ private String indent() { int numIndents = currentIndentation() * this.indent; - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); while (numIndents > 0) { buffer.append(" "); numIndents --; @@ -345,7 +346,8 @@ return buffer.toString(); } - public void endElement(String uri, String local, String qName) { + public void endElement(final String uri, final String local, + final String qName) { flushCharacters(); if (this.topElementWritten) { @@ -400,7 +402,8 @@ return true; } - public void characters(char[] buffer, int offset, int length) { + public void characters(final char[] buffer, final int offset, + final int length) { if (this.inEntity) { /* Skip these characters. We are writing the unexpanded entity * elsewhere. We do not want to also write the expanded version. */ @@ -424,34 +427,37 @@ this.charBuffer.setLength(0); } - private void addToQueue(String string) { + private void addToQueue(final String string) { if (string == null) { return; } this.queue.add(string); } - public void processingInstruction(String target, String data) { + public void processingInstruction(final String target, final String data) { write(target); write(data); } - public void ignorableWhitespace(char[] buffer, int offset, int length) { + public void ignorableWhitespace(final char[] buffer, final int offset, + final int length) { /* Ignorable white space is just ignored. */ // this.charBuffer.append(buffer, offset, length); } - public void comment(char[] buffer, int offset, int length) { + public void comment(final char[] buffer, final int offset, + final int length) { if (this.inDTD) { return; } write("<!--"); - String comment = new String(buffer, offset, length); + final String comment = new String(buffer, offset, length); writeRawPCDATA(comment); write("-->"); } - public void startDTD(String name, String publicId, String systemId) { + public void startDTD(final String name, final String publicId, + final String systemId) { write(newLine()); write("<!DOCTYPE "); write(name); @@ -473,7 +479,7 @@ this.inDTD = false; } - public void startEntity(String name) { + public void startEntity(final String name) { if (this.inDTD) { return; } @@ -484,12 +490,12 @@ this.inEntity = true; } - public void endEntity(String name) { + public void endEntity(final String name) { this.inEntity = false; } - public void elementDecl(String name, String model) { - DTDElement dtdElement = new DTDElement(name, model); + public void elementDecl(final String name, final String model) { + final DTDElement dtdElement = new DTDElement(name, model); this.dtd.addElement(dtdElement); } @@ -501,20 +507,20 @@ * as that may result in the conversion of \r\n to \r\r\n, for example. * @param outputString The String that should be written. */ - private void writeRawPCDATA(String outputString) { + private void writeRawPCDATA(final String outputString) { if (this.lineTerminator.equals("\n")) { /* The specified line terminator is the same as that used in the * input. Just write it. */ write(outputString); return; } - int lastLineBreakIndex = outputString.lastIndexOf("\n"); + final int lastLineBreakIndex = outputString.lastIndexOf("\n"); if (lastLineBreakIndex < 0) { /* No line breaks in what is being written. Just write it. */ write(outputString); return; } - StringBuffer buffer = new StringBuffer(outputString); + final StringBuffer buffer = new StringBuffer(outputString); int bufferIndex = 0; while (bufferIndex < buffer.length()) { if (buffer.charAt(bufferIndex) == '\n') { @@ -528,7 +534,7 @@ write (buffer.toString()); } - private void write(String outputString) { + private void write(final String outputString) { if (outputString == null) { return; } @@ -539,10 +545,11 @@ output.write(outputString.getBytes(this.outputEncoding)); /* Following line for debugging only */ output.flush(); - } catch (IOException e) { + } catch (final IOException e) { logError("Error converting text."); } - int lastLineBreakIndex = outputString.lastIndexOf(this.lineTerminator); + final int lastLineBreakIndex = outputString.lastIndexOf( + this.lineTerminator); if (lastLineBreakIndex < 0) { /* No line breaks in what is being written. Increment the current * column by the length of outputString. Note that we want the @@ -554,18 +561,18 @@ } } - public EntityResolver getEntityResolver(String catalog) { + public EntityResolver getEntityResolver(final String catalog) { if (catalog == null) { return null; } - String [] catalogs = {catalog}; - XMLCatalogResolver resolver = new XMLCatalogResolver(); + final String [] catalogs = {catalog}; + final XMLCatalogResolver resolver = new XMLCatalogResolver(); resolver.setPreferPublic(true); resolver.setCatalogList(catalogs); return resolver; } - private void logError(String message) { + private void logError(final String message) { if (this.locator != null) { System.out.print(locator.getSystemId() + ":" + locator.getLineNumber() + ":" @@ -625,7 +632,7 @@ if (this.breaksChosen.size() < 1) { sizeIfAccepted += lastColumnWritten; } - int firstChunkToConsider = this.getLastBreakChosen(); + final int firstChunkToConsider = this.getLastBreakChosen(); sizeIfAccepted += this.chunkSize(firstChunkToConsider, i); if (sizeIfAccepted > desiredLineLength) { int breakSelected = i - 1; @@ -656,7 +663,7 @@ private void writeAll() { while (this.toWriteQueue.size() > 0) { - String returnItem = (String) this.toWriteQueue.get(0); + final String returnItem = (String) this.toWriteQueue.get(0); writeRawPCDATA(returnItem); this.toWriteQueue.remove(0); } @@ -674,11 +681,11 @@ return toWriteQueue.size(); } - protected void add (String itemToAdd) { + protected void add (final String itemToAdd) { this.toWriteQueue.add(itemToAdd); } - protected String get(int index) { + protected String get(final int index) { if (index > this.toWriteQueue.size()) { return null; } @@ -688,7 +695,7 @@ private int charCount() { int charCount = 0; for (int i = 0; i < this.toWriteQueue.size(); i++) { - String string = get(i); + final String string = get(i); charCount += string.length(); } return charCount; @@ -710,19 +717,19 @@ this.writeChunk(Integer.MAX_VALUE, false); } - private int getBreakChosen(int index) { + private int getBreakChosen(final int index) { if (this.breaksChosen == null || index < 0 || index >= this.breaksChosen.size()) { return -1; } - Object object = this.breaksChosen.get(index); - Integer integer = (Integer) object; + final Object object = this.breaksChosen.get(index); + final Integer integer = (Integer) object; return integer.intValue(); } private int getLastBreakChosen() { - int lastIndex = this.breaksChosen.size() - 1; + final int lastIndex = this.breaksChosen.size() - 1; return getBreakChosen(lastIndex); } @@ -735,9 +742,9 @@ } count = 0; for (int i = 0; i < this.toWriteQueue.size(); i++) { - String string = this.get(i); + final String string = this.get(i); for (int j = 0; j < string.length(); j++) { - char c = string.charAt(j); + final char c = string.charAt(j); if (c == ' ') { this.breakOpportunityItems[count] = i; this.breakOpportunityIndexes[count] = j; @@ -748,7 +755,8 @@ count = this.breakOpportunityItems.length; } - private int chunkSize(int startOpportunity, int endOpportunity) { + private int chunkSize(final int startOpportunity, + final int endOpportunity) { if (startOpportunity == endOpportunity) { return 0; } @@ -763,10 +771,10 @@ startItem = this.breakOpportunityItems[startOpportunity]; startItemIndex = this.breakOpportunityIndexes[startOpportunity]; } - int lastOpportunity = this.breakOpportunityItems.length - 1; + final int lastOpportunity = this.breakOpportunityItems.length - 1; if (endOpportunity > lastOpportunity) { endItem = this.toWriteQueue.size() - 1; - String string = this.get(endItem); + final String string = this.get(endItem); endItemIndex = string.length(); } else { endItem = this.breakOpportunityItems[endOpportunity]; @@ -782,7 +790,7 @@ if (i == endItem) { endIndex = endItemIndex - 1; } else { - String item = this.get(i); + final String item = this.get(i); endIndex = item.length() - 1; } size += endIndex - startIndex; @@ -798,9 +806,9 @@ private int countBreakOpportunities() { int count = 0; for (int i = 0; i < this.toWriteQueue.size(); i++) { - String string = this.get(i); + final String string = this.get(i); for (int j = 0; j < string.length(); j++) { - char c = string.charAt(j); + final char c = string.charAt(j); if (c == ' ') { count ++; } @@ -815,7 +823,8 @@ * @param newLine Set to true if a new-line should be written after * the text of the line. */ - private void writeChunk(int breakSelected, boolean newLine) { + private void writeChunk(final int breakSelected, + final boolean newLine) { int startOpportunity; int endOpportunity; if (breakSelected == 0) { @@ -841,7 +850,7 @@ startItemIndex = this.breakOpportunityIndexes[startOpportunity]; } if (endOpportunity >= this.breakOpportunityIndexes.length) { - int lastItem = this.toWriteQueue.size() - 1; + final int lastItem = this.toWriteQueue.size() - 1; endItem = lastItem; endItemIndex = this.getLastItem().length() - 1; } else { @@ -849,7 +858,7 @@ endItemIndex = this.breakOpportunityIndexes[endOpportunity]; } for (int i = startItem; i <= endItem; i++) { - String string = this.get(i); + final String string = this.get(i); int startIndex = 0; if (i == startItem) { startIndex = startItemIndex; @@ -878,7 +887,7 @@ if (this.toWriteQueue.size() < 1) { return null; } - int lastIndex = this.toWriteQueue.size() - 1; + final int lastIndex = this.toWriteQueue.size() - 1; return (String) this.toWriteQueue.get(lastIndex); } @@ -892,15 +901,15 @@ * Argument 3 is an optional location of an OASIS-compliant catalog file * that can be used to locate local DTDs. */ - public static void main(String[] args) { + public static void main(final String[] args) { if (args == null || args.length < 2 || args.length > 3) { System.out.print("Wrong number of arguments."); System.exit(1); } - String input = args[0]; - String output = args[1]; + final String input = args[0]; + final String output = args[1]; String catalog = null; if (args.length > 2) { catalog = args[2]; @@ -910,24 +919,24 @@ FileInputStream fis = null; fis = new FileInputStream(input); inputStream = new BufferedInputStream(fis); - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { System.err.println("File not found: " + input); System.exit(2); } - InputSource inputSource = new InputSource(inputStream); + final InputSource inputSource = new InputSource(inputStream); OutputStream outputStream = null; try { - FileOutputStream fos = new FileOutputStream(output); + final FileOutputStream fos = new FileOutputStream(output); outputStream = new BufferedOutputStream(fos); - } catch (FileNotFoundException e1) { + } catch (final FileNotFoundException e1) { System.err.println("File not found: " + output); System.exit(3); } - FOrayPretty processor = new FOrayPretty(inputSource, outputStream, + final FOrayPretty processor = new FOrayPretty(inputSource, outputStream, catalog); try { processor.start(); - } catch (Exception e) { + } catch (final Exception e) { System.out.print("Error parsing input."); e.printStackTrace(); System.exit(4); @@ -940,7 +949,7 @@ * normalized to spaces, duplicate spaces will be removed, and spaces and * new-lines will be treated as interchangeable. The default value is true. */ - public void setBreakPCDATA(boolean breakPCDATA) { + public void setBreakPCDATA(final boolean breakPCDATA) { this.breakPCDATA = breakPCDATA; } @@ -949,7 +958,7 @@ * at the beginning of the pretty-printed document. The default value is * <code><?xml version="1.0" encoding="UTF-8"?></code> */ - public void setXmlDeclaration(String xmlDeclaration) { + public void setXmlDeclaration(final String xmlDeclaration) { this.xmlDeclaration = xmlDeclaration; } @@ -959,7 +968,7 @@ * platform-specific. On Unix, for example, it is "\n". On Windows, it is * "\r\n". */ - public void setLineTerminator(String lineTerminator) { + public void setLineTerminator(final String lineTerminator) { this.lineTerminator = lineTerminator; } @@ -967,7 +976,7 @@ * Use this configuration parameter to set the output encoding for the * pretty-printed document. The default value is "UTF-8". */ - public void setOutputEncoding(String outputEncoding) { + public void setOutputEncoding(final String outputEncoding) { this.outputEncoding = outputEncoding; } @@ -978,7 +987,7 @@ * considered to be insignificant and is therefore stripped out. * The default value is null. */ - public void setPreRootText(String preRootText) { + public void setPreRootText(final String preRootText) { this.preRootText = preRootText; } @@ -989,7 +998,7 @@ * be insignificant and is therefore stripped out. * The default value is "\n" (one line-feed). */ - public void setPostRootText(String postRootText) { + public void setPostRootText(final String postRootText) { this.postRootText = postRootText; } @@ -998,7 +1007,7 @@ * successive block level of the document should be indented. The default * is 2. */ - public void setIndent(int indent) { + public void setIndent(final int indent) { this.indent = indent; } @@ -1006,7 +1015,7 @@ * Use this configuration parameter to set the desired maximum line length, * in characters, for the pretty-printed document. The default is 80. */ - public void setDesiredLineLength(int desiredLineLength) { + public void setDesiredLineLength(final int desiredLineLength) { this.desiredLineLength = desiredLineLength; } @@ -1014,7 +1023,7 @@ * Set this configuration parameter to true if blocks that are inside of * mixed content should be indented. The default is "false". */ - public void setIndentBlocksInsideMixedContent(boolean indent) { + public void setIndentBlocksInsideMixedContent(final boolean indent) { this.indentBlocksInsideMixedContent = indent; } Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayXDiff.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayXDiff.java 2006-07-23 21:15:10 UTC (rev 7825) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayXDiff.java 2006-07-23 21:24:31 UTC (rev 7826) @@ -69,16 +69,16 @@ * @see #FOrayXDiff(InputStream[]) For a constructor that takes any * {@link InputStream}. */ - public FOrayXDiff(URL[] urls) throws Exception { + public FOrayXDiff(final URL[] urls) throws Exception { if (urls == null) { throw new Exception("No URLs to compare."); } - InputStream[] streams = new InputStream[urls.length]; + final InputStream[] streams = new InputStream[urls.length]; if (readerIDs == null) { readerIDs = new String[urls.length]; } for (int i = 0; i < urls.length; i++) { - InputStream in = urls[i].openStream(); + final InputStream in = urls[i].openStream(); streams[i] = in; this.readerIDs[i] = urls[i].toExternalForm(); } @@ -88,14 +88,14 @@ /** * Constructor accepting InputStreams to compare. */ - public FOrayXDiff(InputStream[] streams) throws Exception { + public FOrayXDiff(final InputStream[] streams) throws Exception { if (readerIDs == null) { readerIDs = new String[streams.length]; } convertStreams(streams); } - private void convertStreams(InputStream[] streams) + private void convertStreams(final InputStream[] streams) throws IllegalArgumentException, XMLStreamException { if (streams == null) { throw new IllegalArgumentException("No InputStreams to compare."); @@ -105,13 +105,13 @@ + "needed for comparison."); } this.readers = new XMLStreamReader[streams.length]; - XMLInputFactory factory = XMLInputFactory.newInstance(); + final XMLInputFactory factory = XMLInputFactory.newInstance(); /* Make parsers coalesce adjacent character data. */ factory.setProperty("javax.xml.stream.isCoalescing", Boolean.TRUE); factory.setProperty("javax.xml.stream.isReplacingEntityReferences", Boolean.FALSE); for (int i = 0; i < streams.length; i++) { - InputStream in = streams[i]; + final InputStream in = streams[i]; this.readers[i] = factory.createXMLStreamReader(in); if (this.readerIDs[i] == null) { /* If this stream was created from a URL, this should already @@ -132,7 +132,7 @@ */ public boolean equivalent() throws IOException, XMLStreamException { while (true) { - int event = readEvents(); + final int event = readEvents(); switch (event) { case XMLStreamConstants.START_DOCUMENT: { /* Nothing to do here. */ @@ -232,11 +232,11 @@ * @throws XMLStreamException */ private int readEvents() throws XMLStreamException { - int[] events = new int[this.readers.length]; + final int[] events = new int[this.readers.length]; for (int i = 0; i < this.readers.length; i++) { events[i] = readEvent(i); } - int baseEventValue = events[0]; + final int baseEventValue = events[0]; for (int i = 1; i < events.length; i++) { if (events[i] != baseEventValue) { message("Difference in Events\n" @@ -250,7 +250,7 @@ return baseEventValue; } - public static String getEventDescription(int event) { + public static String getEventDescription(final int event) { switch (event) { case XMLStreamConstants.START_DOCUMENT: { return "Start Document"; @@ -309,8 +309,8 @@ * @param i * @throws XMLStreamException */ - private int readEvent(int i) throws XMLStreamException { - XMLStreamReader reader = this.readers[i]; + private int readEvent(final int i) throws XMLStreamException { + final XMLStreamReader reader = this.readers[i]; if (! reader.hasNext()) { return XMLStreamReader.END_DOCUMENT; } @@ -335,18 +335,18 @@ return event; } - private void message(String message) { + private void message(final String message) { System.out.println(message); for (int i = 0; i < this.readers.length; i++) { - String sourceDescription = getSourceDescription(i); - String sourceLocation = getSourceLocation(i); + final String sourceDescription = getSourceDescription(i); + final String sourceLocation = getSourceLocation(i); System.out.println(" Document " + (i + 1) + ": " + sourceDescription + ":" + sourceLocation); } } - private String getSourceDescription(int inputIndex) { - Location location = this.readers[inputIndex].getLocation(); + private String getSourceDescription(final int inputIndex) { + final Location location = this.readers[inputIndex].getLocation(); if (location != null && location.getSystemId() != null) { return location.getSystemId(); @@ -358,8 +358,8 @@ return this.readerIDs[inputIndex]; } - private String getSourceLocation(int inputIndex) { - Location location = this.readers[inputIndex].getLocation(); + private String getSourceLocation(final int inputIndex) { + final Location location = this.readers[inputIndex].getLocation(); if (location == null) { return "Unknown"; } @@ -410,7 +410,7 @@ for (int i = 1; i < this.readers.length; i++) { String compareString = this.readers[i].getText(); compareString = XMLUtil.normalizeWhitespace(compareString); - int differIndex = StringUtil.firstDifferent(baseString, + final int differIndex = StringUtil.firstDifferent(baseString, compareString); if (differIndex < 0) { return true; @@ -430,18 +430,19 @@ */ private boolean compareElements() { /* 1. Make sure the names are the same. */ - QName baseElementName = this.readers[0].getName(); + final QName baseElementName = this.readers[0].getName(); for (int i = 1; i < this.readers.length; i++) { - QName compareElementName = this.readers[i].getName(); + final QName compareElementName = this.readers[i].getName(); if (! baseElementName.equals((compareElementName))) { message("Document " + (i + 1) + " has different Element "); return false; } } /* 2. Make sure the attribute counts are the same. */ - int baseAttributeCount = this.readers[0].getAttributeCount(); + final int baseAttributeCount = this.readers[0].getAttributeCount(); for (int i = 1; i < this.readers.length; i++) { - int compareAttributeCount = this.readers[i].getAttributeCount(); + final int compareAttributeCount = + this.readers[i].getAttributeCount(); if (baseAttributeCount != compareAttributeCount) { message("Document " + (i + 1) + " has different Attribute " + "Count "); @@ -452,12 +453,14 @@ * others, and that their values are equal. */ /* Iterate through each attribute of the base element. */ for (int i = 0; i < baseAttributeCount; i++) { - QName baseAttributeName = this.readers[0].getAttributeName(i); - String baseAttributeValue = this.readers[0].getAttributeValue(i); + final QName baseAttributeName = + this.readers[0].getAttributeName(i); + final String baseAttributeValue = + this.readers[0].getAttributeValue(i); /* Iterate through each of the other documents. */ for (int j = 1; j < this.readers.length; j++) { - XMLStreamReader reader = this.readers[j]; - String compareAttributeValue = reader.getAttributeValue( + final XMLStreamReader reader = this.readers[j]; + final String compareAttributeValue = reader.getAttributeValue( baseAttributeName.getNamespaceURI(), baseAttributeName.getLocalPart()); if (compareAttributeValue == null) { @@ -479,27 +482,27 @@ * Command-line interface for {@link FOrayXDiff}. * @param args Two or more URLs that should be compared. */ - public static void main(String[] args) { - URL[] urlsToCompare = new URL[args.length]; + public static void main(final String[] args) { + final URL[] urlsToCompare = new URL[args.length]; URL context = null; try { context = URLFactory.createURL("file", null, "."); - } catch (MalformedURLException e1) { + } catch (final MalformedURLException e1) { System.out.println("Unable to get URL context."); } for (int i = 0; i < args.length; i++) { URL url = null; try { url = URLFactory.createURL(context, args[i]); - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { System.out.println("Malformed URL: " + args[i]); System.exit(1); } urlsToCompare[i] = url; } try { - FOrayXDiff processor = new FOrayXDiff(urlsToCompare); - boolean equivalent = processor.equivalent(); + final FOrayXDiff processor = new FOrayXDiff(urlsToCompare); + final boolean equivalent = processor.equivalent(); if (equivalent) { System.out.println("All XML Streams are equivalent."); System.exit(0); @@ -507,7 +510,7 @@ System.out.println("Differences(s) in XML Streams found."); System.exit(3); } - } catch (Exception e) { + } catch (final Exception e) { System.out.println("Error parsing input."); System.out.println(e.getMessage()); System.exit(2); Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTD.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTD.java 2006-07-23 21:15:10 UTC (rev 7825) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTD.java 2006-07-23 21:24:31 UTC (rev 7826) @@ -36,11 +36,11 @@ public DTD() { } - public void addElement(DTDElement element) { + public void addElement(final DTDElement element) { this.elements.put(element.getName(), element); } - public DTDElement getElement(String name) { + public DTDElement getElement(final String name) { return (DTDElement) this.elements.get(name); } Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDElement.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDElement.java 2006-07-23 21:15:10 UTC (rev 7825) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDElement.java 2006-07-23 21:24:31 UTC (rev 7826) @@ -36,18 +36,18 @@ boolean isEmpty = false; boolean hasElementChildren = false; - public DTDElement(String elementName, String contentModel) { + public DTDElement(final String elementName, final String contentModel) { this.elementName = elementName; parseContentModel(contentModel); } - private void parseContentModel(String contentModel) { + private void parseContentModel(final String contentModel) { /* All we really care about right now is a whether it is empty, PCDATA, * mixed, or element children only. */ if (contentModel.indexOf("#PCDATA") > -1) { this.hasPCDATA = true; } - String[] contentTokens = DTDTokenizer.tokenizeElementContent( + final String[] contentTokens = DTDTokenizer.tokenizeElementContent( contentModel); this.isEmpty = DTDTokenizer.isElementContentEmpty(contentTokens); this.hasPCDATA = DTDTokenizer.hasPCDATA(contentTokens); Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDTokenizer.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDTokenizer.java 2006-07-23 21:15:10 UTC (rev 7825) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDTokenizer.java 2006-07-23 21:24:31 UTC (rev 7826) @@ -43,8 +43,8 @@ * @param content The Element content to be parsed. * @return An array of String tokens. */ - public static String[] tokenizeElementContent(String content) { - ArrayList tokens = new ArrayList(); + public static String[] tokenizeElementContent(final String content) { + final ArrayList tokens = new ArrayList(); int startIndex = 0; int currentIndex = 0; while (true) { @@ -54,7 +54,7 @@ } break; } - char character = content.charAt(currentIndex); + final char character = content.charAt(currentIndex); if (isWhitespace(character) || isElementDelimiter(character)) { if (currentIndex - 1 > startIndex) { tokens.add(content.substring(startIndex, currentIndex)); @@ -70,7 +70,7 @@ return arrayListToStrings(tokens); } - public static boolean isWhitespace(int character) { + public static boolean isWhitespace(final int character) { switch (character) { case ' ': case '\t': @@ -81,7 +81,7 @@ return false; } - public static boolean isElementDelimiter(int character) { + public static boolean isElementDelimiter(final int character) { switch (character) { case '|': case '(': @@ -96,9 +96,9 @@ return false; } - public static boolean isElementContentEmpty(String[] tokens) { + public static boolean isElementContentEmpty(final String[] tokens) { for (int i = 0; i < tokens.length; i++) { - String token = tokens[i]; + final String token = tokens[i]; if (token.equals("EMPTY")) { return true; } @@ -106,9 +106,9 @@ return false; } - public static boolean hasPCDATA(String[] tokens) { + public static boolean hasPCDATA(final String[] tokens) { for (int i = 0; i < tokens.length; i++) { - String token = tokens[i]; + final String token = tokens[i]; if (token.equals("#PCDATA")) { return true; } @@ -116,9 +116,9 @@ return false; } - public static boolean hasElementChildren(String[] tokens) { + public static boolean hasElementChildren(final String[] tokens) { for (int i = 0; i < tokens.length; i++) { - String token = tokens[i]; + final String token = tokens[i]; if (isElementChild(token)) { return true; } @@ -126,9 +126,9 @@ return false; } - private static boolean isElementChild(String token) { + private static boolean isElementChild(final String token) { if (token.length() == 1) { - int character = token.charAt(0); + final int character = token.charAt(0); if (isElementDelimiter(character)) { return false; } @@ -146,8 +146,8 @@ * @param arrayList * @return A String array with arrayList's contents. */ - public static String[] arrayListToStrings(ArrayList arrayList) { - String[] strings = new String[arrayList.size()]; + public static String[] arrayListToStrings(final ArrayList arrayList) { + final String[] strings = new String[arrayList.size()]; for (int i = 0; i < arrayList.size(); i++) { strings[i] = (String) arrayList.get(i); } Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/ElementStack.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/ElementStack.java 2006-07-23 21:15:10 UTC (rev 7825) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/ElementStack.java 2006-07-23 21:24:31 UTC (rev 7826) @@ -36,12 +36,12 @@ public ElementStack() { } - public void push(DTDElement element) { + public void push(final DTDElement element) { this.stack.add(element); } public DTDElement pop() { - DTDElement topElement = peek(); + final DTDElement topElement = peek(); if (topElement != null) { this.stack.remove(stack.size() - 1); } @@ -58,11 +58,11 @@ * down, set to 1, etc. * @return The nth item down the stack, where n is indexFromTop. */ - private DTDElement peek(int indexFromTop) { + private DTDElement peek(final int indexFromTop) { if (this.stack.size() <= indexFromTop) { return null; } - int index = this.stack.size() - indexFromTop - 1; + final int index = this.stack.size() - indexFromTop - 1; return (DTDElement) this.stack.get(index); } @@ -85,7 +85,7 @@ * the stack is empty. */ public boolean topIsBlockElement() { - DTDElement parentElement = peek(1); + final DTDElement parentElement = peek(1); if (parentElement == null) { return true; } @@ -105,7 +105,7 @@ /* Start the loop at 1, because we don't care whether the top of the * stack contains PCDATA or not. */ for (int i = 1; i < this.stack.size(); i++) { - DTDElement element = peek(i); + final DTDElement element = peek(i); if (element == null) { return false; } @@ -117,7 +117,7 @@ } public boolean topHasPCDATA() { - DTDElement topElement = peek(); + final DTDElement topElement = peek(); if (topElement == null) { return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-23 21:15:43
|
Revision: 7825 Author: victormote Date: 2006-07-23 14:15:10 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7825&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractFlowPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractTableBodyPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockContainerPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/CharacterPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ContinuedLabelPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ExternalGraphicPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FOTextPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjMixedPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FlowPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FootnoteBodyPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FootnotePL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/InstreamForeignObjectPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/LeaderPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListBlockPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemBodyPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemLabelPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/MarkerPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/NoLayoutPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PageNumberCitationPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PageNumberPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerFactory.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/RetrieveMarkerPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/RowCellArray.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/RowSpanMgr.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/StaticContentPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/Status.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableBodyPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableCellPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableFooterPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableHeaderPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableRowPL.java Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractFlowPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractFlowPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractFlowPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -44,7 +44,8 @@ /** ArrayList to store snapshot. */ private ArrayList progressSnapshot; - public AbstractFlowPL(AbstractFlow abstractFlow, PioneerLS layout) { + public AbstractFlowPL(final AbstractFlow abstractFlow, + final PioneerLS layout) { super(abstractFlow, layout); } @@ -61,7 +62,7 @@ /** * @param _status The _status to set. */ - public void set_status(int _status) { + public void set_status(final int _status) { this._status = _status; } @@ -75,11 +76,11 @@ /** * @param progressSnapshot The progressSnapshot to be saved. */ - public void setProgressSnapshot(ArrayList progressSnapshot) { + public void setProgressSnapshot(final ArrayList progressSnapshot) { this.progressSnapshot = progressSnapshot; } - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { return layout(area, null, retrieveMarker); } @@ -88,19 +89,19 @@ return (AbstractFlow) this.getFONode(); } - public int layout(Area area, Region region, RetrieveMarker retrieveMarker) - throws AreaWException { + public int layout(final Area area, final Region region, + final RetrieveMarker retrieveMarker) throws AreaWException { if (getProgress() == FONodePL.START) { setProgress(0); } // flow is *always* laid out into a BodyAreaContainer - RegionRABody bac = (RegionRABody)area; + final RegionRABody bac = (RegionRABody)area; boolean prevChildMustKeepWithNext = false; - int numChildren = getFO().getChildren().size(); + final int numChildren = getFO().getChildren().size(); for (int i = getProgress(); i < numChildren; i++) { - FObj fo = (FObj) getFO().getChildren().get(i); + final FObj fo = (FObj) getFO().getChildren().get(i); if (bac.getWritableMainRA().isBalancingRequired(fo)) { // reset the the just-done span area in preparation @@ -113,7 +114,8 @@ continue; } // current column area - Area currentArea = bac.getWritableMainRA().getNextWritableArea(fo); + final Area currentArea = bac.getWritableMainRA() + .getNextWritableArea(fo); if (bac.getWritableMainRA().isNewSpanArea()) { setProgress(i); setProgressSnapshot(getProgressSnapshot(new @@ -126,9 +128,10 @@ if ((prevChildMustKeepWithNext) && (Status.laidOutNone(get_status()))) { setProgress(i - 1); - FObj prevChild = + final FObj prevChild = (FObj) getFO().getChildren().get(getProgress()); - FObjPL prevChildPL = (FObjPL) getLayoutProxy(prevChild); + final FObjPL prevChildPL = (FObjPL) getLayoutProxy( + prevChild); prevChildPL.resetProgress(); set_status(Status.AREA_FULL_SOME); return get_status(); @@ -151,9 +154,9 @@ return get_status(); } // I don't much like exposing this. (AHS 001217) - NormalFlowRA column = (NormalFlowRA)currentArea; + final NormalFlowRA column = (NormalFlowRA)currentArea; // Cast verified at construction. - SpanRA span = (SpanRA) column.getWritableParent(); + final SpanRA span = (SpanRA) column.getWritableParent(); span.setCurrentColumn(span.getCurrentColumn() + 1); i--; } Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractTableBodyPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractTableBodyPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractTableBodyPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -54,11 +54,12 @@ // manage information about spanning rows public RowSpanMgr rowSpanMgr; - public AbstractTableBodyPL(AbstractTableBody tableBody, PioneerLS layout) { + public AbstractTableBodyPL(final AbstractTableBody tableBody, + final PioneerLS layout) { super(tableBody, layout); } - public void setYPosition(int value) { + public void setYPosition(final int value) { ((GenericContainer)areaContainerRef.get()).setYPosition(value); } @@ -66,13 +67,13 @@ return ((GenericContainer)areaContainerRef.get()).getYPosition(); } - public int getHeight(FOContext context) { + public int getHeight(final FOContext context) { return ((GenericContainer)areaContainerRef.get()).crBPD() + getReal().traitSpaceBeforeOptimum(context) + getReal().traitSpaceAfterOptimum(context); } - public void removeLayout(Area area) { + public void removeLayout(final Area area) { if (areaContainerRef != null) { area.removeChild((GenericContainer)areaContainerRef.get()); } @@ -112,11 +113,11 @@ return (AbstractTableBody) this.getFONode(); } - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { - AbstractTableBody node = getReal(); - TableArea tableArea = (TableArea) area; - Table table = node.getNearestTable(area); + final AbstractTableBody node = getReal(); + final TableArea tableArea = (TableArea) area; + final Table table = node.getNearestTable(area); if (getProgress() == FONodePL.BREAK_AFTER) { return Status.OK; } @@ -164,13 +165,14 @@ areaContainerRef = new WeakReference(areaContainer); ArrayList keepWith = new ArrayList(); - int numChildren = node.childrenFO().size(); + final int numChildren = node.childrenFO().size(); TableRow lastRow = null; boolean endKeepGroup = true; for (int i = getProgress(); i < numChildren; i++) { - Object child = node.childrenFO().get(i); + final Object child = node.childrenFO().get(i); if (child instanceof Marker) { - MarkerPL markerPL = (MarkerPL) getLayoutProxy((FONode) child); + final MarkerPL markerPL = (MarkerPL) getLayoutProxy( + (FONode) child); markerPL.layout(area, retrieveMarker); continue; } @@ -178,8 +180,8 @@ throw new AreaWException("Currently only Table Rows are " + "supported in table body, header and footer"); } - TableRow row = (TableRow)child; - TableRowPL rowPL = (TableRowPL) getLayoutProxy(row); + final TableRow row = (TableRow)child; + final TableRowPL rowPL = (TableRowPL) getLayoutProxy(row); rowPL.setRowSpanMgr(rowSpanMgr); if (row.traitKeepWithPreviousWithinColumn(area) > 0 @@ -235,7 +237,7 @@ // FIXME!!! Handle rows spans!!! removeTableRowLayout(row, areaContainer); for (int j = 0; j < keepWith.size(); j++) { - TableRow tr = (TableRow)keepWith.get(j); + final TableRow tr = (TableRow)keepWith.get(j); removeTableRowLayout(tr, areaContainer); i--; } @@ -281,8 +283,8 @@ return Status.OK; } - public void removeTableRowLayout(TableRow tr, Area area) { - TableRowPL rowPL = (TableRowPL) this.getLayoutProxy(tr); + public void removeTableRowLayout(final TableRow tr, final Area area) { + final TableRowPL rowPL = (TableRowPL) this.getLayoutProxy(tr); rowPL.resetProgress(); } Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockContainerPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockContainerPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockContainerPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -36,7 +36,8 @@ */ public class BlockContainerPL extends FObjPL { - public BlockContainerPL(BlockContainer container, PioneerLS layout) { + public BlockContainerPL(final BlockContainer container, + final PioneerLS layout) { super(container, layout); } @@ -44,19 +45,19 @@ return (BlockContainer) this.getFONode(); } - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { - BlockContainer node = getFO(); + final BlockContainer node = getFO(); if (getProgress() == FONodePL.START) { setProgress(0); } - BlockContainerRA blockContainer = area.makeBlockContainerArea(node, - retrieveMarker); + final BlockContainerRA blockContainer = area.makeBlockContainerArea( + node, retrieveMarker); for (int i = this.getProgress(); i < node.getChildCount(); i++) { - FONode fo = node.getFONodeChildAt(i); - FObjPL fobjPL = (FObjPL) getLayoutProxy(fo); + final FONode fo = node.getFONodeChildAt(i); + final FObjPL fobjPL = (FObjPL) getLayoutProxy(fo); fobjPL.layout(blockContainer, retrieveMarker); } Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -49,7 +49,7 @@ public LineArea currentLineArea; - public BlockPL(FObj realFObj, PioneerLS layout) { + public BlockPL(final FObj realFObj, final PioneerLS layout) { super(realFObj, layout); } @@ -62,14 +62,14 @@ return (Block) this.getFONode(); } - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { - Block node = this.getFO(); + final Block node = this.getFO(); if (! breakStatusBeforeChecked) { breakStatusBeforeChecked = true; // no break if first in area tree, or leading in context // area - int breakBeforeStatus = layout.checkBreakBefore(node, area); + final int breakBeforeStatus = layout.checkBreakBefore(node, area); if (breakBeforeStatus != Status.OK) { return breakBeforeStatus; } @@ -103,9 +103,9 @@ blockArea = area.makeNormalBlockArea(node, retrieveMarker); for (int i = getProgress(); i < node.getChildCount(); i++) { - FONode fo = node.getFONodeChildAt(i); - FONodePL nodePL = this.getLayoutProxy(fo); - int status = nodePL.layout(blockArea, retrieveMarker); + final FONode fo = node.getFONodeChildAt(i); + final FONodePL nodePL = this.getLayoutProxy(fo); + final int status = nodePL.layout(blockArea, retrieveMarker); if (Status.isIncomplete(status)) { setProgress(i); if (status == Status.AREA_FULL_NONE) { @@ -130,7 +130,7 @@ // no break if last in area tree, or trailing in context // area - int breakAfterStatus = Status.checkBreakAfter( + final int breakAfterStatus = Status.checkBreakAfter( node.traitBreakAfter(area)); if (breakAfterStatus != Status.OK) { setProgress(FONodePL.BREAK_AFTER); @@ -157,7 +157,7 @@ * * @return the line area to be used to add inline objects */ - public LineArea getCurrentLineArea(NormalBlockArea blockArea) + public LineArea getCurrentLineArea(final NormalBlockArea blockArea) throws AreaWException { if (this.currentLineArea == null) { this.currentLineArea = blockArea.createNextLineArea(false); Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/CharacterPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/CharacterPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/CharacterPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -35,7 +35,7 @@ */ public class CharacterPL extends FObjPL { - public CharacterPL(Character realFObj, PioneerLS layout) { + public CharacterPL(final Character realFObj, final PioneerLS layout) { super(realFObj, layout); } @@ -43,7 +43,7 @@ return (Character) this.getFONode(); } - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { return layoutChildren(area, retrieveMarker); } Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ContinuedLabelPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ContinuedLabelPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ContinuedLabelPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -36,7 +36,8 @@ */ public class ContinuedLabelPL extends FObjPL { - public ContinuedLabelPL(ContinuedLabel inline, PioneerLS layout) { + public ContinuedLabelPL(final ContinuedLabel inline, + final PioneerLS layout) { super(inline, layout); } @@ -52,19 +53,19 @@ * @return Value indicating where all, some or none of the content * was placed in the current parent area. */ - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { - ContinuedLabel label = getFO(); + final ContinuedLabel label = getFO(); if (getProgress() == FONodePL.START) { setProgress(0); } // See if ancestor table has generated any areas yet. - TableArea tableArea = area.ancestorTableArea(); + final TableArea tableArea = area.ancestorTableArea(); if (tableArea != null && tableArea.getPreviousSibling() != null) { - int numChildren = label.getChildren().size(); + final int numChildren = label.getChildren().size(); for (int i = getProgress(); i < numChildren; i++) { - FONode fo = (FONode)label.getChildren().get(i); + final FONode fo = (FONode)label.getChildren().get(i); int status; if (Status.isIncomplete(status = getLayoutProxy(fo).layout(area, retrieveMarker))) { Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ExternalGraphicPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ExternalGraphicPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ExternalGraphicPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -36,7 +36,8 @@ */ public class ExternalGraphicPL extends FObjPL { - public ExternalGraphicPL(ExternalGraphic graphic, PioneerLS layout) { + public ExternalGraphicPL(final ExternalGraphic graphic, + final PioneerLS layout) { super(graphic, layout); } @@ -44,22 +45,22 @@ return (ExternalGraphic) this.getFONode(); } - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { - ExternalGraphic node = getFO(); + final ExternalGraphic node = getFO(); if (getProgress() == FONodePL.START) { setProgress(0); } - org.axsl.areaW.Area parentForDimensions = + final org.axsl.areaW.Area parentForDimensions = area.nearestGeneratedByBlockLevelFO(); - int height = node.viewportBPD(area, parentForDimensions.crBPD()); + final int height = node.viewportBPD(area, parentForDimensions.crBPD()); if (area.progressionDimensionAvailable() < (height + node.traitSpaceBeforeOptimum(area))) { return Status.AREA_FULL_NONE; } - LineArea lineArea = activeLineArea(area); + final LineArea lineArea = activeLineArea(area); if (lineArea == null) { // Not enough room on the page for this. return Status.AREA_FULL_NONE; Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -66,7 +66,7 @@ protected PioneerLS layout; - public FONodePL(FONode realFObj, PioneerLS layout) { + public FONodePL(final FONode realFObj, final PioneerLS layout) { this.realFONode = realFObj; realFObj.setProxy(this); this.layout = layout; @@ -83,7 +83,7 @@ * @param snapshot a ArrayList of progress indicators (Integer) * @return the updated ArrayList of progress indicators (Integers) */ - public ArrayList getProgressSnapshot(ArrayList snapshot) { + public ArrayList getProgressSnapshot(final ArrayList snapshot) { snapshot.add(new Integer(this.progress)); return snapshot; } @@ -94,7 +94,7 @@ * and restored using this method. * @param snapshot the ArrayList of saved progress indicators (Integers) */ - public void rollback(ArrayList snapshot) { + public void rollback(final ArrayList snapshot) { this.progress = ((Integer)snapshot.get(0)).intValue(); snapshot.remove(0); if (this.progress == START) { @@ -114,11 +114,11 @@ * Sets the progress indicator. * @param progress The progress indicator to be stored. */ - public void setProgress(int progress) { + public void setProgress(final int progress) { this.progress = progress; } - protected FONodePL getLayoutProxy(FONode node) { + protected FONodePL getLayoutProxy(final FONode node) { return this.layout.getLayoutProxy(node); } @@ -154,21 +154,22 @@ * @return The index into the text (char []) to the first character that * was <em>not</em> successfully added to the line. */ - protected int addTextItemToLine(LineArea lineArea, FOLineText lineText, - int start, int end, RetrieveMarker retrieveMarker) - throws AreaWException { + protected int addTextItemToLine(final LineArea lineArea, + final FOLineText lineText, final int start, final int end, + final RetrieveMarker retrieveMarker) throws AreaWException { EagerLineBreaker lb = layout.getLineBreaker(); if (lb == null) { lb = lineArea.getTextServer().provideEagerLineBreaker(null, layout, lineArea.getFontConsumer()); } int status = 0; - FOLineText contextAware = lineText.getContextWrapper(retrieveMarker); + final FOLineText contextAware = lineText.getContextWrapper( + retrieveMarker); try { status = lb.processLineContent(contextAware, start, end, lineArea.asLineOutput()); - } catch (TextException e) { - FObj generatedBy = lineArea.traitGeneratedBy(); + } catch (final TextException e) { + final FObj generatedBy = lineArea.traitGeneratedBy(); throw new AreaWException("Error in text layout:\n" + generatedBy.getContextMessage(), e); } @@ -183,8 +184,8 @@ * @return For non-text items, returns 1 for success or 0 if the item did * not fit onto the current line. */ - protected int addNonTextItemToLine(LineArea lineArea, FOLineNonText nonText, - RetrieveMarker retrieveMarker) + protected int addNonTextItemToLine(final LineArea lineArea, + final FOLineNonText nonText, final RetrieveMarker retrieveMarker) throws AreaWException { EagerLineBreaker lb = layout.getLineBreaker(); if (lb == null) { @@ -192,12 +193,13 @@ lineArea.getFontConsumer()); } int status = 0; - FOLineNonText contextAware = nonText.getContextWrapper(retrieveMarker); + final FOLineNonText contextAware = nonText.getContextWrapper( + retrieveMarker); try { status = lb.processLineContent(contextAware, -1, -1, lineArea.asLineOutput()); - } catch (TextException e) { - FObj generatedBy = lineArea.traitGeneratedBy(); + } catch (final TextException e) { + final FObj generatedBy = lineArea.traitGeneratedBy(); throw new AreaWException("Error in non-text layout:\n" + generatedBy.getContextMessage()); } @@ -205,13 +207,12 @@ return status; } - protected int layoutInlineContent(FObj node, LineArea lineArea, - RetrieveMarker retrieveMarker) - throws AreaWException { + protected int layoutInlineContent(final FObj node, LineArea lineArea, + final RetrieveMarker retrieveMarker) throws AreaWException { if (! (node instanceof FOLineNonText)) { return -1000; } - FOLineNonText nonText = (FOLineNonText) node; + final FOLineNonText nonText = (FOLineNonText) node; // this should start a new page if (lineArea == null) { return Status.AREA_FULL_SOME; @@ -221,10 +222,10 @@ return Status.OK; } // It did not fit on the line. Create new line & try again. - NormalBlockArea blockArea + final NormalBlockArea blockArea = (NormalBlockArea) lineArea.getWritableParentArea(); lineArea = blockArea.createNextLineArea(false); - BlockPL blockPL = this.layout.getBlockPL(blockArea); + final BlockPL blockPL = this.layout.getBlockPL(blockArea); blockPL.currentLineArea = lineArea; if (lineArea == null) { @@ -244,7 +245,7 @@ * @param area The area whose LineArea is being sought. * @return The current LineArea of the block that area is in. */ - protected LineArea activeLineArea(Area area) throws AreaWException { + protected LineArea activeLineArea(final Area area) throws AreaWException { if (area instanceof LineArea) { return (LineArea) area; } @@ -255,11 +256,11 @@ blockArea = area.ancestorWritableNormalBlockArea(); } if (blockArea == null) { - FONode foNode = this.realFONode; + final FONode foNode = this.realFONode; throw new AreaWException("Layout of inline objects must be inside " + "a block:\n" + foNode.getContextMessage()); } - BlockPL blockPL = this.layout.getBlockPL(blockArea); + final BlockPL blockPL = this.layout.getBlockPL(blockArea); return blockPL.getCurrentLineArea(blockArea); } Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FOTextPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FOTextPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FOTextPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -37,7 +37,7 @@ */ public class FOTextPL extends FONodePL { - public FOTextPL(FOText text, PioneerLS layout) { + public FOTextPL(final FOText text, final PioneerLS layout) { super(text, layout); } @@ -45,14 +45,14 @@ return (FOText) this.getFONode(); } - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { - FOText node = this.getFO(); + final FOText node = this.getFO(); if (getProgress() == FONodePL.START) { setProgress(0); } - int progressAtStart = getProgress(); - int progressAtEnd = addText(node, area, progressAtStart, + final int progressAtStart = getProgress(); + final int progressAtEnd = addText(node, area, progressAtStart, retrieveMarker); setProgress(progressAtEnd); if (progressAtEnd == -1) { @@ -70,17 +70,18 @@ * laid out. If the first six characters have been laid out (indices 0-5), * then 6 should be returned. */ - private int addText(FOLineText lineText, Area area, int start, - RetrieveMarker retrieveMarker) throws AreaWException { - int end = lineText.inlineText().length; + private int addText(final FOLineText lineText, final Area area, + int start, final RetrieveMarker retrieveMarker) + throws AreaWException { + final int end = lineText.inlineText().length; LineArea la = this.activeLineArea(area); if (la == null) { return start; } - NormalBlockArea ba = la.ancestorWritableNormalBlockArea(); + final NormalBlockArea ba = la.ancestorWritableNormalBlockArea(); start = addTextItemToLine(la, lineText, start, end, retrieveMarker); while (start != -1) { - BlockPL blockPL = this.layout.getBlockPL(ba); + final BlockPL blockPL = this.layout.getBlockPL(ba); la = ba.createNextLineArea(false); blockPL.currentLineArea = la; Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjMixedPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjMixedPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjMixedPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -37,7 +37,7 @@ */ public class FObjMixedPL extends FObjPL { - public FObjMixedPL(FObj realFObj, PioneerLS layout) { + public FObjMixedPL(final FObj realFObj, final PioneerLS layout) { super(realFObj, layout); } @@ -45,15 +45,15 @@ return (FObjMixed) this.getFONode(); } - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { - FObjMixed node = getFObjMixed(); + final FObjMixed node = getFObjMixed(); if (getProgress() == FONodePL.START) { setProgress(0); } for (int i = getProgress(); i < node.childrenFO().size(); i++) { - FONode fo = (FONode) node.childrenFO().get(i); - int status = getLayoutProxy(fo).layout(area, retrieveMarker); + final FONode fo = (FONode) node.childrenFO().get(i); + final int status = getLayoutProxy(fo).layout(area, retrieveMarker); if (Status.isIncomplete((status))) { setProgress(i); return status; Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -38,16 +38,16 @@ */ public abstract class FObjPL extends FONodePL { - public FObjPL(FObj realFObj, PioneerLS layout) { + public FObjPL(final FObj realFObj, final PioneerLS layout) { super(realFObj, layout); } public void resetProgress() { super.resetProgress(); - List children = getChildren(); + final List children = getChildren(); for (int i = 0; i < children.size(); i++) { - FONode node = ((FONode)children.get(i)); - FONodePL nodePL = getLayoutProxy(node); + final FONode node = ((FONode)children.get(i)); + final FONodePL nodePL = getLayoutProxy(node); nodePL.resetProgress(); } } @@ -58,28 +58,28 @@ if (this.progress < 0) { return snapshot; } - List children = getChildren(); + final List children = getChildren(); if (children.isEmpty()) { return snapshot; } - FONode node = ((FONode)children.get(this.progress)); - FONodePL proxy = getLayoutProxy(node); + final FONode node = ((FONode)children.get(this.progress)); + final FONodePL proxy = getLayoutProxy(node); return proxy.getProgressSnapshot(snapshot); } - public void rollback(ArrayList snapshot) { + public void rollback(final ArrayList snapshot) { super.rollback(snapshot); - List children = getChildren(); + final List children = getChildren(); if ((this.progress == -1) || children.isEmpty() || this.progress <= START) { return; } for (int i = this.progress + 1; i < children.size(); i++) { - FONode fo = (FONode)children.get(i); + final FONode fo = (FONode)children.get(i); getLayoutProxy(fo).resetProgress(); } - FONode node = ((FONode)children.get(this.progress)); + final FONode node = ((FONode)children.get(this.progress)); getLayoutProxy(node).rollback(snapshot); } @@ -87,17 +87,17 @@ return ((FObj) this.getFONode()).getChildren(); } - protected int layoutChildren(Area area, RetrieveMarker retrieveMarker) - throws AreaWException { - FONode node = this.getFONode(); + protected int layoutChildren(final Area area, + final RetrieveMarker retrieveMarker) throws AreaWException { + final FONode node = this.getFONode(); int start = getProgress(); if (start == FONodePL.START) { start = 0; } for (int i = start; i < node.childrenFO().size(); i++) { - FONode fo = (FONode)node.childrenFO().get(i); - FONodePL nodePL = this.getLayoutProxy(fo); - int status = nodePL.layout(area, retrieveMarker); + final FONode fo = (FONode)node.childrenFO().get(i); + final FONodePL nodePL = this.getLayoutProxy(fo); + final int status = nodePL.layout(area, retrieveMarker); if (Status.isIncomplete(status)) { return status; } Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FlowPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FlowPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FlowPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -35,22 +35,22 @@ public class FlowPL extends AbstractFlowPL { - public FlowPL(Flow flow, PioneerLS layout) { + public FlowPL(final Flow flow, final PioneerLS layout) { super(flow, layout); } - public int layout(PageCollection pc, RetrieveMarker retrieveMarker) - throws AreaWException { - List children = getChildren(); + public int layout(final PageCollection pc, + final RetrieveMarker retrieveMarker) throws AreaWException { + final List children = getChildren(); for (int i = 0; i < children.size(); i++) { FObj lastFObj = null; if (i != 0) { lastFObj = (FObj) children.get(i - 1); } - FObj nextFObj = (FObj) children.get(i); - org.axsl.areaW.SpanRA span = pc.startingReferenceArea(lastFObj, - nextFObj); - NormalFlowRA nf = span.normalFlowForNextFO(nextFObj); + final FObj nextFObj = (FObj) children.get(i); + final org.axsl.areaW.SpanRA span = pc.startingReferenceArea( + lastFObj, nextFObj); + final NormalFlowRA nf = span.normalFlowForNextFO(nextFObj); this.getLayoutProxy(nextFObj).layout(nf, retrieveMarker); } return 0; Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FootnoteBodyPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FootnoteBodyPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FootnoteBodyPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -41,7 +41,7 @@ */ public class FootnoteBodyPL extends FObjPL { - public FootnoteBodyPL(FootnoteBody body, PioneerLS layout) { + public FootnoteBodyPL(final FootnoteBody body, final PioneerLS layout) { super(body, layout); } @@ -49,19 +49,19 @@ return (FootnoteBody) this.getFONode(); } - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { - FootnoteBody node = getFO(); + final FootnoteBody node = getFO(); if (getProgress() == FONodePL.START) { setProgress(0); } - FootnoteRA referenceArea = (FootnoteRA) area; + final FootnoteRA referenceArea = (FootnoteRA) area; - int numChildren = node.childrenFO().size(); + final int numChildren = node.childrenFO().size(); for (int i = getProgress(); i < numChildren; i++) { - FONode fo = node.getFONodeChildAt(i); - FONodePL foNodePL = getLayoutProxy(fo); - int status = foNodePL.layout(referenceArea, retrieveMarker); + final FONode fo = node.getFONodeChildAt(i); + final FONodePL foNodePL = getLayoutProxy(fo); + final int status = foNodePL.layout(referenceArea, retrieveMarker); if (Status.isIncomplete((status))) { resetProgress(); return status; @@ -70,35 +70,37 @@ return Status.OK; } - public boolean layoutFootnote(PageArea p, RetrieveMarker retrieveMarker) { - RegionRABody bac = p.getWritableRegionBody(); - FootnoteRA footArea = bac.getWritableFootnoteRA(); + public boolean layoutFootnote(final PageArea p, + final RetrieveMarker retrieveMarker) { + final RegionRABody bac = p.getWritableRegionBody(); + final FootnoteRA footArea = bac.getWritableFootnoteRA(); try { layoutFootnoteSeparator(bac, footArea, retrieveMarker); - int status = layout(footArea, retrieveMarker); + final int status = layout(footArea, retrieveMarker); if (Status.isIncomplete(status)) { // add as a pending footnote return false; } - } catch (AreaWException exception) { + } catch (final AreaWException exception) { return false; } return true; } - private void layoutFootnoteSeparator(RegionRABody bac, FootnoteRA footArea, - RetrieveMarker retrieveMarker) throws AreaWException { + private void layoutFootnoteSeparator(final RegionRABody bac, + final FootnoteRA footArea, final RetrieveMarker retrieveMarker) + throws AreaWException { /* TODO: It seems like this logic should be done once when the * PageCollection is first started, and cached there for reuse. */ if (footArea.hasChildren()) { return; } - PageSequence pageSeq = bac.getWritablePage().getPageSequence(); - StaticContent separator = pageSeq.getFootnoteSeparator(); + final PageSequence pageSeq = bac.getWritablePage().getPageSequence(); + final StaticContent separator = pageSeq.getFootnoteSeparator(); if (separator == null) { return; } - StaticContentPL staticPL = (StaticContentPL) + final StaticContentPL staticPL = (StaticContentPL) getLayoutProxy(separator); staticPL.layout(footArea, retrieveMarker); } Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FootnotePL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FootnotePL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FootnotePL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -38,7 +38,7 @@ */ public class FootnotePL extends FObjPL { - public FootnotePL(Footnote footnote, PioneerLS layout) { + public FootnotePL(final Footnote footnote, final PioneerLS layout) { super(footnote, layout); } @@ -46,25 +46,25 @@ return (Footnote) this.getFONode(); } - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { - Footnote node = getFO(); + final Footnote node = getFO(); if (getProgress() == FONodePL.START) { setProgress(0); } /* Layout the Inline. */ - Inline inline = node.getInline(); - FObjMixedPL inlinePL = (FObjMixedPL) getLayoutProxy(inline); - int status = inlinePL.layout(area, retrieveMarker); + final Inline inline = node.getInline(); + final FObjMixedPL inlinePL = (FObjMixedPL) getLayoutProxy(inline); + final int status = inlinePL.layout(area, retrieveMarker); if (Status.isIncomplete(status)) { return status; } /* Layout the FootnoteBody. */ - FootnoteBody fbody = node.getFootnoteBody(); - FootnoteBodyPL fbPL = ((FootnoteBodyPL) getLayoutProxy(fbody)); - PageArea page = area.getWritablePage(); + final FootnoteBody fbody = node.getFootnoteBody(); + final FootnoteBodyPL fbPL = ((FootnoteBodyPL) getLayoutProxy(fbody)); + final PageArea page = area.getWritablePage(); /* If the footnote cannot be entirely laid out on the current page, * it will be added to the list of pending footnotes. */ fbPL.layoutFootnote(page, retrieveMarker); Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/InstreamForeignObjectPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/InstreamForeignObjectPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/InstreamForeignObjectPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -36,8 +36,8 @@ public ForeignObjectArea areaCurrent; - public InstreamForeignObjectPL(InstreamForeignObject foreignObject, - PioneerLS layout) { + public InstreamForeignObjectPL(final InstreamForeignObject foreignObject, + final PioneerLS layout) { super(foreignObject, layout); } @@ -45,10 +45,10 @@ return (InstreamForeignObject) this.getFONode(); } - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { - InstreamForeignObject node = getFO(); - LineArea lineArea = activeLineArea(area); + final InstreamForeignObject node = getFO(); + final LineArea lineArea = activeLineArea(area); if (lineArea == null) { // Not enough room on the page for this. return Status.AREA_FULL_NONE; Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/LeaderPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/LeaderPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/LeaderPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -36,7 +36,7 @@ */ public class LeaderPL extends FObjPL { - public LeaderPL(Leader realFObj, PioneerLS layout) { + public LeaderPL(final Leader realFObj, final PioneerLS layout) { super(realFObj, layout); } @@ -44,10 +44,10 @@ return (Leader) this.getFONode(); } - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { - Leader node = getFO(); - LineArea lineArea = activeLineArea(area); + final Leader node = getFO(); + final LineArea lineArea = activeLineArea(area); if (lineArea == null) { // Not enough room on the page for this. return Status.AREA_FULL_NONE; Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListBlockPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListBlockPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListBlockPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -37,7 +37,7 @@ */ public class ListBlockPL extends FObjPL { - public ListBlockPL(ListBlock listBlock, PioneerLS layout) { + public ListBlockPL(final ListBlock listBlock, final PioneerLS layout) { super(listBlock, layout); } @@ -45,10 +45,10 @@ return (ListBlock) this.getFONode(); } - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { - ListBlock node = getFO(); - ListBlockPL listBlockPL = (ListBlockPL) getLayoutProxy(node); + final ListBlock node = getFO(); + final ListBlockPL listBlockPL = (ListBlockPL) getLayoutProxy(node); if (listBlockPL.getProgress() == FONodePL.START) { listBlockPL.setProgress(0); @@ -57,12 +57,14 @@ } } - ListBlockArea blockArea = area.makeListBlockArea(node, retrieveMarker); + final ListBlockArea blockArea = area.makeListBlockArea(node, + retrieveMarker); - int numChildren = node.childrenFO().size(); + final int numChildren = node.childrenFO().size(); for (int i = listBlockPL.getProgress(); i < numChildren; i++) { - ListItem listItem = (ListItem)node.childrenFO().get(i); - ListItemPL listItemPL = (ListItemPL) getLayoutProxy(listItem); + final ListItem listItem = (ListItem)node.childrenFO().get(i); + final ListItemPL listItemPL = (ListItemPL) getLayoutProxy( + listItem); int status = listItemPL.layout(blockArea, retrieveMarker); if (Status.isIncomplete(status)) { if (status == Status.AREA_FULL_NONE && i > 0) { Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemBodyPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemBodyPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemBodyPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -36,7 +36,8 @@ */ public class ListItemBodyPL extends FObjPL { - public ListItemBodyPL(ListItemBody listItemBody, PioneerLS layout) { + public ListItemBodyPL(final ListItemBody listItemBody, + final PioneerLS layout) { super(listItemBody, layout); } @@ -44,9 +45,9 @@ return (ListItemBody) this.getFONode(); } - public int layout(Area area, RetrieveMarker retrieveMarker) - throws AreaWException { - ListItemBody node = getFO(); + public int layout(final Area area, + final RetrieveMarker retrieveMarker) throws AreaWException { + final ListItemBody node = getFO(); if (getProgress() == FONodePL.START) { setProgress(0); } @@ -58,11 +59,11 @@ * of areas returned by each of the children of the fo:list-item-body. */ - int numChildren = node.childrenFO().size(); + final int numChildren = node.childrenFO().size(); for (int i = getProgress(); i < numChildren; i++) { - FObj fo = (FObj)node.childrenFO().get(i); + final FObj fo = (FObj)node.childrenFO().get(i); - int status = getLayoutProxy(fo).layout(area, retrieveMarker); + final int status = getLayoutProxy(fo).layout(area, retrieveMarker); if (Status.isIncomplete((status))) { setProgress(i); if ((i == 0) && (status == Status.AREA_FULL_NONE)) { Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemLabelPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemLabelPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemLabelPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -36,7 +36,8 @@ */ public class ListItemLabelPL extends FObjPL { - public ListItemLabelPL(ListItemLabel realFObj, PioneerLS layout) { + public ListItemLabelPL(final ListItemLabel realFObj, + final PioneerLS layout) { super(realFObj, layout); } @@ -44,17 +45,17 @@ return (ListItemLabel) this.getFONode(); } - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { - ListItemLabel node = getFO(); - int numChildren = node.childrenFO().size(); + final ListItemLabel node = getFO(); + final int numChildren = node.childrenFO().size(); if (numChildren != 1) { throw new AreaWException("Non-standard restriction: " + "list-item-label must have exactly one block."); } - Block block = (Block)node.childrenFO().get(0); + final Block block = (Block)node.childrenFO().get(0); /* * For calculating the lineage - The fo:list-item-label formatting @@ -65,7 +66,7 @@ */ int status; - BlockPL blockPL = (BlockPL) getLayoutProxy(block); + final BlockPL blockPL = (BlockPL) getLayoutProxy(block); status = blockPL.layout(area, retrieveMarker); return status; } Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -38,7 +38,7 @@ */ public class ListItemPL extends FObjPL { - public ListItemPL(ListItem listItem, PioneerLS layout) { + public ListItemPL(final ListItem listItem, final PioneerLS layout) { super(listItem, layout); } @@ -46,32 +46,32 @@ return (ListItem) this.getFONode(); } - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { if (! (area instanceof ListBlockArea)) { throw new AreaWException("Illegal parent area for fo:list-item"); } - ListBlockArea blockArea = (ListBlockArea) area; + final ListBlockArea blockArea = (ListBlockArea) area; return layout(blockArea, retrieveMarker); } - public int layout(ListBlockArea area, RetrieveMarker retrieveMarker) - throws AreaWException { - ListItem node = getFO(); + public int layout(final ListBlockArea area, + final RetrieveMarker retrieveMarker) throws AreaWException { + final ListItem node = getFO(); if (getProgress() == FONodePL.START) { setProgress(0); } - ListItemArea group = area.makeListItemArea(node, + final ListItemArea group = area.makeListItemArea(node, retrieveMarker); /* Now lay out the list-item-label inside the new block-area. */ - ListItemLabel label = (ListItemLabel)node.childrenFO().get(0); + final ListItemLabel label = (ListItemLabel)node.childrenFO().get(0); int status; // what follows doesn't yet take into account whether the // body failed completely or only got some text in if (getProgress() == 0) { - ListItemLabelPL labelPL + final ListItemLabelPL labelPL = (ListItemLabelPL) this.getLayoutProxy(label); status = labelPL.layout(group, retrieveMarker); if (Status.isIncomplete(status)) { @@ -80,8 +80,8 @@ } /* Now create a BlockArea to contain the list-item-body. */ - ListItemBody body = (ListItemBody)node.childrenFO().get(1); - ListItemBodyPL bodyPL = (ListItemBodyPL) getLayoutProxy(body); + final ListItemBody body = (ListItemBody)node.childrenFO().get(1); + final ListItemBodyPL bodyPL = (ListItemBodyPL) getLayoutProxy(body); status = bodyPL.layout(group, retrieveMarker); if (Status.isIncomplete(status)) { setProgress(1); Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/MarkerPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/MarkerPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/MarkerPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -31,7 +31,7 @@ public class MarkerPL extends FObjMixedPL { - public MarkerPL(Marker marker, PioneerLS layout) { + public MarkerPL(final Marker marker, final PioneerLS layout) { super(marker, layout); } @@ -39,8 +39,8 @@ return (Marker) this.getFONode(); } - public int layout(Area area, RetrieveMarker retrieveMarker) { - Marker node = getReal(); + public int layout(final Area area, final RetrieveMarker retrieveMarker) { + final Marker node = getReal(); // no layout action desired area.getWritablePage().registerMarker(node); return Status.OK; Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/NoLayoutPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/NoLayoutPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/NoLayoutPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -34,11 +34,11 @@ */ public class NoLayoutPL extends FONodePL { - public NoLayoutPL(FONode realFObj, PioneerLS layout) { + public NoLayoutPL(final FONode realFObj, final PioneerLS layout) { super(realFObj, layout); } - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { return Status.OK; } Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PageNumberCitationPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PageNumberCitationPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PageNumberCitationPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -36,7 +36,8 @@ */ public class PageNumberCitationPL extends FObjPL { - public PageNumberCitationPL(PageNumberCitation citation, PioneerLS layout) { + public PageNumberCitationPL(final PageNumberCitation citation, + final PioneerLS layout) { super(citation, layout); } @@ -44,10 +45,10 @@ return (PageNumberCitation) this.getFONode(); } - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { - PageNumberCitation node = getFO(); - LineArea lineArea = activeLineArea(area); + final PageNumberCitation node = getFO(); + final LineArea lineArea = activeLineArea(area); if (lineArea == null) { // Not enough room on the page for this. return Status.AREA_FULL_NONE; Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PageNumberPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PageNumberPL.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PageNumberPL.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -36,7 +36,7 @@ */ public class PageNumberPL extends FObjPL { - public PageNumberPL(PageNumber pageNumber, PioneerLS layout) { + public PageNumberPL(final PageNumber pageNumber, final PioneerLS layout) { super(pageNumber, layout); } @@ -44,10 +44,10 @@ return (PageNumber) this.getFONode(); } - public int layout(Area area, RetrieveMarker retrieveMarker) + public int layout(final Area area, final RetrieveMarker retrieveMarker) throws AreaWException { - PageNumber node = getFO(); - LineArea lineArea = activeLineArea(area); + final PageNumber node = getFO(); + final LineArea lineArea = activeLineArea(area); if (lineArea == null) { // Not enough room on the page for this. return Status.AREA_FULL_NONE; Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerFactory.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerFactory.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerFactory.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -36,7 +36,7 @@ private Log logger; - public PioneerFactory(Log logger) { + public PioneerFactory(final Log logger) { this.logger = logger; } Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java 2006-07-23 20:51:25 UTC (rev 7824) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java 2006-07-23 21:15:10 UTC (rev 7825) @@ -131,27 +131,27 @@ /** * Constructor. */ - public PioneerLS(Log logger) { + public PioneerLS(final Log logger) { super(logger); } - public BlockPL getBlockPL(NormalBlockArea blockArea) { - FObj block = blockArea.traitGeneratedBy(); + public BlockPL getBlockPL(final NormalBlockArea blockArea) { + final FObj block = blockArea.traitGeneratedBy(); return (BlockPL) block.getProxy(); } - public void completeCurrentLineInBlock(NormalBlockArea blockArea) { - BlockPL blockPL = getBlockPL(blockArea); + public void completeCurrentLineInBlock(final NormalBlockArea blockArea) { + final BlockPL blockPL = getBlockPL(blockArea); blockPL.completeCurrentLine(); } /** * Runs the formatting of this page sequence into the given area tree */ - public void processPageSequence(PageCollection pageCollection) + public void processPageSequence(final PageCollection pageCollection) throws AreaWException { - PageSequence pageSeq = pageCollection.getPageSequence(); - org.axsl.foR.fo.Flow flow = pageSeq.getFlow(); + final PageSequence pageSeq = pageCollection.getPageSequence(); + final org.axsl.foR.fo.Flow flow = pageSeq.getFlow(); flow.setProxy(new FlowPL(flow, this)); pageCollection.padPagesAtBeginning(); @@ -172,7 +172,7 @@ ... [truncated message content] |
|
From: <vic...@us...> - 2006-07-23 20:51:48
|
Revision: 7824 Author: victormote Date: 2006-07-23 13:51:25 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7824&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNameTree.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNamedDestination.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFObject.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutline.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineItem.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineParent.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPages.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPathPaint.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPattern.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRectangle.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFResources.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRoot.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFShading.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFTextString.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFToUnicodeCMap.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFUri.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFWArray.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXForm.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXImage.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXPostScript.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXReference.java Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNameTree.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNameTree.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNameTree.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -36,7 +36,7 @@ private Collection names; - public PDFNameTree(PDFDocument doc) { + public PDFNameTree(final PDFDocument doc) { super(doc); this.names = new ArrayList(); } @@ -46,12 +46,12 @@ * @return The PDF string */ public String toPDF() { - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); p.append(this.pdfID() + EOL); p.append("<<" + EOL); p.append("/Names [" + EOL); - for (Iterator i = names.iterator(); i.hasNext(); ) { - PDFDestination dest = (PDFDestination)i.next(); + for (final Iterator i = names.iterator(); i.hasNext(); ) { + final PDFDestination dest = (PDFDestination)i.next(); p.append(dest.toPDF()); } p.append("]" + EOL); @@ -60,7 +60,7 @@ return p.toString(); } - public void add(PDFNamedDestination destination) { + public void add(final PDFNamedDestination destination) { this.names.add(destination); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNamedDestination.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNamedDestination.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNamedDestination.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -49,8 +49,8 @@ * @param destination The PDFDestination that should be referred to by * this named destination. */ - public PDFNamedDestination(PDFDocument doc, String name, - PDFDestination destination) { + public PDFNamedDestination(final PDFDocument doc, final String name, + final PDFDestination destination) { super(doc); this.name = name; this.destination = destination; @@ -63,7 +63,7 @@ * the referred destination. */ protected String toPDF() { - StringBuffer result = new StringBuffer(); + final StringBuffer result = new StringBuffer(); result.append("(" + this.name + ") "); result.append(this.destination.pdfReference() + EOL); return result.toString(); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFObject.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFObject.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFObject.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -77,7 +77,7 @@ * Create an empty object. * @param doc The PDFDocument to which this object is attached. */ - public PDFObject(PDFDocument doc) { + public PDFObject(final PDFDocument doc) { this.document = doc; } @@ -85,7 +85,7 @@ // do nothing } - protected void setNumber(int number) { + protected void setNumber(final int number) { if (this.number > -1) { return; } @@ -112,12 +112,12 @@ * @param stream the stream to write the PDF to * @return the number of bytes written */ - protected int output(OutputStream stream) throws IOException { - String pdf = this.toPDF(); + protected int output(final OutputStream stream) throws IOException { + final String pdf = this.toPDF(); if (pdf == null) { return 0; } - byte[] bytes = PDFObject.stringToByteArray(pdf); + final byte[] bytes = PDFObject.stringToByteArray(pdf); stream.write(bytes); return bytes.length; } @@ -147,14 +147,14 @@ */ abstract String toPDF(); - protected static byte[] bufferToByteArray(StringBuffer buffer) { + protected static byte[] bufferToByteArray(final StringBuffer buffer) { return stringToByteArray(buffer.toString()); } - protected static byte[] stringToByteArray(String string) { + protected static byte[] stringToByteArray(final String string) { try { return string.getBytes(PDFDocument.ENCODING); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { return string.getBytes(); } } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutline.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutline.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutline.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -33,7 +33,7 @@ /** * @param doc {@inheritDoc} */ - public PDFOutline(PDFDocument doc) { + public PDFOutline(final PDFDocument doc) { super(doc); } @@ -46,7 +46,7 @@ * represent the object in PDF */ protected String toPDF() { - StringBuffer result = new StringBuffer(); + final StringBuffer result = new StringBuffer(); result.append(this.pdfID() + EOL); result.append("<<" + EOL); result.append(" /Type /Outlines" + EOL); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineItem.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineItem.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineItem.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -83,8 +83,9 @@ * Private constructor to be used only by the public constructors in this * class. */ - private PDFOutlineItem(PDFDocument doc, PDFOutlineParent parent, - String title, Color color, boolean italic, boolean bold) { + private PDFOutlineItem(final PDFDocument doc, final PDFOutlineParent parent, + final String title, final Color color, final boolean italic, + final boolean bold) { super(doc); this.parent = parent; parent.addChild(this); @@ -104,9 +105,9 @@ * @param destinationString The name of the named destination that should * be accessed by this Outline Item. */ - public PDFOutlineItem(PDFDocument doc, PDFOutlineParent parent, - String title, String destinationString, Color color, - boolean italic, boolean bold) { + public PDFOutlineItem(final PDFDocument doc, final PDFOutlineParent parent, + final String title, final String destinationString, + final Color color, final boolean italic, final boolean bold) { this(doc, parent, title, color, italic, bold); this.destinationString = new PDFTextString(doc, destinationString); } @@ -119,9 +120,9 @@ * @param destination The PDFDestination instance that should be accessed * by this Outline Item. */ - public PDFOutlineItem(PDFDocument doc, PDFOutlineParent parent, - String title, PDFDestination destination, Color color, - boolean italic, boolean bold) { + public PDFOutlineItem(final PDFDocument doc, final PDFOutlineParent parent, + final String title, final PDFDestination destination, + final Color color, final boolean italic, final boolean bold) { this(doc, parent, title, color, italic, bold); this.destination = destination; } @@ -134,9 +135,9 @@ * @param action The PDFAction instance that should be accessed * by this Outline Item. */ - public PDFOutlineItem(PDFDocument doc, PDFOutlineParent parent, - String title, PDFAction action, Color color, boolean italic, - boolean bold) { + public PDFOutlineItem(final PDFDocument doc, final PDFOutlineParent parent, + final String title, final PDFAction action, final Color color, + final boolean italic, final boolean bold) { this(doc, parent, title, color, italic, bold); this.action = action; } @@ -155,7 +156,7 @@ if (parent == null) { return null; } - int siblingIndex = getSiblings().indexOf(this); + final int siblingIndex = getSiblings().indexOf(this); if (siblingIndex < 1 || siblingIndex >= getSiblings().size()) { return null; } @@ -166,7 +167,7 @@ if (parent == null) { return null; } - int siblingIndex = getSiblings().indexOf(this); + final int siblingIndex = getSiblings().indexOf(this); if (siblingIndex < 0 || siblingIndex >= getSiblings().size() - 1) { return null; @@ -180,7 +181,7 @@ } int descendants = getChildren().size(); for (int i = 0; i < getChildren().size(); i++) { - PDFOutlineItem child = (PDFOutlineItem) getChildren().get(i); + final PDFOutlineItem child = (PDFOutlineItem) getChildren().get(i); descendants += child.count(); } return descendants; @@ -206,9 +207,9 @@ * represent the object in PDF */ protected String toPDF() { - StringBuffer result = new StringBuffer(); + final StringBuffer result = new StringBuffer(); result.append(this.pdfID() + EOL + "<<" + EOL); - int countDescendants = this.count(); + final int countDescendants = this.count(); // subentry Outline object result.append(" /Title " + title.toPDF() + EOL); result.append(" /Parent " + parent.pdfReference() + EOL); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineParent.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineParent.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineParent.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -41,11 +41,11 @@ /** * @param doc {@inheritDoc} */ - public PDFOutlineParent(PDFDocument doc) { + public PDFOutlineParent(final PDFDocument doc) { super(doc); } - public void addChild(PDFOutlineItem child) { + public void addChild(final PDFOutlineItem child) { this.children.add(child); } @@ -72,9 +72,9 @@ /** * {@inheritDoc} */ - public org.axsl.pdfW.PDFOutlineItem createPDFOutlineItem(String titleText, - String internalDestination, Color color, boolean italic, - boolean bold) { + public org.axsl.pdfW.PDFOutlineItem createPDFOutlineItem( + final String titleText, final String internalDestination, + final Color color, final boolean italic, final boolean bold) { return new org.foray.pdf.object.PDFOutlineItem(this.getPDFDocument(), this, titleText, internalDestination, color, italic, bold); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -76,8 +76,8 @@ * @param pagewidth the page's width in points * @param pageheight the page's height in points */ - public PDFPage(PDFDocument doc, PDFResources resources, int pagewidth, - int pageheight) { + public PDFPage(final PDFDocument doc, final PDFResources resources, + final int pagewidth, final int pageheight) { super(doc); /* add the page to the Root */ doc.getRoot().addPage(this); @@ -87,7 +87,7 @@ this.pageheight = pageheight; this.contents = new PDFContentStream(this.getPDFDocument(), this); this.contents.addDefaultFilters(); - PDFEncryption encryption = this.getPDFDocument().getEncryption(); + final PDFEncryption encryption = this.getPDFDocument().getEncryption(); if (encryption != null) { this.contents.addFilter(encryption.makeFilter()); } @@ -98,7 +98,7 @@ * * @param parent the /Pages object that is this page's parent */ - public void setParent(PDFPages parent) { + public void setParent(final PDFPages parent) { this.parent = parent.pdfReference(); } @@ -114,7 +114,7 @@ return this.annotList; } - public void addShading(PDFShading shading) { + public void addShading(final PDFShading shading) { this.resources.addShading(shading); } @@ -124,7 +124,7 @@ * @return the PDF string */ public String toPDF() { - StringBuffer sb = new StringBuffer(); + final StringBuffer sb = new StringBuffer(); sb.append(this.pdfID() + EOL + "<< /Type /Page" + EOL + "/Parent " @@ -146,16 +146,16 @@ * Add a PDFAnnotation to the collection of annotations on this page. * @param annotation The {@link PDFAnnotation} to add. */ - public void addAnnotation(PDFAnnotation annotation) { + public void addAnnotation(final PDFAnnotation annotation) { this.getAnnotList().addAnnotation(annotation); } /** * {@inheritDoc} */ - public org.axsl.pdfW.PDFLink makeLink(Rectangle2D.Float rect, - String destination, boolean externalLink) { - PDFDocument pdfDoc = getPDFDocument(); + public org.axsl.pdfW.PDFLink makeLink(final Rectangle2D.Float rect, + final String destination, final boolean externalLink) { + final PDFDocument pdfDoc = getPDFDocument(); PDFAction action; PDFLink link = null; int index; @@ -163,18 +163,19 @@ if (externalLink) { // check destination if (destination.endsWith(".pdf")) { // FileSpec - PDFFileSpec fileSpec = new PDFFileSpec(pdfDoc, destination); + final PDFFileSpec fileSpec = new PDFFileSpec(pdfDoc, + destination); action = new PDFGoToRemote(pdfDoc, fileSpec); } else if ((index = destination.indexOf(".pdf#page=")) > 0) { - String file = destination.substring(0, index + 4); - int pageNum = Integer.parseInt(destination.substring( + final String file = destination.substring(0, index + 4); + final int pageNum = Integer.parseInt(destination.substring( index + 10)); - PDFFileSpec fileSpec = new PDFFileSpec(pdfDoc, file); + final PDFFileSpec fileSpec = new PDFFileSpec(pdfDoc, file); action = new PDFGoToRemote(pdfDoc, fileSpec, pageNum); } else if ((index = destination.indexOf(".pdf#dest=")) > 0) { - String file = destination.substring(0, index + 4); - String dest = destination.substring(index + 10); - PDFFileSpec fileSpec = new PDFFileSpec(pdfDoc, file); + final String file = destination.substring(0, index + 4); + final String dest = destination.substring(index + 10); + final PDFFileSpec fileSpec = new PDFFileSpec(pdfDoc, file); action = new PDFGoToRemote(pdfDoc, fileSpec, dest); } else { // URI action = new PDFUri(destination); @@ -197,9 +198,9 @@ /** * {@inheritDoc} */ - public PDFExplicitDestination createPDFExplicitDestination(float xPosition, - float yPosition) { - org.foray.pdf.object.PDFExplicitDestination destination + public PDFExplicitDestination createPDFExplicitDestination( + final float xPosition, final float yPosition) { + final org.foray.pdf.object.PDFExplicitDestination destination = new org.foray.pdf.object.PDFExplicitDestination( this.getPDFDocument(), this, xPosition, yPosition); this.getPDFDocument().registerIndirectObjectLast(destination); @@ -209,8 +210,8 @@ /** * {@inheritDoc} */ - public org.axsl.pdfW.PDFLink createPDFLink(Rectangle2D.Float linkRectangle, - String destination) { + public org.axsl.pdfW.PDFLink createPDFLink( + final Rectangle2D.Float linkRectangle, final String destination) { return new org.foray.pdf.object.PDFLink(this.getPDFDocument(), this, linkRectangle, destination); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPages.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPages.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPages.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -57,7 +57,7 @@ * * @param doc {@inheritDoc} */ - public PDFPages(PDFDocument doc) { + public PDFPages(final PDFDocument doc) { super(doc); } @@ -66,7 +66,7 @@ * * @param page the PDFPage to add. */ - public void addPage(PDFPage page) { + public void addPage(final PDFPage page) { this.kids.add(page.pdfReference()); page.setParent(this); this.incrementCount(); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPathPaint.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPathPaint.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPathPaint.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -32,7 +32,7 @@ // protected int colorspace = 0; //default is 0:RGB, not 1:CMYK protected ColorSpace colorSpace; - public PDFPathPaint(PDFDocument doc) { + public PDFPathPaint(final PDFDocument doc) { super(doc); } @@ -44,11 +44,11 @@ /** * {@inheritDoc} */ - public String getColorSpaceOut(boolean fillNotStroke) { + public String getColorSpaceOut(final boolean fillNotStroke) { return (""); } - public void setColorSpace(ColorSpace theColorSpace) { + public void setColorSpace(final ColorSpace theColorSpace) { this.colorSpace = theColorSpace; } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPattern.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPattern.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPattern.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -131,12 +131,11 @@ * pattern. * @param thePatternDataStream The stream of pattern data to be tiled. */ - public PDFPattern(PDFDocument doc, - PDFResources theResources, int thePatternType, // 1 - int thePaintType, int theTilingType, List theBBox, - double theXStep, double theYStep, - List theMatrix, List theXUID, - StringBuffer thePatternDataStream) { + public PDFPattern(final PDFDocument doc, final PDFResources theResources, + final int thePatternType, final int thePaintType, + final int theTilingType, final List theBBox, final double theXStep, + final double theYStep, final List theMatrix, final List theXUID, + final StringBuffer thePatternDataStream) { super(doc); this.patternCount = doc.registerPatternResource(this); this.resources = theResources; @@ -164,10 +163,9 @@ * @param theExtGState optional: the extended graphics state, if used. * @param theMatrix Optional:List of Doubles that specify the matrix. */ - public PDFPattern(PDFDocument doc, - int thePatternType, PDFShading theShading, - List theXUID, StringBuffer theExtGState, - List theMatrix) { + public PDFPattern(final PDFDocument doc, final int thePatternType, + final PDFShading theShading, final List theXUID, + final StringBuffer theExtGState, final List theMatrix) { super(doc); this.patternCount = doc.registerPatternResource(this); this.patternType = 2; // thePatternType; @@ -191,7 +189,7 @@ return "Pa" + this.patternCount; } - public String getColorSpaceOut(boolean fillNotStroke) { + public String getColorSpaceOut(final boolean fillNotStroke) { if (fillNotStroke) { // fill but no stroke return ("/Pattern cs /" + this.getName() + " scn" + EOL); @@ -200,20 +198,21 @@ return ("/Pattern CS /" + this.getName() + " SCN" + EOL); } - public static PDFPattern createGradient(boolean radial, - ColorSpace theColorSpace, List theColors, List theBounds, - List theCoords, PDFDocument document) { + public static PDFPattern createGradient(final boolean radial, + final ColorSpace theColorSpace, final List theColors, + final List theBounds, final List theCoords, + final PDFDocument document) { PDFShading myShad; PDFFunction myfunky; PDFFunction myfunc; List theCzero; List theCone; PDFPattern myPattern; - double interpolation = 1.000; - List theFunctions = new ArrayList(); + final double interpolation = 1.000; + final List theFunctions = new ArrayList(); int currentPosition; - int lastPosition = theColors.size() - 1; + final int lastPosition = theColors.size() - 1; // if 5 elements, the penultimate element is 3. @@ -222,9 +221,9 @@ for (currentPosition = 0; currentPosition < lastPosition; currentPosition++) { // for every consecutive color pair - PDFColor currentColor = + final PDFColor currentColor = (PDFColor)theColors.get(currentPosition); - PDFColor nextColor = (PDFColor)theColors.get(currentPosition + final PDFColor nextColor = (PDFColor)theColors.get(currentPosition + 1); // colorspace must be consistant if (theColorSpace.getType() @@ -258,7 +257,7 @@ } else { // if the center x, center y, and radius specifiy // the gradient, then assume the same center x, center y, // and radius of zero for the other necessary component - List newCoords = new ArrayList(); + final List newCoords = new ArrayList(); newCoords.add(theCoords.get(0)); newCoords.add(theCoords.get(1)); newCoords.add(theCoords.get(2)); @@ -278,12 +277,12 @@ return (myPattern); } - static ArrayList colorToDoubleList(Color theColor) { - ArrayList theColorVector = new ArrayList(); + static ArrayList colorToDoubleList(final Color theColor) { + final ArrayList theColorVector = new ArrayList(); if (theColor == null) { return theColorVector; } - float[] colorComponents = theColor.getColorComponents(null); + final float[] colorComponents = theColor.getColorComponents(null); for (int i = 0; i < colorComponents.length; i++) { theColorVector.add(new Double(colorComponents[i])); } @@ -304,7 +303,7 @@ public String toPDF() { int vectorSize = 0; int tempInt = 0; - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); p.append(this.pdfID() + EOL + "<<" + EOL + "/Type /Pattern" + EOL); if (this.resources != null) { Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRectangle.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRectangle.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRectangle.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -61,7 +61,8 @@ * @param urx upper right x coordinate * @param ury upper right y coordinate */ - public PDFRectangle(int llx, int lly, int urx, int ury) { + public PDFRectangle(final int llx, final int lly, final int urx, + final int ury) { this.llx = llx; this.lly = lly; this.urx = urx; @@ -73,7 +74,7 @@ * * @param array values in the order llx, lly, urx, ury */ - public PDFRectangle(int[] array) { + public PDFRectangle(final int[] array) { this.llx = array[0]; this.lly = array[1]; this.urx = array[2]; @@ -88,7 +89,7 @@ public byte[] toPDF() { try { return toPDFString().getBytes(PDFDocument.ENCODING); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { return toPDFString().getBytes(); } } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFResources.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFResources.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFResources.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -45,7 +45,7 @@ * * @param doc {@inheritDoc} */ - public PDFResources(PDFDocument doc) { + public PDFResources(final PDFDocument doc) { super(doc); } @@ -54,19 +54,19 @@ * * @param font the PDFFont to add */ - public void addFont(PDFFont font) { + public void addFont(final PDFFont font) { this.fonts.add(font); } - public void addXObject(PDFXObject theXObject) { + public void addXObject(final PDFXObject theXObject) { this.xObjects.add(theXObject); } - public void addShading(PDFShading theShading) { + public void addShading(final PDFShading theShading) { this.shadings.add(theShading); } - public void addPattern(PDFPattern thePattern) { + public void addPattern(final PDFPattern thePattern) { this.patterns.add(thePattern); } @@ -76,7 +76,7 @@ * @return the PDF */ public String toPDF() { - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); p.append(this.pdfID() + EOL); p.append("<<" + EOL); if (! this.fonts.isEmpty()) { @@ -84,7 +84,7 @@ p.append("/Font" + EOL); p.append("<<" + EOL); for (int i = 0; i < fonts.size(); i++) { - PDFFont pdfFont = (PDFFont) fonts.get(i); + final PDFFont pdfFont = (PDFFont) fonts.get(i); p.append("/" + pdfFont.getName() + " " + pdfFont.pdfReference() + EOL); } @@ -129,7 +129,7 @@ p.append("/XObject" + EOL); p.append("<<" + EOL); for (int i = 0; i < this.xObjects.size(); i++) { - PDFXObject xObject = (PDFXObject) this.xObjects.get(i); + final PDFXObject xObject = (PDFXObject) this.xObjects.get(i); p.append("/" + xObject.getXObjectName() + " " + xObject.pdfReference() + EOL); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRoot.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRoot.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRoot.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -48,7 +48,7 @@ * Create a Root (/Catalog) object. * @param doc {@inheritDoc} */ - public PDFRoot(PDFDocument doc) { + public PDFRoot(final PDFDocument doc) { super(doc); this.rootPages = new PDFPages(doc); doc.registerIndirectObjectLast(this.rootPages); @@ -60,7 +60,7 @@ * * @param page the /Page object to add */ - public void addPage(PDFPage page) { + public void addPage(final PDFPage page) { this.rootPages.addPage(page); } @@ -89,7 +89,7 @@ * @return The PDF string */ public String toPDF() { - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); p.append(this.pdfID() + EOL); p.append("<<" + EOL); p.append("/Type /Catalog" + EOL); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFShading.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFShading.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFShading.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -172,11 +172,11 @@ * @param theFunction The PDF Function that maps an (x,y) location to a * color. */ - public PDFShading(PDFDocument doc, - int theShadingType, ColorSpace theColorSpace, - List theBackground, List theBBox, - boolean theAntiAlias, List theDomain, - List theMatrix, PDFFunction theFunction) { + public PDFShading(final PDFDocument doc, final int theShadingType, + final ColorSpace theColorSpace, final List theBackground, + final List theBBox, final boolean theAntiAlias, + final List theDomain, final List theMatrix, + final PDFFunction theFunction) { super(doc); this.shadingCount = doc.registerShadingResource(this); this.shadingType = theShadingType; // 1 @@ -211,12 +211,11 @@ * colors past the start and end points. * The default is [false, false] */ - public PDFShading(PDFDocument doc, - int theShadingType, ColorSpace theColorSpace, - List theBackground, List theBBox, - boolean theAntiAlias, List theCoords, - List theDomain, PDFFunction theFunction, - List theExtend) { + public PDFShading(final PDFDocument doc, final int theShadingType, + final ColorSpace theColorSpace, final List theBackground, + final List theBBox, final boolean theAntiAlias, + final List theCoords, final List theDomain, + final PDFFunction theFunction, final List theExtend) { super(doc); this.shadingCount = doc.registerShadingResource(this); this.shadingType = theShadingType; // 2 or 3 @@ -252,12 +251,12 @@ * @param theDecode List of Doubles see PDF 1.3 spec pages 303 to 312. * @param theFunction the PDFFunction */ - public PDFShading(PDFDocument doc, - int theShadingType, ColorSpace theColorSpace, - List theBackground, List theBBox, - boolean theAntiAlias, int theBitsPerCoordinate, - int theBitsPerComponent, int theBitsPerFlag, - List theDecode, PDFFunction theFunction) { + public PDFShading(final PDFDocument doc, final int theShadingType, + final ColorSpace theColorSpace, final List theBackground, + final List theBBox, final boolean theAntiAlias, + final int theBitsPerCoordinate, final int theBitsPerComponent, + final int theBitsPerFlag, final List theDecode, + final PDFFunction theFunction) { super(doc); doc.getResources().addShading(this); this.shadingType = theShadingType; // 4,6 or 7 @@ -292,12 +291,12 @@ * @param theFunction The PDFFunction that's mapped on to this shape * @param doc The parent PDF document. */ - public PDFShading(PDFDocument doc, - int theShadingType, ColorSpace theColorSpace, - List theBackground, List theBBox, - boolean theAntiAlias, int theBitsPerCoordinate, - int theBitsPerComponent, List theDecode, - int theVerticesPerRow, PDFFunction theFunction) { + public PDFShading(final PDFDocument doc, + final int theShadingType, final ColorSpace theColorSpace, + final List theBackground, final List theBBox, + final boolean theAntiAlias, final int theBitsPerCoordinate, + final int theBitsPerComponent, final List theDecode, + final int theVerticesPerRow, final PDFFunction theFunction) { super(doc); this.shadingCount = doc.registerShadingResource(this); this.shadingType = theShadingType; // 5 @@ -330,7 +329,7 @@ public String toPDF() { int vectorSize; int tempInt; - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); p.append(this.pdfID() + EOL); p.append("<<" + EOL); p.append("/ShadingType " + this.shadingType + EOL); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -73,7 +73,7 @@ * Constructor normally used. Creates an empty stream object. * @param doc The PDFDocument to which this stream is attached. */ - public PDFStream(PDFDocument doc) { + public PDFStream(final PDFDocument doc) { super(doc); initializeVariables(); } @@ -88,14 +88,14 @@ * * @param s the string of PDF to add */ - public void add(String s) { + public void add(final String s) { try { try { _data.write(s.getBytes(PDFDocument.ENCODING)); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { _data.write(s.getBytes()); } - } catch (IOException ex) { + } catch (final IOException ex) { ex.printStackTrace(); } @@ -108,14 +108,14 @@ * flag in the filter is marked true after it has been applied to the * data. */ - public void addFilter(PSFilter filter) { + public void addFilter(final PSFilter filter) { if (filter != null) { _filters.add(filter); } } - public void addFilter(String filterType) { + public void addFilter(final String filterType) { if (filterType == null) { return; } @@ -141,14 +141,14 @@ if (document == null) { return; } - List filters = document.getDefaultFilters(); + final List filters = document.getDefaultFilters(); for (int i = 0; i < filters.size(); i++) { - String filterToAdd = (String)filters.get(i); + final String filterToAdd = (String)filters.get(i); addFilter(filterToAdd); } } - public void setData(byte[] data) throws IOException { + public void setData(final byte[] data) throws IOException { _data.reset(); if (data != null) { _data.write(data); @@ -167,16 +167,16 @@ throw new RuntimeException(); } - protected int output(OutputStream stream) throws IOException { + protected int output(final OutputStream stream) throws IOException { int length = 0; - String filterEntry = applyFilters(); - String s = this.pdfID() + EOL + "<< /Length " + final String filterEntry = applyFilters(); + final String s = this.pdfID() + EOL + "<< /Length " + (_data.size() + 1) + " " + filterEntry + " >>" + EOL; byte[] p; try { p = s.getBytes(PDFDocument.ENCODING); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { p = s.getBytes(); } stream.write(p); @@ -184,7 +184,7 @@ length += outputStreamData(stream); try { p = ("endobj" + EOL).getBytes(PDFDocument.ENCODING); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { p = ("endobj" + EOL).getBytes(); } stream.write(p); @@ -196,12 +196,13 @@ /** * Output just the stream data enclosed by stream/endstream markers */ - protected int outputStreamData(OutputStream stream) throws IOException { + protected int outputStreamData(final OutputStream stream) + throws IOException { int length = 0; byte[] p; try { p = ("stream" + EOL).getBytes(PDFDocument.ENCODING); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { p = ("stream" + EOL).getBytes(); } stream.write(p); @@ -210,7 +211,7 @@ length += _data.size(); try { p = (EOL + "endstream" + EOL).getBytes(PDFDocument.ENCODING); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { p = (EOL + "endstream" + EOL).getBytes(); } stream.write(p); @@ -229,18 +230,18 @@ if (_filters.size() < 1) { return ""; } - List names = new ArrayList(); - List parms = new ArrayList(); + final List names = new ArrayList(); + final List parms = new ArrayList(); // run the filters for (int i = 0; i < _filters.size(); i++) { - PSFilter filter = (PSFilter)_filters.get(i); + final PSFilter filter = (PSFilter)_filters.get(i); // apply the filter encoding if neccessary if (!filter.isApplied()) { byte[] tmp = null; try { tmp = filter.encode(_data.toByteArray()); - } catch (PSFilterException e) { + } catch (final PSFilterException e) { throw new IOException(e.getMessage()); } _data.reset(); @@ -256,8 +257,8 @@ return buildFilterEntries(names) + buildDecodeParms(parms); } - private String buildFilterEntries(List names) { - StringBuffer sb = new StringBuffer(); + private String buildFilterEntries(final List names) { + final StringBuffer sb = new StringBuffer(); sb.append("/Filter "); if (names.size() > 1) { sb.append("[ "); @@ -273,8 +274,8 @@ return sb.toString(); } - private String buildDecodeParms(List parms) { - StringBuffer sb = new StringBuffer(); + private String buildDecodeParms(final List parms) { + final StringBuffer sb = new StringBuffer(); boolean needParmsEntry = false; sb.append("/DecodeParms "); @@ -282,7 +283,7 @@ sb.append("[ "); } for (int i = 0; i < parms.size(); i++) { - String s = (String)parms.get(i); + final String s = (String)parms.get(i); if (s != null) { sb.append(s); needParmsEntry = true; Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -44,23 +44,24 @@ /** The Font that should be used to render this String */ protected PDFFont font; - public PDFString(PDFDocument doc, String string, PDFFont font) { + public PDFString(final PDFDocument doc, final String string, + final PDFFont font) { super(doc); this.theString = string; this.font = font; } public String toPDF() { - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append("["); buffer.append(startTextDelimiter()); - FontUse font = this.font.getFontUse(); + final FontUse font = this.font.getFontUse(); for (int i = 0; i < theString.length(); i++) { - int codePoint = StringUtilPre5.codePointAt(theString, i); + final int codePoint = StringUtilPre5.codePointAt(theString, i); if (StringUtilPre5.isSupplementaryCodePoint(codePoint)) { i++; } - int ch = font.encodeCharacter(codePoint); + final int ch = font.encodeCharacter(codePoint); addCharToBuffer(buffer, ch); if (i + 1 < theString.length()) { addKerning(font.getFont(), theString.charAt(i), @@ -77,8 +78,8 @@ * @param buffer * @param glyphIndex */ - private void addCharToBuffer(StringBuffer buffer, int glyphIndex) { - Font font = this.font.getFontUse().getFont(); + private void addCharToBuffer(final StringBuffer buffer, int glyphIndex) { + final Font font = this.font.getFontUse().getFont(); if (font.getFontComplexity() == Font.FONT_COMPOSITE) { buffer.append(PDFString.getUnicodeString(glyphIndex)); return; @@ -92,7 +93,7 @@ if (glyphIndex < 0) { glyphIndex = ' '; } - char c = (char) glyphIndex; + final char c = (char) glyphIndex; switch (c) { case '(': case ')': @@ -115,9 +116,9 @@ * @param buf The StringBuffer to which any kerning information should be * written. */ - private void addKerning(Font font, char char1, char char2, - StringBuffer buf) { - int kernAmount = font.kern(char1, char2); + private void addKerning(final Font font, final char char1, final char char2, + final StringBuffer buf) { + final int kernAmount = font.kern(char1, char2); if (kernAmount == 0) { return; } @@ -128,7 +129,7 @@ } private char startTextDelimiter() { - Font font = this.font.getFontUse().getFont(); + final Font font = this.font.getFontUse().getFont(); if (font.getFontComplexity() == Font.FONT_COMPOSITE) { return '<'; } @@ -136,7 +137,7 @@ } private char endTextDelimiter() { - Font font = this.font.getFontUse().getFont(); + final Font font = this.font.getFontUse().getFont(); if (font.getFontComplexity() == Font.FONT_COMPOSITE) { return '>'; } @@ -157,18 +158,18 @@ || c > Character.MAX_VALUE) { c = ' '; } - char[] a = {(char) c}; + final char[] a = {(char) c}; try { uniBytes = new String(a).getBytes("UnicodeBigUnmarked"); - } catch (Exception e) { + } catch (final Exception e) { uniBytes = new String(a).getBytes(); } for (int i = 0; i < uniBytes.length; i++) { - int b = (uniBytes[i] < 0) ? (int) (256 + uniBytes[i]) + final int b = (uniBytes[i] < 0) ? (int) (256 + uniBytes[i]) : (int) uniBytes[i]; - String hexString = Integer.toHexString(b); + final String hexString = Integer.toHexString(b); if (hexString.length() == 1) { buf = buf.append("0" + hexString); } else { Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFTextString.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFTextString.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFTextString.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -42,7 +42,7 @@ /** The encapsulated String. */ protected String theString; - public PDFTextString(PDFDocument doc, String string) { + public PDFTextString(final PDFDocument doc, final String string) { super(doc); this.theString = string; } @@ -60,10 +60,10 @@ if (this.theString == null) { return new String(); } - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append("("); // Since it is more readable, try to use the PDFDocEncoding. - String pdfDoc = unicodeToPDFDocEncoding(this.theString); + final String pdfDoc = unicodeToPDFDocEncoding(this.theString); if (pdfDoc != null) { buffer.append(pdfDoc); } else { @@ -74,13 +74,13 @@ } private String toPDFUnicode() { - StringBuffer result = new StringBuffer(); + final StringBuffer result = new StringBuffer(); // byte order marker (0xfeff) result.append("\\376\\377"); for (int i = 0; i < this.theString.length(); i++) { - char ch = this.theString.charAt(i); - int high = (ch & 0xff00) >>> 8; - int low = ch & 0xff; + final char ch = this.theString.charAt(i); + final int high = (ch & 0xff00) >>> 8; + final int low = ch & 0xff; result.append("\\"); result.append(Integer.toOctalString(high)); result.append("\\"); @@ -95,11 +95,11 @@ * @return The converted String, or null if unicodeString contains one or * more chars that cannot be converted to PDFDocEncoding. */ - public static String unicodeToPDFDocEncoding(String unicodeString) { - StringBuffer pdfDocString = new StringBuffer(unicodeString); + public static String unicodeToPDFDocEncoding(final String unicodeString) { + final StringBuffer pdfDocString = new StringBuffer(unicodeString); for(int i = 0; i < unicodeString.length(); i++) { - char unicodeChar = unicodeString.charAt(i); - char pdfDocChar = unicodeToPDFDocEncoding(unicodeChar); + final char unicodeChar = unicodeString.charAt(i); + final char pdfDocChar = unicodeToPDFDocEncoding(unicodeChar); if (pdfDocChar == INVALID_PDF_DOC_ENCODING) { return null; } @@ -117,7 +117,7 @@ * @return The PDFDocEncoding equivalent of #unicodeChar if possible, * or #INVALID_PDF_DOC_ENCODING if it cannot be converted. */ - public static char unicodeToPDFDocEncoding(char unicodeChar) { + public static char unicodeToPDFDocEncoding(final char unicodeChar) { /* * This may not be right, but I am pretty sure that the ASCII chars * are the same. Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFToUnicodeCMap.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFToUnicodeCMap.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFToUnicodeCMap.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -51,27 +51,27 @@ * Reference, Second Edition. * @param sysInfo The attributes of the character collection of the CIDFont. */ - public PDFToUnicodeCMap(PDFDocument doc, String name, - PDFCIDSystemInfo sysInfo, FontUse fsFont) { + public PDFToUnicodeCMap(final PDFDocument doc, final String name, + final PDFCIDSystemInfo sysInfo, final FontUse fsFont) { super(doc, name, sysInfo); this.fsFont = fsFont; } - public void fillInPDF(StringBuffer p) { + public void fillInPDF(final StringBuffer p) { writeCIDInit(p); writeCIDSystemInfo(p); writeVersionTypeName(p); writeCodeSpaceRange(p); - FontPDF fontPDF = (FontPDF) this.fsFont.getFontOutput( + final FontPDF fontPDF = (FontPDF) this.fsFont.getFontOutput( "application/pdf"); - String bfEntries = fontPDF.getToUnicodeBF(); + final String bfEntries = fontPDF.getToUnicodeBF(); p.append(bfEntries); writeBFEntries(p); writeWrapUp(p); add(p.toString()); } - protected void writeCIDSystemInfo(StringBuffer p) { + protected void writeCIDSystemInfo(final StringBuffer p) { p.append("/CIDSystemInfo" + EOL); p.append("<< /Registry (Adobe)" + EOL); p.append("/Ordering (UCS)" + EOL); @@ -79,7 +79,7 @@ p.append(">> def" + EOL); } - protected void writeVersionTypeName(StringBuffer p) { + protected void writeVersionTypeName(final StringBuffer p) { p.append("/CMapName /Adobe-Identity-UCS def" + EOL); p.append("/CMapType 2 def" + EOL); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFUri.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFUri.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFUri.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -37,7 +37,7 @@ * * @param uri the uri to which the link should point */ - public PDFUri(String uri) { + public PDFUri(final String uri) { this.uri = uri; } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFWArray.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFWArray.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFWArray.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -48,7 +48,7 @@ * @param start the starting CID value. * @param metrics the metrics array. */ - public void addEntry(int start, int[] metrics) { + public void addEntry(final int start, final int[] metrics) { entries.add(new Entry(start, metrics)); } @@ -59,7 +59,7 @@ * @param last the last CID in the range * @param width the width for all CIDs in the range */ - public void addEntry(int first, int last, int width) { + public void addEntry(final int first, final int last, final int width) { entries.add(new int[] { first, last, width }); @@ -74,7 +74,8 @@ * @param posX the x component for the vertical position vector * @param posY the y component for the vertical position vector */ - public void addEntry(int first, int last, int width, int posX, int posY) { + public void addEntry(final int first, final int last, final int width, + final int posX, final int posY) { entries.add(new int[] { first, last, width, posX, posY }); @@ -83,19 +84,19 @@ public byte[] toPDF() { try { return toPDFString().getBytes(PDFDocument.ENCODING); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { return toPDFString().getBytes(); } } public String toPDFString() { - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); p.append("[ "); - int len = entries.size(); + final int len = entries.size(); for (int i = 0; i < len; i++) { - Object entry = entries.get(i); + final Object entry = entries.get(i); if (entry instanceof int[]) { - int[] line = (int[])entry; + final int[] line = (int[])entry; for (int j = 0; j < line.length; j++) { p.append(line[j]); p.append(" "); @@ -114,12 +115,12 @@ private static class Entry { private int start; private int[] metrics; - public Entry(int s, int[] m) { + public Entry(final int s, final int[] m) { start = s; metrics = m; } - public void fillInPDF(StringBuffer p) { + public void fillInPDF(final StringBuffer p) { // p.setLength(0); p.append(start); p.append(" ["); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXForm.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXForm.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXForm.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -45,9 +45,9 @@ * @param doc * @param img */ - public PDFXForm(PDFDocument doc, Graphic img, - Rectangle2D.Float contentRectangle, Rectangle2D.Float clipRectangle) - throws GraphicException { + public PDFXForm(final PDFDocument doc, final Graphic img, + final Rectangle2D.Float contentRectangle, + final Rectangle2D.Float clipRectangle) throws GraphicException { super(doc, img, contentRectangle, clipRectangle); } @@ -55,17 +55,17 @@ return "Form"; } - protected void xObjectContent(PDFStream stream) throws GraphicException, - IOException { + protected void xObjectContent(final PDFStream stream) + throws GraphicException, IOException { if (graphic.getGraphicType() == Graphic.TYPE_EPS) { byte[] bytes = null; try { bytes = convertPStoPDF(); - } catch (GraphicException e) { + } catch (final GraphicException e) { // Ignore this. An error was already logged & fallback is below. } if (bytes == null || bytes.length < 1) { - String s = "0 0 m" + EOL + final String s = "0 0 m" + EOL + "0 1000 l" + EOL + "1000 1000 l" + EOL + "1000 0 l" + EOL @@ -79,28 +79,28 @@ } protected byte[] convertPStoPDF() throws GraphicException { - File file = new File(graphic.getURL().getFile()); + final File file = new File(graphic.getURL().getFile()); PSInputFile psInput = null; try { psInput = new PSInputFile(file); - } catch (IOException e) { + } catch (final IOException e) { throw new GraphicException("Cannot open EPS file."); } - PDFSystemDict systemDict = new PDFSystemDict(); + final PDFSystemDict systemDict = new PDFSystemDict(); PSInterpreter interpreter = null; try { interpreter = new PSInterpreter(getLogger(), psInput, systemDict); interpreter.process(); - } catch (PSException e1) { + } catch (final PSException e1) { getLogger().error(e1.getMessage()); throw new GraphicException("Cannot parse EPS file."); } - byte[] pdfBytes = systemDict.getOutputStream().toByteArray(); + final byte[] pdfBytes = systemDict.getOutputStream().toByteArray(); return pdfBytes; } protected String xObjectDictionary() { - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append("/FormType 1" + EOL); buffer.append("/BBox ["); /* Use the clip rectangle for the bounding box if we have it. Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXImage.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXImage.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXImage.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -52,14 +52,14 @@ /** * Create a sampled-image Xobject. */ - public PDFXImage(PDFDocument doc, Graphic img, - Rectangle2D.Float contentRectangle, Rectangle2D.Float clipRectangle) - throws GraphicException { + public PDFXImage(final PDFDocument doc, final Graphic img, + final Rectangle2D.Float contentRectangle, + final Rectangle2D.Float clipRectangle) throws GraphicException { super(doc, img, contentRectangle, clipRectangle); - ColorSpace cs = graphic.getColorSpace(); + final ColorSpace cs = graphic.getColorSpace(); if (graphic.getGraphicType() == Graphic.TYPE_JPEG && cs instanceof ICC_ColorSpace) { - ICC_ColorSpace icc_cs = (ICC_ColorSpace) cs; + final ICC_ColorSpace icc_cs = (ICC_ColorSpace) cs; pdfICCStream = new PDFICCStream(doc, icc_cs); pdfICCStream.addDefaultFilters(); if (doc.getEncryption() != null) { @@ -72,8 +72,8 @@ return "Image"; } - protected void xObjectContent(PDFStream stream) throws GraphicException, - IOException { + protected void xObjectContent(final PDFStream stream) + throws GraphicException, IOException { stream.setData(graphic.getContent()); } @@ -91,10 +91,10 @@ cs = graphic.getColorSpace(); isTransparent = graphic.isTransparent(); transp = graphic.getTransparentColor(); - } catch (GraphicException e) { + } catch (final GraphicException e) { getLogger().error("Error in XObject:" + MSG_EOL + e.getMessage()); } - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); // The width, in pixels (aka samples), *not* points. buffer.append("/Width " + pixelWidth + EOL); // The width, in pixels ... [truncated message content] |
|
From: <vic...@us...> - 2006-07-23 20:30:58
|
Revision: 7823 Author: victormote Date: 2006-07-23 13:30:33 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7823&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAction.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotList.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotation.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFArray.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFBorderStyle.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFont.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFontDescriptor.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDSystemInfo.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCMap.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCharProcs.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFColor.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDate.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDestination.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEmbeddedFileStream.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncoding.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFExplicitDestination.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFileSpec.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFont.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFontDescriptor.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFontFileStream.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFontType0.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFunction.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFGoTo.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFGoToRemote.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFICCStream.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFInfo.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFLink.java Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAction.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAction.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAction.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -33,7 +33,7 @@ * Create an Action object. * @param doc The parent PDFDocument. */ - public PDFAction(PDFDocument doc) { + public PDFAction(final PDFDocument doc) { super(doc); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotList.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotList.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotList.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -38,7 +38,7 @@ * Create a PDFAnnotList object. * @param doc The parent PDF document. */ - public PDFAnnotList(PDFDocument doc) { + public PDFAnnotList(final PDFDocument doc) { super(doc); } @@ -46,7 +46,7 @@ * Add a PDFAnnotation to the collection. * @param annotation The {@link PDFAnnotation} to add. */ - public void addAnnotation(PDFAnnotation annotation) { + public void addAnnotation(final PDFAnnotation annotation) { if (annotation == null) { return; } @@ -58,12 +58,12 @@ * @param listToAdd The PDFAnnotList whose contents are to be added * to this. */ - public void addAnnotationList(PDFAnnotList listToAdd) { + public void addAnnotationList(final PDFAnnotList listToAdd) { if (listToAdd == null) { return; } for (int i = 0; i < listToAdd.annotations.size(); i++) { - PDFAnnotation annotationToAdd = + final PDFAnnotation annotationToAdd = (PDFAnnotation) listToAdd.annotations.get(i); this.addAnnotation(annotationToAdd); } @@ -74,11 +74,11 @@ * @return the PDF string */ public String toPDF() { - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); p.append(this.pdfID() + EOL); p.append("[" + EOL); for (int i = 0; i < annotations.size(); i++) { - PDFAnnotation child = (PDFAnnotation)annotations.get(i); + final PDFAnnotation child = (PDFAnnotation)annotations.get(i); p.append(child.pdfReference() + EOL); } p.append("] endobj" + EOL); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotation.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotation.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotation.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -40,7 +40,8 @@ * @param doc {@inheritDoc} * @param r The rectangle which outlines the link. */ - public PDFAnnotation(PDFDocument doc, PDFPage page, Rectangle2D.Float r) { + public PDFAnnotation(final PDFDocument doc, final PDFPage page, + final Rectangle2D.Float r) { super(doc); this.page = page; this.rectangle = r; Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFArray.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFArray.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFArray.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -38,7 +38,7 @@ * @param doc The parent PDF document. * @param arrayContents the actual array wrapped by this object */ - public PDFArray(PDFDocument doc, Object arrayContents) { + public PDFArray(final PDFDocument doc, final Object arrayContents) { super(doc); this.arrayContents = arrayContents; } @@ -49,7 +49,7 @@ * @return the PDF */ public String toPDF() { - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append(this.pdfID() + EOL); buffer.append("[" + EOL); buffer.append(addContents()); @@ -60,9 +60,9 @@ } private StringBuffer addContents() { - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); if (arrayContents instanceof int[]) { - int[] intValues = (int[]) arrayContents; + final int[] intValues = (int[]) arrayContents; for (int i = 0; i < intValues.length; i++) { if (i != 0) { buffer.append(" "); @@ -70,7 +70,7 @@ buffer.append(intValues[i]); } } else if (arrayContents instanceof short[]) { - short[] shortValues = (short[]) arrayContents; + final short[] shortValues = (short[]) arrayContents; for (int i = 0; i < shortValues.length; i++) { if (i != 0) { buffer.append(" "); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFBorderStyle.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFBorderStyle.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFBorderStyle.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -57,7 +57,8 @@ * {@link PDFBorderStyle#STYLE_INSET}, * or {@link PDFBorderStyle#STYLE_UNDERLINE}. */ - public PDFBorderStyle(PDFDocument doc, float width, byte style) { + public PDFBorderStyle(final PDFDocument doc, final float width, + final byte style) { super(doc); this.width = width; this.style = style; @@ -72,7 +73,7 @@ * @return The text that should be placed in the PDF for this object. */ public String toPDF() { - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append(this.pdfID() + EOL); buffer.append("<< /Type /Border" + EOL); if (this.width >= 0) { Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFont.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFont.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFont.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -74,8 +74,9 @@ /** * Constructor. */ - public PDFCIDFont(PDFDocument doc, FontUse fsFont, - PDFCIDSystemInfo systemInfo, PDFCIDFontDescriptor descriptor) { + public PDFCIDFont(final PDFDocument doc, final FontUse fsFont, + final PDFCIDSystemInfo systemInfo, + final PDFCIDFontDescriptor descriptor) { super(doc); this.fsFont = fsFont; this.dw2 = null; @@ -91,8 +92,8 @@ * @return the PDF */ public String toPDF() { - Font font = fsFont.getFont(); - StringBuffer p = new StringBuffer(); + final Font font = fsFont.getFont(); + final StringBuffer p = new StringBuffer(); p.append(pdfID() + EOL); p.append("<< /Type /Font"); p.append(EOL + "/BaseFont /"); @@ -132,14 +133,14 @@ return p.toString(); } - protected static byte getCidType(Font fsFont) { + protected static byte getCidType(final Font fsFont) { if (fsFont.getFontFormat() == Font.FORMAT_TRUETYPE) { return PDFCIDFont.CID_TYPE2; } return PDFCIDFont.CID_TYPE0; } - private static String getCidTypeName(Font fsFont) { + private static String getCidTypeName(final Font fsFont) { return TYPE_NAMES[PDFCIDFont.getCidType(fsFont)]; } @@ -147,7 +148,7 @@ if (! fsFont.getFont().isEmbeddable()) { return null; } - FontPDF outputHelper = (FontPDF) fsFont.getFontOutput( + final FontPDF outputHelper = (FontPDF) fsFont.getFontOutput( "application/pdf"); return outputHelper.getWidths(); } @@ -160,16 +161,17 @@ * entry. * @return The String containing the /W entry. */ - public static String widthArrayToPDFString(short[] widthArray) { + public static String widthArrayToPDFString(final short[] widthArray) { if (widthArray.length == 0) { return ""; } - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); p.append(EOL + "/W ["); int start = 0; int end = 0; while (start < widthArray.length) { - int nextEqualRunStarts = findStartOfNextEqualRun(widthArray, start); + final int nextEqualRunStarts = findStartOfNextEqualRun(widthArray, + start); if (nextEqualRunStarts < 0) { /* * There are no more Equal Runs. Therefore, write the remaining @@ -199,8 +201,8 @@ return p.toString(); } - private static void writeWidthArrayUnequalRun(StringBuffer p, - short[] widthArray, int start, int end) { + private static void writeWidthArrayUnequalRun(final StringBuffer p, + final short[] widthArray, final int start, final int end) { p.append(" " + start + " ["); for (int i = start; i <= end; i++) { p.append(widthArray[i]); @@ -211,8 +213,8 @@ p.append("]"); } - private static int writeWidthArrayEqualRun(StringBuffer p, - short[] widthArray, int start) { + private static int writeWidthArrayEqualRun(final StringBuffer p, + final short[] widthArray, final int start) { // First, compute the end-point of the run. int end = -1; for (int i = start; i < widthArray.length && end < 0; i++) { @@ -238,7 +240,8 @@ * @return The index to the first array element that starts a run of 3 or * more equal values in the array, or -1 if there is not one. */ - private static int findStartOfNextEqualRun(short[] widthArray, int start) { + private static int findStartOfNextEqualRun(final short[] widthArray, + final int start) { int returnValue = -1; for (int i = start; i < widthArray.length - 2 && returnValue < 0; i++) { if ((widthArray[i] == widthArray[i + 1]) Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFontDescriptor.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFontDescriptor.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFontDescriptor.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -43,17 +43,17 @@ * @param font The PDF Font for which this FontDescript is created. * @param lang the language. */ - public PDFCIDFontDescriptor(PDFDocument doc, PDFFont font, - String lang) { + public PDFCIDFontDescriptor(final PDFDocument doc, final PDFFont font, + final String lang) { super(doc, font); this.lang = lang; } - public void setCIDSet(PDFStream cidSet) { + public void setCIDSet(final PDFStream cidSet) { this.cidSet = cidSet; } - protected void fillInPDF(StringBuffer p) { + protected void fillInPDF(final StringBuffer p) { p.append(EOL + "/MissingWidth 500" + EOL); if (lang != null) { p.append(EOL + "/Lang /"); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDSystemInfo.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDSystemInfo.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDSystemInfo.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -37,8 +37,8 @@ protected String ordering; protected int supplement; - public PDFCIDSystemInfo(String registry, String ordering, - int supplement) { + public PDFCIDSystemInfo(final String registry, final String ordering, + final int supplement) { this.registry = registry; this.ordering = ordering; this.supplement = supplement; Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCMap.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCMap.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCMap.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -139,7 +139,8 @@ * @param name one the registered names (see Table 7.20 on p 215) * @param sysInfo the attributes of the character collection of the CIDFont */ - public PDFCMap(PDFDocument doc, String name, PDFCIDSystemInfo sysInfo) { + public PDFCMap(final PDFDocument doc, final String name, + final PDFCIDSystemInfo sysInfo) { super(doc); this.name = name; this.sysInfo = sysInfo; @@ -152,7 +153,7 @@ * @param mode is either <code>WMODE_HORIZONTAL</code> * or <code>WMODE_VERTICAL</code> */ - public void setWMode(byte mode) { + public void setWMode(final byte mode) { this.wMode = mode; } @@ -161,7 +162,7 @@ * * @param base the name of the base CMap (see Table 7.20) */ - public void setUseCMap(String base) { + public void setUseCMap(final String base) { this.base = base; } @@ -170,16 +171,16 @@ * * @param base the stream to be used as base CMap */ - public void setUseCMap(PDFStream base) { + public void setUseCMap(final PDFStream base) { this.base = base; } - protected int output(OutputStream stream) throws IOException { + protected int output(final OutputStream stream) throws IOException { fillInPDF(new StringBuffer()); return super.output(stream); } - public void fillInPDF(StringBuffer p) { + public void fillInPDF(final StringBuffer p) { writePreStream(p); writeStreamComments(p); writeCIDInit(p); @@ -194,13 +195,13 @@ add(p.toString()); } - protected void writePreStream(StringBuffer p) { + protected void writePreStream(final StringBuffer p) { // p.append("/Type /CMap" + EOL); // p.append(sysInfo.toPDFString()); // p.append("/CMapName /" + name + EOL); } - protected void writeStreamComments(StringBuffer p) { + protected void writeStreamComments(final StringBuffer p) { p.append("%!PS-Adobe-3.0 Resource-CMap" + EOL); p.append("%%DocumentNeededResources: ProcSet (CIDInit)" + EOL); p.append("%%IncludeResource: ProcSet (CIDInit)" + EOL); @@ -208,13 +209,13 @@ p.append("%%EndComments" + EOL); } - protected void writeCIDInit(StringBuffer p) { + protected void writeCIDInit(final StringBuffer p) { p.append("/CIDInit /ProcSet findresource begin" + EOL); p.append("12 dict begin" + EOL); p.append("begincmap" + EOL); } - protected void writeCIDSystemInfo(StringBuffer p) { + protected void writeCIDSystemInfo(final StringBuffer p) { p.append("/CIDSystemInfo 3 dict dup begin" + EOL); p.append(" /Registry (Adobe) def" + EOL); p.append(" /Ordering (Identity) def" + EOL); @@ -222,43 +223,43 @@ p.append("end def" + EOL); } - protected void writeVersionTypeName(StringBuffer p) { + protected void writeVersionTypeName(final StringBuffer p) { p.append("/CMapVersion 1 def" + EOL); p.append("/CMapType 1 def" + EOL); p.append("/CMapName /" + name + " def" + EOL); } - protected void writeCodeSpaceRange(StringBuffer p) { + protected void writeCodeSpaceRange(final StringBuffer p) { p.append("1 begincodespacerange" + EOL); p.append("<0000> <FFFF>" + EOL); p.append("endcodespacerange" + EOL); } - protected void writeCIDRange(StringBuffer p) { + protected void writeCIDRange(final StringBuffer p) { p.append("1 begincidrange" + EOL); p.append("<0000> <FFFF> 0" + EOL); p.append("endcidrange" + EOL); } - protected void writeBFEntries(StringBuffer p) { + protected void writeBFEntries(final StringBuffer p) { // p.append("1 beginbfrange" + EOL); // p.append("<0020> <0100> <0000>" + EOL); // p.append("endbfrange" + EOL); } - protected void writeWrapUp(StringBuffer p) { + protected void writeWrapUp(final StringBuffer p) { p.append("endcmap" + EOL); p.append("CMapName currentdict /CMap defineresource pop" + EOL); p.append("end" + EOL); p.append("end" + EOL); } - protected void writeStreamAfterComments(StringBuffer p) { + protected void writeStreamAfterComments(final StringBuffer p) { p.append("%%EndResource" + EOL); p.append("%%EOF" + EOL); } - protected void writeUseCMap(StringBuffer p) { + protected void writeUseCMap(final StringBuffer p) { /* * p.append(" /Type /CMap"); * p.append("/CMapName /" + name + EOL); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCharProcs.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCharProcs.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCharProcs.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -52,7 +52,7 @@ * @param name the character name * @param stream the stream that draws the character */ - public void addCharacter(String name, PDFStream stream) { + public void addCharacter(final String name, final PDFStream stream) { keys.put(name, stream); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFColor.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFColor.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFColor.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -33,17 +33,17 @@ protected Color color; - public PDFColor(Color theColor) { + public PDFColor(final Color theColor) { this.color = theColor; this.colorSpace = this.color.getColorSpace(); } - public String getColorSpaceOut(boolean fillNotStroke) { + public String getColorSpaceOut(final boolean fillNotStroke) { return PSColor.toPS(this.color, fillNotStroke, "\n"); } String toPDF() { - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append("["); buffer.append(getRed() + " "); buffer.append(getGreen() + " "); @@ -52,15 +52,15 @@ return buffer.toString(); } - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (!(obj instanceof PDFColor)) { return false; } - PDFColor otherColor = (PDFColor) obj; + final PDFColor otherColor = (PDFColor) obj; return this.getColor().equals(otherColor.getColor()); } - public static String getColorSpacePDFString(ColorSpace colorSpace) { + public static String getColorSpacePDFString(final ColorSpace colorSpace) { if (colorSpace == null) { return null; } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -67,7 +67,7 @@ /** * Create a PDFContentStream. */ - public PDFContentStream(PDFDocument doc, PDFPage page) { + public PDFContentStream(final PDFDocument doc, final PDFPage page) { super(doc); this.page = page; } @@ -104,22 +104,23 @@ } } - public synchronized void setCursor(float originX, float originY) { + public synchronized void setCursor(final float originX, + final float originY) { openTextObject(); add("1 0 0 1 " + originX + " " + originY + " Tm" + EOL); } - public synchronized void drawText(String text) { + public synchronized void drawText(final String text) { if (text.length() < 1) { return; } openTextObject(); - PDFString pdfString = new PDFString(this.getPDFDocument(), text, + final PDFString pdfString = new PDFString(this.getPDFDocument(), text, this.getGS().getFont()); add(pdfString.toPDF()); } - public void setFont(PDFFont newFont, float newFontSize) { + public void setFont(final PDFFont newFont, final float newFontSize) { openTextObject(); boolean anyChange = false; anyChange |= this.getGS().setFont(newFont); @@ -128,11 +129,11 @@ // Nothing needs to change. return; } - String psStyleName = newFont.getName(); + final String psStyleName = newFont.getName(); add("/" + psStyleName + " " + newFontSize + " Tf" + EOL); } - public void setStrokeColor(PDFColor newStrokeColor) { + public void setStrokeColor(final PDFColor newStrokeColor) { if (! this.getGS().setStrokeColor(newStrokeColor)) { // Nothing needs to change. return; @@ -140,7 +141,7 @@ add(newStrokeColor.getColorSpaceOut(true)); } - public void setWordSpacing(float newWordSpacing) { + public void setWordSpacing(final float newWordSpacing) { openTextObject(); if (! this.getGS().setWordSpacing(newWordSpacing)) { // Nothing needs to change. @@ -149,7 +150,7 @@ add(newWordSpacing + " Tw" + EOL); } - public void setCharacterSpacing(float newCharacterSpacing) { + public void setCharacterSpacing(final float newCharacterSpacing) { openTextObject(); if (! this.getGS().setCharacterSpacing(newCharacterSpacing)) { // Nothing needs to change. @@ -158,7 +159,8 @@ add(newCharacterSpacing + " Tc" + EOL); } - public void setLineDashPattern(float[] dashArray, float dashPhase) { + public void setLineDashPattern(final float[] dashArray, + final float dashPhase) { if (! this.getGS().setLineDashPattern(dashArray, dashPhase)) { // Nothing needs to change. return; @@ -178,8 +180,9 @@ /** * {@inheritDoc} */ - public void drawLine(Line2D.Float line, float thickness, float[] dashArray, - float dashPhase, PDFPathPaint stroke) { + public void drawLine(final Line2D.Float line, final float thickness, + final float[] dashArray, final float dashPhase, + final PDFPathPaint stroke) { closeTextObject(); add("q" + EOL); add(stroke.getColorSpaceOut(false)); @@ -193,8 +196,9 @@ /** * {@inheritDoc} */ - public void drawRectangle(Rectangle2D.Float rectangle, boolean stroke, - PDFPathPaint strokePaint, boolean fill, PDFPathPaint fillPaint) { + public void drawRectangle(final Rectangle2D.Float rectangle, + final boolean stroke, final PDFPathPaint strokePaint, + final boolean fill, final PDFPathPaint fillPaint) { // Bail out if stroke and fill are both missing. if (stroke == false && fill == false) { return; @@ -229,8 +233,8 @@ /** * {@inheritDoc} */ - public void drawGraphic(Rectangle2D.Float contentRectangle, - Rectangle2D.Float clipRectangle, Graphic image) { + public void drawGraphic(final Rectangle2D.Float contentRectangle, + final Rectangle2D.Float clipRectangle, final Graphic image) { /* Use drawSVG() method for SVG. */ if (image instanceof SVGGraphic) { return; @@ -239,7 +243,7 @@ try { xObject = PDFXObject.makeXObject(this.getPDFDocument(), image, contentRectangle, clipRectangle); - } catch (GraphicException e) { + } catch (final GraphicException e) { getLogger().error(e.getMessage()); return; } @@ -266,11 +270,13 @@ /** * {@inheritDoc} */ - public void drawSVGDocument(SVGDocument doc, - Rectangle2D.Float contentRectangle, Rectangle2D.Float clipRectangle, - FontConsumer fontConsumer, boolean strokeSVGText) { + public void drawSVGDocument(final SVGDocument doc, + final Rectangle2D.Float contentRectangle, + final Rectangle2D.Float clipRectangle, + final FontConsumer fontConsumer, + final boolean strokeSVGText) { closeTextObject(); - PDFGraphics2D graphics = getPDFContent4SVG(contentRectangle, + final PDFGraphics2D graphics = getPDFContent4SVG(contentRectangle, fontConsumer, doc, strokeSVGText); if (graphics == null) { // Error messages have already been logged. @@ -300,8 +306,8 @@ this.page.getAnnotList().addAnnotationList(graphics.getAnnotList()); } - private void clip(Rectangle2D.Float clipRectangle, - Rectangle2D.Float contentRectangle) { + private void clip(final Rectangle2D.Float clipRectangle, + final Rectangle2D.Float contentRectangle) { if (clipRectangle == null || contentRectangle == null) { return; } @@ -326,9 +332,10 @@ add("h W n" + EOL); } - public PDFGraphics2D getPDFContent4SVG(Rectangle2D.Float contentRectangle, - FontConsumer fontConsumer, - SVGDocument svgDocument, boolean strokeSVGText) { + public PDFGraphics2D getPDFContent4SVG( + final Rectangle2D.Float contentRectangle, + final FontConsumer fontConsumer, + final SVGDocument svgDocument, final boolean strokeSVGText) { /* If not running in a graphical environment, log an error message * and skip the SVG. */ if (! Environment.isGraphicalEnvironment()) { @@ -336,7 +343,7 @@ + "to process SVG. Skipping."); return null; } - SVGUserAgent userAgent = new SVGUserAgent(new AffineTransform()); + final SVGUserAgent userAgent = new SVGUserAgent(new AffineTransform()); userAgent.setLogger(getLogger()); BridgeContext ctx = new BridgeContext(userAgent); GVTBuilder builder = new GVTBuilder(); @@ -348,7 +355,7 @@ } ctx.setTextPainter(textPainter); - PDFAElementBridge aBridge = new PDFAElementBridge(); + final PDFAElementBridge aBridge = new PDFAElementBridge(); aBridge.setCurrentTransform(new AffineTransform(1, 0, 0, -1, contentRectangle.x, contentRectangle.y)); ctx.putBridge(aBridge); @@ -356,7 +363,7 @@ GraphicsNode root; try { root = builder.build(ctx, svgDocument); - } catch (Exception e) { + } catch (final Exception e) { getLogger().error("svg graphic could not be built: " + e.getMessage()); getLogger().error(e.getMessage()); @@ -365,13 +372,14 @@ ctx = null; builder = null; - PDFGraphics2D graphics = new PDFGraphics2D(true, this.getPDFDocument(), + final PDFGraphics2D graphics = new PDFGraphics2D(true, + this.getPDFDocument(), contentRectangle, svgDocument, fontConsumer); graphics.setGraphicContext(new GraphicContext()); try { root.paint(graphics); - } catch (Exception e) { + } catch (final Exception e) { getLogger().error("svg graphic could not be rendered: " + e.getMessage()); getLogger().error(e.getMessage()); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDate.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDate.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDate.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -45,7 +45,7 @@ /** * Create a PDFDate instance. */ - public PDFDate(PDFDocument doc, Date date) { + public PDFDate(final PDFDocument doc, final Date date) { super(doc); this.date = date; } @@ -54,12 +54,13 @@ if (this.date == null) { return new String(); } - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append("(D:"); - SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); + final SimpleDateFormat formatter = new SimpleDateFormat( + "yyyyMMddHHmmss"); buffer.append(formatter.format(this.date)); formatter.applyPattern("Z"); - String tzOffset = formatter.format(this.date); + final String tzOffset = formatter.format(this.date); buffer.append(tzOffset.substring(0, 3)); buffer.append("'"); buffer.append(tzOffset.substring(3, 5)); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDestination.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDestination.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDestination.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -31,7 +31,7 @@ */ public abstract class PDFDestination extends PDFObject { - public PDFDestination(PDFDocument doc) { + public PDFDestination(final PDFDocument doc) { super(doc); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -194,7 +194,7 @@ * updated later. This allows Pages to refer to their * Parent before we write it out. */ - public PDFDocument(Log logger) { + public PDFDocument(final Log logger) { this.logger = logger; // Create the Root object @@ -220,7 +220,7 @@ * {@inheritDoc} * If not set, the default value is PDF_VERSION_1_6. */ - public void setVersion(int newVersion) throws PDFException { + public void setVersion(final int newVersion) throws PDFException { if (newVersion >= 0 && newVersion < validVersions.length) { this.pdfVersion = newVersion; return; @@ -236,7 +236,7 @@ return this.colorspace; } - public void setColorSpace(ColorSpace theColorspace) { + public void setColorSpace(final ColorSpace theColorspace) { this.colorspace = theColorspace; } @@ -269,7 +269,8 @@ * This can be done as often as desired. * @param stream The OutputStream to which the output should be written. */ - public void writeIndirectObjects(OutputStream stream) throws IOException { + public void writeIndirectObjects(final OutputStream stream) + throws IOException { /* * Use a "while" loop here, because as each object is written, it has * potential to reference another object indirectly, which will add an @@ -277,7 +278,7 @@ */ while (indirectObjects.size() > 0) { /* retrieve the object with the current number */ - PDFObject object = (PDFObject) indirectObjects.get(0); + final PDFObject object = (PDFObject) indirectObjects.get(0); recordLocation(object); /* @@ -292,7 +293,7 @@ /** * @param object */ - private void recordLocation(PDFObject object) { + private void recordLocation(final PDFObject object) { /* Ensure there is room in the locations xref for the number of * objects that have been created. */ while(location.size() < lastIndirectObjectAssigned + 1) { @@ -309,20 +310,20 @@ /** * {@inheritDoc} */ - public void outputHeader(OutputStream stream) throws IOException { + public void outputHeader(final OutputStream stream) throws IOException { this.position = 0; - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); // The PDF identifier comment. buffer.append("%PDF-" + versionStrings[pdfVersion] + PDFObject.EOL); // A binary comment as recommended by the PDF spec (3.4.1) buffer.append("%" + (char) 0xAA + (char) 0xAB + (char) 0xAC + (char) 0xAD + PDFObject.EOL); - byte[] bytes = PDFObject.bufferToByteArray(buffer); + final byte[] bytes = PDFObject.bufferToByteArray(buffer); stream.write(bytes); this.position += bytes.length; } - public void close(OutputStream stream) throws IOException { + public void close(final OutputStream stream) throws IOException { outputTrailer(stream); } @@ -331,17 +332,17 @@ * * @param stream the OutputStream to write the trailer to */ - private void outputTrailer(OutputStream stream) throws IOException { + private void outputTrailer(final OutputStream stream) throws IOException { writeIndirectObjects(stream); for (int i = 0; i < indirectObjectsLast.size(); i++) { - PDFObject o = (PDFObject) indirectObjectsLast.get(i); + final PDFObject o = (PDFObject) indirectObjectsLast.get(i); recordLocation(o); this.position += o.output(stream); } writeIndirectObjects(stream); /* remember position of xref table */ - int xrefPosition = this.position; + final int xrefPosition = this.position; /* output the xref table and increment the character position by the table's length */ @@ -349,7 +350,7 @@ this.position += outputXref(stream); /* construct the trailer */ - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append(getTrailerContent()); buffer.append("startxref" + PDFObject.EOL); buffer.append(xrefPosition + PDFObject.EOL); @@ -359,14 +360,14 @@ byte[] trailer; try { trailer = buffer.toString().getBytes(PDFDocument.ENCODING); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { trailer = buffer.toString().getBytes(); } stream.write(trailer); } private String getTrailerContent() { - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append("trailer" + PDFObject.EOL); buffer.append("<<" + PDFObject.EOL); buffer.append("/Size " + (this.lastIndirectObjectAssigned + 1) @@ -391,18 +392,18 @@ * @param stream the OutputStream to write the xref table to * @return the number of characters written */ - private int outputXref(OutputStream stream) throws IOException { + private int outputXref(final OutputStream stream) throws IOException { /* construct initial part of xref */ - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append("xref" + PDFObject.EOL); buffer.append("0 " + (this.lastIndirectObjectAssigned + 1) + PDFObject.EOL); buffer.append("0000000000 65535 f" + PDFObject.XREF_EOL); for (int i = 1; i < this.location.size(); i++) { - String x = this.location.get(i).toString(); + final String x = this.location.get(i).toString(); /* contruct xref entry for object */ - String padding = "0000000000"; - String loc = padding.substring(x.length()) + x; + final String padding = "0000000000"; + final String loc = padding.substring(x.length()) + x; /* append to xref table */ buffer.append(loc + " 00000 n" + PDFObject.XREF_EOL); } @@ -410,7 +411,7 @@ byte[] pdfBytes; try { pdfBytes = buffer.toString().getBytes(PDFDocument.ENCODING); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { pdfBytes = buffer.toString().getBytes(); } stream.write(pdfBytes); @@ -420,7 +421,7 @@ /** * Increment the object count and return it. */ - public void registerIndirectObject(PDFObject object) { + public void registerIndirectObject(final PDFObject object) { if (object.getNumber() > -1) { return; } @@ -428,7 +429,7 @@ this.indirectObjects.add(object); } - public void registerIndirectObjectLast(PDFObject object) { + public void registerIndirectObjectLast(final PDFObject object) { if (object.getNumber() > -1) { return; } @@ -440,7 +441,7 @@ * Increment the shadingCount and return it. * @return The incremented shading count. */ - public int registerShadingResource(PDFShading shading) { + public int registerShadingResource(final PDFShading shading) { registerIndirectObject(shading); getResources().addShading(shading); return ++this.lastShadingAssigned; @@ -450,7 +451,7 @@ * Increment the patternCount and return it. * @return The incremented pattern count. */ - public int registerPatternResource(PDFPattern pattern) { + public int registerPatternResource(final PDFPattern pattern) { registerIndirectObject(pattern); getResources().addPattern(pattern); return ++this.lastPatternAssigned; @@ -460,7 +461,7 @@ * Increment the lastFontAssigned and return it. * @return The incremented font count. */ - public int registerFontResource(PDFFont font) { + public int registerFontResource(final PDFFont font) { registerIndirectObject(font); getResources().addFont(font); return ++this.lastFontAssigned; @@ -470,7 +471,8 @@ * Increment the patternCount and return it. * @return The incremented pattern count. */ - public int registerXObjectResource(PDFXObject theXObject, URL url) { + public int registerXObjectResource(final PDFXObject theXObject, + final URL url) { // Add it to the global map so that it can be reused. this.xObjectsMap.put(url, theXObject); registerIndirectObject(theXObject); @@ -489,7 +491,7 @@ /** * {@inheritDoc} */ - public void addDefaultFilter(String filterToAdd) { + public void addDefaultFilter(final String filterToAdd) { if (filterToAdd == null) { return; } @@ -503,7 +505,7 @@ * @return The tag to be prefixed to the subset font's name. */ public String getNextFontSubsetTag() { - StringBuffer tag = new StringBuffer(); + final StringBuffer tag = new StringBuffer(); for (int i = 0; i < nextFontSubsetTag.length; i ++) { tag.append(nextFontSubsetTag[i]); } @@ -541,11 +543,11 @@ * @param url The URL for whom a PDFXObject is sought. * @return The corresponding PDFXObject, or null if there is none. */ - public PDFXObject findXObject(URL url) { + public PDFXObject findXObject(final URL url) { return (PDFXObject) xObjectsMap.get(url); } - public PDFEncoding obtainPDFEncoding(Encoding encoding) { + public PDFEncoding obtainPDFEncoding(final Encoding encoding) { if (encoding == null) { return null; } @@ -558,13 +560,13 @@ return pdfEncoding; } - public org.axsl.pdfW.PDFFont getPDFFont(FontUse fontUse) { - Font font = fontUse.getFont(); + public org.axsl.pdfW.PDFFont getPDFFont(final FontUse fontUse) { + final Font font = fontUse.getFont(); /* Look for a match in the existing fonts. */ for (int i = 0; i < this.usedFonts.size(); i++) { - PDFFont pdfFont = (PDFFont) this.usedFonts.get(i); - FontUse testFontUse = pdfFont.getFsFont(); - Font testFont = testFontUse.getFont(); + final PDFFont pdfFont = (PDFFont) this.usedFonts.get(i); + final FontUse testFontUse = pdfFont.getFsFont(); + final Font testFont = testFontUse.getFont(); /* For there to be a match, the underlying fonts must be the same * and the encoding must be the same. */ if (testFont == font @@ -572,7 +574,7 @@ return pdfFont; } } - PDFFont pdfFont = PDFFont.makeFont(this, fontUse); + final PDFFont pdfFont = PDFFont.makeFont(this, fontUse); this.usedFonts.add(pdfFont); return pdfFont; } @@ -580,18 +582,18 @@ /** * {@inheritDoc} */ - public void setProducer(String producer) { + public void setProducer(final String producer) { this.getInfo().setProducer(producer); } /** * {@inheritDoc} */ - public void setCreationDate(Date creationDate) { + public void setCreationDate(final Date creationDate) { this.getInfo().setCreationDate(creationDate); } - public void addNamedDestination(PDFNamedDestination destination) { + public void addNamedDestination(final PDFNamedDestination destination) { this.getRoot().getDestinations().add(destination); } @@ -612,7 +614,7 @@ /** * {@inheritDoc} */ - public PDFColor createPDFColor(Color color) { + public PDFColor createPDFColor(final Color color) { org.foray.pdf.object.PDFColor pdfColor = null; for (int i = 0; i < this.usedColors.size(); i++) { pdfColor = (org.foray.pdf.object.PDFColor) this.usedColors.get(i); @@ -628,7 +630,7 @@ /** * {@inheritDoc} */ - public PDFPage createPDFPage(int pagewidth, int pageheight) { + public PDFPage createPDFPage(final int pagewidth, final int pageheight) { return new org.foray.pdf.object.PDFPage(this, this.getResources(), pagewidth, pageheight); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEmbeddedFileStream.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEmbeddedFileStream.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEmbeddedFileStream.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -33,7 +33,7 @@ /** * Create a PDFEmbeddedFileStream instance. */ - public PDFEmbeddedFileStream(PDFDocument doc) { + public PDFEmbeddedFileStream(final PDFDocument doc) { super(doc); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncoding.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncoding.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncoding.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -41,7 +41,7 @@ * Constructor. Creates the /Encoding object. * @param doc The parent PDF document. */ - public PDFEncoding(PDFDocument doc, Encoding encoding) { + public PDFEncoding(final PDFDocument doc, final Encoding encoding) { super(doc); this.encoding = encoding; } @@ -78,7 +78,7 @@ * need to be written into the document. */ return new String(); } - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); p.append(pdfID() + EOL); p.append("% " + this.encoding.getName() + EOL); p.append("<< /Type /Encoding" + EOL); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -49,7 +49,7 @@ /** The constructor for the internal PDFEncryption filter * @param encryption The encryption object to use */ - public EncryptionFilter(PDFEncryption encryption) { + public EncryptionFilter(final PDFEncryption encryption) { super(); this.encryption = encryption; } @@ -73,14 +73,14 @@ * @param data The data to be encrypted * @return The encrypted data */ - public byte[] encode(byte[] data) { + public byte[] encode(final byte[] data) { return encryption.encryptData(data, getNumber(), getGeneration()); } /** * Unimplemented. */ - public byte[] decode(byte[] input) { + public byte[] decode(final byte[] input) { return input; } @@ -127,14 +127,14 @@ * Create a /Filter /Standard object. * @param doc The parent PDF document. */ - public PDFEncryption(PDFDocument doc) { + public PDFEncryption(final PDFDocument doc) { super(doc); try { digest = MessageDigest.getInstance("MD5"); cipher = Cipher.getInstance("RC4"); - } catch (NoSuchAlgorithmException e) { + } catch (final NoSuchAlgorithmException e) { throw new IllegalStateException(e.getMessage()); - } catch (NoSuchPaddingException e) { + } catch (final NoSuchPaddingException e) { throw new IllegalStateException(e.getMessage()); } doc.registerIndirectObjectLast(this); @@ -143,7 +143,7 @@ /** * {@inheritDoc} */ - public void setUserPassword(String value) { + public void setUserPassword(final String value) { this.userPassword = value; } @@ -157,7 +157,7 @@ /** * {@inheritDoc} */ - public void setOwnerPassword(String value) { + public void setOwnerPassword(final String value) { this.ownerPassword = value; } @@ -171,36 +171,36 @@ /** * {@inheritDoc} */ - public void setAllowPrint(boolean value) { + public void setAllowPrint(final boolean value) { this.allowPrint = value; } /** * {@inheritDoc} */ - public void setAllowCopyContent(boolean value) { + public void setAllowCopyContent(final boolean value) { this.allowCopyContent = value; } /** * {@inheritDoc} */ - public void setAllowEditContent(boolean value) { + public void setAllowEditContent(final boolean value) { this.allowEditContent = value; } /** Set whether the document will allow annotation modificcations * @param value The new permission value */ - public void setAllowEditAnnotation(boolean value) { + public void setAllowEditAnnotation(final boolean value) { this.allowEditAnnotations = value; } // Internal procedures - private byte [] prepPassword(String password) { - byte [] obuffer = new byte[32]; - byte [] pbuffer = password.getBytes(); + private byte [] prepPassword(final String password) { + final byte [] obuffer = new byte[32]; + final byte [] pbuffer = password.getBytes(); int i = 0; int j = 0; @@ -215,8 +215,8 @@ return obuffer; } - private String toHex(byte [] value) { - StringBuffer buffer = new StringBuffer(); + private String toHex(final byte [] value) { + final StringBuffer buffer = new StringBuffer(); for(int i=0; i < value.length; i++) { buffer.append(digits[(value[i] >>> 4) & 0x0F]); @@ -242,34 +242,35 @@ * @param index The index to access the file ID * @return The file ID */ - public String getFileID(int index) { + public String getFileID(final int index) { if (index == 1) { return toHex(getFileID()); } - byte [] id = new byte[16]; + final byte [] id = new byte[16]; random.nextBytes(id); return toHex(id); } - private byte [] encryptWithKey(byte [] data, byte [] key) { + private byte [] encryptWithKey(final byte [] data, final byte [] key) { try { - SecretKeySpec keyspec = new SecretKeySpec(key, "RC4"); + final SecretKeySpec keyspec = new SecretKeySpec(key, "RC4"); cipher.init(Cipher.ENCRYPT_MODE,keyspec); return cipher.doFinal(data); - } catch (IllegalBlockSizeException e) { + } catch (final IllegalBlockSizeException e) { throw new IllegalStateException(e.getMessage()); - } catch (BadPaddingException e) { + } catch (final BadPaddingException e) { throw new IllegalStateException(e.getMessage()); - } catch (InvalidKeyException e) { + } catch (final InvalidKeyException e) { throw new IllegalStateException(e.getMessage()); } } - private byte [] encryptWithHash(byte [] data, byte [] hash, int size) { + private byte [] encryptWithHash(final byte [] data, byte [] hash, + final int size) { hash = digest.digest(hash); - byte [] key = new byte[size]; + final byte [] key = new byte[size]; for(int i = 0; i < size; i++) { key[i] = hash[i]; @@ -316,7 +317,7 @@ digest.update((byte) (permissions >>> 24)); digest.update(getFileID()); - byte [] hash = digest.digest(); + final byte [] hash = digest.digest(); this.encryptionKey = new byte[5]; for(int i = 0; i < 5; i++) { @@ -324,7 +325,8 @@ } // Create the user value - byte [] uValue = encryptWithKey(prepPassword(""),this.encryptionKey); + final byte [] uValue = encryptWithKey( + prepPassword(""),this.encryptionKey); // Create the dictionary this.dictionary = this.pdfID() + EOL + "<< /Filter /Standard" + EOL @@ -344,13 +346,14 @@ * @param generation The block generation * @return The encrypted data */ - public byte [] encryptData(byte [] data, int number, int generation) { + public byte [] encryptData(final byte [] data, final int number, + final int generation) { if (this.encryptionKey == null) { throw new IllegalStateException("PDF Encryption has not been " + "initialized"); } - byte [] hash = new byte[this.encryptionKey.length+5]; + final byte [] hash = new byte[this.encryptionKey.length+5]; int i = 0; Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFExplicitDestination.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFExplicitDestination.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFExplicitDestination.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -44,8 +44,8 @@ protected float leftPosition = 0; protected float topPosition = 0; - public PDFExplicitDestination(PDFDocument doc, PDFPage page, - float xPosition, float yPosition) { + public PDFExplicitDestination(final PDFDocument doc, final PDFPage page, + final float xPosition, final float yPosition) { super(doc); this.page = page; this.leftPosition = xPosition; @@ -57,7 +57,7 @@ * describes this destination. */ protected String toPDF() { - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append(this.pdfID() + EOL); buffer.append("[" + this.page.pdfReference() + " /XYZ " + leftPosition + " " + topPosition + " null]" + EOL); @@ -69,8 +69,8 @@ * {@inheritDoc} */ public org.axsl.pdfW.PDFNamedDestination createPDFNamedDestination( - String name) { - org.foray.pdf.object.PDFNamedDestination destination + final String name) { + final org.foray.pdf.object.PDFNamedDestination destination = new org.foray.pdf.object.PDFNamedDestination( this.getPDFDocument(), name, this); this.getPDFDocument().addNamedDestination(destination); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFileSpec.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFileSpec.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFileSpec.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -40,7 +40,7 @@ * @param doc The parent PDF document. * @param filename the filename represented by this object */ - public PDFFileSpec(PDFDocument doc, String filename) { + public PDFFileSpec(final PDFDocument doc, final String filename) { super(doc); this.filename = filename; } @@ -51,7 +51,7 @@ * @return the PDF string */ public String toPDF() { - String p = new String(pdfID() + EOL + final String p = new String(pdfID() + EOL + "<<" + EOL + "/Type /FileSpec" + EOL + "/F (" + this.filename + ")" + EOL Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFont.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFont.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFont.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -94,7 +94,7 @@ * @param doc The parent PDF document. * @param fsFont The FreeStandingFont which is the basis for this PDF Font. */ - public PDFFont(PDFDocument doc, FontUse fsFont) { + public PDFFont(final PDFDocument doc, final FontUse fsFont) { super(doc); this.fontCount = doc.registerFontResource(this); this.fsFont = fsFont; @@ -111,9 +111,10 @@ * @param fsFont The FreeStandingFont to be added * @return the created /Font object */ - public static PDFFont makeFont(PDFDocument pdfDoc, FontUse fsFont) { + public static PDFFont makeFont(final PDFDocument pdfDoc, + final FontUse fsFont) { if (fsFont.getFont().isPDFStandardFont()) { - PDFFont font = new PDFFont(pdfDoc, fsFont); + final PDFFont font = new PDFFont(pdfDoc, fsFont); return font; } switch (PDFFont.getFontSubtype(fsFont)) { @@ -151,7 +152,7 @@ * @return the PDF */ public String toPDF() { - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append(this.pdfID() + EOL); buffer.append("<<" + EOL); buffer.append("/Type /Font" + EOL); @@ -177,7 +178,7 @@ * as if they were not standard when they use a non-standard encoding. * We're not sure why this is necessary, but it seems to be. */ if (this.fsFont.getFont().isPDFStandardFont()) { - Encoding encoding = this.fsFont.getEncoding(); + final Encoding encoding = this.fsFont.getEncoding(); if (encoding.isPredefinedPDF()) { return true; } @@ -190,7 +191,7 @@ return false; } - protected void writeFirstChar(StringBuffer buffer) { + protected void writeFirstChar(final StringBuffer buffer) { if (isStandardFont()) { return; } @@ -200,7 +201,7 @@ buffer.append(EOL); } - protected void writeLastChar(StringBuffer buffer) { + protected void writeLastChar(final StringBuffer buffer) { if (isStandardFont()) { return; } @@ -210,18 +211,18 @@ buffer.append(EOL); } - protected void writeWidths(StringBuffer buffer) { + protected void writeWidths(final StringBuffer buffer) { if (isStandardFont()) { return; } - PDFArray widthArray = new PDFArray(this.document, + final PDFArray widthArray = new PDFArray(this.document, getFontOutput().getWidths()); buffer.append("/Widths "); buffer.append(widthArray.pdfReference()); buffer.append(EOL); } - protected void writeFontDescriptor(StringBuffer buffer) { + protected void writeFontDescriptor(final StringBuffer buffer) { if (descriptor == null) { return; } @@ -230,7 +231,7 @@ buffer.append(EOL); } - private void writeE... [truncated message content] |
|
From: <vic...@us...> - 2006-07-23 20:07:14
|
Revision: 7822 Author: victormote Date: 2006-07-23 13:07:00 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7822&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-pdf/.project trunk/foray/foray-pdf/src/java/org/foray/pdf/PDFGraphicsState.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFAElementBridge.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFANode.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFDocumentGraphics2D.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphics2D.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphicsConfiguration.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphicsDevice.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFImageElementBridge.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTextPainter.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTranscoder.java Modified: trunk/foray/foray-pdf/.project =================================================================== --- trunk/foray/foray-pdf/.project 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/.project 2006-07-23 20:07:00 UTC (rev 7822) @@ -10,12 +10,12 @@ </projects> <buildSpec> <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> <arguments> </arguments> </buildCommand> Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/PDFGraphicsState.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/PDFGraphicsState.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/PDFGraphicsState.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -79,7 +79,7 @@ * @param newStrokeColor The color that stroke operations should now use. * @return True if the Graphics State was changed by this operation. */ - public boolean setStrokeColor(PDFColor newStrokeColor) { + public boolean setStrokeColor(final PDFColor newStrokeColor) { boolean anyChange = false; if (! newStrokeColor.equals(this.strokeColor)) { this.strokeColor = newStrokeColor; @@ -96,7 +96,7 @@ * @param newFillColor The color that non-stroke operations should now use. * @return True if the Graphics State was changed by this operation. */ - public boolean setFillColor(PDFColor newFillColor) { + public boolean setFillColor(final PDFColor newFillColor) { boolean anyChange = false; if (! newFillColor.equals(this.fillColor)) { this.fillColor = newFillColor; @@ -105,7 +105,7 @@ return anyChange; } - public boolean setCharacterSpacing(float newCharacterSpacing) { + public boolean setCharacterSpacing(final float newCharacterSpacing) { boolean anyChange = false; if (newCharacterSpacing != this.characterSpacing) { this.characterSpacing = newCharacterSpacing; @@ -114,7 +114,7 @@ return anyChange; } - public boolean setWordSpacing(float newWordSpacing) { + public boolean setWordSpacing(final float newWordSpacing) { boolean anyChange = false; if (newWordSpacing != this.wordSpacing) { this.wordSpacing = newWordSpacing; @@ -123,7 +123,7 @@ return anyChange; } - public boolean setFont(PDFFont newFont) { + public boolean setFont(final PDFFont newFont) { boolean anyChange = false; if (! newFont.equals(this.font)) { this.font = newFont; @@ -136,7 +136,7 @@ return this.font; } - public boolean setFontSize(float newFontSize) { + public boolean setFontSize(final float newFontSize) { boolean anyChange = false; if (newFontSize != this.fontSize) { this.fontSize = newFontSize; @@ -155,8 +155,8 @@ * @param newDashPhase The new dash phase. * @return True if the Graphics State was changed by this operation. */ - public boolean setLineDashPattern(float[] newDashArray, - float newDashPhase) { + public boolean setLineDashPattern(final float[] newDashArray, + final float newDashPhase) { boolean anyChange = false; anyChange |= setLineDashArray(newDashArray); anyChange |= setLineDashPhase(newDashPhase); @@ -168,7 +168,7 @@ * @param newDashArray The new dash array. * @return True if the Graphics State was changed by this operation. */ - private boolean setLineDashArray(float[] newDashArray) { + private boolean setLineDashArray(final float[] newDashArray) { /* Null is a valid value for a dash array. If either the new or old * value is null, or both, we need to handle those cases before trying * to test equality between the two values. */ @@ -200,7 +200,7 @@ * @param newDashPhase The new dash phase. * @return True if the Graphics State was changed by this operation. */ - private boolean setLineDashPhase(float newDashPhase) { + private boolean setLineDashPhase(final float newDashPhase) { boolean anyChange = false; if (newDashPhase != this.dashPhase) { this.dashPhase = newDashPhase; Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFAElementBridge.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFAElementBridge.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFAElementBridge.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -46,7 +46,7 @@ */ public PDFAElementBridge() {} - public void setCurrentTransform(AffineTransform tf) { + public void setCurrentTransform(final AffineTransform tf) { transform = tf; } @@ -71,8 +71,9 @@ * @param ctx the bridge context to use * @param e the element that describes the graphics node to build */ - public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) { - PDFANode aNode = (PDFANode)super.createGraphicsNode(ctx, e); + public GraphicsNode createGraphicsNode(final BridgeContext ctx, + final Element e) { + final PDFANode aNode = (PDFANode)super.createGraphicsNode(ctx, e); aNode.setDestination(((SVGAElement)e).getHref().getBaseVal()); aNode.setTransform(transform); return aNode; Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFANode.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFANode.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFANode.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -50,11 +50,11 @@ /** * Set the destination String. */ - public void setDestination(String dest) { + public void setDestination(final String dest) { destination = dest; } - public void setTransform(AffineTransform tf) { + public void setTransform(final AffineTransform tf) { transform = tf; } @@ -63,7 +63,7 @@ * * @param g2d the Graphics2D to use */ - public void paint(PDFPage pdfPage, Graphics2D g2d) { + public void paint(final PDFPage pdfPage, final Graphics2D g2d) { if (! isVisible) { return; } @@ -71,21 +71,21 @@ if (! (g2d instanceof PDFGraphics2D)) { return; } - PDFGraphics2D pdfg = (PDFGraphics2D)g2d; + final PDFGraphics2D pdfg = (PDFGraphics2D)g2d; boolean externalLink = true; - Shape outline = getOutline(); + final Shape outline = getOutline(); if(destination.startsWith("#svgView(viewBox(")) { externalLink = false; - String nums = destination.substring(18, + final String nums = destination.substring(18, destination.length() - 2); float x = 0; float y = 0; float width = 0; int count = 0; try { - StringTokenizer st = new StringTokenizer(nums, ","); + final StringTokenizer st = new StringTokenizer(nums, ","); while(st.hasMoreTokens()) { - String tok = st.nextToken(); + final String tok = st.nextToken(); count++; switch(count) { case 1: @@ -103,7 +103,7 @@ break; } } - } catch(Exception e) { + } catch(final Exception e) { } // these numbers need conversion to current // svg position and scaled for the page Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFDocumentGraphics2D.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFDocumentGraphics2D.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFDocumentGraphics2D.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -71,8 +71,9 @@ * @param width the width of the document * @param height the height of the document */ - public PDFDocumentGraphics2D(boolean textAsShapes, OutputStream stream, - int width, int height, String appName, FontConsumer fontConsumer) + public PDFDocumentGraphics2D(final boolean textAsShapes, + final OutputStream stream, final int width, final int height, + final String appName, final FontConsumer fontConsumer) throws PDFException { super(textAsShapes); @@ -101,7 +102,7 @@ * The result is scaled so that the svg fits correctly inside the pdf * document. */ - public void setSVGDimension(float w, float h) { + public void setSVGDimension(final float w, final float h) { currentStream.write("" + PSReal.doubleOut(width / w) + " 0 0 " + PSReal.doubleOut(height / h) + " 0 0 cm\n"); } @@ -111,7 +112,7 @@ * This is used to set the background for the pdf document * Rather than leaving it as the default white. */ - public void setBackgroundColor(Color col) { + public void setBackgroundColor(final Color col) { currentColour = new PDFColor(col); currentStream.write("q\n"); currentStream.write(currentColour.getColorSpaceOut(true)); @@ -129,10 +130,10 @@ * This will then write the results to the output stream. */ public void finish() throws IOException { - PDFResources pdfResources = this.pdfDoc.getResources(); - PDFPage currentPage = new PDFPage(this.pdfDoc, pdfResources, width, - height); - PDFContentStream contentStream = (PDFContentStream) + final PDFResources pdfResources = this.pdfDoc.getResources(); + final PDFPage currentPage = new PDFPage(this.pdfDoc, pdfResources, + width, height); + final PDFContentStream contentStream = (PDFContentStream) currentPage.getContentStream(); contentStream.add(getString()); if(currentAnnotList != null) { @@ -143,14 +144,14 @@ pdfDoc.close(stream); } - public void setGraphicContext(GraphicContext c) { + public void setGraphicContext(final GraphicContext c) { gc = c; } /** * This constructor supports the create method */ - public PDFDocumentGraphics2D(PDFDocumentGraphics2D g) { + public PDFDocumentGraphics2D(final PDFDocumentGraphics2D g) { super(g); } @@ -164,12 +165,12 @@ return new PDFDocumentGraphics2D(this); } - public void drawString(String s, float x, float y) { + public void drawString(final String s, final float x, final float y) { if (super.textAsShapes) { - Font font = super.getFont(); - FontRenderContext frc = super.getFontRenderContext(); - GlyphVector gv = font.createGlyphVector(frc, s); - Shape glyphOutline = gv.getOutline(x, y); + final Font font = super.getFont(); + final FontRenderContext frc = super.getFontRenderContext(); + final GlyphVector gv = font.createGlyphVector(frc, s); + final Shape glyphOutline = gv.getOutline(x, y); super.fill(glyphOutline); } else { super.drawString(s, x, y); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphics2D.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphics2D.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphics2D.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -142,13 +142,14 @@ * This is used to create a Graphics object for use inside an already * existing document. */ - public PDFGraphics2D(boolean textAsShapes, PDFDocument doc, - Rectangle2D.Float contentRectangle, - SVGDocument svgDocument, FontConsumer fontConsumer) { + public PDFGraphics2D(final boolean textAsShapes, final PDFDocument doc, + final Rectangle2D.Float contentRectangle, + final SVGDocument svgDocument, final FontConsumer fontConsumer) { super(textAsShapes); pdfDoc = doc; this.fontConsumer = fontConsumer; - org.axsl.pdfW.PDFFont pdfFont = doc.getCurrentGraphicsState().getFont(); + final org.axsl.pdfW.PDFFont pdfFont = + doc.getCurrentGraphicsState().getFont(); if (pdfFont == null) { this.currentFont = null; } else { @@ -162,19 +163,19 @@ /** * @param svgDocument */ - private void transformCoordinates(Rectangle2D.Float contentRectangle, - SVGDocument svgDocument) { + private void transformCoordinates(final Rectangle2D.Float contentRectangle, + final SVGDocument svgDocument) { // transform so that the coordinates (0,0) is from the top left // and positive is down and to the right. (0,0) is where the // viewBox puts it. currentStream.write("1 0 0 -1 " + contentRectangle.x + " " + contentRectangle.y + " cm\n"); - SVGSVGElement svg = svgDocument.getRootElement(); - AffineTransform at = ViewBox.getPreserveAspectRatioTransform(svg, + final SVGSVGElement svg = svgDocument.getRootElement(); + final AffineTransform at = ViewBox.getPreserveAspectRatioTransform(svg, contentRectangle.width, contentRectangle.height); if (!at.isIdentity()) { - double[] vals = new double[6]; + final double[] vals = new double[6]; at.getMatrix(vals); currentStream.write(PSReal.doubleOut(vals[0], 8) + " " + PSReal.doubleOut(vals[1], 8) + " " @@ -185,7 +186,7 @@ } } - public PDFGraphics2D(boolean textAsShapes) { + public PDFGraphics2D(final boolean textAsShapes) { super(textAsShapes); } @@ -193,12 +194,12 @@ return currentStream.toString(); } - public void setGraphicContext(GraphicContext c) { + public void setGraphicContext(final GraphicContext c) { gc = c; } - public void setOverrideFontState(org.axsl.fontR.FontUse infont, - float size) { + public void setOverrideFontState(final org.axsl.fontR.FontUse infont, + final float size) { this.overrideFont = infont; this.overrideFontSize = size; } @@ -206,7 +207,7 @@ /** * This constructor supports the create method */ - public PDFGraphics2D(PDFGraphics2D g) { + public PDFGraphics2D(final PDFGraphics2D g) { super(g); } @@ -224,19 +225,21 @@ * This is a pdf specific method used to add a link to the * pdf document. */ - public void addLink(PDFPage pdfPage, Shape bounds, AffineTransform trans, - String dest, boolean externalLink) { + public void addLink(final PDFPage pdfPage, final Shape bounds, + final AffineTransform trans, final String dest, + final boolean externalLink) { if(currentAnnotList == null) { currentAnnotList = new PDFAnnotList(pdfDoc); } - AffineTransform at = getTransform(); + final AffineTransform at = getTransform(); Shape b = at.createTransformedShape(bounds); b = trans.createTransformedShape(b); - Rectangle2D.Float linkRectangle = (Rectangle2D.Float) b.getBounds2D(); + final Rectangle2D.Float linkRectangle = + (Rectangle2D.Float) b.getBounds2D(); linkRectangle.height *= -1; PDFLink link = null; if (externalLink) { - String pdfdest = "/XYZ " + dest; + final String pdfdest = "/XYZ " + dest; link = new PDFLink(pdfDoc, pdfPage, linkRectangle, pdfdest); } else { link = (PDFLink) pdfPage.makeLink(linkRectangle, dest, false); @@ -248,18 +251,18 @@ return currentAnnotList; } - public void addJpegImage(Graphic jpeg, float x, float y, float width, - float height) throws GraphicException { - Rectangle2D.Float contentRectangle = new Rectangle2D.Float(x, y, width, - height); - PDFXObject xObject = PDFXObject.makeXObject(this.pdfDoc, jpeg, + public void addJpegImage(final Graphic jpeg, final float x, final float y, + final float width, final float height) throws GraphicException { + final Rectangle2D.Float contentRectangle = new Rectangle2D.Float(x, y, + width, height); + final PDFXObject xObject = PDFXObject.makeXObject(this.pdfDoc, jpeg, contentRectangle, null); - AffineTransform at = getTransform(); - double[] matrix = new double[6]; + final AffineTransform at = getTransform(); + final double[] matrix = new double[6]; at.getMatrix(matrix); currentStream.write("q\n"); - Shape imclip = getClip(); + final Shape imclip = getClip(); writeClip(imclip); currentStream.write("" + matrix[0] + " " + matrix[1] + " " + matrix[2] + " " + matrix[3] + " " @@ -297,19 +300,19 @@ * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, * int, int, int) */ - public boolean drawImage(Image img, int x, int y, - ImageObserver observer) { - int width = img.getWidth(observer); - int height = img.getHeight(observer); + public boolean drawImage(final Image img, final int x, final int y, + final ImageObserver observer) { + final int width = img.getWidth(observer); + final int height = img.getHeight(observer); if (width == -1 || height == -1) { return false; } - Dimension size = new Dimension(width * 3, height * 3); - BufferedImage buf = buildBufferedImage(size); + final Dimension size = new Dimension(width * 3, height * 3); + final BufferedImage buf = buildBufferedImage(size); - Graphics2D g = buf.createGraphics(); + final Graphics2D g = buf.createGraphics(); g.setComposite(AlphaComposite.SrcOver); g.setBackground(new Color(1, 1, 1, 0)); g.setPaint(new Color(1, 1, 1, 0)); @@ -324,15 +327,15 @@ final byte[] result = new byte[buf.getWidth() * buf.getHeight() * 3]; - Raster raster = buf.getData(); - DataBuffer bd = raster.getDataBuffer(); + final Raster raster = buf.getData(); + final DataBuffer bd = raster.getDataBuffer(); int count = 0; int[] iarray; int i, j, val, alpha, add, mult; switch (bd.getDataType()) { case DataBuffer.TYPE_INT: - int[][] idata = ((DataBufferInt)bd).getBankData(); + final int[][] idata = ((DataBufferInt)bd).getBankData(); for (i = 0; i < idata.length; i++) { iarray = idata[i]; for (j = 0; j < iarray.length; j++) { @@ -367,11 +370,11 @@ // now do any transformation required and add the actual image // placement instance - AffineTransform at = getTransform(); - double[] matrix = new double[6]; + final AffineTransform at = getTransform(); + final double[] matrix = new double[6]; at.getMatrix(matrix); currentStream.write("q\n"); - Shape imclip = getClip(); + final Shape imclip = getClip(); writeClip(imclip); currentStream.write("" + matrix[0] + " " + matrix[1] + " " + matrix[2] + " " + matrix[3] + " " @@ -383,7 +386,7 @@ return true; } - public BufferedImage buildBufferedImage(Dimension size) { + public BufferedImage buildBufferedImage(final Dimension size) { return new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB); } @@ -422,8 +425,8 @@ * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, * int, int, int) */ - public boolean drawImage(Image img, int x, int y, int width, int height, - ImageObserver observer) { + public boolean drawImage(final Image img, final int x, final int y, + final int width, final int height, final ImageObserver observer) { return true; } @@ -475,7 +478,7 @@ * @see AbstractGraphics2D#clip * @see AbstractGraphics2D#setComposite */ - public void draw(Shape s) { + public void draw(final Shape s) { Color c; c = getColor(); if(c.getAlpha() == 0) { @@ -483,15 +486,15 @@ } currentStream.write("q\n"); - Shape imclip = getClip(); + final Shape imclip = getClip(); writeClip(imclip); applyColor(c, false); applyPaint(getPaint(), false); applyStroke(getStroke()); - AffineTransform trans = getTransform(); - double[] tranvals = new double[6]; + final AffineTransform trans = getTransform(); + final double[] tranvals = new double[6]; trans.getMatrix(tranvals); currentStream.write(PSReal.doubleOut(tranvals[0], 8) + " " + PSReal.doubleOut(tranvals[1], 8) + " " @@ -500,10 +503,10 @@ + PSReal.doubleOut(tranvals[4], 8) + " " + PSReal.doubleOut(tranvals[5], 8) + " cm\n"); - PathIterator iter = s.getPathIterator(new AffineTransform()); + final PathIterator iter = s.getPathIterator(new AffineTransform()); while (!iter.isDone()) { - double vals[] = new double[6]; - int type = iter.currentSegment(vals); + final double vals[] = new double[6]; + final int type = iter.currentSegment(vals); switch (type) { case PathIterator.SEG_CUBICTO: currentStream.write(PSReal.doubleOut(vals[0]) + " " @@ -539,14 +542,14 @@ currentStream.write("Q\n"); } - protected void writeClip(Shape s) { + protected void writeClip(final Shape s) { if (s == null) { return; } - PathIterator iter = s.getPathIterator(getTransform()); + final PathIterator iter = s.getPathIterator(getTransform()); while (!iter.isDone()) { - double vals[] = new double[6]; - int type = iter.currentSegment(vals); + final double vals[] = new double[6]; + final int type = iter.currentSegment(vals); switch (type) { case PathIterator.SEG_CUBICTO: currentStream.write(PSReal.doubleOut(vals[0]) + " " @@ -583,29 +586,29 @@ currentStream.write("n\n"); } - protected void applyColor(Color col, boolean fill) { - Color c = col; + protected void applyColor(final Color col, final boolean fill) { + final Color c = col; if (c.getColorSpace().getType() == java.awt.color.ColorSpace.TYPE_RGB) { currentColour = new PDFColor(c); currentStream.write(currentColour.getColorSpaceOut(fill)); } else if (c.getColorSpace().getType() == java.awt.color.ColorSpace.TYPE_CMYK) { - float[] cComps = c.getColorComponents(new float[3]); - float[] cmyk = new float[3]; + final float[] cComps = c.getColorComponents(new float[3]); + final float[] cmyk = new float[3]; for (int i = 0; i < 3; i++) { // convert the float elements to doubles for pdf cmyk[i] = cComps[i]; } - Color cmykColor = ColorSpaceCMYK.makeColor(cmyk[0], cmyk[1], + final Color cmykColor = ColorSpaceCMYK.makeColor(cmyk[0], cmyk[1], cmyk[2], cmyk[3]); currentColour = new PDFColor(cmykColor); currentStream.write(currentColour.getColorSpaceOut(fill)); } else if (c.getColorSpace().getType() == java.awt.color.ColorSpace.TYPE_2CLR) { // used for black/magenta - float[] cComps = c.getColorComponents(new float[1]); - double[] blackMagenta = new double[1]; + final float[] cComps = c.getColorComponents(new float[1]); + final double[] blackMagenta = new double[1]; for (int i = 0; i < 1; i++) { blackMagenta[i] = cComps[i]; } @@ -617,57 +620,59 @@ } } - protected void applyPaint(Paint paint, boolean fill) { + protected void applyPaint(final Paint paint, final boolean fill) { if (paint instanceof GradientPaint) { - GradientPaint gp = (GradientPaint)paint; - Color c1 = gp.getColor1(); - Color c2 = gp.getColor2(); - Point2D p1 = gp.getPoint1(); - Point2D p2 = gp.getPoint2(); + final GradientPaint gp = (GradientPaint)paint; + final Color c1 = gp.getColor1(); + final Color c2 = gp.getColor2(); + final Point2D p1 = gp.getPoint1(); + final Point2D p2 = gp.getPoint2(); - List theCoords = new ArrayList(); + final List theCoords = new ArrayList(); theCoords.add(new Double(p1.getX())); theCoords.add(new Double(p1.getY())); theCoords.add(new Double(p2.getX())); theCoords.add(new Double(p2.getY())); - List theExtend = new ArrayList(); + final List theExtend = new ArrayList(); theExtend.add(new Boolean(true)); theExtend.add(new Boolean(true)); - List theDomain = new ArrayList(); + final List theDomain = new ArrayList(); theDomain.add(new Double(0)); theDomain.add(new Double(1)); - List theEncode = new ArrayList(); + final List theEncode = new ArrayList(); theEncode.add(new Double(0)); theEncode.add(new Double(1)); theEncode.add(new Double(0)); theEncode.add(new Double(1)); - List theBounds = new ArrayList(); + final List theBounds = new ArrayList(); theBounds.add(new Double(0)); theBounds.add(new Double(1)); - List someColors = new ArrayList(); + final List someColors = new ArrayList(); - PDFColor color1 = new PDFColor(c1); + final PDFColor color1 = new PDFColor(c1); someColors.add(color1); - PDFColor color2 = new PDFColor(c2); + final PDFColor color2 = new PDFColor(c2); someColors.add(color2); - ColorSpace aColorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB); - PDFPattern myPat = PDFPattern.createGradient(false, aColorSpace, + final ColorSpace aColorSpace = ColorSpace.getInstance( + ColorSpace.CS_sRGB); + final PDFPattern myPat = PDFPattern.createGradient(false, + aColorSpace, someColors, null, theCoords, pdfDoc); currentStream.write(myPat.getColorSpaceOut(fill)); } else if (paint instanceof TexturePaint) {} } - protected void applyStroke(Stroke stroke) { + protected void applyStroke(final Stroke stroke) { if (stroke instanceof BasicStroke) { - BasicStroke bs = (BasicStroke)stroke; + final BasicStroke bs = (BasicStroke)stroke; - float[] da = bs.getDashArray(); + final float[] da = bs.getDashArray(); if (da != null) { currentStream.write("["); for (int count = 0; count < da.length; count++) { @@ -683,10 +688,10 @@ } } currentStream.write("] "); - float offset = bs.getDashPhase(); + final float offset = bs.getDashPhase(); currentStream.write(((int)offset) + " d\n"); } - int ec = bs.getEndCap(); + final int ec = bs.getEndCap(); switch (ec) { case BasicStroke.CAP_BUTT: currentStream.write(0 + " J\n"); @@ -699,7 +704,7 @@ break; } - int lj = bs.getLineJoin(); + final int lj = bs.getLineJoin(); switch (lj) { case BasicStroke.JOIN_MITER: currentStream.write(0 + " j\n"); @@ -711,10 +716,10 @@ currentStream.write(2 + " j\n"); break; } - float lw = bs.getLineWidth(); + final float lw = bs.getLineWidth(); currentStream.write(PSReal.doubleOut(lw) + " w\n"); - float ml = bs.getMiterLimit(); + final float ml = bs.getMiterLimit(); currentStream.write(PSReal.doubleOut(ml) + " M\n"); } } @@ -738,7 +743,8 @@ * @see AbstractGraphics2D#setComposite * @see AbstractGraphics2D#clip */ - public void drawRenderedImage(RenderedImage img, AffineTransform xform) { + public void drawRenderedImage(final RenderedImage img, + final AffineTransform xform) { this.pdfDoc.getLogger().info("drawRenderedImage"); } @@ -773,8 +779,8 @@ * @see AbstractGraphics2D#clip * @see #drawRenderedImage */ - public void drawRenderableImage(RenderableImage img, - AffineTransform xform) { + public void drawRenderableImage(final RenderableImage img, + final AffineTransform xform) { this.pdfDoc.getLogger().info("drawRenderableImage"); } @@ -799,7 +805,7 @@ * @see AbstractGraphics2D#setTransform * @see AbstractGraphics2D#setComposite */ - public void drawString(String s, float x, float y) { + public void drawString(final String s, final float x, final float y) { org.axsl.fontR.FontUse font; float size; if (overrideFont == null) { @@ -814,7 +820,7 @@ if (font != this.currentFont || (size != this.currentFontSize)) { this.currentFont = font; this.currentFontSize = size; - PDFFont pdfFont = new PDFFont(pdfDoc, font); + final PDFFont pdfFont = new PDFFont(pdfDoc, font); currentStream.write("/" + pdfFont.getName() + size + " Tf\n"); @@ -822,7 +828,7 @@ currentStream.write("q\n"); - Shape imclip = getClip(); + final Shape imclip = getClip(); writeClip(imclip); Color c = getColor(); applyColor(c, true); @@ -831,9 +837,9 @@ currentStream.write("BT\n"); - AffineTransform trans = getTransform(); + final AffineTransform trans = getTransform(); trans.translate(x, y); - double[] vals = new double[6]; + final double[] vals = new double[6]; trans.getMatrix(vals); currentStream.write(PSReal.doubleOut(vals[0], 8) + " " @@ -844,9 +850,9 @@ + PSReal.doubleOut(vals[5], 8) + " cm\n"); currentStream.write("1 0 0 -1 0 0 Tm "); - PDFFont pdfFont = new PDFFont(this.pdfDoc, font); - PDFString pdfString = new PDFString(this.pdfDoc, s, pdfFont); - String outputString = pdfString.toPDF(); + final PDFFont pdfFont = new PDFFont(this.pdfDoc, font); + final PDFString pdfString = new PDFString(this.pdfDoc, s, pdfFont); + final String outputString = pdfString.toPDF(); currentStream.write(outputString); currentStream.write("ET\n"); @@ -858,12 +864,12 @@ * java.awt.Font that comes from the Batik environment. */ private org.axsl.fontR.FontUse getImplicitFont() { - Font gFont = getFont(); + final Font gFont = getFont(); String fontFamily = gFont.getFamily(); if (fontFamily.equals("sanserif")) { fontFamily = "sans-serif"; } - float fontSize = gFont.getSize(); + final float fontSize = gFont.getSize(); int fontStyle = org.axsl.fontR.Font.FONT_STYLE_NORMAL; if (gFont.isItalic()) { fontStyle = org.axsl.fontR.Font.FONT_STYLE_ITALIC; @@ -873,7 +879,8 @@ fontWeight = org.axsl.fontR.Font.FONT_WEIGHT_BOLD; } try { - FontConsumer fontConsumer = this.currentFont.getFontConsumer(); + final FontConsumer fontConsumer = + this.currentFont.getFontConsumer(); return fontConsumer.selectFontXSL( org.axsl.fontR.Font.FONT_SELECTION_AUTO, FontUtility.foFontFamily(fontFamily), @@ -882,7 +889,7 @@ org.axsl.fontR.Font.FONT_STRETCH_NORMAL, (int) (fontSize * 1000), ' '); - } catch (FontException exception) { + } catch (final FontException exception) { exception.printStackTrace(); return null; } @@ -910,12 +917,12 @@ * @see AbstractGraphics2D#setTransform * @see AbstractGraphics2D#setComposite */ - public void drawString(AttributedCharacterIterator iterator, float x, - float y) { + public void drawString(final AttributedCharacterIterator iterator, + final float x, final float y) { this.pdfDoc.getLogger().error( "drawString(AttributedCharacterIterator)"); - Shape imclip = getClip(); + final Shape imclip = getClip(); writeClip(imclip); Color c = getColor(); applyColor(c, true); @@ -924,34 +931,34 @@ currentStream.write("BT\n"); - AffineTransform trans = getTransform(); + final AffineTransform trans = getTransform(); trans.translate(x, y); - double[] vals = new double[6]; + final double[] vals = new double[6]; trans.getMatrix(vals); for (char ch = iterator.first(); ch != CharacterIterator.DONE; ch = iterator.next()) { /* TODO: All of this should be integrated with the regular methods * in PDFContentStream. */ - String[] fontFamily = new String[1]; + final String[] fontFamily = new String[1]; fontFamily[0] = (String) iterator.getAttribute( TextAttribute.FAMILY); - Float fontSize = (Float) iterator.getAttribute( + final Float fontSize = (Float) iterator.getAttribute( TextAttribute.FAMILY); org.axsl.fontR.FontUse font; try { font = this.fontConsumer.selectFontCSS( fontFamily, 0, 0, 0, 0, 0, ch); - } catch (FontException e) { + } catch (final FontException e) { /* We can't find a font for this character, so skip it. */ continue; } - float size = fontSize.floatValue(); + final float size = fontSize.floatValue(); if ((font != this.currentFont) || (size != this.currentFontSize)) { this.currentFont = font; this.currentFontSize = size; - PDFFont pdfFont = new PDFFont(pdfDoc, font); + final PDFFont pdfFont = new PDFFont(pdfDoc, font); currentStream.write("/" + pdfFont.getName() + " " + size + " Tf\n"); @@ -983,7 +990,7 @@ * @see AbstractGraphics2D#setComposite * @see AbstractGraphics2D#clip */ - public void fill(Shape s) { + public void fill(final Shape s) { // this.area.getLogger().error("fill"); Color c; c = getBackground(); @@ -994,7 +1001,7 @@ } } currentStream.write("q\n"); - Shape imclip = getClip(); + final Shape imclip = getClip(); writeClip(imclip); c = getColor(); applyColor(c, true); @@ -1003,10 +1010,10 @@ applyPaint(getPaint(), true); - PathIterator iter = s.getPathIterator(getTransform()); + final PathIterator iter = s.getPathIterator(getTransform()); while (!iter.isDone()) { - double vals[] = new double[6]; - int type = iter.currentSegment(vals); + final double vals[] = new double[6]; + final int type = iter.currentSegment(vals); switch (type) { case PathIterator.SEG_CUBICTO: currentStream.write(PSReal.doubleOut(vals[0]) + " " @@ -1043,7 +1050,8 @@ currentStream.write("Q\n"); } - protected void doDrawing(boolean fill, boolean stroke, boolean nonzero) { + protected void doDrawing(final boolean fill, final boolean stroke, + final boolean nonzero) { if (fill) { if (stroke) { if (nonzero) { @@ -1079,10 +1087,10 @@ private void initGraphicalEnvironment() { try { - BufferedImage bi = new BufferedImage(1, 1, + final BufferedImage bi = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); this.fmg = bi.createGraphics(); - } catch (LinkageError e) { + } catch (final LinkageError e) { pdfDoc.getLogger().error("Unable to create graphical " + "environment required to process SVG. Aborting."); e.printStackTrace(); @@ -1098,7 +1106,7 @@ * @see java.awt.FontMetrics * @see java.awt.Graphics#getFontMetrics() */ - public FontMetrics getFontMetrics(Font f) { + public FontMetrics getFontMetrics(final Font f) { return fmg.getFontMetrics(f); } @@ -1117,7 +1125,7 @@ * drawn twice, then all pixels are restored to their original values. * @param c1 the XOR alternation color */ - public void setXORMode(Color c1) { + public void setXORMode(final Color c1) { this.pdfDoc.getLogger().info("setXORMode"); } @@ -1141,8 +1149,8 @@ * @param dx the horizontal distance to copy the pixels. * @param dy the vertical distance to copy the pixels. */ - public void copyArea(int x, int y, int width, int height, int dx, - int dy) { + public void copyArea(final int x, final int y, final int width, + final int height, final int dx, final int dy) { this.pdfDoc.getLogger().info("copyArea"); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphicsConfiguration.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphicsConfiguration.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphicsConfiguration.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -48,8 +48,8 @@ * @param transparency the alpha value of the image * @return the new buffered image */ - public BufferedImage createCompatibleImage(int width, int height, - int transparency) { + public BufferedImage createCompatibleImage(final int width, + final int height, final int transparency) { if (transparency == Transparency.OPAQUE) { return new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); @@ -65,7 +65,8 @@ * @param height the height of the image * @return the new buffered image */ - public BufferedImage createCompatibleImage(int width, int height) { + public BufferedImage createCompatibleImage(final int width, + final int height) { return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); } @@ -74,7 +75,8 @@ * Stub implementation to get Java 5 to compile. * TODO: This needs to be implemented properly. */ - public VolatileImage createCompatibleVolatileImage(int width, int height) { + public VolatileImage createCompatibleVolatileImage(final int width, + final int height) { return null; } @@ -82,8 +84,8 @@ * Stub implementation to get Java 5 to compile. * TODO: This needs to be implemented properly. */ - public VolatileImage createCompatibleVolatileImage(int width, int height, - int transparency) { + public VolatileImage createCompatibleVolatileImage(final int width, + final int height, final int transparency) { return null; } @@ -113,7 +115,7 @@ * @param transparency the alpha value for the colour model * @return the colour model for the configuration */ - public ColorModel getColorModel(int transparency) { + public ColorModel getColorModel(final int transparency) { if (transparency == Transparency.OPAQUE) { return BI_WITHOUT_ALPHA.getColorModel(); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphicsDevice.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphicsDevice.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphicsDevice.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -40,7 +40,7 @@ * * @param gc The gc we should reference */ - PDFGraphicsDevice(PDFGraphicsConfiguration gc) { + PDFGraphicsDevice(final PDFGraphicsConfiguration gc) { this.gc = gc; } @@ -51,7 +51,7 @@ * @return the best configuration which is the only one */ public GraphicsConfiguration getBestConfiguration( - GraphicsConfigTemplate gct) { + final GraphicsConfigTemplate gct) { return gc; } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFImageElementBridge.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFImageElementBridge.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFImageElementBridge.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -73,7 +73,7 @@ */ public static class PDFJpegNode extends AbstractGraphicsNode { Graphic jpeg; - public PDFJpegNode(Graphic j) { + public PDFJpegNode(final Graphic j) { jpeg = j; } @@ -81,17 +81,17 @@ return getPrimitiveBounds(); } - public void primitivePaint(Graphics2D g2d) { + public void primitivePaint(final Graphics2D g2d) { if (g2d instanceof PDFGraphics2D) { - PDFGraphics2D pdfg = (PDFGraphics2D) g2d; + final PDFGraphics2D pdfg = (PDFGraphics2D) g2d; pdfg.setTransform(getTransform()); - float x = 0; - float y = 0; + final float x = 0; + final float y = 0; try { - float width = jpeg.pixelWidth(); - float height = jpeg.pixelHeight(); + final float width = jpeg.pixelWidth(); + final float height = jpeg.pixelHeight(); pdfg.addJpegImage(jpeg, x, y, width, height); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -105,7 +105,7 @@ try { return new Rectangle2D.Double(0, 0, jpeg.pixelWidth(), jpeg.pixelHeight()); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } return null; Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTextPainter.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTextPainter.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTextPainter.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -84,7 +84,7 @@ * @param logger A Log instance for logging user messages. * @param consumer The FontConsumer that should be used for font resolution. */ - public PDFTextPainter(Log logger, FontConsumer consumer) { + public PDFTextPainter(final Log logger, final FontConsumer consumer) { this.logger = logger; } @@ -94,8 +94,8 @@ * @param node the TextNode to paint * @param g2d the Graphics2D to use */ - public void paint(TextNode node, Graphics2D g2d) { - Point2D loc = node.getLocation(); + public void paint(final TextNode node, final Graphics2D g2d) { + final Point2D loc = node.getLocation(); /* AttributedCharacterIterator aci = @@ -109,7 +109,7 @@ return; } */ - TextNode.Anchor anchor = (TextNode.Anchor)node + final TextNode.Anchor anchor = (TextNode.Anchor)node .getAttributedCharacterIterator() .getAttribute(GVTAttributedCharacterIterator .TextAttribute.ANCHOR_TYPE); @@ -123,26 +123,27 @@ } - protected void paintTextRuns(List textRuns, Graphics2D g2d, Point2D loc) { + protected void paintTextRuns(final List textRuns, final Graphics2D g2d, + final Point2D loc) { Point2D currentloc = loc; - Iterator i = textRuns.iterator(); + final Iterator i = textRuns.iterator(); while (i.hasNext()) { - StrokingTextPainter.TextRun run = + final StrokingTextPainter.TextRun run = (StrokingTextPainter.TextRun)i.next(); currentloc = paintTextRun(run, g2d, currentloc); } } - protected Point2D paintTextRun(StrokingTextPainter.TextRun run, - Graphics2D g2d, Point2D loc) { - AttributedCharacterIterator aci = run.getACI(); + protected Point2D paintTextRun(final StrokingTextPainter.TextRun run, + final Graphics2D g2d, final Point2D loc) { + final AttributedCharacterIterator aci = run.getACI(); return paintACI(aci, g2d, loc); } - protected String getText(AttributedCharacterIterator aci) { - StringBuffer sb = new StringBuffer(aci.getEndIndex() + protected String getText(final AttributedCharacterIterator aci) { + final StringBuffer sb = new StringBuffer(aci.getEndIndex() - aci.getBeginIndex()); for (char c = aci.first(); c != CharacterIterator.DONE; c = aci.next()) { @@ -152,22 +153,22 @@ } - protected Point2D paintACI(AttributedCharacterIterator aci, Graphics2D g2d, - Point2D loc) { + protected Point2D paintACI(final AttributedCharacterIterator aci, + final Graphics2D g2d, final Point2D loc) { aci.first(); - TextNode.Anchor anchor = (TextNode.Anchor)aci.getAttribute + final TextNode.Anchor anchor = (TextNode.Anchor)aci.getAttribute (GVTAttributedCharacterIterator.TextAttribute.ANCHOR_TYPE); //Adjust position of span - Float xpos = (Float)aci.getAttribute(GVTAttributedCharacterIterator - .TextAttribute.X); - Float ypos = (Float)aci.getAttribute(GVTAttributedCharacterIterator - .TextAttribute.Y); - Float dxpos = (Float)aci.getAttribute(GVTAttributedCharacterIterator - .TextAttribute.DX); - Float dypos = (Float)aci.getAttribute(GVTAttributedCharacterIterator - .TextAttribute.DY); + final Float xpos = (Float)aci.getAttribute( + GVTAttributedCharacterIterator.TextAttribute.X); + final Float ypos = (Float)aci.getAttribute( + GVTAttributedCharacterIterator.TextAttribute.Y); + final Float dxpos = (Float)aci.getAttribute( + GVTAttributedCharacterIterator.TextAttribute.DX); + final Float dypos = (Float)aci.getAttribute( + GVTAttributedCharacterIterator.TextAttribute.DY); if (xpos != null) { loc.setLocation(xpos.doubleValue(), loc.getY()); } @@ -183,20 +184,20 @@ //Set up font - Float taFontSize = (Float)aci.getAttribute(TextAttribute.SIZE); + final Float taFontSize = (Float)aci.getAttribute(TextAttribute.SIZE); if (taFontSize == null) { return loc; } - TextPaintInfo tpi = (TextPaintInfo) aci.getAttribute( + final TextPaintInfo tpi = (TextPaintInfo) aci.getAttribute( GVTAttributedCharacterIterator.TextAttribute.PAINT_INFO); if (tpi == null) { return loc; } - Stroke stroke = tpi.strokeStroke; + final Stroke stroke = tpi.strokeStroke; g2d.setStroke(stroke); - Paint forg = (Paint)aci.getAttribute(TextAttribute.FOREGROUND); + final Paint forg = (Paint)aci.getAttribute(TextAttribute.FOREGROUND); if (forg instanceof Color) { g2d.setColor((Color)forg); } @@ -211,8 +212,8 @@ * To try to distinguish them, "awt", "fo", and "ta" prefixes are added * to local variable names. */ - Float taPosture = (Float)aci.getAttribute(TextAttribute.POSTURE); - Float taWeight = (Float)aci.getAttribute(TextAttribute.WEIGHT); + final Float taPosture = (Float)aci.getAttribute(TextAttribute.POSTURE); + final Float taWeight = (Float)aci.getAttribute(TextAttribute.WEIGHT); boolean isItalic = false; boolean isBold = false; @@ -236,22 +237,22 @@ try { this.fontToUse = getFontToUse(aci, g2d, taFontSize, isItalic, isBold); - } catch (FontException e) { + } catch (final FontException e) { e.printStackTrace(); } - String awtFontFamily = this.fontFamily; - int awtFontSize = Math.round(taFontSize.floatValue()); - java.awt.Font awtFont = new java.awt.Font(awtFontFamily, awtFontStyle, - awtFontSize); + final String awtFontFamily = this.fontFamily; + final int awtFontSize = Math.round(taFontSize.floatValue()); + final java.awt.Font awtFont = new java.awt.Font(awtFontFamily, + awtFontStyle, awtFontSize); g2d.setFont(awtFont); //Get text and paint - String txt = getText(aci); + final String txt = getText(aci); fontToUse.registerCharsUsed(txt); /* TODO: If letter-spacing is used, it needs to come from the SVG. */ - int letterSpacing = 0; - float advance = fontToUse.getFont().width(txt, awtFontSize * 1000, + final int letterSpacing = 0; + final float advance = fontToUse.getFont().width(txt, awtFontSize * 1000, letterSpacing, 0) / 1000f; float tx = 0; if (anchor != null) { @@ -274,8 +275,9 @@ * @param g2d * @param size */ - private org.axsl.fontR.FontUse getFontToUse(AttributedCharacterIterator aci, - Graphics2D g2d, Float size, boolean italic, boolean bold) + private org.axsl.fontR.FontUse getFontToUse( + final AttributedCharacterIterator aci, final Graphics2D g2d, + final Float size, final boolean italic, final boolean bold) throws FontException { org.axsl.fontR.FontUse font = null; int style = Font.FONT_STYLE_NORMAL; @@ -286,13 +288,13 @@ if (bold) { weight = org.axsl.fontR.Font.FONT_WEIGHT_BOLD; } - List gvtFonts = (List)aci.getAttribute(GVTAttributedCharacterIterator - .TextAttribute.GVT_FONT_FAMILIES); + final List gvtFonts = (List)aci.getAttribute( + GVTAttributedCharacterIterator.TextAttribute.GVT_FONT_FAMILIES); - int fsize = (int)size.floatValue(); + final int fsize = (int)size.floatValue(); if (gvtFonts != null) { - for (Iterator i = gvtFonts.iterator(); i.hasNext(); ) { - GVTFontFamily fam = (GVTFontFamily)i.next(); + for (final Iterator i = gvtFonts.iterator(); i.hasNext(); ) { + final GVTFontFamily fam = (GVTFontFamily)i.next(); this.fontFamily = fam.getFamilyName(); font = this.fontConsumer.selectFontCSS( FontUtility.foFontFamily(this.fontFamily), @@ -319,56 +321,55 @@ return font; } - public Mark getMark(TextNode node, int pos, boolean all) { + public Mark getMark(final TextNode node, final int pos, final boolean all) { logger.info("PDFText getMark"); return null; } - public Mark selectAt(double x, double y, - TextNode node) { + public Mark selectAt(final double x, final double y, final TextNode node) { logger.info("PDFText selectAt"); return null; } - public Mark selectTo(double x, double y, Mark beginMark) { + public Mark selectTo(final double x, final double y, final Mark beginMark) { logger.info("PDFText selectTo"); return null; } - public Mark selectAll(double x, double y, TextNode node) { + public Mark selectAll(final double x, final double y, final TextNode node) { logger.info("PDFText selectAll"); return null; } - public Mark selectFirst(TextNode node) { + public Mark selectFirst(final TextNode node) { logger.info("PDFText selectFirst"); return null; } - public Mark selectLast(TextNode node) { + public Mark selectLast(final TextNode node) { logger.info("PDFText selectLast"); return null; } - public int[] getSelected(Mark start, Mark finish) { + public int[] getSelected(final Mark start, final Mark finish) { logger.info("PDFText getSelected"); return null; } - public Shape getHighlightShape(Mark beginMark, Mark endMark) { + public Shape getHighlightShape(final Mark beginMark, final Mark endMark) { logger.info("PDFText getHighlightShape"); return null; } - public Rectangle2D getBounds2D(TextNode node) { + public Rectangle2D getBounds2D(final TextNode node) { return PROXY_PAINTER.getBounds2D(node); } - public Rectangle2D getGeometryBounds(TextNode node) { + public Rectangle2D getGeometryBounds(final TextNode node) { return PROXY_PAINTER.getGeometryBounds(node); } - public Shape getOutline(TextNode node) { + public Shape getOutline(final TextNode node) { return PROXY_PAINTER.getOutline(node); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTranscoder.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTranscoder.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTranscoder.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -114,7 +114,8 @@ * application using the Transcoder is "XYZ System", the appName might be * "XYZ". */ - public PDFTranscoder(String appName, FontUse font, int fontSize) { + public PDFTranscoder(final String appName, final FontUse font, + final int fontSize) { hints.put(KEY_DOCUMENT_ELEMENT_NAMESPACE_URI, SVGConstants.SVG_NAMESPACE_URI); hints.put(KEY_DOCUMENT_ELEMENT, SVGConstants.SVG_SVG_TAG); @@ -133,15 +134,15 @@ * @param output the ouput where to transcode * @exception TranscoderException if an error occured while transcoding */ - protected void transcode(Document document, String uri, - TranscoderOutput output) throws TranscoderException { + protected void transcode(final Document document, final String uri, + final TranscoderOutput output) throws TranscoderException { if (!(document instanceof SVGOMDocument)) { throw new TranscoderException(Messages.formatMessage("notsvg", null)); } - SVGDocument svgDoc = (SVGDocument)document; - SVGSVGElement root = svgDoc.getRootElement(); + final SVGDocument svgDoc = (SVGDocument)document; + final SVGSVGElement root = svgDoc.getRootElement(); // initialize the SVG document with the appropriate context boolean stroke = true; @@ -156,21 +157,21 @@ textPainter = new StrokingTextPainter(); ctx.setTextPainter(textPainter); - PDFAElementBridge pdfAElementBridge = new PDFAElementBridge(); - AffineTransform currentTransform = new AffineTransform(1, 0, 0, 1, 0, - 0); + final PDFAElementBridge pdfAElementBridge = new PDFAElementBridge(); + final AffineTransform currentTransform = new AffineTransform(1, 0, 0, + 1, 0, 0); pdfAElementBridge.setCurrentTransform(currentTransform); ctx.putBridge(pdfAElementBridge); ctx.putBridge(new PDFImageElementBridge()); GraphicsNode gvtRoot; try { gvtRoot = builder.build(ctx, svgDoc); - } catch (BridgeException ex) { + } catch (final BridgeException ex) { throw new TranscoderException(ex); } // get the 'width' and 'height' attributes of the SVG document - float docWidth = (float)ctx.getDocumentSize().getWidth(); - float docHeight = (float)ctx.getDocumentSize().getHeight(); + final float docWidth = (float)ctx.getDocumentSize().getWidth(); + final float docHeight = (float)ctx.getDocumentSize().getHeight(); ctx = null; builder = null; @@ -204,22 +205,22 @@ String ref = null; try { ref = URLFactory.createURL(uri).getRef(); - } catch (MalformedURLException ex) { + } catch (final MalformedURLException ex) { // nothing to do, catched previously } try { Px = ViewBox.getViewTransform(ref, root, width, height); - } catch (BridgeException ex) { + } catch (final BridgeException ex) { throw new TranscoderException(ex); } if (Px.isIdentity() && (width != docWidth || height != docHeight)) { // The document has no viewBox, we need to resize it by hand. // we want to keep the document size ratio - float d = Math.max(docWidth, docHeight); - f... [truncated message content] |
|
From: <vic...@us...> - 2006-07-23 19:48:20
|
Revision: 7821 Author: victormote Date: 2006-07-23 12:48:10 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7821&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-output/src/java/org/foray/output/Converter.java trunk/foray/foray-output/src/java/org/foray/output/MIFConverter.java trunk/foray/foray-output/src/java/org/foray/output/OutputConfig.java trunk/foray/foray-output/src/java/org/foray/output/OutputTarget.java Modified: trunk/foray/foray-output/src/java/org/foray/output/Converter.java =================================================================== --- trunk/foray/foray-output/src/java/org/foray/output/Converter.java 2006-07-23 19:47:59 UTC (rev 7820) +++ trunk/foray/foray-output/src/java/org/foray/output/Converter.java 2006-07-23 19:48:10 UTC (rev 7821) @@ -35,7 +35,7 @@ /** * */ - public Converter(Log logger, OutputConfig outputConfig) { + public Converter(final Log logger, final OutputConfig outputConfig) { super(logger, outputConfig); } Modified: trunk/foray/foray-output/src/java/org/foray/output/MIFConverter.java =================================================================== --- trunk/foray/foray-output/src/java/org/foray/output/MIFConverter.java 2006-07-23 19:47:59 UTC (rev 7820) +++ trunk/foray/foray-output/src/java/org/foray/output/MIFConverter.java 2006-07-23 19:48:10 UTC (rev 7821) @@ -74,35 +74,36 @@ /** * create the MIF renderer */ - public MIFConverter(Log logger, OutputConfig outputConfig) { + public MIFConverter(final Log logger, final OutputConfig outputConfig) { super(logger, outputConfig); } - public void convert(Table table) { + public void convert(final Table table) { this.mifDoc.createTable(); // this.inTable = true; } - public void convert(TableBody tableBody) { + public void convert(final TableBody tableBody) { this.mifDoc.setCurrent("fo:table-body"); } - public void convert(TableRow row) { + public void convert(final TableRow row) { this.mifDoc.startRow(); } - public void convert(TableColumn column) { + public void convert(final TableColumn column) { // int colWidth = column.getComputedColumnWidth(); // this.mifDoc.setColumnProp(colWidth); } - public void render(TableCell cell) { - int rowSpan = cell.traitNumberRowsSpanned(); - int colSpan = cell.traitNumberColumnsSpanned(); + public void render(final TableCell cell) { + final int rowSpan = cell.traitNumberRowsSpanned(); + final int colSpan = cell.traitNumberColumnsSpanned(); this.mifDoc.startCell(rowSpan, colSpan); } - protected void addFilledRect(int x, int y, int w, int h, Color col) { + protected void addFilledRect(final int x, final int y, final int w, + final int h, final Color col) { } // protected void markBorder(Area area) { @@ -157,9 +158,9 @@ /** * render the given block area */ - public void render(Block block) { - FOContext context = null; - int containingIPD = 1; + public void render(final Block block) { + final FOContext context = null; + final int containingIPD = 1; this.mifDoc.setBlockProp(block.traitStartIndent(context, containingIPD), block.traitEndIndent(context, containingIPD)); } Modified: trunk/foray/foray-output/src/java/org/foray/output/OutputConfig.java =================================================================== --- trunk/foray/foray-output/src/java/org/foray/output/OutputConfig.java 2006-07-23 19:47:59 UTC (rev 7820) +++ trunk/foray/foray-output/src/java/org/foray/output/OutputConfig.java 2006-07-23 19:48:10 UTC (rev 7821) @@ -42,7 +42,7 @@ */ public class OutputConfig extends Configuration { - public OutputConfig(Log logger) { + public OutputConfig(final Log logger) { super(logger); } @@ -56,7 +56,7 @@ protected void setDefaults() { put("at-sparse", Boolean.FALSE, PRECEDENCE_DEFAULT); - List streamFilterList = new ArrayList(2); + final List streamFilterList = new ArrayList(2); streamFilterList.add("flate"); streamFilterList.add("ascii-85"); put("pdf-filters", streamFilterList, PRECEDENCE_DEFAULT); @@ -71,20 +71,21 @@ put("txt-encoding", "UTF-8", PRECEDENCE_DEFAULT); } - public boolean parseOption(String key, String value, int precedenceValue) { + public boolean parseOption(final String key, final String value, + final int precedenceValue) { if (key.equals("at-sparse") || key.equals("pdf-user-print") || key.equals("pdf-user-copy") || key.equals("pdf-user-modify") || key.equals("pdf-user-annotate")) { // Boolean value. - Boolean booleanValue = this.parseBoolean(key, value); + final Boolean booleanValue = this.parseBoolean(key, value); put(key, booleanValue, precedenceValue); return true; } if (key.equals("pdf-filters")) { // Space-delimited List. - ArrayList list = parseSpaceDelimitedList(key, value); + final ArrayList list = parseSpaceDelimitedList(key, value); put(key, list, precedenceValue); return true; } Modified: trunk/foray/foray-output/src/java/org/foray/output/OutputTarget.java =================================================================== --- trunk/foray/foray-output/src/java/org/foray/output/OutputTarget.java 2006-07-23 19:47:59 UTC (rev 7820) +++ trunk/foray/foray-output/src/java/org/foray/output/OutputTarget.java 2006-07-23 19:48:10 UTC (rev 7821) @@ -49,7 +49,7 @@ /** * */ - public OutputTarget(Log logger, OutputConfig outputConfig) { + public OutputTarget(final Log logger, final OutputConfig outputConfig) { this.logger = logger; this.options = outputConfig; } @@ -66,7 +66,7 @@ return this.fontConsumer; } - public void setOutputStream(OutputStream stream) { + public void setOutputStream(final OutputStream stream) { this.outputStream = stream; } @@ -92,7 +92,7 @@ /** * {@inheritDoc} */ - public void setApplicationName(String applicationName) { + public void setApplicationName(final String applicationName) { this.applicationName = applicationName; } @@ -109,7 +109,7 @@ /** * {@inheritDoc} */ - public void setApplicationNameShort(String applicationNameShort) { + public void setApplicationNameShort(final String applicationNameShort) { this.applicationNameShort = applicationNameShort; } @@ -124,7 +124,7 @@ /** * {@inheritDoc} */ - public void setApplicationVersion(String applicationVersion) { + public void setApplicationVersion(final String applicationVersion) { this.applicationVersion = applicationVersion; } @@ -140,11 +140,11 @@ /** * {@inheritDoc} */ - public void setDeveloperURLShort(String developerURLShort) { + public void setDeveloperURLShort(final String developerURLShort) { this.developerURLShort = developerURLShort; } - public void setStrokeSVGText(boolean stroke) { + public void setStrokeSVGText(final boolean stroke) { this.strokeSVGText = stroke; } @@ -159,7 +159,7 @@ /** * @param fontConsumer The fontConsumer to set. */ - public void setFontConsumer(FontConsumer fontConsumer) { + public void setFontConsumer(final FontConsumer fontConsumer) { this.fontConsumer = fontConsumer; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-23 19:48:08
|
Revision: 7820 Author: victormote Date: 2006-07-23 12:47:59 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7820&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-mif/src/java/org/foray/mif/MIFDocument.java Modified: trunk/foray/foray-mif/src/java/org/foray/mif/MIFDocument.java =================================================================== --- trunk/foray/foray-mif/src/java/org/foray/mif/MIFDocument.java 2006-07-23 19:39:14 UTC (rev 7819) +++ trunk/foray/foray-mif/src/java/org/foray/mif/MIFDocument.java 2006-07-23 19:47:59 UTC (rev 7820) @@ -52,9 +52,9 @@ private ID curIDCounter = new ID(); private Log logger; - public static final String MIFEncode(String val) { - int len = val.length(); - StringBuffer buf = new StringBuffer(len * 2); + public static final String MIFEncode(final String val) { + final int len = val.length(); + final StringBuffer buf = new StringBuffer(len * 2); char c; for(int i = 0; i < len; i++) { @@ -133,11 +133,11 @@ protected int width; public Document() {} - public void output(OutputStream stream) throws IOException { + public void output(final OutputStream stream) throws IOException { - String mif = "\n<Document " + "\n<DPageSize " + width / 1000f + final String mif = "\n<Document " + "\n<DPageSize " + width / 1000f + " " + height / 1000f + " >\n>"; - byte buf[] = mif.getBytes(); + final byte buf[] = mif.getBytes(); stream.write(buf); @@ -157,7 +157,8 @@ private String url; private int x, y, w, h; - public ImportObject(String url, int x, int y, int w, int h) { + public ImportObject(final String url, final int x, final int y, + final int w, final int h) { this.url = url; this.x = x; @@ -168,9 +169,7 @@ } - public void output(OutputStream stream) throws IOException { - - + public void output(final OutputStream stream) throws IOException { String path = this.url; // Strip 'file:' @@ -207,24 +206,20 @@ private int ID; private int x, y, w, h; ArrayList content = new ArrayList(); - public Frame(int x, int y, int w, int h) { + public Frame(final int x, final int y, final int w, final int h) { this.ID = curIDCounter.getnewID(); this.x = x; this.y = y; this.w = w; this.h = h; - } - public void addContent(ImportObject obj) { - + public void addContent(final ImportObject obj) { content.add(obj); - } - public void output(OutputStream stream) throws IOException { - + public void output(final OutputStream stream) throws IOException { String mif = "\n<Frame" + "\n\t<ID " + this.ID + " >"; mif += EOL + TAB + "<Pen 15>" + EOL @@ -276,25 +271,19 @@ private int curCol = 0; // Current column being processed private int colGap = 0; private int textRectID; - public TextRect(int numCols) { + public TextRect(final int numCols) { this.numCols = numCols; this.curCol = 0; this.textRectID = curIDCounter.getnewID(); - } - public int getTextRectID() { - return textRectID; - } - - public void setTextRectProp(int left, int top, int width, - int height) { - + public void setTextRectProp(final int left, final int top, + final int width, final int height) { if (curCol == 0) { // Use the left and top margins @@ -318,7 +307,7 @@ } - public void output(OutputStream stream) throws IOException { + public void output(final OutputStream stream) throws IOException { String mif = "\n<TextRect" + "\n\t<ID " + textRectID + ">" + "\n\t<ShapeRect " + rx / 1000f + " " + ry / 1000f @@ -330,7 +319,7 @@ } mif += "\n> #End TextRect"; - byte buf[] = mif.getBytes(); + final byte buf[] = mif.getBytes(); stream.write(buf); } @@ -341,7 +330,8 @@ private String pageBackground; private ArrayList textRects; - public Page(String pageType, String pageTag, String pageBackground) { + public Page(final String pageType, final String pageTag, + final String pageBackground) { this.pageType = pageType; this.pageBackground = pageBackground; this.textRects = new ArrayList(); @@ -353,15 +343,15 @@ this.textRects = new ArrayList(); } - public void addTextRect(int numCols) { - TextRect textRect = new TextRect(numCols); + public void addTextRect(final int numCols) { + final TextRect textRect = new TextRect(numCols); this.textRects.add(textRect); } public TextRect curTextRect() { //temporary fix for NoSuchElementException if (textRects.isEmpty()) { - TextRect textRect = new TextRect(1); + final TextRect textRect = new TextRect(1); this.textRects.add(textRect); } return (TextRect)textRects.get(textRects.size() - 1); @@ -369,11 +359,11 @@ - public void output(OutputStream stream) throws IOException { + public void output(final OutputStream stream) throws IOException { String mif = "\n<Page" + "\n\t<PageType " + pageType + ">" + "\n\t<PageBackground " + "`" + pageBackground + "'" + ">"; - byte buf[] = mif.getBytes(); + final byte buf[] = mif.getBytes(); stream.write(buf); for (int i = 0; i < textRects.size(); i++) { ((TextRect)textRects.get(i)).output(stream); @@ -425,7 +415,7 @@ this.paras.add(new Para(ID)); } - public void output(OutputStream stream) throws IOException { + public void output(final OutputStream stream) throws IOException { String mif = "\n<TextFlow"; stream.write(mif.getBytes()); for (int i = 0; i < paras.size(); i++) { @@ -450,7 +440,7 @@ } - public Para(int ID) { + public Para(final int ID) { this.ID = ID; this.paraLines = new ArrayList(); @@ -471,7 +461,8 @@ } - public void setBlockProp(int startIndent, int endIndent) { + public void setBlockProp(final int startIndent, + final int endIndent) { pgf = new ParagraphFormat(); pgf.startIndent = startIndent; @@ -481,7 +472,7 @@ } - public void output(OutputStream stream) throws IOException { + public void output(final OutputStream stream) throws IOException { String mif = "\n<Para"; // Is there a block property? @@ -508,7 +499,7 @@ int textRectID; String tableID; String aFrameID; - public ParaLine(int textRectID) { + public ParaLine(final int textRectID) { this.textRectID = textRectID; this.content = new ArrayList(); @@ -521,13 +512,13 @@ this.content = new ArrayList(); } - public void addContent(Object obj) { + public void addContent(final Object obj) { this.content.add(obj); } - public void output(OutputStream stream) throws IOException { + public void output(final OutputStream stream) throws IOException { String mif = "\n<ParaLine"; @@ -537,7 +528,7 @@ } stream.write(mif.getBytes()); for (int i = 0; i < content.size(); i++) { - Object elem = content.get(i); + final Object elem = content.get(i); if (elem instanceof String) { // Output newlines as char hard return if (elem == "\n") { @@ -566,8 +557,8 @@ ArrayList pgfs; // Paragraph formats public PgfCatalog() {} - public void output(OutputStream stream) throws IOException { - String mif = "\n<PgfCatalog" + "\n<Pgf" + "\n<PgfTag `Body'>" + public void output(final OutputStream stream) throws IOException { + final String mif = "\n<PgfCatalog" + "\n<Pgf" + "\n<PgfTag `Body'>" + "\n>" + "\n>"; stream.write(mif.getBytes()); } @@ -600,7 +591,7 @@ } - public void output(OutputStream stream) throws IOException { + public void output(final OutputStream stream) throws IOException { String mif = "\n<Ruling \n<RulingTag `Default'>"; mif += "\n<RulingPenWidth " + penWidth + ">"; @@ -624,7 +615,7 @@ } - public void output(OutputStream stream) throws IOException { + public void output(final OutputStream stream) throws IOException { String mif = "\n<RulingCatalog"; stream.write(mif.getBytes()); @@ -652,15 +643,15 @@ class TblColumn { private int width; - public TblColumn(int width) { + public TblColumn(final int width) { this.width = width; } - public void output(OutputStream stream) throws IOException { + public void output(final OutputStream stream) throws IOException { - String mif = "\n\t<TblColumnWidth " + width + " >"; + final String mif = "\n\t<TblColumnWidth " + width + " >"; stream.write(mif.getBytes()); } @@ -673,7 +664,7 @@ class Cell { private ArrayList paras; // Paras - public Cell(int rowSpan, int colSpan) { + public Cell(final int rowSpan, final int colSpan) { paras = new ArrayList(); } @@ -681,7 +672,8 @@ this.paras.add(new Para()); } - public void output(OutputStream stream) throws IOException { + public void output(final OutputStream stream) + throws IOException { String mif = "\n\t\t<Cell" + "\n\t\t<CellContent"; stream.write(mif.getBytes()); for (int i = 0; i < paras.size(); i++) { @@ -695,7 +687,7 @@ private ArrayList cells; - public void addCell(int rowSpan, int colSpan) { + public void addCell(final int rowSpan, final int colSpan) { cells.add(new Cell(rowSpan, colSpan)); } @@ -707,7 +699,7 @@ return (Cell)this.cells.get(cells.size() - 1); } - public void output(OutputStream stream) throws IOException { + public void output(final OutputStream stream) throws IOException { String mif = "\n\t<Row"; stream.write(mif.getBytes()); for (int i = 0; i < cells.size(); i++) { @@ -723,13 +715,13 @@ private ArrayList tblBody, tblHead, tblFoot; /* is a reference to one of tblHead,tblBody or tblFoot */ private ArrayList current; - public void addColumn(int colWidth) { + public void addColumn(final int colWidth) { tblColumns.add(new TblColumn(colWidth)); } - public void setCurrent(String current) { + public void setCurrent(final String current) { if (current == "fo:table-body") { this.current = this.tblBody; @@ -744,7 +736,7 @@ this.current.add(new Row()); } - public void startCell(int rowSpan, int colSpan) { + public void startCell(final int rowSpan, final int colSpan) { // Add a cell into the current row ((Row)this.current.get(current.size() - 1)).addCell(rowSpan, colSpan); @@ -766,8 +758,8 @@ public Para curPara() { // Return the last para of the current cell - Row curRow = (Row)this.current.get(current.size() - 1); - ArrayList paras = curRow.curCell().paras; + final Row curRow = (Row)this.current.get(current.size() - 1); + final ArrayList paras = curRow.curCell().paras; return (Para)paras.get(paras.size() - 1); } @@ -780,7 +772,7 @@ } - public void output(OutputStream stream) throws IOException { + public void output(final OutputStream stream) throws IOException { String mif = "\n<Tbl" + "\n\t<TblID " + ID + " >"; @@ -867,8 +859,9 @@ } - public Frame createFrame(int x, int y, int w, int h) { - Frame frame = new Frame(x, y, w, h); + public Frame createFrame(final int x, final int y, final int w, + final int h) { + final Frame frame = new Frame(x, y, w, h); aFrames.add(frame); return frame; } @@ -883,7 +876,7 @@ public Tbl createTable() { - Tbl table = new Tbl(); + final Tbl table = new Tbl(); tables.add(table); return table; } @@ -893,7 +886,7 @@ return (Tbl)tables.get(tables.size() - 1); } - public void output(OutputStream stream) throws IOException { + public void output(final OutputStream stream) throws IOException { String mif = "<MIFFile 5.00>" + "\n<Units Upt>"; stream.write(mif.getBytes()); pgfCatalog.output(stream); @@ -943,7 +936,7 @@ /** * creates an empty MIF document */ - public MIFDocument(Log logger) { + public MIFDocument(final Log logger) { this.logger = logger; bookComponent = new BookComponent(); } @@ -954,19 +947,19 @@ } - public void addToStream(String s) { + public void addToStream(final String s) { // Add this string to the curent flow - Para para = curFlow.curPara(); - ParaLine paraLine = para.curParaLine(); + final Para para = curFlow.curPara(); + final ParaLine paraLine = para.curParaLine(); paraLine.addContent(s); } - public void output(OutputStream stream) throws IOException { + public void output(final OutputStream stream) throws IOException { // Output the contents of bookComponent this.bookComponent.output(stream); } - public void setDocumentHeightWidth(int height, int width) { + public void setDocumentHeightWidth(final int height, final int width) { if (bookComponent.document == null) { bookComponent.document = new Document(); bookComponent.document.height = height; @@ -978,7 +971,7 @@ } } - public void createTextRect(int numCols) { + public void createTextRect(final int numCols) { // Create a textrect on the bodypage with these dimensions // This default behaviour will later be changed to reflect on // the master-page @@ -989,7 +982,8 @@ bookComponent.textFlows.add(curFlow); } - public void setTextRectProp(int left, int top, int width, int height) { + public void setTextRectProp(final int left, final int top, final int width, + final int height) { (bookComponent.curPage()).curTextRect().setTextRectProp(left, top, width, height); } @@ -1003,19 +997,21 @@ } } - public void setBlockProp(int startIndent, int endIndent) { + public void setBlockProp(final int startIndent, final int endIndent) { curFlow.startPara(); // Start a para curFlow.curPara().setBlockProp(startIndent, endIndent); } - public void createFrame(int x, int y, int w, int h) { + public void createFrame(final int x, final int y, final int w, + final int h) { // Create a new anchored frame bookComponent.createFrame(x, y, w, h); } - public void addImage(String url, int x, int y, int w, int h) { - Frame frame = bookComponent.createFrame(x, y, w, h); - ImportObject imageObject = new ImportObject(url, 0, 0, w, h); + public void addImage(final String url, final int x, final int y, + final int w, final int h) { + final Frame frame = bookComponent.createFrame(x, y, w, h); + final ImportObject imageObject = new ImportObject(url, 0, 0, w, h); frame.addContent(imageObject); if (curFlow.curPara().curParaLine() == null) { curFlow.curPara().startParaLine(); @@ -1025,7 +1021,7 @@ public void createTable() { // First create a table with an ID, then add it to the textflow - Tbl table = bookComponent.createTable(); + final Tbl table = bookComponent.createTable(); if (curFlow.curPara().curParaLine() == null) { curFlow.curPara().startParaLine(); } @@ -1038,25 +1034,25 @@ curFlow = table; } - public void setColumnProp(int colWidth) { + public void setColumnProp(final int colWidth) { // Get the current table - Tbl table = bookComponent.curTable(); + final Tbl table = bookComponent.curTable(); table.addColumn(colWidth); } - public void setCurrent(String current) { + public void setCurrent(final String current) { // Start the table body or header or footer - Tbl table = bookComponent.curTable(); + final Tbl table = bookComponent.curTable(); table.setCurrent(current); } public void startRow() { - Tbl table = bookComponent.curTable(); + final Tbl table = bookComponent.curTable(); table.startRow(); } - public void startCell(int rowSpan, int colSpan) { - Tbl table = bookComponent.curTable(); + public void startCell(final int rowSpan, final int colSpan) { + final Tbl table = bookComponent.curTable(); table.startCell(rowSpan, colSpan); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-23 19:39:18
|
Revision: 7819 Author: victormote Date: 2006-07-23 12:39:14 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7819&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-layout/src/java/org/foray/layout/LayoutStrategy.java Modified: trunk/foray/foray-layout/src/java/org/foray/layout/LayoutStrategy.java =================================================================== --- trunk/foray/foray-layout/src/java/org/foray/layout/LayoutStrategy.java 2006-07-23 19:36:26 UTC (rev 7818) +++ trunk/foray/foray-layout/src/java/org/foray/layout/LayoutStrategy.java 2006-07-23 19:39:14 UTC (rev 7819) @@ -66,14 +66,14 @@ /** * Constructor. */ - public LayoutStrategy(Log logger) { + public LayoutStrategy(final Log logger) { this.logger = logger; } /** * {@inheritDoc} */ - public void formatPageSequence(PageCollection pageCollection) + public void formatPageSequence(final PageCollection pageCollection) throws AreaWException { if (areaTree == null) { areaTree = pageCollection.getWritableAreaTree(); @@ -98,22 +98,22 @@ public abstract void layoutStaticContent(PageSequence pageSequence, Region region, RegionArea area) throws AreaWException; - public void handleLineBreakText(LineOutput lineOutput, LineText text, - int startOffset, int sizeInChars, int sizeInline, - boolean hasDiscretionaryHyphen, boolean hasFauxSmallCaps, - boolean isLastItemOnLine) + public void handleLineBreakText(final LineOutput lineOutput, + LineText text, final int startOffset, final int sizeInChars, + final int sizeInline, final boolean hasDiscretionaryHyphen, + final boolean hasFauxSmallCaps, final boolean isLastItemOnLine) throws TextException { checkLayoutTarget(lineOutput); - LineArea lineArea = (LineArea) lineOutput; + final LineArea lineArea = (LineArea) lineOutput; RetrieveMarker retrieveMarker = null; if (text instanceof org.axsl.foR.FOLineText) { - FOLineText foLineText = (FOLineText) text; + final FOLineText foLineText = (FOLineText) text; retrieveMarker = foLineText.getRetrieveMarker(); text = foLineText.getWrapped(); } if (text instanceof FOText) { - FOText foText = (FOText) text; + final FOText foText = (FOText) text; lineArea.makeTextArea(foText, sizeInline, startOffset, sizeInChars, hasDiscretionaryHyphen, hasFauxSmallCaps, isLastItemOnLine, retrieveMarker); @@ -122,39 +122,39 @@ } } - public void handleLineBreakNonText(LineOutput lineOutput, - LineNonText nonText, int sizeInline) + public void handleLineBreakNonText(final LineOutput lineOutput, + LineNonText nonText, final int sizeInline) throws TextException { checkLayoutTarget(lineOutput); - LineArea lineArea = (LineArea) lineOutput; + final LineArea lineArea = (LineArea) lineOutput; RetrieveMarker retrieveMarker = null; if (nonText instanceof org.axsl.foR.FOLineNonText) { - FOLineNonText foLineNonText = (FOLineNonText) nonText; + final FOLineNonText foLineNonText = (FOLineNonText) nonText; retrieveMarker = foLineNonText.getRetrieveMarker(); nonText = foLineNonText.getWrapped(); } if (nonText instanceof InstreamForeignObject) { - InstreamForeignObject ifo = (InstreamForeignObject) nonText; + final InstreamForeignObject ifo = (InstreamForeignObject) nonText; lineArea.makeForeignObjectArea(ifo, sizeInline, retrieveMarker); } else if (nonText instanceof ExternalGraphic) { - ExternalGraphic graphic = (ExternalGraphic) nonText; + final ExternalGraphic graphic = (ExternalGraphic) nonText; lineArea.makeExternalGraphicArea(graphic, sizeInline, retrieveMarker); } else if (nonText instanceof Leader) { - Leader leader = (Leader) nonText; + final Leader leader = (Leader) nonText; lineArea.makeLeaderArea(leader, sizeInline, retrieveMarker); } else if (nonText instanceof PageNumberCitation) { - PageNumberCitation citation = (PageNumberCitation) nonText; + final PageNumberCitation citation = (PageNumberCitation) nonText; lineArea.makePageNumberCitationArea(citation, sizeInline, retrieveMarker); } else if (nonText instanceof PageNumber) { - PageNumber pageNumber = (PageNumber) nonText; + final PageNumber pageNumber = (PageNumber) nonText; lineArea.makePageNumberArea(pageNumber, sizeInline, retrieveMarker); } } - private void checkLayoutTarget(LineOutput lineOutput) + private void checkLayoutTarget(final LineOutput lineOutput) throws TextException { if (! (lineOutput instanceof LineArea)) { throw new TextException("Line-breaking layout target must be " @@ -169,11 +169,11 @@ /** * Formats the static content of the current page. */ - public void formatStaticContent(PageArea pageArea) + public void formatStaticContent(final PageArea pageArea) throws AreaWException { - PageCollection areaTree = pageArea.getWritablePageCollection(); - PageSequence pageSeq = areaTree.getPageSequence(); - SimplePageMaster simpleMaster = pageArea.getPageMaster(); + final PageCollection areaTree = pageArea.getWritablePageCollection(); + final PageSequence pageSeq = areaTree.getPageSequence(); + final SimplePageMaster simpleMaster = pageArea.getPageMaster(); // region-before layoutStaticContent(pageSeq, simpleMaster.getRegionBefore(), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-23 19:36:41
|
Revision: 7818 Author: victormote Date: 2006-07-23 12:36:26 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7818&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-hyphen-r/.project trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/ByteVector.java trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/CharVector.java trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/Hyphen.java trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/Hyphenation.java trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/PatternParser.java trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/SerializeHyphPattern.java trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/TernaryTree.java Modified: trunk/foray/foray-hyphen-r/.project =================================================================== --- trunk/foray/foray-hyphen-r/.project 2006-07-23 19:16:06 UTC (rev 7817) +++ trunk/foray/foray-hyphen-r/.project 2006-07-23 19:36:26 UTC (rev 7818) @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> <projectDescription> - <name>FOrayHyphenR</name> + <name>FOrayHyphen-R</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> <arguments> </arguments> </buildCommand> Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/ByteVector.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/ByteVector.java 2006-07-23 19:16:06 UTC (rev 7817) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/ByteVector.java 2006-07-23 19:36:26 UTC (rev 7818) @@ -55,7 +55,7 @@ this(DEFAULT_BLOCK_SIZE); } - public ByteVector(int capacity) { + public ByteVector(final int capacity) { if (capacity > 0) { BLOCK_SIZE = capacity; } else { @@ -65,13 +65,13 @@ n = 0; } - public ByteVector(byte[] a) { + public ByteVector(final byte[] a) { BLOCK_SIZE = DEFAULT_BLOCK_SIZE; array = a; n = 0; } - public ByteVector(byte[] a, int capacity) { + public ByteVector(final byte[] a, final int capacity) { if (capacity > 0) { BLOCK_SIZE = capacity; } else { @@ -99,22 +99,22 @@ return array.length; } - public void put(int index, byte val) { + public void put(final int index, final byte val) { array[index] = val; } - public byte get(int index) { + public byte get(final int index) { return array[index]; } /** * This is to implement memory allocation in the array. Like malloc(). */ - public int alloc(int size) { - int index = n; - int len = array.length; + public int alloc(final int size) { + final int index = n; + final int len = array.length; if (n + size >= len) { - byte[] aux = new byte[len + BLOCK_SIZE]; + final byte[] aux = new byte[len + BLOCK_SIZE]; System.arraycopy(array, 0, aux, 0, len); array = aux; } @@ -124,7 +124,7 @@ public void trimToSize() { if (n < array.length) { - byte[] aux = new byte[n]; + final byte[] aux = new byte[n]; System.arraycopy(array, 0, aux, 0, n); array = aux; } Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/CharVector.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/CharVector.java 2006-07-23 19:16:06 UTC (rev 7817) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/CharVector.java 2006-07-23 19:36:26 UTC (rev 7818) @@ -55,7 +55,7 @@ this(DEFAULT_BLOCK_SIZE); } - public CharVector(int capacity) { + public CharVector(final int capacity) { if (capacity > 0) { BLOCK_SIZE = capacity; } else { @@ -65,13 +65,13 @@ n = 0; } - public CharVector(char[] a) { + public CharVector(final char[] a) { BLOCK_SIZE = DEFAULT_BLOCK_SIZE; array = a; n = a.length; } - public CharVector(char[] a, int capacity) { + public CharVector(final char[] a, final int capacity) { if (capacity > 0) { BLOCK_SIZE = capacity; } else { @@ -89,7 +89,7 @@ } public Object clone() { - CharVector cv = new CharVector((char[])array.clone(), BLOCK_SIZE); + final CharVector cv = new CharVector((char[])array.clone(), BLOCK_SIZE); cv.n = this.n; return cv; } @@ -112,19 +112,19 @@ return array.length; } - public void put(int index, char val) { + public void put(final int index, final char val) { array[index] = val; } - public char get(int index) { + public char get(final int index) { return array[index]; } - public int alloc(int size) { - int index = n; - int len = array.length; + public int alloc(final int size) { + final int index = n; + final int len = array.length; if (n + size >= len) { - char[] aux = new char[len + BLOCK_SIZE]; + final char[] aux = new char[len + BLOCK_SIZE]; System.arraycopy(array, 0, aux, 0, len); array = aux; } @@ -134,7 +134,7 @@ public void trimToSize() { if (n < array.length) { - char[] aux = new char[n]; + final char[] aux = new char[n]; System.arraycopy(array, 0, aux, 0, n); array = aux; } Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/Hyphen.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/Hyphen.java 2006-07-23 19:16:06 UTC (rev 7817) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/Hyphen.java 2006-07-23 19:36:26 UTC (rev 7818) @@ -46,13 +46,13 @@ public String noBreak; public String postBreak; - Hyphen(String pre, String no, String post) { + Hyphen(final String pre, final String no, final String post) { preBreak = pre; noBreak = no; postBreak = post; } - Hyphen(String pre) { + Hyphen(final String pre) { preBreak = pre; noBreak = null; postBreak = null; @@ -65,7 +65,7 @@ && preBreak.equals("-")) { return "-"; } - StringBuffer res = new StringBuffer("{"); + final StringBuffer res = new StringBuffer("{"); res.append(preBreak); res.append("}{"); res.append(postBreak); Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/Hyphenation.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/Hyphenation.java 2006-07-23 19:16:06 UTC (rev 7817) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/Hyphenation.java 2006-07-23 19:36:26 UTC (rev 7818) @@ -44,7 +44,7 @@ /* Always store the weights using the Liang weights. */ private byte[] hyphenValues; - Hyphenation(String word, int[] points, byte[] values) { + Hyphenation(final String word, final int[] points, final byte[] values) { this.word = word; this.hyphenPoints = points; this.hyphenValues = values; @@ -71,12 +71,12 @@ if (this.hyphenValues == null) { return null; } - byte[] returnArray = new byte[this.hyphenValues.length]; + final byte[] returnArray = new byte[this.hyphenValues.length]; for (int i = 0; i < this.hyphenValues.length; i++) { - byte value = this.hyphenValues[i]; + final byte value = this.hyphenValues[i]; try { returnArray[i] = convertLiangToWeight(value); - } catch (HyphenationException e) { + } catch (final HyphenationException e) { /* TODO: This exception should be passed upstream further. */ returnArray[i] = Byte.MIN_VALUE; } @@ -85,7 +85,7 @@ } public String toString() { - StringBuffer str = new StringBuffer(); + final StringBuffer str = new StringBuffer(); int start = 0; for (int i = 0; i < hyphenPoints.length; i++) { str.append(word.substring(start, hyphenPoints[i]) + "-"); @@ -112,7 +112,7 @@ + liangValue); } /* Save the low-order bit. */ - boolean good = (liangValue & 1) == 1; + final boolean good = (liangValue & 1) == 1; liangValue ++; liangValue /= 2; if (! good) { @@ -124,7 +124,7 @@ /** * {@inheritDoc} */ - public HyphenBreak getHyphenBreak(int index) { + public HyphenBreak getHyphenBreak(final int index) { /* TODO: Consider implementing this. */ return null; } Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java 2006-07-23 19:16:06 UTC (rev 7817) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java 2006-07-23 19:36:26 UTC (rev 7818) @@ -74,13 +74,14 @@ * Constructor. * @param logger The Log instance for user messages. */ - public HyphenationServer(Log logger, URL hyphenationDir) { + public HyphenationServer(final Log logger, final URL hyphenationDir) { this.logger = logger; // TODO: This is klunky. Use the URL. this.hyphenationDir = hyphenationDir.getFile(); } - private HyphenationTree getHyphenationTree(String lang, String country) { + private HyphenationTree getHyphenationTree(final String lang, + final String country) { String key = lang; // check whether the country code has been used if (country != null && !country.equals("none")) { @@ -95,9 +96,9 @@ } /* See if it is one that we already have tried and failed. */ - Iterator iter = hyphenTreesNotFound.iterator(); + final Iterator iter = hyphenTreesNotFound.iterator(); while (iter.hasNext()) { - String testedKey = (String) iter.next(); + final String testedKey = (String) iter.next(); if (key.equals(testedKey)) { return null; } @@ -121,20 +122,20 @@ return hTree; } - private InputStream getResourceStream(String key) { + private InputStream getResourceStream(final String key) { InputStream is = null; // Try to use Context Class Loader to load the properties file. try { - Method getCCL = + final Method getCCL = Thread.class.getMethod("getContextClassLoader", new Class[0]); if (getCCL != null) { - ClassLoader contextClassLoader = + final ClassLoader contextClassLoader = (ClassLoader)getCCL.invoke(Thread.currentThread(), new Object[0]); is = contextClassLoader.getResourceAsStream("hyph/" + key + ".hyp"); } - } catch (Exception e) {} + } catch (final Exception e) {} if (is == null) { is = HyphenationServer.class.getResourceAsStream("/hyph/" + key @@ -144,7 +145,7 @@ return is; } - private HyphenationTree getHyphenationTree(String key) { + private HyphenationTree getHyphenationTree(final String key) { HyphenationTree hTree = null; ObjectInputStream ois = null; InputStream is = null; @@ -178,14 +179,14 @@ } ois = new ObjectInputStream(is); hTree = (HyphenationTree)ois.readObject(); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } finally { if (ois != null) { try { ois.close(); - } catch (IOException e) { + } catch (final IOException e) { getLogger().error("can't close hyphenation object stream"); } } @@ -197,8 +198,8 @@ * load tree from serialized file or xml file * using configuration settings */ - private HyphenationTree loadHyphenationTree(String key, - String language) { + private HyphenationTree loadHyphenationTree(final String key, + final String language) { if (this.hyphenationDir == null) { return null; } @@ -215,14 +216,14 @@ try { ois = new ObjectInputStream(new FileInputStream(hyphenFile)); hTree = (HyphenationTree)ois.readObject(); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } finally { if (ois != null) { try { ois.close(); - } catch (IOException e) {} + } catch (final IOException e) {} } } return hTree; @@ -246,7 +247,7 @@ hTree.printStats(getLogger()); } return hTree; - } catch (HyphenationException ex) { + } catch (final HyphenationException ex) { if (errorDump) { getLogger().error("Can't load user patterns " + "from xml file " + this.hyphenationDir @@ -264,17 +265,19 @@ return null; } - public org.axsl.hyphenR.Hyphenation hyphenate(CharSequence word, int offset, - int len, String language, String country, int remainCount, - int pushCount, boolean includeInhibitors) { + public org.axsl.hyphenR.Hyphenation hyphenate(final CharSequence word, + final int offset, final int len, final String language, + final String country, final int remainCount, final int pushCount, + final boolean includeInhibitors) { return this.hyphenate(word.toString().toCharArray(), offset, len, language, country, remainCount, pushCount, includeInhibitors); } - public org.axsl.hyphenR.Hyphenation hyphenate(char[] word, int offset, - int len, String language, String country, int remainCount, - int pushCount, boolean includeInhibitors) { - HyphenationTree hTree = getHyphenationTree(language, country); + public org.axsl.hyphenR.Hyphenation hyphenate(final char[] word, + final int offset, final int len, final String language, + final String country, final int remainCount, + final int pushCount, final boolean includeInhibitors) { + final HyphenationTree hTree = getHyphenationTree(language, country); if (hTree == null) { return null; } @@ -282,13 +285,14 @@ includeInhibitors); } - public org.axsl.hyphenR.Hyphenation hyphenate(int[] word, int offset, - int len, String language, String country, int remainCount, - int pushCount, boolean includeInhibitors) { + public org.axsl.hyphenR.Hyphenation hyphenate(final int[] word, + final int offset, final int len, final String language, + final String country, final int remainCount, final int pushCount, + final boolean includeInhibitors) { /* Convert to a String using the 32-bit ICU4J method. */ /* TODO: After Java 5 is the minimum, use the standard String * constructor instead. */ - String string = StringUtilPre5.newString(word, offset, len); + final String string = StringUtilPre5.newString(word, offset, len); /* FIXME: The Hyphenation instance needs to know that it was created * from an int[] instead of a char[], so that it can properly handle * surrogate pairs (an int that would convert to 2 chars).*/ @@ -303,17 +307,17 @@ /** * {@inheritDoc} */ - public int wordSize(char[] characters, int wordStart, String language, - String country) { + public int wordSize(final char[] characters, final int wordStart, + final String language, final String country) { if (characters == null) { return 0; } boolean wordendFound = false; int counter = 0; - int[] newWord = new int[characters.length]; // create a buffer + final int[] newWord = new int[characters.length]; // create a buffer while ((!wordendFound) && ((wordStart + counter) < characters.length)) { - int tk = characters[wordStart + counter]; + final int tk = characters[wordStart + counter]; if (StringUtilPre5.isLetter(tk)) { newWord[counter] = tk; counter++; @@ -327,8 +331,8 @@ /** * {@inheritDoc} */ - public int wordSize(CharSequence characters, int wordStart, String language, - String country) { + public int wordSize(final CharSequence characters, final int wordStart, + final String language, final String country) { if (characters == null) { return 0; } @@ -339,15 +343,15 @@ /** * {@inheritDoc} */ - public int wordSize(int[] characters, int wordStart, String language, - String country) { + public int wordSize(final int[] characters, final int wordStart, + final String language, final String country) { if (characters == null) { return 0; } /* Convert to a String using the 32-bit ICU4J method. */ /* TODO: After Java 5 is the minimum, use the standard String * constructor instead. */ - String string = StringUtilPre5.newString(characters, wordStart, + final String string = StringUtilPre5.newString(characters, wordStart, (characters.length - wordStart)); /* FIXME: Return value needs to be reduced by the number of surrogate * pairs (an int that would convert to 2 chars) found.*/ @@ -357,14 +361,14 @@ /** * {@inheritDoc} */ - public int wordStarts(char[] characters, int startIndex, String language, - String country) { + public int wordStarts(final char[] characters, final int startIndex, + final String language, final String country) { if (characters == null) { return -1; } /* TODO: We need to handle language and country here. */ for (int i = startIndex; i < characters.length; i++) { - char c = characters[i]; + final char c = characters[i]; switch(c) { case '"': case '\'': { @@ -382,8 +386,8 @@ /** * {@inheritDoc} */ - public int wordStarts(CharSequence characters, int startIndex, - String language, String country) { + public int wordStarts(final CharSequence characters, final int startIndex, + final String language, final String country) { if (characters == null) { return -1; } @@ -391,15 +395,15 @@ language, country); } - public int wordStarts(int[] characters, int startIndex, - String language, String country) { + public int wordStarts(final int[] characters, final int startIndex, + final String language, final String country) { if (characters == null) { return -1; } /* Convert to a String using the 32-bit ICU4J method. */ /* TODO: After Java 5 is the minimum, use the standard String * constructor instead. */ - String string = StringUtilPre5.newString(characters, startIndex, + final String string = StringUtilPre5.newString(characters, startIndex, (characters.length - startIndex)); /* FIXME: Return value needs to be reduced by the number of surrogate * pairs (an int that would convert to 2 chars) found.*/ Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java 2006-07-23 19:16:06 UTC (rev 7817) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java 2006-07-23 19:36:26 UTC (rev 7818) @@ -89,14 +89,15 @@ * @return the index into the vspace array where the packed values * are stored. */ - protected int packValues(String values) { - int i, n = values.length(); - int m = (n & 1) == 1 ? (n >> 1) + 2 : (n >> 1) + 1; - int offset = vspace.alloc(m); - byte[] va = vspace.getArray(); + protected int packValues(final String values) { + int i; + final int n = values.length(); + final int m = (n & 1) == 1 ? (n >> 1) + 2 : (n >> 1) + 1; + final int offset = vspace.alloc(m); + final byte[] va = vspace.getArray(); for (i = 0; i < n; i++) { - int j = i >> 1; - byte v = (byte)((values.charAt(i) - '0' + 1) & 0x0f); + final int j = i >> 1; + final byte v = (byte)((values.charAt(i) - '0' + 1) & 0x0f); if ((i & 1) == 1) { va[j + offset] = (byte)(va[j + offset] | v); } else { @@ -108,7 +109,7 @@ } protected String unpackValues(int k) { - StringBuffer buf = new StringBuffer(); + final StringBuffer buf = new StringBuffer(); byte v = vspace.get(k++); while (v != 0) { char c = (char)((v >>> 4) - 1 + '0'); @@ -127,9 +128,9 @@ /** * Read hyphenation patterns from an XML file. */ - public void loadPatterns(String filename, Log logger) + public void loadPatterns(final String filename, final Log logger) throws HyphenationException { - PatternParser pp = new PatternParser(this, logger); + final PatternParser pp = new PatternParser(this, logger); ivalues = new TernaryTree(); pp.parse(filename); @@ -144,8 +145,8 @@ ivalues = null; } - public String findPattern(String pat) { - int k = super.find(pat); + public String findPattern(final String pat) { + final int k = super.find(pat); if (k >= 0) { return unpackValues(k); } @@ -156,7 +157,7 @@ * String compare, returns 0 if equal or * t is a substring of s */ - protected int hstrcmp(char[] s, int si, char[] t, int ti) { + protected int hstrcmp(final char[] s, int si, final char[] t, int ti) { for (; s[si] == t[ti]; si++, ti++) { if (s[si] == 0) { return 0; @@ -169,7 +170,7 @@ } protected byte[] getValues(int k) { - StringBuffer buf = new StringBuffer(); + final StringBuffer buf = new StringBuffer(); byte v = vspace.get(k++); while (v != 0) { char c = (char)((v >>> 4) - 1); @@ -182,7 +183,7 @@ buf.append(c); v = vspace.get(k++); } - byte[] res = new byte[buf.length()]; + final byte[] res = new byte[buf.length()]; for (int i = 0; i < res.length; i++) { res[i] = (byte)buf.charAt(i); } @@ -213,7 +214,8 @@ * @param index start index from word * @param il interletter values array to update */ - protected void searchPatterns(char[] word, int index, byte[] il) { + protected void searchPatterns(final char[] word, final int index, + final byte[] il) { byte[] values; int i = index; char p, q; @@ -234,7 +236,7 @@ } return; } - int d = sp - sc[p]; + final int d = sp - sc[p]; if (d == 0) { if (sp == 0) { break; @@ -285,14 +287,15 @@ * @return a {@link Hyphenation Hyphenation} object representing * the hyphenated word or null if word is not hyphenated. */ - public org.axsl.hyphenR.Hyphenation hyphenate(char[] w, int offset, int len, - int remainCharCount, int pushCharCount, boolean includeInhibitors) { - char[] word = normalizeWord(w, offset, len); + public org.axsl.hyphenR.Hyphenation hyphenate(final char[] w, + final int offset, final int len, final int remainCharCount, + final int pushCharCount, final boolean includeInhibitors) { + final char[] word = normalizeWord(w, offset, len); if (word == null) { return null; } - String theWord = new String(w, offset, len); + final String theWord = new String(w, offset, len); Hyphenation hyphenation = checkExceptions(theWord, remainCharCount, pushCharCount); if (hyphenation != null) { @@ -308,26 +311,27 @@ * @param k * @return The new Hyphenation instance. */ - private Hyphenation createHyphenation(String theWord, int[] points, - byte[] values, int k) { + private Hyphenation createHyphenation(final String theWord, + final int[] points, final byte[] values, final int k) { if (k > 0) { // trim result array - int[] returnPoints = new int[k]; + final int[] returnPoints = new int[k]; System.arraycopy(points, 0, returnPoints, 0, k); - byte[] returnValues = new byte[k]; + final byte[] returnValues = new byte[k]; System.arraycopy(values, 0, returnValues, 0, k); return new Hyphenation(theWord, returnPoints, returnValues); } return null; } - private char[] normalizeWord(char[] w, int offset, int len) { - char[] word = new char[len + 3]; + private char[] normalizeWord(final char[] w, final int offset, + final int len) { + final char[] word = new char[len + 3]; - char[] c = new char[2]; + final char[] c = new char[2]; for (int i = 1; i <= len; i++) { c[0] = w[offset + i - 1]; - int nc = classmap.find(c, 0); + final int nc = classmap.find(c, 0); if (nc < 0) { // found a non-letter character, abort return null; } @@ -336,20 +340,20 @@ return word; } - private Hyphenation checkExceptions(String sw, int remainCharCount, - int pushCharCount) { + private Hyphenation checkExceptions(final String sw, + final int remainCharCount, final int pushCharCount) { if (! stoplist.containsKey(sw)) { return null; } - int length = sw.length(); - int[] result = new int[length + 1]; + final int length = sw.length(); + final int[] result = new int[length + 1]; int k = 0; /* assume only simple hyphens (Hyphen.pre="-", * Hyphen.post = Hyphen.no = null) */ - ArrayList hw = (ArrayList)stoplist.get(sw); + final ArrayList hw = (ArrayList)stoplist.get(sw); int j = 0; for (int i = 0; i < hw.size(); i++) { - Object o = hw.get(i); + final Object o = hw.get(i); if (o instanceof String) { j += ((String)o).length(); if (j >= remainCharCount @@ -359,31 +363,32 @@ } } /* Assume that all found points have a value of 1. */ - byte[] values = new byte[result.length]; + final byte[] values = new byte[result.length]; for (int i = 0; i < values.length; i++) { values[i] = 1; } return createHyphenation(sw, result, values, k); } - private Hyphenation checkAlgorithm(String theWord, int remainCharCount, - int pushCharCount, char[] word, boolean includeInhibitors) { - int len = theWord.length(); + private Hyphenation checkAlgorithm(final String theWord, + final int remainCharCount, final int pushCharCount, + final char[] word, final boolean includeInhibitors) { + final int len = theWord.length(); // use algorithm to get hyphenation points - int[] result = new int[len + 1]; - byte[] values = new byte[result.length]; + final int[] result = new int[len + 1]; + final byte[] values = new byte[result.length]; int k = 0; word[0] = '.'; // word start marker word[len + 1] = '.'; // word end marker word[len + 2] = 0; // null terminated - byte[] il = new byte[len + 3]; // initialized to zero + final byte[] il = new byte[len + 3]; // initialized to zero for (int i = 0; i < len + 1; i++) { searchPatterns(word, i, il); } for (int i = 0; i < len; i++) { - byte interletterValue = il[i + 1]; - boolean reportValue = reportValue(interletterValue, i, len, + final byte interletterValue = il[i + 1]; + final boolean reportValue = reportValue(interletterValue, i, len, remainCharCount, pushCharCount, includeInhibitors); if (reportValue) { k++; @@ -394,8 +399,9 @@ return createHyphenation(theWord, result, values, k); } - private boolean reportValue(byte interletterValue, int index, int length, - int remainCharCount, int pushCharCount, boolean includeInhibitors) { + private boolean reportValue(final byte interletterValue, final int index, + final int length, final int remainCharCount, + final int pushCharCount, final boolean includeInhibitors) { /* Zeroes are never reported. */ if (interletterValue == 0) { return false; @@ -429,10 +435,10 @@ * for letter 'a', for example, should be defined as "aA", the first * character being the normalization char. */ - public void addClass(String chargroup) { + public void addClass(final String chargroup) { if (chargroup.length() > 0) { - char equivChar = chargroup.charAt(0); - char[] key = new char[2]; + final char equivChar = chargroup.charAt(0); + final char[] key = new char[2]; key[1] = 0; for (int i = 0; i < chargroup.length(); i++) { key[0] = chargroup.charAt(i); @@ -449,7 +455,8 @@ * @param hyphenatedword a ArrayList of alternating strings and * {@link Hyphen hyphen} objects. */ - public void addException(String word, ArrayList hyphenatedword) { + public void addException(final String word, + final ArrayList hyphenatedword) { stoplist.put(word, hyphenatedword); } @@ -463,7 +470,7 @@ * within the pattern. It should contain only digit characters. * (i.e. '0' to '9'). */ - public void addPattern(String pattern, String ivalue) { + public void addPattern(final String pattern, final String ivalue) { int k = ivalues.find(ivalue); if (k <= 0) { k = packValues(ivalue); @@ -472,16 +479,16 @@ insert(pattern, (char)k); } - public void printStats(Log logger) { + public void printStats(final Log logger) { logger.info("Value space size = " + Integer.toString(vspace.length())); super.printStats(logger); } - public static void main(String[] argv) throws Exception { - Log logger = Logging.makeDefaultLogger(); + public static void main(final String[] argv) throws Exception { + final Log logger = Logging.makeDefaultLogger(); HyphenationTree ht = null; int minCharCount = 2; - BufferedReader in = + final BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); for (; ; ) { logger.info("l:\tload patterns from XML\n" @@ -514,14 +521,14 @@ try { ois = new ObjectInputStream(new FileInputStream(token)); ht = (HyphenationTree)ois.readObject(); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } finally { if (ois != null) { try { ois.close(); - } catch (IOException e) {} + } catch (final IOException e) {} } } } else if (token.equals("w")) { @@ -531,17 +538,17 @@ try { oos = new ObjectOutputStream(new FileOutputStream(token)); oos.writeObject(ht); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } finally { if (oos != null) { try { oos.flush(); - } catch (IOException e) {} + } catch (final IOException e) {} try { oos.close(); - } catch (IOException e) {} + } catch (final IOException e) {} } } } else if (token.equals("h")) { @@ -561,19 +568,19 @@ int counter = 0; ; try { - BufferedReader reader = + final BufferedReader reader = new BufferedReader(new FileReader(token)); starttime = System.currentTimeMillis(); while ((reader.readLine()) != null) { counter++; } - } catch (Exception ioe) { + } catch (final Exception ioe) { logger.info("Exception " + ioe); ioe.printStackTrace(); } - long endtime = System.currentTimeMillis(); - long result = endtime - starttime; + final long endtime = System.currentTimeMillis(); + final long result = endtime - starttime; logger.info(counter + " words hypehanted in " + result + " milliseconds."); Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/PatternParser.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/PatternParser.java 2006-07-23 19:16:06 UTC (rev 7817) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/PatternParser.java 2006-07-23 19:36:26 UTC (rev 7818) @@ -65,7 +65,7 @@ static final int ELEM_PATTERNS = 3; static final int ELEM_HYPHEN = 4; - public PatternParser(Log logger) throws HyphenationException { + public PatternParser(final Log logger) throws HyphenationException { this.logger = logger; token = new StringBuffer(); parser = createParser(); @@ -74,26 +74,26 @@ hyphenChar = '-'; // default } - public PatternParser(PatternConsumer consumer, Log logger) + public PatternParser(final PatternConsumer consumer, final Log logger) throws HyphenationException { this(logger); this.consumer = consumer; } - public void setConsumer(PatternConsumer consumer) { + public void setConsumer(final PatternConsumer consumer) { this.consumer = consumer; } - public void parse(String filename) throws HyphenationException { - InputSource uri = fileInputSource(filename); + public void parse(final String filename) throws HyphenationException { + final InputSource uri = fileInputSource(filename); try { parser.parse(uri); - } catch (SAXException e) { + } catch (final SAXException e) { throw new HyphenationException(errMsg); - } catch (IOException e) { + } catch (final IOException e) { throw new HyphenationException(e.getMessage()); - } catch (NullPointerException e) { + } catch (final NullPointerException e) { throw new HyphenationException("SAX parser not available"); } } @@ -111,16 +111,16 @@ } try { return (XMLReader)Class.forName(parserClassName).newInstance(); - } catch (ClassNotFoundException e) { + } catch (final ClassNotFoundException e) { throw new HyphenationException("Could not find " + parserClassName); - } catch (InstantiationException e) { + } catch (final InstantiationException e) { throw new HyphenationException("Could not instantiate " + parserClassName); - } catch (IllegalAccessException e) { + } catch (final IllegalAccessException e) { throw new HyphenationException("Could not access " + parserClassName); - } catch (ClassCastException e) { + } catch (final ClassCastException e) { throw new HyphenationException(parserClassName + " is not a SAX driver"); } @@ -132,13 +132,13 @@ * @param filename the name of the file * @return the InputSource created */ - protected static InputSource fileInputSource(String filename) + protected static InputSource fileInputSource(final String filename) throws HyphenationException { /* this code adapted from James Clark's in XT */ - File file = new File(filename); + final File file = new File(filename); String path = file.getAbsolutePath(); - String fSep = System.getProperty("file.separator"); + final String fSep = System.getProperty("file.separator"); if (fSep != null && fSep.length() == 1) { path = path.replace(fSep.charAt(0), '/'); } @@ -148,12 +148,12 @@ try { return new InputSource(URLFactory.createURL("file", null, path).toString()); - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { throw new HyphenationException("unexpected MalformedURLException"); } } - protected String readToken(StringBuffer chars) { + protected String readToken(final StringBuffer chars) { String word; boolean space = false; int i; @@ -196,9 +196,9 @@ return null; } - protected static String getPattern(String word) { - StringBuffer pat = new StringBuffer(); - int len = word.length(); + protected static String getPattern(final String word) { + final StringBuffer pat = new StringBuffer(); + final int len = word.length(); for (int i = 0; i < len; i++) { if (!Character.isDigit(word.charAt(i))) { pat.append(word.charAt(i)); @@ -207,21 +207,21 @@ return pat.toString(); } - protected ArrayList normalizeException(ArrayList ex) { - ArrayList res = new ArrayList(); + protected ArrayList normalizeException(final ArrayList ex) { + final ArrayList res = new ArrayList(); for (int i = 0; i < ex.size(); i++) { - Object item = ex.get(i); + final Object item = ex.get(i); if (item instanceof String) { - String str = (String)item; - StringBuffer buf = new StringBuffer(); + final String str = (String)item; + final StringBuffer buf = new StringBuffer(); for (int j = 0; j < str.length(); j++) { - char c = str.charAt(j); + final char c = str.charAt(j); if (c != hyphenChar) { buf.append(c); } else { res.add(buf.toString()); buf.setLength(0); - char[] h = new char[1]; + final char[] h = new char[1]; h[0] = hyphenChar; // we use here hyphenChar which is not necessarily // the one to be printed @@ -238,10 +238,10 @@ return res; } - protected String getExceptionWord(ArrayList ex) { - StringBuffer res = new StringBuffer(); + protected String getExceptionWord(final ArrayList ex) { + final StringBuffer res = new StringBuffer(); for (int i = 0; i < ex.size(); i++) { - Object item = ex.get(i); + final Object item = ex.get(i); if (item instanceof String) { res.append((String)item); } else { @@ -253,12 +253,13 @@ return res.toString(); } - protected static String getInterletterValues(String pat) { - StringBuffer il = new StringBuffer(); - String word = pat + "a"; // add dummy letter to serve as sentinel - int len = word.length(); + protected static String getInterletterValues(final String pat) { + final StringBuffer il = new StringBuffer(); + // add dummy letter to serve as sentinel + final String word = pat + "a"; + final int len = word.length(); for (int i = 0; i < len; i++) { - char c = word.charAt(i); + final char c = word.charAt(i); if (Character.isDigit(c)) { il.append(c); i++; @@ -276,10 +277,10 @@ /** * Start element. */ - public void startElement(String uri, String local, String raw, - Attributes attrs) { + public void startElement(final String uri, final String local, + final String raw, final Attributes attrs) { if (local.equals("hyphen-char")) { - String h = attrs.getValue("value"); + final String h = attrs.getValue("value"); if (h != null && h.length() == 1) { hyphenChar = h.charAt(0); } @@ -301,10 +302,10 @@ token.setLength(0); } - public void endElement(String uri, String local, String raw) { - + public void endElement(final String uri, final String local, + final String raw) { if (token.length() > 0) { - String word = token.toString(); + final String word = token.toString(); switch (currElement) { case ELEM_CLASSES: consumer.addClass(word); @@ -337,8 +338,8 @@ /** * Characters. */ - public void characters(char ch[], int start, int length) { - StringBuffer chars = new StringBuffer(length); + public void characters(final char ch[], final int start, final int length) { + final StringBuffer chars = new StringBuffer(length); chars.append(ch, start, length); String word = readToken(chars); while (word != null) { @@ -370,7 +371,7 @@ /** * Warning. */ - public void warning(SAXParseException ex) { + public void warning(final SAXParseException ex) { errMsg = "[Warning] " + getLocationString(ex) + ": " + ex.getMessage(); } @@ -378,14 +379,14 @@ /** * Error. */ - public void error(SAXParseException ex) { + public void error(final SAXParseException ex) { errMsg = "[Error] " + getLocationString(ex) + ": " + ex.getMessage(); } /** * Fatal error. */ - public void fatalError(SAXParseException ex) throws SAXException { + public void fatalError(final SAXParseException ex) throws SAXException { errMsg = "[Fatal Error] " + getLocationString(ex) + ": " + ex.getMessage(); throw ex; @@ -394,12 +395,12 @@ /** * Returns a string of the location. */ - private String getLocationString(SAXParseException ex) { - StringBuffer str = new StringBuffer(); + private String getLocationString(final SAXParseException ex) { + final StringBuffer str = new StringBuffer(); String systemId = ex.getSystemId(); if (systemId != null) { - int index = systemId.lastIndexOf('/'); + final int index = systemId.lastIndexOf('/'); if (index != -1) { systemId = systemId.substring(index + 1); } @@ -416,22 +417,22 @@ // PatternConsumer implementation for testing purposes - public void addClass(String c) { + public void addClass(final String c) { this.logger.info("class: " + c); } - public void addException(String w, ArrayList e) { + public void addException(final String w, final ArrayList e) { this.logger.info("exception: " + w + " : " + e.toString()); } - public void addPattern(String p, String v) { + public void addPattern(final String p, final String v) { this.logger.info("pattern: " + p + " : " + v); } - public static void main(String[] args) throws Exception { - Log logger = Logging.makeDefaultLogger(); + public static void main(final String[] args) throws Exception { + final Log logger = Logging.makeDefaultLogger(); if (args.length > 0) { - PatternParser pp = new PatternParser(logger); + final PatternParser pp = new PatternParser(logger); pp.setConsumer(pp); pp.parse(args[0]); } Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/SerializeHyphPattern.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/SerializeHyphPattern.java 2006-07-23 19:16:06 UTC (rev 7817) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/SerializeHyphPattern.java 2006-07-23 19:36:26 UTC (rev 7818) @@ -50,8 +50,8 @@ * Main method, which is called by ant. */ public void execute() throws BuildException { - DirectoryScanner ds = this.getDirectoryScanner(sourceDir); - String[] files = ds.getIncludedFiles(); + final DirectoryScanner ds = this.getDirectoryScanner(sourceDir); + final String[] files = ds.getIncludedFiles(); for (int i = 0; i < files.length; i++) { processFile(files[i].substring(0, files[i].length() - 4)); } @@ -62,8 +62,8 @@ * Sets the source directory * */ - public void setSourceDir(String sourceDir) { - File dir = new File(sourceDir); + public void setSourceDir(final String sourceDir) { + final File dir = new File(sourceDir); if (!dir.exists()) { getLogger().error("Fatal Error: source directory " + sourceDir + " for hyphenation files doesn't exist."); @@ -76,8 +76,8 @@ * Sets the target directory * */ - public void setTargetDir(String targetDir) { - File dir = new File(targetDir); + public void setTargetDir(final String targetDir) { + final File dir = new File(targetDir); this.targetDir = dir; } @@ -85,7 +85,7 @@ * more error information * */ - public void setErrorDump(boolean errorDump) { + public void setErrorDump(final boolean errorDump) { this.errorDump = errorDump; } @@ -94,9 +94,9 @@ * Checks whether input or output files exists or the latter is older than * input file and start build if necessary */ - private void processFile(String filename) { - File infile = new File(sourceDir, filename + ".xml"); - File outfile = new File(targetDir, filename + ".hyp"); + private void processFile(final String filename) { + final File infile = new File(sourceDir, filename + ".xml"); + final File outfile = new File(targetDir, filename + ".hyp"); boolean startProcess = true; startProcess = rebuild(infile, outfile); @@ -108,16 +108,16 @@ /* * serializes pattern files */ - private void buildPatternFile(File infile, File outfile) { + private void buildPatternFile(final File infile, final File outfile) { getLogger().info("Processing " + infile); - HyphenationTree hTree = new HyphenationTree(); + final HyphenationTree hTree = new HyphenationTree(); try { hTree.loadPatterns(infile.toString(), getLogger()); if (errorDump) { getLogger().info("Stats: "); hTree.printStats(getLogger()); } - } catch (HyphenationException ex) { + } catch (final HyphenationException ex) { getLogger().error("Can't load patterns from xml file " + infile + " - Maybe hyphenation.dtd is missing?"); if (errorDump) { @@ -126,11 +126,11 @@ } // serialize class try { - ObjectOutputStream out = + final ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(outfile)); out.writeObject(hTree); out.close(); - } catch (IOException ioe) { + } catch (final IOException ioe) { getLogger().error("Can't write compiled pattern file: " + outfile); getLogger().error(ioe.toString()); } @@ -140,7 +140,7 @@ * Checks for existence of output file and compares * dates with input and stylesheet file */ - private boolean rebuild(File infile, File outfile) { + private boolean rebuild(final File infile, final File outfile) { if (outfile.exists()) { // checks whether output file is older than input file if (outfile.lastModified() < infile.lastModified()) { Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/TernaryTree.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/TernaryTree.java 2006-07-23 19:16:06 UTC (rev 7817) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/TernaryTree.java 2006-07-23 19:36:26 UTC (rev 7818) @@ -147,21 +147,21 @@ * is inserted. This saves a lot of space, * specially for long keys. */ - public void insert(String key, char val) { + public void insert(final String key, final char val) { // make sure we have enough room in the arrays int len = key.length() + 1; // maximum number of nodes that may be generated if (freenode + len > eq.length) { redimNodeArrays(eq.length + BLOCK_SIZE); } - char strkey[] = new char[len--]; + final char strkey[] = new char[len--]; key.getChars(0, len, strkey, 0); strkey[len] = 0; root = insert(root, strkey, 0, val); } - public void insert(char[] key, int start, char val) { - int len = strlen(key) + 1; + public void insert(final char[] key, final int start, final char val) { + final int len = strlen(key) + 1; if (freenode + len > eq.length) { redimNodeArrays(eq.length + BLOCK_SIZE); } @@ -171,8 +171,9 @@ /** * The actual insertion function, recursive version. */ - private char insert(char p, char[] key, int start, char val) { - int len = strlen(key, start); + private char insert(char p, final char[] key, final int start, + final char val) { + final int len = strlen(key, start); if (p == 0) { // this means there is no branch, this node will start a new branch. // Instead of doing that, we store the key somewhere else and create @@ -194,7 +195,7 @@ } if (sc[p] == 0xFFFF) { - char pp = freenode++; + final char pp = freenode++; lo[pp] = lo[p]; eq[pp] = eq[p]; lo[p] = 0; @@ -218,7 +219,7 @@ return p; } } - char s = key[start]; + final char s = key[start]; if (s < sc[p]) { lo[p] = insert(lo[p], key, start, val); } else if (s == sc[p]) { @@ -238,7 +239,8 @@ /** * Compares 2 null terminated char arrays */ - public static int strcmp(char[] a, int startA, char[] b, int startB) { + public static int strcmp(final char[] a, int startA, final char[] b, + int startB) { for (; a[startA] == b[startB]; startA++, startB++) { if (a[startA] == 0) { return 0; @@ -250,8 +252,11 @@ /** * Compares a string with null terminated char array */ - public static int strcmp(String str, char[] a, int start) { - int i, d, len = str.length(); + public static int strcmp(final String str, final char[] a, + final int start) { + int i; + int d; + final int len = str.length(); for (i = 0; i < len; i++) { d = str.charAt(i) - a[start + i]; if (d != 0) { @@ -268,14 +273,15 @@ } - public static void strcpy(char[] dst, int di, char[] src, int si) { + public static void strcpy(final char[] dst, int di, final char[] src, + int si) { while (src[si] != 0) { dst[di++] = src[si++]; } dst[di] = 0; } - public static int strlen(char[] a, int start) { + public static int strlen(final char[] a, final int start) { int len = 0; for (int i = start; i < a.length && a[i] != 0; i++) { len++; @@ -283,20 +289,20 @@ return len; } - public static int strlen(char[] a) { + public static int strlen(final char[] a) { return strlen(a, 0); } - public int find(String key) { - int len = key.length(); - char strkey[] = new char[len + 1]; + public int find(final String key) { + final int len = key.length(); + final char strkey[] = new char[len + 1]; key.getChars(0, len, strkey, 0); strkey[len] = 0; return find(strkey, 0); } - public int find(char[] key, int start) { + public int find(final char[] key, final int start) { int d; char p = root; int i = start; @@ -326,13 +332,13 @@ return -1; } - public boolean knows(String key) { + public boolean knows(final String key) { return (find(key) >= 0); } // redimension the arrays - private void redimNodeArrays(int newsize) { - int len = newsize < lo.length ? newsize : lo.length; + private void redimNodeArrays(final int newsize) { + final int len = newsize < lo.length ? newsize : lo.length; char[] na = new char[newsize]; System.arraycopy(lo, 0, na, 0, len); lo = na; @@ -352,7 +358,7 @@ } public Object clone() { - TernaryTree t = new TernaryTree(); + final TernaryTree t = new TernaryTree(); t.lo = (char[])this.lo.clone(); t.hi = (char[])this.hi.clone(); t.eq = (char[])this.eq.clone(); @@ -371,7 +377,8 @@ * tree. The array of keys is assumed to be sorted in ascending * order. */ - protected void insertBalanced(String[] k, char[] v, int offset, int n) { + protected void insertBalanced(final String[] k, final char[] v, + final int offset, final int n) { int m; if (n < 1) { return; @@ -389,10 +396,11 @@ * Balance the tree for best search performance */ public void balance() { - int i = 0, n = length; - String[] k = new String[n]; - char[] v = new char[n]; - Iterator iter = new Iterator(); + int i = 0; + final int n = length; + final String[] k = new String[n]; + final char[] v = new char[n]; + final Iterator iter = new Iterator(); while (iter.hasMoreElements()) { v[i] = iter.getValue(); k[i++] = (String)iter.nextElement(); @@ -423,15 +431,16 @@ redimNodeArrays(freenode); // ok, compact kv array - CharVector kx = new CharVector(); + final CharVector kx = new CharVector(); kx.alloc(1); - TernaryTree map = new TernaryTree(); + final TernaryTree map = new TernaryTree(); compact(kx, map, root); kv = kx; kv.trimToSize(); } - private void compact(CharVector kx, TernaryTree map, char p) { + private void compact(final CharVector kx, final TernaryTree map, + final char p) { int k; if (p == 0) { return; @@ -479,7 +488,7 @@ child = 0; } - public Item(char p, char c) { + public Item(final char p, final char c) { parent = p; child = c; } @@ -515,7 +524,7 @@ } public Object nextElement() { - String res = new String(curkey); + final String res = new String(curkey); cur = up(); run(); return res; @@ -620,7 +629,7 @@ } // The current node should be a data node and // the key should be in the key stack (at least partially) - StringBuffer buf = new StringBuffer(ks.toString()); + final StringBuffer buf = new StringBuffer(ks.toString()); if (sc[cur] == 0xFFFF) { int p = lo[cur]; while (kv.get(p) != 0) { @@ -633,7 +642,7 @@ } - public void printStats(Log logger) { + public void printStats(final Log logger) { logger.info("Number of keys = " + Integer.toString(length)); logger.info("Node count = " + Integer.toString(freenode)); logger.info("Key Array length = " + Integer.toString(kv.length())); @@ -651,9 +660,9 @@ } - public static void main(String[] args) throws Exception { - Log logger = Logging.makeDefaultLogger(); - TernaryTree tt = new TernaryTree(); + public static void main(final String[] args) throws Exception { + final Log logger = Logging.makeDefaultLogger(); + final TernaryTree tt = new TernaryTree(); tt.insert("Carlos", 'C'); tt.insert("Car", 'r'); tt.insert("palos", 'l'); @@ -666,4 +675,3 @@ } } - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-23 19:16:27
|
Revision: 7817 Author: victormote Date: 2006-07-23 12:16:06 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7817&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-graphic/.project trunk/foray/foray-graphic/src/java/org/foray/graphic/BMPGraphic.java trunk/foray/foray-graphic/src/java/org/foray/graphic/EPSGraphic.java trunk/foray/foray-graphic/src/java/org/foray/graphic/FOrayGraphicServer.java trunk/foray/foray-graphic/src/java/org/foray/graphic/GIFGraphic.java trunk/foray/foray-graphic/src/java/org/foray/graphic/Graphic.java trunk/foray/foray-graphic/src/java/org/foray/graphic/ImageConsumerImpl.java trunk/foray/foray-graphic/src/java/org/foray/graphic/JAIGraphic.java trunk/foray/foray-graphic/src/java/org/foray/graphic/JPEGGraphic.java trunk/foray/foray-graphic/src/java/org/foray/graphic/PDFGraphic.java trunk/foray/foray-graphic/src/java/org/foray/graphic/PNGGraphic.java trunk/foray/foray-graphic/src/java/org/foray/graphic/SVGGraphic.java trunk/foray/foray-graphic/src/java/org/foray/graphic/TIFFGraphic.java trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/BMPFactory.java trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/EPSFactory.java trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/GIFFactory.java trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/GraphicFactory.java trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/JPEGFactory.java trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/PDFFactory.java trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/PNGFactory.java trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/SVGFactory.java trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/TIFFFactory.java Modified: trunk/foray/foray-graphic/.project =================================================================== --- trunk/foray/foray-graphic/.project 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/.project 2006-07-23 19:16:06 UTC (rev 7817) @@ -7,12 +7,12 @@ </projects> <buildSpec> <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> <arguments> </arguments> </buildCommand> Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/BMPGraphic.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/BMPGraphic.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/BMPGraphic.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -40,21 +40,22 @@ public static final int BMP_SIG_LENGTH = 26; - public BMPGraphic(FOrayGraphicServer server, URL href, - BufferedInputStream bis) { + public BMPGraphic(final FOrayGraphicServer server, final URL href, + final BufferedInputStream bis) { super(server, href, bis); } public void loadImage() throws GraphicException { - int wpos = 18; - int hpos = 22; // offset positioning for w and height in bmp files - int[] headermap = new int[54]; + final int wpos = 18; + // offset positioning for w and height in bmp files + final int hpos = 22; + final int[] headermap = new int[54]; int filepos = 0; byte palette[] = null; try { boolean eof = false; while ((!eof) && (filepos < 54)) { - int input = bis.read(); + final int input = bis.read(); if (input == -1) { eof = true; } else { @@ -63,13 +64,13 @@ } if (headermap[28] == 4 || headermap[28] == 8) { - int palettesize = 1 << headermap[28]; + final int palettesize = 1 << headermap[28]; palette = new byte[palettesize * 3]; int countr = 0; while (!eof && countr < palettesize) { int count2 = 2; while (!eof && count2 >= -1) { - int input = bis.read(); + final int input = bis.read(); if (input == -1) { eof = true; } else if (count2 >= 0) { @@ -81,7 +82,7 @@ countr++; } } - } catch (IOException e) { + } catch (final IOException e) { throw new GraphicException("Error while loading image " + this.url.toString() + " : " + e.getClass() + " - " @@ -95,7 +96,7 @@ + headermap[hpos + 2] * 256 * 256 + headermap[hpos + 3] * 256 * 256 * 256; - int imagestart = headermap[10] + headermap[11] * 256 + final int imagestart = headermap[10] + headermap[11] * 256 + headermap[12] * 256 * 256 + headermap[13] * 256 * 256 * 256; this.bitDepth = headermap[28]; @@ -121,7 +122,7 @@ this.contentSize = this.pixelWidth * this.pixelHeight * 3; this.content = new byte[this.contentSize]; - int[] temp = new int[bytes * this.pixelHeight]; + final int[] temp = new int[bytes * this.pixelHeight]; try { int input; int count = 0; @@ -130,7 +131,7 @@ temp[count++] = input; } bis.close(); - } catch (IOException e) { + } catch (final IOException e) { throw new GraphicException("Error while loading image " + this.url.toString() + " : " + e.getClass() + " - " @@ -177,7 +178,7 @@ } else if (this.bitDepth == 4) { for (int countr = 0; countr < 2 && x < this.pixelWidth; countr++) { - int pal = ((p & 0xF0) >> 4) * 3; + final int pal = ((p & 0xF0) >> 4) * 3; this.content[3 * (i * this.pixelWidth + x)] = palette[pal]; this.content[3 * (i * this.pixelWidth + x) + 1] = @@ -232,7 +233,7 @@ * {@inheritDoc} */ public void parseBasics() throws IOException { - byte[] header = new byte[BMPGraphic.BMP_SIG_LENGTH]; + final byte[] header = new byte[BMPGraphic.BMP_SIG_LENGTH]; bis.read(header); // little endian notation int byte1 = header[18] & 0xff; Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/EPSGraphic.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/EPSGraphic.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/EPSGraphic.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -69,8 +69,8 @@ /** The entire contents of the file. */ private byte[] fileContents; - public EPSGraphic(FOrayGraphicServer server, URL href, - BufferedInputStream bis, boolean isASCII) { + public EPSGraphic(final FOrayGraphicServer server, final URL href, + final BufferedInputStream bis, final boolean isASCII) { super(server, href, bis); docName = href.toString(); this.isAscii = isASCII; @@ -88,8 +88,8 @@ return; } imageLoaded = true; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - byte[] readBuf = new byte[20480]; + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final byte[] readBuf = new byte[20480]; int bytes_read; try { @@ -101,7 +101,7 @@ break; } } - } catch (IOException ex) { + } catch (final IOException ex) { throw new GraphicException("Error while loading image " + this.url.toString() + " : " + ex.getClass() + " - " + ex.getMessage()); @@ -125,7 +125,7 @@ * {@inheritDoc} */ protected void parseBasics() throws IOException { - byte[] fileStart = new byte[this.maxBytesToParseBasics()]; + final byte[] fileStart = new byte[this.maxBytesToParseBasics()]; bis.read(fileStart); if (! isAscii) { this.psStart = parseInteger(fileStart, 4); @@ -153,7 +153,7 @@ if (isAscii) { return this.fileContents; } - byte[] epsFile = new byte[psLength]; + final byte[] epsFile = new byte[psLength]; System.arraycopy(this.fileContents, psStart, epsFile, 0, psLength); return epsFile; } @@ -173,8 +173,8 @@ /** Extract bounding box from eps part */ - private void readBBox(byte[] fileStart) { - byte[] bbxName = "%%BoundingBox:".getBytes(); + private void readBBox(final byte[] fileStart) { + final byte[] bbxName = "%%BoundingBox:".getBytes(); boolean found = false; int index = 0; for (index = 0; index + bbxName.length < fileStart.length && !found; @@ -192,7 +192,8 @@ index += readLongString(fileStart, 3, index); } - private int readLongString(byte[] fileStart, int bboxIndex, int idx) { + private int readLongString(final byte[] fileStart, final int bboxIndex, + int idx) { while (idx < fileStart.length && (fileStart[idx] == 32)) { idx++; } @@ -202,9 +203,9 @@ (fileStart[nidx] == 45))) { nidx++; } - byte[] num = new byte[nidx - idx]; + final byte[] num = new byte[nidx - idx]; System.arraycopy(fileStart, idx, num, 0, nidx - idx); - String ns = new String(num); + final String ns = new String(num); this.bbox[bboxIndex] = Integer.parseInt(ns); return (1 + nidx - idx); } Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/FOrayGraphicServer.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/FOrayGraphicServer.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/FOrayGraphicServer.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -85,7 +85,8 @@ /** * Constructor. */ - public FOrayGraphicServer(Log logger, String svgParserClassName) { + public FOrayGraphicServer(final Log logger, + final String svgParserClassName) { this.logger = logger; if (this.logger == null) { this.logger = Logging.makeDefaultLogger(); @@ -98,7 +99,7 @@ "com.sun.media.jai.codec.FileCacheSeekableStream"); aClass = Class.forName("javax.media.jai.JAI"); this.jaiAvailable = (aClass != null); - } catch (ClassNotFoundException e) { + } catch (final ClassNotFoundException e) { this.jaiAvailable = false; } } @@ -125,7 +126,7 @@ * @param factory The factory that should be added to the list of factories. * @return True if the factory was successfully registered, false if not. */ - public boolean registerFactory(GraphicFactory factory) { + public boolean registerFactory(final GraphicFactory factory) { customFactories.add(factory); return true; } @@ -133,8 +134,8 @@ /** * {@inheritDoc} */ - public synchronized org.axsl.graphicR.Graphic makeGraphic(String href, - URL[] baseURLs, boolean cachingThisGraphic) + public synchronized org.axsl.graphicR.Graphic makeGraphic(final String href, + final URL[] baseURLs, final boolean cachingThisGraphic) throws GraphicException { URL absoluteURL = null; @@ -145,13 +146,13 @@ // An exception was thrown in buildURLList if urlList is null. try { urlList = URLUtil.buildURLList(baseURLs, href); - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { throw new GraphicException(e.getMessage()); } // See if any of the possibilities are in our cache for (int i = 0; i < urlList.size(); i++) { absoluteURL = (URL) urlList.get(i); - Graphic imageObject = (Graphic)m_urlMap.get(href); + final Graphic imageObject = (Graphic)m_urlMap.get(href); if (imageObject != null) { return imageObject; } @@ -161,11 +162,11 @@ for (int i = 0; i < urlList.size(); i++) { absoluteURL = (URL) urlList.get(i); try { - InputStream inputStream = absoluteURL.openStream(); + final InputStream inputStream = absoluteURL.openStream(); if (inputStream != null) { imgIS = new BufferedInputStream(inputStream); } - } catch (IOException e1) { + } catch (final IOException e1) { /* * Ignore this. We'll throw an Exception at the end if none * of these work. @@ -179,7 +180,7 @@ throw new GraphicException("Cannot open URL: " + href); } - Graphic graphic = createGraphic(absoluteURL, imgIS); + final Graphic graphic = createGraphic(absoluteURL, imgIS); if (graphic == null) { throw new GraphicException("No Graphic Factory: " @@ -199,8 +200,8 @@ * @return The newly-created Graphic instance. * @throws GraphicException */ - private Graphic createGraphic(URL absoluteURL, BufferedInputStream imgIS) - throws GraphicException { + private Graphic createGraphic(final URL absoluteURL, + final BufferedInputStream imgIS) throws GraphicException { /* Try custom factories first, so that they can override. */ Graphic graphic = createGraphicFromFactoryList(this.customFactories, absoluteURL, imgIS); @@ -220,8 +221,8 @@ * @return The newly-created Graphic. * @throws GraphicException */ - private Graphic createGraphicFromFactoryList(ArrayList factoryList, - URL absoluteURL, BufferedInputStream imgIS) + private Graphic createGraphicFromFactoryList(final ArrayList factoryList, + final URL absoluteURL, final BufferedInputStream imgIS) throws GraphicException { Graphic graphic = null; /* @@ -229,11 +230,11 @@ * to create a Graphic instance. */ for (int i = 0; i < factoryList.size(); i++) { - GraphicFactory factory = (GraphicFactory) + final GraphicFactory factory = (GraphicFactory) factoryList.get(i); try { graphic = factory.makeGraphic(absoluteURL, imgIS); - } catch (IOException e) { + } catch (final IOException e) { throw new GraphicException("Error parsing Graphic: " + e.getMessage()); } @@ -251,7 +252,7 @@ m_urlMap.clear(); } - private String getMapKey(URL url) { + private String getMapKey(final URL url) { return url.getFile(); } Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/GIFGraphic.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/GIFGraphic.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/GIFGraphic.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -46,16 +46,16 @@ public static final int GIF_SIG_LENGTH = 10; - public GIFGraphic(FOrayGraphicServer server, URL href, - BufferedInputStream bis) { + public GIFGraphic(final FOrayGraphicServer server, final URL href, + final BufferedInputStream bis) { super(server, href, bis); } public void loadImage() throws GraphicException { int[] tmpMap = null; try { - ImageProducer ip = (ImageProducer)this.url.getContent(); - ImageConsumerImpl consumer = new ImageConsumerImpl(ip); + final ImageProducer ip = (ImageProducer)this.url.getContent(); + final ImageConsumerImpl consumer = new ImageConsumerImpl(ip); ip.startProduction(consumer); @@ -69,12 +69,12 @@ try { tmpMap = consumer.getImage(); - } catch (Exception ex) { + } catch (final Exception ex) { throw new GraphicException("Image grabbing interrupted : " + ex.getMessage()); } - ColorModel cm = consumer.getColorModel(); + final ColorModel cm = consumer.getColorModel(); this.bitDepth = 8; // this.m_bitsPerPixel = cm.getPixelSize(); this.colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB); @@ -83,7 +83,7 @@ } else { this.isTransparent = false; } - } catch (Exception ex) { + } catch (final Exception ex) { throw new GraphicException("Error while loading image " + this.url.toString() + " : " + ex.getClass() + " - " @@ -95,10 +95,10 @@ this.content = new byte[this.contentSize]; for (int i = 0; i < this.pixelHeight; i++) { for (int j = 0; j < this.pixelWidth; j++) { - int p = tmpMap[i * this.pixelWidth + j]; - int r = (p >> 16) & 0xFF; - int g = (p >> 8) & 0xFF; - int b = (p) & 0xFF; + final int p = tmpMap[i * this.pixelWidth + j]; + final int r = (p >> 16) & 0xFF; + final int g = (p >> 8) & 0xFF; + final int b = (p) & 0xFF; this.content[3 * (i * this.pixelWidth + j)] = (byte)(r & 0xFF); this.content[3 * (i * this.pixelWidth + j) + 1] = (byte)(g & 0xFF); @@ -108,7 +108,7 @@ } } - private void loadTransparency(ColorModel cm) { + private void loadTransparency(final ColorModel cm) { switch (cm.getTransparency()) { case Transparency.OPAQUE: this.isTransparent = false; @@ -138,16 +138,16 @@ } } - private void loadBitmapTransparency(ColorModel cm) { + private void loadBitmapTransparency(final ColorModel cm) { if (cm instanceof IndexColorModel) { this.isTransparent = false; - byte[] alphas = + final byte[] alphas = new byte[((IndexColorModel)cm).getMapSize()]; - byte[] reds = + final byte[] reds = new byte[((IndexColorModel)cm).getMapSize()]; - byte[] greens = + final byte[] greens = new byte[((IndexColorModel)cm).getMapSize()]; - byte[] blues = + final byte[] blues = new byte[((IndexColorModel)cm).getMapSize()]; ((IndexColorModel)cm).getAlphas(alphas); ((IndexColorModel)cm).getReds(reds); @@ -184,7 +184,7 @@ * {@inheritDoc} */ public void parseBasics() throws IOException { - byte[] header = new byte[GIFGraphic.GIF_SIG_LENGTH]; + final byte[] header = new byte[GIFGraphic.GIF_SIG_LENGTH]; bis.read(header); // little endian notation int byte1 = header[6] & 0xff; Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/Graphic.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/Graphic.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/Graphic.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -93,8 +93,8 @@ /** Set this flag to false if the image is not valid. */ protected boolean isValid = true; - public Graphic(FOrayGraphicServer server, URL href, - BufferedInputStream bis) { + public Graphic(final FOrayGraphicServer server, final URL href, + final BufferedInputStream bis) { this.server = server; this.url = href; this.bis = bis; @@ -265,7 +265,7 @@ this.bis.mark(this.maxBytesToParseBasics()); parseBasics(); this.bis.reset(); - } catch (IOException e) { + } catch (final IOException e) { throw new GraphicException(e.getMessage()); } this.basicsParsed = true; @@ -306,8 +306,9 @@ /** * {@inheritDoc} */ - public final int absoluteWidth(int pixelsPerInch) throws GraphicException { - int absoluteWidth = absoluteWidthReal(); + public final int absoluteWidth(final int pixelsPerInch) + throws GraphicException { + final int absoluteWidth = absoluteWidthReal(); if (absoluteWidth > 0) { // The graphic knows its absolute width. return absoluteWidth; @@ -316,7 +317,7 @@ // The user does not want the fallback computation. return -1; } - int pixelWidth = pixelWidth(); + final int pixelWidth = pixelWidth(); if (pixelWidth < 1) { // pixel Width is not valid return -1; @@ -335,8 +336,9 @@ /** * {@inheritDoc} */ - public final int absoluteHeight(int pixelsPerInch) throws GraphicException { - int absoluteHeight = absoluteHeightReal(); + public final int absoluteHeight(final int pixelsPerInch) + throws GraphicException { + final int absoluteHeight = absoluteHeightReal(); if (absoluteHeight > 0) { // The graphic knows its absolute height. return absoluteHeight; @@ -345,7 +347,7 @@ // The user does not want the fallback computation. return -1; } - int pixelHeight = pixelHeight(); + final int pixelHeight = pixelHeight(); if (pixelHeight < 1) { // pixel Height is not valid return -1; @@ -361,14 +363,14 @@ return -1; } - protected int parseInteger(byte[] buf, int idx) { + protected int parseInteger(final byte[] buf, final int idx) { if (idx > buf.length - 4) { return 0x00; } - int b1 = buf[idx] & 0xff; - int b2 = buf[idx+1] & 0xff; - int b3 = buf[idx+2] & 0xff; - int b4 = buf[idx+3] & 0xff; + final int b1 = buf[idx] & 0xff; + final int b2 = buf[idx+1] & 0xff; + final int b3 = buf[idx+2] & 0xff; + final int b4 = buf[idx+3] & 0xff; return (b4 << 24) | (b3 << 16) | (b2 << 8) | b1; } Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/ImageConsumerImpl.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/ImageConsumerImpl.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/ImageConsumerImpl.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -43,11 +43,11 @@ protected ColorModel cm = null; protected ImageProducer ip = null; - public ImageConsumerImpl(ImageProducer iprod) { + public ImageConsumerImpl(final ImageProducer iprod) { this.ip = iprod; } - public void imageComplete(int status) { + public void imageComplete(final int status) { /* * MessageHandler.error("Status "); * if (status == ImageConsumer.COMPLETESCANLINES) { @@ -80,32 +80,34 @@ } } - public void setColorModel(ColorModel model) { + public void setColorModel(final ColorModel model) { // MessageHandler.errorln("setColorModel: " + model); this.cm = model; } - public void setDimensions(int width, int height) { + public void setDimensions(final int width, final int height) { // MessageHandler.errorln("setDimension: w=" + width + " h=" + height); this.width = width; this.height = height; } - public void setHints(int hintflags) { + public void setHints(final int hintflags) { // MessageHandler.errorln("setHints: " + hintflags); this.hints = hintflags; } - public void setProperties(Hashtable props) { + public void setProperties(final Hashtable props) { // MessageHandler.errorln("setProperties: " + props); this.properties = props; } - public void setPixels(int x, int y, int w, int h, ColorModel model, - byte[] pixels, int off, int scansize) {} + public void setPixels(final int x, final int y, final int w, final int h, + final ColorModel model, final byte[] pixels, final int off, + final int scansize) {} - public void setPixels(int x, int y, int w, int h, ColorModel model, - int[] pixels, int off, int scansize) {} + public void setPixels(final int x, final int y, final int w, final int h, + final ColorModel model, final int[] pixels, final int off, + final int scansize) {} public boolean isImageReady() throws Exception { synchronized (this.imageStatus) { @@ -138,8 +140,8 @@ } public int[] getImage() throws Exception { - int tmpMap[] = new int[this.width * this.height]; - PixelGrabber pg = new PixelGrabber(this.ip, 0, 0, this.width, + final int tmpMap[] = new int[this.width * this.height]; + final PixelGrabber pg = new PixelGrabber(this.ip, 0, 0, this.width, this.height, tmpMap, 0, this.width); pg.setDimensions(this.width, this.height); @@ -148,7 +150,7 @@ pg.setProperties(this.properties); try { pg.grabPixels(); - } catch (InterruptedException intex) { + } catch (final InterruptedException intex) { throw new Exception("Image grabbing interrupted : " + intex.getMessage()); } Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/JAIGraphic.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/JAIGraphic.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/JAIGraphic.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -51,25 +51,25 @@ /** The JAI stream manager that is used for handling IO. */ FileCacheSeekableStream seekableInput2 = null; - public JAIGraphic(FOrayGraphicServer server, URL href, - BufferedInputStream bis) { + public JAIGraphic(final FOrayGraphicServer server, final URL href, + final BufferedInputStream bis) { super(server, href, bis); } public void loadImage() throws GraphicException { try { - RenderedOp imageOp = JAI.create("stream", getSeekableInput()); + final RenderedOp imageOp = JAI.create("stream", getSeekableInput()); this.pixelHeight = imageOp.getHeight(); this.pixelWidth = imageOp.getWidth(); - ColorModel cm = imageOp.getColorModel(); + final ColorModel cm = imageOp.getColorModel(); this.bitDepth = 8; // this.m_bitsPerPixel = cm.getPixelSize(); this.colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB); - BufferedImage imageData = imageOp.getAsBufferedImage(); - int[] tmpMap = imageData.getRGB(0, 0, this.pixelWidth, + final BufferedImage imageData = imageOp.getAsBufferedImage(); + final int[] tmpMap = imageData.getRGB(0, 0, this.pixelWidth, this.pixelHeight, null, 0, this.pixelWidth); @@ -80,10 +80,10 @@ this.content = new byte[this.contentSize]; for (int i = 0; i < this.pixelHeight; i++) { for (int j = 0; j < this.pixelWidth; j++) { - int p = tmpMap[i * this.pixelWidth + j]; - int r = (p >> 16) & 0xFF; - int g = (p >> 8) & 0xFF; - int b = (p) & 0xFF; + final int p = tmpMap[i * this.pixelWidth + j]; + final int r = (p >> 16) & 0xFF; + final int g = (p >> 8) & 0xFF; + final int b = (p) & 0xFF; this.content[3 * (i * this.pixelWidth + j)] = (byte)(r & 0xFF); this.content[3 * (i * this.pixelWidth + j) + 1] = (byte)(g @@ -93,7 +93,7 @@ } } - } catch (Exception ex) { + } catch (final Exception ex) { throw new GraphicException("Error while loading image " + this.url.toString() + " : " + ex.getClass() + " - " @@ -101,26 +101,26 @@ } } - private void checkAlpha(ColorModel cm) { + private void checkAlpha(final ColorModel cm) { if (! cm.hasAlpha()) { this.isTransparent = false; return; } // Transparency. BITMASK or OPAQUE or TRANSLUCENT - int transparencyType = cm.getTransparency(); + final int transparencyType = cm.getTransparency(); if (transparencyType == Transparency.OPAQUE) { this.isTransparent = false; } else if (transparencyType == Transparency.BITMASK) { if (cm instanceof IndexColorModel) { this.isTransparent = false; - byte[] alphas = + final byte[] alphas = new byte[((IndexColorModel)cm).getMapSize()]; - byte[] reds = + final byte[] reds = new byte[((IndexColorModel)cm).getMapSize()]; - byte[] greens = + final byte[] greens = new byte[((IndexColorModel)cm).getMapSize()]; - byte[] blues = + final byte[] blues = new byte[((IndexColorModel)cm).getMapSize()]; ((IndexColorModel)cm).getAlphas(alphas); ((IndexColorModel)cm).getReds(reds); @@ -169,7 +169,7 @@ * {@inheritDoc} */ public void parseBasics() throws IOException { - RenderedOp imageOp = JAI.create("stream", getSeekableInput()); + final RenderedOp imageOp = JAI.create("stream", getSeekableInput()); this.pixelHeight = imageOp.getHeight(); this.pixelWidth = imageOp.getWidth(); this.basicsParsed = true; Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/JPEGGraphic.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/JPEGGraphic.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/JPEGGraphic.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -76,8 +76,8 @@ boolean found_icc_profile = false; boolean found_dimensions = false; - public JPEGGraphic(FOrayGraphicServer server, URL href, - BufferedInputStream bis) { + public JPEGGraphic(final FOrayGraphicServer server, final URL href, + final BufferedInputStream bis) { super(server, href, bis); } @@ -89,18 +89,18 @@ if (! this.isValid) { return; } - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ByteArrayOutputStream iccStream = new ByteArrayOutputStream(); + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final ByteArrayOutputStream iccStream = new ByteArrayOutputStream(); this.colorSpace = null; - byte[] readBuf = new byte[4096]; + final byte[] readBuf = new byte[4096]; int bytes_read; - int index = 0; + final int index = 0; try { while ((bytes_read = bis.read(readBuf)) != -1) { baos.write(readBuf, 0, bytes_read); } - } catch (IOException ex) { + } catch (final IOException ex) { this.isValid = false; throw new GraphicException("Error loading image:\n " + this.url.toString() @@ -126,14 +126,15 @@ + "\n JpegImage - Invalid JPEG Header."); } if (iccStream.size() > 0) { - byte[] align = new byte[((iccStream.size()) % 8) + 8]; + final byte[] align = new byte[((iccStream.size()) % 8) + 8]; try { iccStream.write(align); - } catch (Exception e) { + } catch (final Exception e) { throw new GraphicException("\n1 Error while loading image " + this.url.toString() + " : " + e.getMessage()); } - ICC_Profile icc = ICC_Profile.getInstance(iccStream.toByteArray()); + final ICC_Profile icc = ICC_Profile.getInstance( + iccStream.toByteArray()); this.colorSpace = new ICC_ColorSpace(icc); } @@ -143,7 +144,8 @@ } } - private void processRemainder(ByteArrayOutputStream iccStream, int index) { + private void processRemainder(final ByteArrayOutputStream iccStream, + int index) { boolean cont = true; index += 2; while (index < this.content.length && cont) { @@ -155,8 +157,8 @@ } } - private boolean processNextChunk(ByteArrayOutputStream iccStream, - int index) { + private boolean processNextChunk(final ByteArrayOutputStream iccStream, + final int index) { //check to be sure this is the begining of a header if (! isBeginningOfHeader(index)) { // throw new GraphicException("\n2 Error while loading " @@ -192,12 +194,12 @@ return true; } - private boolean createdByPhotoshop(int index) { + private boolean createdByPhotoshop(final int index) { return ((uByte(this.content[index]) == 0xff)) && (uByte(this.content[index + 1]) == 0xe1); } - private boolean isICCProfile(int index) { + private boolean isICCProfile(final int index) { return uByte(this.content[index+1]) == 226 && this.content.length > (index+60); } @@ -217,7 +219,7 @@ * * This code will remain present for the time being. -blg */ - private boolean hasAPPEMarker(int index) { + private boolean hasAPPEMarker(final int index) { //hasAPPEMarker = true; return (uByte(this.content[index]) == 0xff && @@ -231,12 +233,12 @@ * 192 or 194 are the header bytes that contain the jpeg * width height and color depth. */ - private boolean isDimensionsAndColor(int index) { + private boolean isDimensionsAndColor(final int index) { return uByte(this.content[index + 1]) == 192 || uByte(this.content[index + 1]) == 194; } - private boolean isBeginningOfHeader(int index) { + private boolean isBeginningOfHeader(final int index) { if (this.content.length > (index + 2) && uByte(this.content[index]) == 255) { return true; @@ -244,9 +246,10 @@ return false; } - private void checkICCProfile(ByteArrayOutputStream iccStream, int index) { + private void checkICCProfile(final ByteArrayOutputStream iccStream, + final int index) { // Check if ICC profile - byte[] icc_string = new byte[11]; + final byte[] icc_string = new byte[11]; System.arraycopy(this.content, index+4, icc_string, 0, 11); /* @@ -259,7 +262,7 @@ } */ if ("ICC_PROFILE".equals(new String(icc_string))){ - int chunkSize = calcBytes(this.content[index + 2], + final int chunkSize = calcBytes(this.content[index + 2], this.content[index + 3]) + 2; // eller 18.. iccStream.write(this.content, index+16, chunkSize - 18); @@ -267,7 +270,7 @@ } - private void getColorSpace(int index) { + private void getColorSpace(final int index) { if (this.content[index + 9] == 1) { this.colorSpace = ColorSpace.getInstance(ColorSpace.CS_GRAY); } else if (this.content[index + 9] == 3) { @@ -281,18 +284,18 @@ } } - private void getDimensions(int index) { + private void getDimensions(final int index) { this.pixelHeight = calcBytes(this.content[index + 5], this.content[index + 6]); this.pixelWidth = calcBytes(this.content[index + 7], this.content[index + 8]); } - private int calcBytes(byte bOne, byte bTwo) { + private int calcBytes(final byte bOne, final byte bTwo) { return (uByte(bOne) * 256) + uByte(bTwo); } - private int uByte(byte bIn) { + private int uByte(final byte bIn) { if (bIn < 0) { return 256 + bIn; } @@ -349,7 +352,7 @@ * @param readBuffer Byte array containing either the contents of the * entire file, or some portion of the beginning of the file. */ - protected void findImageSize(byte[] readBuffer) { + protected void findImageSize(final byte[] readBuffer) { /* Start index at 2 because the first two bytes are the SOI marker. */ int index = 2; while (this.pixelHeight < 1 && this.pixelWidth < 1) { @@ -357,7 +360,7 @@ /* This is not the beginning of a segment.*/ return; } - byte markerType = readBuffer[index + 1]; + final byte markerType = readBuffer[index + 1]; switch (markerType) { case SOF1: case SOF2: @@ -377,7 +380,7 @@ default: { // Eat the segment marker and segment type bytes index += 2; - int toSkip = combine2bytes(readBuffer[index], + final int toSkip = combine2bytes(readBuffer[index], readBuffer[index + 1]); index += toSkip; } @@ -385,9 +388,10 @@ } } - protected static int combine2bytes(byte highOrder, byte lowOrder) { - int intHigh = highOrder << 24 >>> 16; - int intLow = lowOrder << 24 >>> 24; + protected static int combine2bytes(final byte highOrder, + final byte lowOrder) { + final int intHigh = highOrder << 24 >>> 16; + final int intLow = lowOrder << 24 >>> 24; return intHigh | intLow; } Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/PDFGraphic.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/PDFGraphic.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/PDFGraphic.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -36,8 +36,8 @@ */ public class PDFGraphic extends Graphic { - public PDFGraphic(FOrayGraphicServer server, URL href, - BufferedInputStream bis) { + public PDFGraphic(final FOrayGraphicServer server, final URL href, + final BufferedInputStream bis) { super(server, href, bis); } @@ -53,8 +53,8 @@ return; } imageLoaded = true; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - byte[] readBuf = new byte[20480]; + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final byte[] readBuf = new byte[20480]; int bytes_read; try { while (true) { @@ -65,7 +65,7 @@ break; } } - } catch (IOException ex) { + } catch (final IOException ex) { throw new GraphicException("Error while loading image " + this.url.toString() + " : " + ex.getClass() + " - " + ex.getMessage()); Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/PNGGraphic.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/PNGGraphic.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/PNGGraphic.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -36,8 +36,8 @@ public static final int PNG_SIG_LENGTH = 24; - public PNGGraphic(FOrayGraphicServer server, URL href, - BufferedInputStream bis) { + public PNGGraphic(final FOrayGraphicServer server, final URL href, + final BufferedInputStream bis) { super(server, href, bis); } @@ -49,7 +49,7 @@ * {@inheritDoc} */ public void parseBasics() throws IOException { - byte[] header = new byte[PNGGraphic.PNG_SIG_LENGTH]; + final byte[] header = new byte[PNGGraphic.PNG_SIG_LENGTH]; bis.read(header); // png is always big endian int byte1 = header[16] & 0xff; Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/SVGGraphic.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/SVGGraphic.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/SVGGraphic.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -51,17 +51,17 @@ private SVGDocument doc; - public SVGGraphic(FOrayGraphicServer server, URL href, - BufferedInputStream bis) { + public SVGGraphic(final FOrayGraphicServer server, final URL href, + final BufferedInputStream bis) { super(server, href, bis); } public void loadImage() throws GraphicException { try { - SAXSVGDocumentFactory factory = + final SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(this.server.getSVGParserClassName()); doc = factory.createSVGDocument(this.url.toExternalForm()); - } catch (Exception e) { + } catch (final Exception e) { getLogger().error("Could not load external SVG: " + e.getMessage()); } @@ -92,21 +92,22 @@ public void parseBasics() throws IOException { // parse document and get the size attributes of the svg element try { - SAXSVGDocumentFactory factory = + final SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(server.getSVGParserClassName()); /* It seems klunky to open another stream here, but the * createDocument method apparently closes the one that gets * passed to it. We need to leave it open so that it can be * reused later on. */ - SVGDocument doc = (SVGDocument)factory.createDocument( + final SVGDocument doc = (SVGDocument)factory.createDocument( url.toString(), url.openStream()); - UserAgent userAgent = new MUserAgent(new AffineTransform()); - BridgeContext ctx = new BridgeContext(userAgent); + final UserAgent userAgent = new MUserAgent(new AffineTransform()); + final BridgeContext ctx = new BridgeContext(userAgent); - Element e = doc.getRootElement(); - UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, e); + final Element e = doc.getRootElement(); + final UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, + e); String s; // 'width' attribute - default is 100% @@ -125,7 +126,7 @@ this.pixelHeight = (int)UnitProcessor.svgVerticalLengthToUserSpace (s, SVGOMDocument.SVG_HEIGHT_ATTRIBUTE, uctx); - } catch (NoClassDefFoundError ncdfe) { + } catch (final NoClassDefFoundError ncdfe) { getLogger().error("Batik not in class path"); return; } @@ -141,21 +142,21 @@ /** * Creates a new SVGUserAgent. */ - protected MUserAgent(AffineTransform at) { + protected MUserAgent(final AffineTransform at) { currentTransform = at; } /** * Displays an error message. */ - public void displayError(String message) { + public void displayError(final String message) { getLogger().error(message); } /** * Displays an error resulting from the specified Exception. */ - public void displayError(Exception ex) { + public void displayError(final Exception ex) { getLogger().error("SVGGraphic Exception", ex); } @@ -163,7 +164,7 @@ * Displays a message in the User Agent interface. * The given message is typically displayed in a status bar. */ - public void displayMessage(String message) { + public void displayMessage(final String message) { getLogger().info(message); } Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/TIFFGraphic.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/TIFFGraphic.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/TIFFGraphic.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -44,8 +44,8 @@ public class TIFFGraphic extends JAIGraphic { private int m_compression = 0; - public TIFFGraphic(FOrayGraphicServer server, URL href, - BufferedInputStream bis) { + public TIFFGraphic(final FOrayGraphicServer server, final URL href, + final BufferedInputStream bis) { super(server, href, bis); } @@ -55,7 +55,7 @@ } imageLoaded = true; try { - TIFFDirectory ifd = new TIFFDirectory(getSeekableInput(), 0); + final TIFFDirectory ifd = new TIFFDirectory(getSeekableInput(), 0); TIFFField fld = null; this.pixelHeight = (int)ifd.getFieldAsLong(0x101); @@ -112,10 +112,10 @@ + "only single strip images supported "); } } - long offset = ifd.getFieldAsLong(0x111); - long length = ifd.getFieldAsLong(0x117); + final long offset = ifd.getFieldAsLong(0x111); + final long length = ifd.getFieldAsLong(0x117); - byte[] readBuf = new byte[(int)length]; + final byte[] readBuf = new byte[(int)length]; int bytes_read; bis.close(); @@ -130,11 +130,11 @@ } this.content = readBuf; - } catch (GraphicException fie) { + } catch (final GraphicException fie) { getLogger().error("Reverting to TIFF image handling " + "through JAI: " + fie.getMessage()); super.loadImage(); - } catch (Exception ex) { + } catch (final Exception ex) { throw new GraphicException("Error while loading image " + this.url.toString() + " : " + ex.getClass() + " - " Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/BMPFactory.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/BMPFactory.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/BMPFactory.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -38,15 +38,15 @@ */ public class BMPFactory extends GraphicFactory { - public BMPFactory(FOrayGraphicServer server) { + public BMPFactory(final FOrayGraphicServer server) { super(server); } - public Graphic attemptCreate(URL url, BufferedInputStream bis) + public Graphic attemptCreate(final URL url, final BufferedInputStream bis) throws IOException { - byte[] header = new byte[BMPGraphic.BMP_SIG_LENGTH]; + final byte[] header = new byte[BMPGraphic.BMP_SIG_LENGTH]; bis.read(header); - boolean supported = ((header[0] == (byte)0x42) + final boolean supported = ((header[0] == (byte)0x42) && (header[1] == (byte)0x4d)); if (! supported) { return null; Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/EPSFactory.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/EPSFactory.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/EPSFactory.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -38,13 +38,13 @@ */ public class EPSFactory extends GraphicFactory { - public EPSFactory(FOrayGraphicServer server) { + public EPSFactory(final FOrayGraphicServer server) { super(server); } - public Graphic attemptCreate(URL url, BufferedInputStream bis) + public Graphic attemptCreate(final URL url, final BufferedInputStream bis) throws IOException { - byte[] header = new byte[30]; + final byte[] header = new byte[30]; bis.read(header, 0, 30); boolean isEPS = false; boolean isAscii = false; @@ -55,7 +55,7 @@ isEPS = true; } else { // Check if plain ascii - byte[] epsh = "%!PS".getBytes(); + final byte[] epsh = "%!PS".getBytes(); if (epsh[0] == header[0] && epsh[1] == header[1] && epsh[2] == header[2] && Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/GIFFactory.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/GIFFactory.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/GIFFactory.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -39,15 +39,15 @@ */ public class GIFFactory extends GraphicFactory { - public GIFFactory(FOrayGraphicServer server) { + public GIFFactory(final FOrayGraphicServer server) { super(server); } - public Graphic attemptCreate(URL url, BufferedInputStream bis) + public Graphic attemptCreate(final URL url, final BufferedInputStream bis) throws IOException { - byte[] header = new byte[GIFGraphic.GIF_SIG_LENGTH]; + final byte[] header = new byte[GIFGraphic.GIF_SIG_LENGTH]; bis.read(header); - boolean supported = ((header[0] == 'G') && (header[1] == 'I') + final boolean supported = ((header[0] == 'G') && (header[1] == 'I') && (header[2] == 'F') && (header[3] == '8') && (header[4] == '7' || header[4] == '9') && (header[5] == 'a')); Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/GraphicFactory.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/GraphicFactory.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/GraphicFactory.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -53,15 +53,15 @@ /** The parent GraphicServer instance. */ protected FOrayGraphicServer server = null; - public GraphicFactory(FOrayGraphicServer server) { + public GraphicFactory(final FOrayGraphicServer server) { this.server = server; } - public Graphic makeGraphic(URL url, BufferedInputStream bis) + public Graphic makeGraphic(final URL url, final BufferedInputStream bis) throws IOException { // Mark the stream so that it can be reset after the attempt. bis.mark(maxBytesToVerify()); - Graphic graphic = attemptCreate(url, bis); + final Graphic graphic = attemptCreate(url, bis); // Reset the stream so that is can be reused later. bis.reset(); return graphic; @@ -88,11 +88,11 @@ return this.server.getLogger(); } - protected long getLong(byte[] buf, int idx) { - int b1 = buf[idx] & 0xff; - int b2 = buf[idx+1] & 0xff; - int b3 = buf[idx+2] & 0xff; - int b4 = buf[idx+3] & 0xff; + protected long getLong(final byte[] buf, final int idx) { + final int b1 = buf[idx] & 0xff; + final int b2 = buf[idx+1] & 0xff; + final int b3 = buf[idx+2] & 0xff; + final int b4 = buf[idx+3] & 0xff; return (b4 << 24) | (b3 << 16) | (b2 << 8) | b1; } Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/JPEGFactory.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/JPEGFactory.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/JPEGFactory.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -40,15 +40,15 @@ */ public class JPEGFactory extends GraphicFactory { - public JPEGFactory(FOrayGraphicServer server) { + public JPEGFactory(final FOrayGraphicServer server) { super(server); } - public Graphic attemptCreate(URL url, BufferedInputStream bis) + public Graphic attemptCreate(final URL url, final BufferedInputStream bis) throws IOException { - byte[] header = new byte[JPEGGraphic.JPG_SIG_LENGTH]; + final byte[] header = new byte[JPEGGraphic.JPG_SIG_LENGTH]; bis.read(header); - boolean supported = ((header[0] == (byte)0xff) + final boolean supported = ((header[0] == (byte)0xff) && (header[1] == (byte)0xd8)); if (! supported) { return null; Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/PDFFactory.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/PDFFactory.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/PDFFactory.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -38,13 +38,13 @@ */ public class PDFFactory extends GraphicFactory { - public PDFFactory(FOrayGraphicServer server) { + public PDFFactory(final FOrayGraphicServer server) { super(server); } - public Graphic attemptCreate(URL url, BufferedInputStream bis) + public Graphic attemptCreate(final URL url, final BufferedInputStream bis) throws IOException { - byte[] header = new byte[4]; + final byte[] header = new byte[4]; bis.read(header, 0, 4); if (header[0] == 0x25 // % && header[1] == 0x50 // P Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/PNGFactory.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/PNGFactory.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/PNGFactory.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -39,15 +39,15 @@ */ public class PNGFactory extends GraphicFactory { - public PNGFactory(FOrayGraphicServer server) { + public PNGFactory(final FOrayGraphicServer server) { super(server); } - public Graphic attemptCreate(URL url, BufferedInputStream bis) + public Graphic attemptCreate(final URL url, final BufferedInputStream bis) throws IOException { - byte[] header = new byte[PNGGraphic.PNG_SIG_LENGTH]; + final byte[] header = new byte[PNGGraphic.PNG_SIG_LENGTH]; bis.read(header); - boolean supported + final boolean supported = ((header[0] == (byte) 0x89) // HTJ control character && (header[1] == (byte) 0x50) // P && (header[2] == (byte) 0x4e) // N Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/SVGFactory.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/SVGFactory.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/SVGFactory.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -37,20 +37,20 @@ */ public class SVGFactory extends GraphicFactory { - public SVGFactory(FOrayGraphicServer server) { + public SVGFactory(final FOrayGraphicServer server) { super(server); } - public Graphic attemptCreate(URL url, BufferedInputStream bis) + public Graphic attemptCreate(final URL url, final BufferedInputStream bis) throws IOException { - byte[] header = new byte[1024]; + final byte[] header = new byte[1024]; bis.read(header); /* * For now, try to avoid parsing the whole document. Converting a byte * array to a String is a bit risky & this may need some more work. */ - String headerString = new String(header); - int svgStringIndex = headerString.indexOf("<svg"); + final String headerString = new String(header); + final int svgStringIndex = headerString.indexOf("<svg"); if (svgStringIndex < 0) { return null; } Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/TIFFFactory.java =================================================================== --- trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/TIFFFactory.java 2006-07-23 17:25:44 UTC (rev 7816) +++ trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/TIFFFactory.java 2006-07-23 19:16:06 UTC (rev 7817) @@ -39,13 +39,13 @@ public class TIFFFactory extends GraphicFactory { protected static final int TIFF_SIG_LENGTH = 8; - public TIFFFactory(FOrayGraphicServer server) { + public TIFFFactory(final FOrayGraphicServer server) { super(server); } - public Graphic attemptCreate(URL url, BufferedInputStream bis) + public Graphic attemptCreate(final URL url, final BufferedInputStream bis) throws IOException { - byte[] header = new byte[TIFF_SIG_LENGTH]; + final byte[] header = new byte[TIFF_SIG_LENGTH]; bis.read(header); boolean supported = false; // first 2 bytes = II (little endian encoding) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-23 17:25:50
|
Revision: 7816 Author: victormote Date: 2006-07-23 10:25:44 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7816&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/NamespaceFO.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/ObjectMakerFO.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/PropertyMakerFO.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/NamespaceFO.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/NamespaceFO.java 2006-07-23 17:19:43 UTC (rev 7815) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/NamespaceFO.java 2006-07-23 17:25:44 UTC (rev 7816) @@ -55,26 +55,28 @@ return "fo"; } - public FObj parseElementForNS(String localName, FObj currentFObj, - PropertyList list, Locator locator) throws FOTreeException { + public FObj parseElementForNS(final String localName, + final FObj currentFObj, final PropertyList list, + final Locator locator) throws FOTreeException { return ObjectMakerFO.makeObject(localName, currentFObj, list, locator); } - public void parseAttributes(PropertyList propertyList, Attributes attlist, - FObj currentFObj, Locator locator, FOTreeBuilder builder) + public void parseAttributes(final PropertyList propertyList, + final Attributes attlist, final FObj currentFObj, + final Locator locator, final FOTreeBuilder builder) throws FOTreeException { - int[] attributeSort = sortAttributes(attlist); + final int[] attributeSort = sortAttributes(attlist); try { makeList(propertyList, attlist, currentFObj, attributeSort, locator, builder); - } catch (PropertyException e) { + } catch (final PropertyException e) { currentFObj.throwException(e.getMessage()); } } - public Property parseAttributeForNS(Attributes attributes, - String attributeName, String attributeValue, - PropertyList propertyList, Locator locator) + public Property parseAttributeForNS(final Attributes attributes, + final String attributeName, final String attributeValue, + final PropertyList propertyList, final Locator locator) throws PropertyException { Property property = null; // Try the FO namespace. @@ -88,11 +90,11 @@ return property; } - public byte enumerateElement(String localName) { + public byte enumerateElement(final String localName) { return ObjectMakerFO.enumerateObjectName(localName); } - public short enumerateAttribute(String attributeName) { + public short enumerateAttribute(final String attributeName) { short enumerated = PropertyMakerFO.enumeratePropertyName(attributeName); // If not found, try the XML namespace. if (enumerated < 0) { @@ -101,12 +103,12 @@ return enumerated; } - protected PropertyList createNewPropertyList(String localName, - Attributes attlist) { + protected PropertyList createNewPropertyList(final String localName, + final Attributes attlist) { return new PropertyList(); } - public String getPropertyName(short propertyType) { + public String getPropertyName(final short propertyType) { return Constants.expandPropertyNameEnumeration(propertyType); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/ObjectMakerFO.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/ObjectMakerFO.java 2006-07-23 17:19:43 UTC (rev 7815) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/ObjectMakerFO.java 2006-07-23 17:25:44 UTC (rev 7816) @@ -100,14 +100,14 @@ * @param objectName The object name to be enumerated. * @return The enumerated value of the object name. */ - public static byte enumerateObjectName(String objectName) { + public static byte enumerateObjectName(final String objectName) { return (byte) Arrays.binarySearch(Constants.objectNameList, objectName); } - public static FObj makeObject(String objectName, FObj parent, - PropertyList propertyList, Locator locator) + public static FObj makeObject(final String objectName, final FObj parent, + final PropertyList propertyList, final Locator locator) throws FOTreeException { - byte enumeration = enumerateObjectName(objectName); + final byte enumeration = enumerateObjectName(objectName); String systemId = null; int line = 0; int column = 0; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/PropertyMakerFO.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/PropertyMakerFO.java 2006-07-23 17:19:43 UTC (rev 7815) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/PropertyMakerFO.java 2006-07-23 17:25:44 UTC (rev 7816) @@ -150,18 +150,18 @@ */ public static short enumeratePropertyName(String propertyName) { propertyName = Property.getBasePropertyName(propertyName); - short enumerated = (short) Arrays.binarySearch( + final short enumerated = (short) Arrays.binarySearch( Constants.propertyNameList, propertyName); return enumerated; } - public static Property makeProperty(String propertyFullName, - String attributeValue, PropertyList propertyList) + public static Property makeProperty(final String propertyFullName, + final String attributeValue, final PropertyList propertyList) throws PropertyException { - String basePropertyName = Property.getBasePropertyName + final String basePropertyName = Property.getBasePropertyName (propertyFullName); - short enumeration = enumeratePropertyName(basePropertyName); - Property property = checkCompoundProperty(propertyList, + final short enumeration = enumeratePropertyName(basePropertyName); + final Property property = checkCompoundProperty(propertyList, enumeration, propertyFullName, attributeValue); if (property != null) { return property; @@ -1114,12 +1114,13 @@ * @return True if the property was successfully processed here (i.e. no * further processing is necessary), false otherwise. */ - private static Property checkCompoundProperty(PropertyList propertyList, - short enumeration, String propertyFullName, String attributeValue) + private static Property checkCompoundProperty( + final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { switch (enumeration) { case Constants.FOPROP_BLOCK_PROGRESSION_DIMENSION: { - Property property = getProperty(propertyList, + final Property property = getProperty(propertyList, Constants.FOPROP_BLOCK_PROGRESSION_DIMENSION); if (property == null) { return null; @@ -1131,7 +1132,7 @@ return property; } case Constants.FOPROP_INLINE_PROGRESSION_DIMENSION: { - Property property = getProperty(propertyList, + final Property property = getProperty(propertyList, Constants.FOPROP_INLINE_PROGRESSION_DIMENSION); if (property == null) { return null; @@ -1143,7 +1144,7 @@ return property; } case Constants.FOPROP_SPACE_AFTER: { - Property property = getProperty(propertyList, + final Property property = getProperty(propertyList, Constants.FOPROP_SPACE_AFTER); if (property == null) { return null; @@ -1155,7 +1156,7 @@ return property; } case Constants.FOPROP_SPACE_BEFORE: { - Property property = getProperty(propertyList, + final Property property = getProperty(propertyList, Constants.FOPROP_SPACE_BEFORE); if (property == null) { return null; @@ -1167,7 +1168,7 @@ return property; } case Constants.FOPROP_SPACE_END: { - Property property = getProperty(propertyList, + final Property property = getProperty(propertyList, Constants.FOPROP_SPACE_END); if (property == null) { return null; @@ -1179,7 +1180,7 @@ return property; } case Constants.FOPROP_SPACE_START: { - Property property = getProperty(propertyList, + final Property property = getProperty(propertyList, Constants.FOPROP_SPACE_START); if (property == null) { return null; @@ -1191,7 +1192,7 @@ return property; } case Constants.FOPROP_BORDER_SEPARATION: { - Property property = getProperty(propertyList, + final Property property = getProperty(propertyList, Constants.FOPROP_BORDER_SEPARATION); if (property == null) { return null; @@ -1203,7 +1204,7 @@ return property; } case Constants.FOPROP_LETTER_SPACING: { - Property property = getProperty(propertyList, + final Property property = getProperty(propertyList, Constants.FOPROP_LETTER_SPACING); if (property == null) { return null; @@ -1215,7 +1216,7 @@ return property; } case Constants.FOPROP_WORD_SPACING: { - Property property = getProperty(propertyList, + final Property property = getProperty(propertyList, Constants.FOPROP_WORD_SPACING); if (property == null) { return null; @@ -1227,7 +1228,7 @@ return property; } case Constants.FOPROP_KEEP_TOGETHER: { - Property property = getProperty(propertyList, + final Property property = getProperty(propertyList, Constants.FOPROP_KEEP_TOGETHER); if (property == null) { return null; @@ -1239,7 +1240,7 @@ return property; } case Constants.FOPROP_KEEP_WITH_NEXT: { - Property property = getProperty(propertyList, + final Property property = getProperty(propertyList, Constants.FOPROP_KEEP_WITH_NEXT); if (property == null) { return null; @@ -1251,7 +1252,7 @@ return property; } case Constants.FOPROP_KEEP_WITH_PREVIOUS: { - Property property = getProperty(propertyList, + final Property property = getProperty(propertyList, Constants.FOPROP_KEEP_WITH_PREVIOUS); if (property == null) { return null; @@ -1263,7 +1264,7 @@ return property; } case Constants.FOPROP_LINE_HEIGHT: { - Property property = getProperty(propertyList, + final Property property = getProperty(propertyList, Constants.FOPROP_LINE_HEIGHT); if (property == null) { return null; @@ -1275,7 +1276,7 @@ return property; } case Constants.FOPROP_LEADER_LENGTH: { - Property property = getProperty(propertyList, + final Property property = getProperty(propertyList, Constants.FOPROP_LEADER_LENGTH); if (property == null) { return null; @@ -1297,8 +1298,8 @@ * @param propertyType The integral identifier for the desired property. * @return The Property instance, or null if it does not exist. */ - private static Property getProperty(PropertyList propertyList, - short propertyType) { + private static Property getProperty(final PropertyList propertyList, + final short propertyType) { return propertyList.getProperty(propertyType); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-23 17:20:38
|
Revision: 7815 Author: victormote Date: 2006-07-23 10:19:43 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7815&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractFlow.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractTableBody.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BasicLink.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Bookmark.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTree.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ColorProfile.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Declarations.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Float.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Footnote.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FootnoteBody.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InitialPropertySet.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListBlock.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemBody.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemLabel.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Marker.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiCase.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiProperties.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiPropertySet.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiSwitch.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiToggle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageMasterReference.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumber.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberCitation.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberGenerator.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequence.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequenceMaster.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Region.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionAfter.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionBefore.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionBody.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionEnd.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionStart.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RepeatablePMAlternatives.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RepeatablePMReference.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RetrieveMarker.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Root.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SimplePageMaster.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SinglePageMasterReference.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/StaticContent.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Table.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableAndCaption.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableBody.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCaption.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCell.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableColumn.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableFooter.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableHeader.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableRow.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Title.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Wrapper.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractFlow.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractFlow.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractFlow.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -32,8 +32,9 @@ public abstract class AbstractFlow extends FObj { - protected AbstractFlow(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + protected AbstractFlow(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); if (! (parent instanceof PageSequence)) { throwException(getFullName() + " must be child of " @@ -42,7 +43,7 @@ } protected void start() throws FOTreeException { - String name = traitFlowName(); + final String name = traitFlowName(); if (name == null || name.equals("")) { throwException(getFullName() + "requires a 'flow-name'."); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractTableBody.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractTableBody.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractTableBody.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -33,8 +33,9 @@ public abstract class AbstractTableBody extends FObj implements org.axsl.foR.fo.AbstractTableBody { - public AbstractTableBody(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public AbstractTableBody(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); if (! (parent instanceof Table)) { throwException(getFullName() + " must be child of fo:table."); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BasicLink.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BasicLink.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BasicLink.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -33,8 +33,9 @@ public class BasicLink extends Inline implements org.axsl.foR.fo.BasicLink { - public BasicLink(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public BasicLink(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -66,7 +67,7 @@ /** * Override the FONode method, because "this" is the object being sought. */ - public org.axsl.foR.fo.BasicLink getBasicLink(FOContext context) { + public org.axsl.foR.fo.BasicLink getBasicLink(final FOContext context) { return this; } @@ -118,7 +119,7 @@ /** * {@inheritDoc} */ - public String refIdNeeded(FOContext context) { + public String refIdNeeded(final FOContext context) { return traitInternalDestination(); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -37,8 +37,9 @@ public class BidiOverride extends FObj implements org.axsl.foR.fo.BidiOverride { - public BidiOverride(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public BidiOverride(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -54,7 +55,7 @@ return true; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -42,8 +42,9 @@ public class Block extends FObjMixed implements org.axsl.foR.fo.Block { - public Block(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public Block(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -58,7 +59,7 @@ /** * Overrides the method in FObj, because this is the containing block. */ - public org.axsl.foR.fo.Block getContainingBlock(FOContext context) { + public org.axsl.foR.fo.Block getContainingBlock(final FOContext context) { return this; } @@ -98,9 +99,9 @@ * @return The List of this block's logical blocks, as defined. */ public List getLogicalBlocks() { - ArrayList outsideList = new ArrayList(); + final ArrayList outsideList = new ArrayList(); ArrayList insideList = new ArrayList(); - Stack stack = new Stack(); + final Stack stack = new Stack(); /* * Place the children on the stack in reverse order (last item on the * bottom, first on the top). @@ -109,13 +110,13 @@ stack.push(getChildren().get(i)); } while (! stack.isEmpty()) { - FONode node = (FONode) stack.pop(); + final FONode node = (FONode) stack.pop(); // FOText is always a leaf. Include in list. if (node instanceof FOText) { insideList.add(node); continue; } - FObj fobj = (FObj) node; + final FObj fobj = (FObj) node; /* Block-type content is a special case. Include it in list instead * of its descendants. */ if (fobj.isContentBlock()) { @@ -126,7 +127,7 @@ outsideList.add(node); continue; } - List children = fobj.getChildren(); + final List children = fobj.getChildren(); // If there are no children, it is a leaf. Include in list. if (children == null || children.size() < 1) { insideList.add(node); @@ -151,7 +152,7 @@ return true; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -35,8 +35,9 @@ public class BlockContainer extends FObj implements org.axsl.foR.fo.BlockContainer { - public BlockContainer(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public BlockContainer(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -61,7 +62,7 @@ return true; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Bookmark.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Bookmark.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Bookmark.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -38,8 +38,9 @@ * An fo:bookmark object in XSL-FO. */ public class Bookmark extends FObj implements org.axsl.foR.fo.Bookmark { - public Bookmark(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public Bookmark(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); /* * Validate that this is a child of either fo:bookmark-tree or @@ -53,12 +54,12 @@ } public void start() throws FOTreeException { - String _internalDestination = this.traitInternalDestination(); + final String _internalDestination = this.traitInternalDestination(); if (_internalDestination == null || _internalDestination.equals("")) { getLogger().warn(getFullName() + "requires an internal-destination."); } - String _externalDestination = this.traitExternalDestination(); + final String _externalDestination = this.traitExternalDestination(); if (_externalDestination != null &&!_externalDestination.equals("")) { getLogger().warn(getFullName() + "external-destination not supported currently."); @@ -75,7 +76,7 @@ } // Validate that all other children are Outline instances. for (int i = 1; i < children.size(); i++) { - FObj child = (FObj) children.get(i); + final FObj child = (FObj) children.get(i); if (child instanceof BookmarkTitle) { throwException("Child fo:bookmark-title not allowed in this " + "position."); @@ -87,7 +88,7 @@ } } - public Bookmark getParentOutline(FOContext context) { + public Bookmark getParentOutline(final FOContext context) { for (FONode node = (FONode) getParent(); node != null; node = node.effectiveParent(context)) { if (node instanceof Bookmark) { @@ -113,11 +114,11 @@ /** * {@inheritDoc} */ - public String refIdNeeded(FOContext context) { + public String refIdNeeded(final FOContext context) { return traitInternalDestination(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -40,8 +40,9 @@ public class BookmarkTitle extends FObjMixed implements org.axsl.foR.fo.BookmarkTitle { - public BookmarkTitle(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public BookmarkTitle(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -82,7 +83,7 @@ return false; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTree.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTree.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTree.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -38,8 +38,9 @@ public class BookmarkTree extends FObj implements org.axsl.foR.fo.BookmarkTree { - public BookmarkTree(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public BookmarkTree(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); // Validate that this is a child of fo:root. if (! (parent instanceof Root)) { @@ -50,7 +51,7 @@ public void end() throws FOTreeException { // Validate that all children are Bookmark instances. for (int i = 1; i < children.size(); i++) { - FObj child = (FObj) children.get(i); + final FObj child = (FObj) children.get(i); if (! (child instanceof Bookmark)) { throwException(child.getFullName() + " cannot be child of " + this.getFullName()); @@ -66,7 +67,7 @@ return this.getFOTreeBuilder().getFONamespace(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -39,8 +39,9 @@ */ public class Character extends FObj implements org.axsl.foR.fo.Character { - public Character(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public Character(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -57,24 +58,24 @@ } public void start() throws FOTreeException { - char c = traitCharacter(); + final char c = traitCharacter(); if (c == org.foray.fotree.fo.prop.Character.CHARACTER_NOT_SPECIFIED) { throwException("Property \"character\" is required."); } /* This is a duplication of data, but is deemed acceptable at the * moment, because it is expected that use of fo:character will normally * be very limited. */ - char[] chars = new char[] {c}; - FOText text = new FOText(this, chars); + final char[] chars = new char[] {c}; + final FOText text = new FOText(this, chars); super.addChild(text); } - public char[] getAreaTreeText(FOContext context) { - FOText text = (FOText) this.children.get(0); + public char[] getAreaTreeText(final FOContext context) { + final FOText text = (FOText) this.children.get(0); return text.getAreaTreeText(context); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ColorProfile.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ColorProfile.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ColorProfile.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -36,8 +36,9 @@ public class ColorProfile extends FObj implements org.axsl.foR.fo.ColorProfile { - public ColorProfile(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public ColorProfile(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); logWarning(getFullName() + " not implemented."); } @@ -50,7 +51,7 @@ return this.getFOTreeBuilder().getFONamespace(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -41,9 +41,9 @@ */ public class ConditionalPageMasterReference extends FObj { - public ConditionalPageMasterReference(FObj parent, - PropertyList propertyList, String systemId, int line, int column) - throws FOTreeException { + public ConditionalPageMasterReference(final FObj parent, + final PropertyList propertyList, final String systemId, + final int line, final int column) throws FOTreeException { super(parent, propertyList, systemId, line, column); /* Validate ancestry. */ if (! (parent instanceof RepeatablePMAlternatives)) { @@ -73,9 +73,9 @@ return (RepeatablePMAlternatives) this.parentFO(); } - protected boolean isValid(boolean isOddPage, boolean isFirstPage, - boolean isEmptyPage) { - int pagePosition = traitPagePosition(); + protected boolean isValid(final boolean isOddPage, + final boolean isFirstPage, final boolean isEmptyPage) { + final int pagePosition = traitPagePosition(); if (isFirstPage) { if (pagePosition == Constants.FOVAL_REST) { return false; @@ -124,7 +124,7 @@ return this.getFOTreeBuilder().getFONamespace(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Declarations.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Declarations.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Declarations.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -36,8 +36,9 @@ public class Declarations extends FObj implements org.axsl.foR.fo.Declarations { - public Declarations(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public Declarations(final FObj parent,final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -49,7 +50,7 @@ return this.getFOTreeBuilder().getFONamespace(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -58,8 +58,9 @@ * computations. */ protected int pixelsPerInch = 96; - public ExternalGraphic(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public ExternalGraphic(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -78,14 +79,14 @@ /** * @return The resolved Graphic instance encapsulated by this FO. */ - public Graphic getGraphic(FOContext context) { + public Graphic getGraphic(final FOContext context) { if (this.graphic == null && ! makeGraphicAttempted) { makeGraphicAttempted = true; try { this.graphic = getGraphicServer().makeGraphic(traitSrc(context), getFOTreeBuilder().getGraphicSearchPath(), getFOTreeBuilder().getCachingGraphics()); - } catch (GraphicException e) { + } catch (final GraphicException e) { getLogger().error(e.getMessage() + "\n" + this.getContextMessage()); } @@ -96,7 +97,7 @@ /** * {@inheritDoc} */ - protected int intrinsicContentWidth(FOContext context) { + protected int intrinsicContentWidth(final FOContext context) { if (getGraphic(context) == null) { return Constants.DIMENSION_AUTO; } @@ -107,7 +108,7 @@ /* Use conversion formula 1 pixel = 1/96 inch. See XSL-FO Standard * 1.0, Section 6.6.5, where this formula is suggested. */ return pixelsToMillipoints(getGraphic(context).pixelWidth(), 96); - } catch (GraphicException e) { + } catch (final GraphicException e) { return Constants.DIMENSION_AUTO; } } @@ -115,7 +116,7 @@ /** * {@inheritDoc} */ - protected int intrinsicContentHeight(FOContext context) { + protected int intrinsicContentHeight(final FOContext context) { if (getGraphic(context) == null) { return Constants.DIMENSION_AUTO; } @@ -126,20 +127,20 @@ /* Use conversion formula 1 pixel = 1/96 inch. See XSL-FO Standard * 1.0, Section 6.6.5, where this formula is suggested. */ return pixelsToMillipoints(getGraphic(context).pixelHeight(), 96); - } catch (GraphicException e) { + } catch (final GraphicException e) { return Constants.DIMENSION_AUTO; } } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } /** * {@inheritDoc} */ - public FOLineNonText getContextWrapper(FOContext context) { - org.axsl.foR.fo.Marker marker = this.ancestorMarker(); + public FOLineNonText getContextWrapper(final FOContext context) { + final org.axsl.foR.fo.Marker marker = this.ancestorMarker(); if (marker == null) { return this; } @@ -161,42 +162,45 @@ return null; } - public int inlineSizeOptimum(int lineLength) { + public int inlineSizeOptimum(final int lineLength) { return inlineSizeOptimum(null, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeOptimum(FOContext context, int lineLength) { + public int inlineSizeOptimum(final FOContext context, + final int lineLength) { return this.viewportIPD(context, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMinimum(int lineLength) { + public int inlineSizeMinimum(final int lineLength) { return inlineSizeMinimum(null, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMinimum(FOContext context, int lineLength) { + public int inlineSizeMinimum(final FOContext context, + final int lineLength) { return this.viewportIPD(context, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMaximum(int lineLength) { + public int inlineSizeMaximum(final int lineLength) { return inlineSizeMaximum(null, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMaximum(FOContext context, int lineLength) { + public int inlineSizeMaximum(final FOContext context, + final int lineLength) { return this.viewportIPD(context, lineLength); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Float.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Float.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Float.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -36,8 +36,9 @@ */ public class Float extends FObj implements org.axsl.foR.fo.Float { - public Float(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public Float(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -61,7 +62,7 @@ return true; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -35,8 +35,9 @@ public class Flow extends AbstractFlow implements org.axsl.foR.fo.Flow { - public Flow(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public Flow(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -49,7 +50,7 @@ for (int i = 0; i < getChildren().size(); i++) { /* Cast to FObj should be OK, because it is not possible to create * an FOText item whose parent is anything but an FObjMixed. */ - FObj child = (FObj) getChildren().get(i); + final FObj child = (FObj) getChildren().get(i); if (child.isContentBlock()) { anyBlockContent = true; continue; @@ -79,11 +80,11 @@ * Overrides the method in FObj, because this is the object being sought. * @return this, because this is the ancestor flow object. */ - public org.axsl.foR.fo.Flow getFlow(FOContext context) { + public org.axsl.foR.fo.Flow getFlow(final FOContext context) { return this; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Footnote.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Footnote.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Footnote.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -35,8 +35,9 @@ public class Footnote extends FObj implements org.axsl.foR.fo.Footnote { - public Footnote(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public Footnote(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -79,7 +80,7 @@ return (FootnoteBody) this.children.get(1); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FootnoteBody.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FootnoteBody.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FootnoteBody.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -36,8 +36,9 @@ public class FootnoteBody extends FObj implements org.axsl.foR.fo.FootnoteBody { - public FootnoteBody(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public FootnoteBody(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -49,7 +50,7 @@ return this.getFOTreeBuilder().getFONamespace(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InitialPropertySet.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InitialPropertySet.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InitialPropertySet.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -37,8 +37,9 @@ public class InitialPropertySet extends FObj implements org.axsl.foR.fo.InitialPropertySet { - public InitialPropertySet(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public InitialPropertySet(final FObj parent, + final PropertyList propertyList, final String systemId, + final int line, final int column) throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -50,7 +51,7 @@ return this.getFOTreeBuilder().getFONamespace(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -36,8 +36,9 @@ public class Inline extends FObjMixed implements org.axsl.foR.fo.Inline { - public Inline(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public Inline(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); if (parent instanceof Flow) { throwException(getFullName() + " cannot be child of fo:flow."); @@ -63,7 +64,7 @@ return true; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -37,8 +37,9 @@ public class InlineContainer extends FObj implements org.axsl.foR.fo.InlineContainer { - public InlineContainer(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public InlineContainer(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -59,7 +60,7 @@ return true; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -40,8 +40,9 @@ public class InstreamForeignObject extends FObjScaled implements org.axsl.foR.fo.InstreamForeignObject { - public InstreamForeignObject(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public InstreamForeignObject(final FObj parent, + final PropertyList propertyList, final String systemId, + final int line, final int column) throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -78,26 +79,26 @@ /** * {@inheritDoc} */ - protected int intrinsicContentWidth(FOContext context) { + protected int intrinsicContentWidth(final FOContext context) { return ((ForeignXML) getForeignXML()).intrinsicContentWidth(); } /** * {@inheritDoc} */ - protected int intrinsicContentHeight(FOContext context) { + protected int intrinsicContentHeight(final FOContext context) { return ((ForeignXML) getForeignXML()).intrinsicContentHeight(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } /** * {@inheritDoc} */ - public FOLineNonText getContextWrapper(FOContext context) { - org.axsl.foR.fo.Marker marker = this.ancestorMarker(); + public FOLineNonText getContextWrapper(final FOContext context) { + final org.axsl.foR.fo.Marker marker = this.ancestorMarker(); if (marker == null) { return this; } @@ -119,42 +120,45 @@ return null; } - public int inlineSizeOptimum(int lineLength) { + public int inlineSizeOptimum(final int lineLength) { return inlineSizeOptimum(null, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeOptimum(FOContext context, int lineLength) { + public int inlineSizeOptimum(final FOContext context, + final int lineLength) { return this.viewportIPD(context, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMinimum(int lineLength) { + public int inlineSizeMinimum(final int lineLength) { return inlineSizeMinimum(null, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMinimum(FOContext context, int lineLength) { + public int inlineSizeMinimum(final FOContext context, + final int lineLength) { return this.viewportIPD(context, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMaximum(int lineLength) { + public int inlineSizeMaximum(final int lineLength) { return inlineSizeMaximum(null, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMaximum(FOContext context, int lineLength) { + public int inlineSizeMaximum(final FOContext context, + final int lineLength) { return this.viewportIPD(context, lineLength); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -52,8 +52,9 @@ */ private HashMap regionMap; - public LayoutMasterSet(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public LayoutMasterSet(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); if (! (parent instanceof Root)) { throwException(getFullName() + " must be child of fo:root."); @@ -67,7 +68,7 @@ return "layout-master-set"; } - protected void addSimplePageMaster(SimplePageMaster simplePageMaster) + protected void addSimplePageMaster(final SimplePageMaster simplePageMaster) throws FOTreeException { // check against duplication of master-name if (existsName(simplePageMaster.traitMasterName())) { @@ -80,12 +81,12 @@ simplePageMaster); } - public SimplePageMaster getSimplePageMaster(String masterName) { + public SimplePageMaster getSimplePageMaster(final String masterName) { return (SimplePageMaster)this.simplePageMasters.get(masterName); } - protected void addPageSequenceMaster(String masterName, - PageSequenceMaster pageSequenceMaster) + protected void addPageSequenceMaster(final String masterName, + final PageSequenceMaster pageSequenceMaster) throws FOTreeException { // check against duplication of master-name if (existsName(masterName)) { @@ -96,11 +97,11 @@ this.pageSequenceMasters.put(masterName, pageSequenceMaster); } - public PageSequenceMaster getPageSequenceMaster(String masterName) { + public PageSequenceMaster getPageSequenceMaster(final String masterName) { return (PageSequenceMaster)this.pageSequenceMasters.get(masterName); } - private boolean existsName(String masterName) { + private boolean existsName(final String masterName) { if (simplePageMasters.containsKey(masterName) || pageSequenceMasters.containsKey(masterName)) { return true; @@ -114,8 +115,8 @@ * @return True iff at least one region in this layout-master-set has its * region-name matching regionName. */ - protected boolean regionNameExists(String regionName) { - String regionClass = (String) this.regionMap.get(regionName); + protected boolean regionNameExists(final String regionName) { + final String regionClass = (String) this.regionMap.get(regionName); return (regionClass != null); } @@ -123,7 +124,7 @@ return this.getFOTreeBuilder().getFONamespace(); } - public org.axsl.foR.fo.Root getRoot(FOContext context) { + public org.axsl.foR.fo.Root getRoot(final FOContext context) { // Cast verified at construction. return (org.axsl.foR.fo.Root) this.getParent(); } @@ -138,15 +139,15 @@ * @return The region-class for regionName, or null if the region-name has * not yet been registered. */ - public String getRegionClass(String regionName) { + public String getRegionClass(final String regionName) { return (String) regionMap.get(traitRegionName()); } - protected void registerRegionName(Region region) { + protected void registerRegionName(final Region region) { regionMap.put(region.traitRegionName(), region.getName()); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -44,8 +44,9 @@ public class Leader extends FObjMixed implements org.axsl.foR.fo.Leader { - public Leader(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public Leader(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -53,7 +54,7 @@ /* Using a null context here is OK, because we are not computing * a length to be used anywhere, only testing the relative values of * the min, max, and optimum. */ - FOContext context = null; + final FOContext context = null; final int testConstant = 1000000; if (traitLeaderLengthMin(context, testConstant) > traitLeaderLengthOpt(context, testConstant)) { @@ -82,8 +83,8 @@ /** * {@inheritDoc} */ - public FOLineNonText getContextWrapper(FOContext context) { - org.axsl.foR.fo.Marker marker = this.ancestorMarker(); + public FOLineNonText getContextWrapper(final FOContext context) { + final org.axsl.foR.fo.Marker marker = this.ancestorMarker(); if (marker == null) { return this; } @@ -105,34 +106,37 @@ return null; } - public int inlineSizeOptimum(int lineLength) { + public int inlineSizeOptimum(final int lineLength) { return traitLeaderLengthOpt(null, lineLength); } - public int inlineSizeOptimum(FOContext context, int lineLength) { + public int inlineSizeOptimum(final FOContext context, + final int lineLength) { return traitLeaderLengthOpt(context, lineLength); } - public int inlineSizeMinimum(int lineLength) { + public int inlineSizeMinimum(final int lineLength) { return traitLeaderLengthMin(null, lineLength); } - public int inlineSizeMinimum(FOContext context, int lineLength) { + public int inlineSizeMinimum(final FOContext context, + final int lineLength) { return traitLeaderLengthMin(context, lineLength); } - public int inlineSizeMaximum(int lineLength) { + public int inlineSizeMaximum(final int lineLength) { return traitLeaderLengthMax(null, lineLength); } - public int inlineSizeMaximum(FOContext context, int lineLength) { + public int inlineSizeMaximum(final FOContext context, + final int lineLength) { return traitLeaderLengthMax(context, lineLength); } /** * Overrides FObj method, because this is the Leader being sought. */ - public org.axsl.foR.fo.Leader getNearestLeader(FOContext context) { + public org.axsl.foR.fo.Leader getNearestLeader(final FOContext context) { return this; } @@ -147,7 +151,7 @@ return true; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListBlock.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListBlock.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListBlock.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -34,8 +34,9 @@ public class ListBlock extends FObj implements org.axsl.foR.fo.ListBlock { - public ListBlock(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public ListBlock(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -56,7 +57,7 @@ this.throwException("fo:list-block must have at least one child."); } for (int i = 0; i < this.getChildren().size(); i++) { - FObj fobj = (FObj) this.getChildAt(i); + final FObj fobj = (FObj) this.getChildAt(i); if (! (fobj instanceof ListItem)) { this.throwException("Child of fo:list-block must be " + "fo:list-item", fobj.getContextMessage()); @@ -64,7 +65,7 @@ } } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -35,8 +35,9 @@ public class ListItem extends FObj implements org.axsl.foR.fo.ListItem { - public ListItem(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public ListItem(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -57,7 +58,8 @@ /** * Override the FObj method, because this is a ListItem instance. */ - public org.axsl.foR.fo.ListItem getNearestListItem(FOContext context) { + public org.axsl.foR.fo.ListItem getNearestListItem( + final FOContext context) { return this; } @@ -69,7 +71,7 @@ return this.getFOTreeBuilder().getFONamespace(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemBody.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemBody.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemBody.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -36,8 +36,9 @@ public class ListItemBody extends FObj implements org.axsl.foR.fo.ListItemBody { - public ListItemBody(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public ListItemBody(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -53,11 +54,12 @@ * Overrides the FObj method, because this is the object that is being * sought. */ - public org.axsl.foR.FObj ancestorListRelatedObject(FOContext context) { + public org.axsl.foR.FObj ancestorListRelatedObject( + final FOContext context) { return this; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemLabel.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemLabel.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemLabel.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -37,8 +37,9 @@ public class ListItemLabel extends FObj implements org.axsl.foR.fo.ListItemLabel { - public ListItemLabel(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public ListItemLabel(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -54,11 +55,12 @@ * Overrides the FObj method, because this is the object that is being * sought. */ - public org.axsl.foR.FObj ancestorListRelatedObject(FOContext context) { + public org.axsl.foR.FObj ancestorListRelatedObject( + final FOContext context) { return this; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Marker.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Marker.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Marker.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -39,17 +39,18 @@ public class Marker extends FObjMixed implements org.axsl.foR.fo.Marker { - public Marker(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public Marker(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); // Validate that we are inside an fo:flow. if (getFlow(null) == null) { throwException(getFullName() + " must be descendant of fo:flow."); } // Validate that there is not content before this and other markers. - List siblings = realParent().getChildren(); + final List siblings = realParent().getChildren(); for (int i = 0; i < siblings.size(); i++) { - FONode sibling = (FONode) siblings.get(i); + final FONode sibling = (FONode) siblings.get(i); if ((sibling instanceof Marker) || (sibling instanceof FOText && ((FOText) sibling).isAllWhiteSpace())) { @@ -62,12 +63,12 @@ public void start() throws FOTreeException { // Make sure that no sibling marker has the same 'marker-class-name'. - List siblings = realParent().getChildren(); + final List siblings = realParent().getChildren(); for (int i = 0; i < siblings.size(); i++) { if (! (siblings.get(i) instanceof Marker)) { continue; } - Marker siblingMarker = (Marker) siblings.get(i); + final Marker siblingMarker = (Marker) siblings.get(i); /* * Since this is already registered as a child of parent, we must * exclude it from the test. @@ -99,7 +100,7 @@ return true; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiCase.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiCase.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiCase.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -37,8 +37,9 @@ */ public class MultiCase extends FObj implements org.axsl.foR.fo.MultiCase { - public MultiCase(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public MultiCase(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -50,7 +51,7 @@ return this.getFOTreeBuilder().getFONamespace(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiProperties.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiProperties.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/j... [truncated message content] |
|
From: <vic...@us...> - 2006-07-23 14:57:47
|
Revision: 7814 Author: victormote Date: 2006-07-23 07:56:47 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7814&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-fotree/.project trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontFamily.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSize.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSizeAdjust.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStretch.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStyle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontVariant.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontWeight.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ForcePageCount.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Format.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GlyphOrientation.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GroupingSize.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphLadderCount.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphPushCharCount.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphRemainCharCount.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Id.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Indent.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InitialPageNumber.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InternalDestination.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Keep.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Language.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LastLineEndIndent.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LeaderLength.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LeaderPatternWidth.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LetterSpacing.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LineHeight.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Margin.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/MaximumRepeats.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Name.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/NumberColumnsRepeated.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/NumberColumnsSpanned.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/NumberRowsSpanned.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Orphans.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Padding.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/PageDimension.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Pause.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Pitch.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/PlayDuring.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ProvDistanceBetween.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ProvLabelSeparation.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RefId.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RegionName.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeDimension.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeSpace.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Role.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RuleThickness.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Script.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Size.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/SourceDocument.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/SpeechRate.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Src.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/SwitchTo.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TableLayout.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TargetPresentationContext.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TargetProcessingContext.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TargetStylesheet.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextAlign.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextAlignLast.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextAltitude.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextDecoration.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextDepth.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextIndent.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextShadow.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TreatAsWordSpace.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/VerticalAlign.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/VoiceFamily.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Volume.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Widows.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/WordSpacing.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/WritingMode.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ZIndex.java Modified: trunk/foray/foray-fotree/.project =================================================================== --- trunk/foray/foray-fotree/.project 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/.project 2006-07-23 14:56:47 UTC (rev 7814) @@ -10,8 +10,14 @@ <arguments> </arguments> </buildCommand> + <buildCommand> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <arguments> + </arguments> + </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> </natures> </projectDescription> Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontFamily.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontFamily.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontFamily.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -55,30 +55,30 @@ Constants.FOVAL_INHERIT, }; - public FontFamily(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public FontFamily(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public FontFamily(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public FontFamily(final PropertyList propertyList, final short enumeration, + final PropertyValue value) throws PropertyException { super(propertyList, enumeration, value); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyValue pv = checkKeywords(value); + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } return new DtString(value); } - public String[] getValue(FOContext context, FObj fobj) { + public String[] getValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getValueNoInstance(context, fobj); @@ -88,23 +88,24 @@ case Constants.FOVAL_CURSIVE: case Constants.FOVAL_FANTASY: case Constants.FOVAL_MONOSPACE: { - String[] returnArray + final String[] returnArray = {Constants.propertyKeywordValues[keyword]}; return returnArray; } } } if (this.value instanceof DtString) { - DtString stringDT = (DtString) this.value; - String[] returnArray = FontUtility.foFontFamily( + final DtString stringDT = (DtString) this.value; + final String[] returnArray = FontUtility.foFontFamily( stringDT.getValue()); return returnArray; } return DEFAULT_FONT_FAMILY; } - public static String[] getValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static String[] getValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent != null) { return parent.traitFontFamily(context); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSize.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSize.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSize.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -70,20 +70,20 @@ 20700, }; - public FontSize(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public FontSize(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public FontSize(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public FontSize(final PropertyList propertyList, final short enumeration, + final PropertyValue value) throws PropertyException { super(propertyList, enumeration, value); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -100,9 +100,9 @@ throw unexpectedValue(value, propertyList); } - public int getValue(FOContext context, FObj fobj) { + public int getValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getBaseFontSize(context, fobj); @@ -137,12 +137,12 @@ } } if (this.value instanceof DtLength) { - DtLength length = (DtLength) this.value; + final DtLength length = (DtLength) this.value; return length.getValue(getBaseFontSize(context, fobj), 0); } if (this.value instanceof DtPercentage) { - DtPercentage percentageDT = (DtPercentage) this.value; - float percentage = percentageDT.getValue(); + final DtPercentage percentageDT = (DtPercentage) this.value; + final float percentage = percentageDT.getValue(); return Math.round(percentage * getBaseFontSize(context, fobj) / 100); } @@ -153,16 +153,18 @@ return getBaseFontSize(context, fobj); } - public static int getValueNoInstance(FOContext context, FObj fobj) { + public static int getValueNoInstance(final FOContext context, + final FObj fobj) { return getBaseFontSize(context, fobj); } - private static int getBaseFontSize(FOContext context, FObj fobj) { + private static int getBaseFontSize(final FOContext context, + final FObj fobj) { /* * The base font size comes from the parent object, and is needed * for "em" and percentage computations. */ - FObj parent = fobj.effectiveParent(context); + final FObj parent = fobj.effectiveParent(context); int baseFontSize = getDefaultFontSize(); if (parent != null) { baseFontSize = parent.traitFontSize(context); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSizeAdjust.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSizeAdjust.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSizeAdjust.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -43,20 +43,22 @@ Constants.FOVAL_INHERIT, }; - public FontSizeAdjust(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public FontSizeAdjust(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public FontSizeAdjust(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public FontSizeAdjust(final PropertyList propertyList, + final short enumeration, + final PropertyValue value) throws PropertyException { super(propertyList, enumeration, value); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -68,12 +70,12 @@ throw unexpectedValue(value, propertyList); } - public double getValue(FOContext context, FObj fobj) { + public double getValue(final FOContext context, final FObj fobj) { if (this.value instanceof DtNumber) { return ((DtNumber) this.value).getValue(); } if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getValueNoInstance(context, fobj); @@ -87,8 +89,9 @@ return getValueNoInstance(context, fobj); } - public static double getValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static double getValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (fobj != null) { return parent.traitFontSizeAdjust(context); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStretch.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStretch.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStretch.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -52,30 +52,30 @@ Constants.FOVAL_INHERIT, }; - public FontStretch(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public FontStretch(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public FontStretch(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public FontStretch(final PropertyList propertyList, final short enumeration, + final PropertyValue value) throws PropertyException { super(propertyList, enumeration, value); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyValue pv = checkKeywords(value); + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } throw unexpectedValue(value, propertyList); } - public short getValue(FObj fobj) { + public short getValue(final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { } @@ -84,8 +84,9 @@ return 0; } - public static short getValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static short getValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent != null) { return parent.traitFontStretch(context); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStyle.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStyle.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStyle.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -45,30 +45,30 @@ Constants.FOVAL_INHERIT, }; - public FontStyle(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public FontStyle(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public FontStyle(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public FontStyle(final PropertyList propertyList, final short enumeration, + final PropertyValue value) throws PropertyException { super(propertyList, enumeration, value); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyValue pv = checkKeywords(value); + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } throw unexpectedValue(value, propertyList); } - public short getValue(FOContext context, FObj fobj) { + public short getValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getValueNoInstance(context, fobj); @@ -81,8 +81,9 @@ return Constants.FOVAL_NORMAL; } - public static short getValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static short getValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent != null) { return parent.traitFontStyle(context); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontVariant.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontVariant.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontVariant.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -43,30 +43,30 @@ Constants.FOVAL_INHERIT, }; - public FontVariant(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public FontVariant(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public FontVariant(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public FontVariant(final PropertyList propertyList, final short enumeration, + final PropertyValue value) throws PropertyException { super(propertyList, enumeration, value); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyValue pv = checkKeywords(value); + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } throw unexpectedValue(value, propertyList); } - public short getValue(FOContext context, FObj fobj) { + public short getValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); if (keyword == Constants.FOVAL_INHERIT) { return getValueNoInstance(context, fobj); } @@ -75,8 +75,9 @@ return Constants.FOVAL_NORMAL; } - public static short getValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static short getValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent != null) { return parent.traitFontVariant(context); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontWeight.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontWeight.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontWeight.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -47,27 +47,27 @@ Constants.FOVAL_INHERIT, }; - public FontWeight(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public FontWeight(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public FontWeight(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public FontWeight(final PropertyList propertyList, final short enumeration, + final PropertyValue value) throws PropertyException { super(propertyList, enumeration, value); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } pv = standardParse(propertyList, value, false, false); if (pv instanceof DtInteger) { - int integer = ((DtInteger) pv).getValue(); + final int integer = ((DtInteger) pv).getValue(); switch (integer) { case 100: case 200: @@ -86,9 +86,9 @@ throw unexpectedValue(value, propertyList); } - public short getValue(FOContext context, FObj fobj) { + public short getValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getValueNoInstance(context, fobj); @@ -109,7 +109,7 @@ * font-family using that weight, and 3) find the relative font * in that font-family. */ - FontUse font = getInheritedFont(context, fobj); + final FontUse font = getInheritedFont(context, fobj); if (font == null) { break; } @@ -117,7 +117,7 @@ } case Constants.FOVAL_LIGHTER: { /* See comments re: algorithm in FOVAL_BOLDER case above. */ - FontUse font = getInheritedFont(context, fobj); + final FontUse font = getInheritedFont(context, fobj); if (font == null) { break; } @@ -131,8 +131,9 @@ return 400; } - public static short getValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static short getValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent != null) { return parent.traitFontWeight(context); } @@ -143,12 +144,12 @@ return validKeywords; } - FontUse getInheritedFont(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + FontUse getInheritedFont(final FOContext context, final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent == null) { return null; } - FontUse font = parent.getPrimaryFont(context); + final FontUse font = parent.getPrimaryFont(context); return font; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ForcePageCount.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ForcePageCount.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ForcePageCount.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -47,28 +47,29 @@ Constants.FOVAL_INHERIT, }; - public ForcePageCount(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public ForcePageCount(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyValue pv = checkKeywords(value); + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } throw unexpectedValue(value, propertyList); } - public short getValue(FOContext context, FObj fobj) { + public short getValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { - FObj parent = fobj.effectiveParent(context); + final FObj parent = fobj.effectiveParent(context); if (parent != null) { return parent.traitForcePageCount(context); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Format.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Format.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Format.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -33,15 +33,15 @@ public class Format extends Property { - public Format(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public Format(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { if (value.length() != 0) { return new DtString(value); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GlyphOrientation.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GlyphOrientation.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GlyphOrientation.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -50,15 +50,16 @@ Constants.FOVAL_INHERIT, }; - public GlyphOrientation(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public GlyphOrientation(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -70,9 +71,10 @@ throw unexpectedValue(value, propertyList); } - public short getValue(FOContext context, FObj fobj, byte axis) { + public short getValue(final FOContext context, final FObj fobj, + final byte axis) { if (this.value instanceof DtAngle) { - double angleValue = ((DtAngle) this.value).getValue(); + final double angleValue = ((DtAngle) this.value).getValue(); if (angleValue < 45) { return 0; } @@ -85,7 +87,7 @@ return 270; } if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); switch (keyword) { case Constants.FOVAL_AUTO: { // AUTO only applies to glyph-orientation-vertical @@ -99,9 +101,9 @@ return getValueNoInstance(context, fobj, axis); } - public static short getValueNoInstance(FOContext context, FObj fobj, - byte axis) { - FObj parent = fobj.effectiveParent(context); + public static short getValueNoInstance(final FOContext context, + final FObj fobj, final byte axis) { + final FObj parent = fobj.effectiveParent(context); if (parent != null) { switch (axis) { case Constants.AXIS_HORIZONTAL: { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GroupingSize.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GroupingSize.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GroupingSize.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -33,20 +33,21 @@ public class GroupingSize extends Property { - public GroupingSize(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) - throws PropertyException { + public GroupingSize(final PropertyList propertyList, + final short enumeration, final String propertyFullName, + final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { /* The standard allows for a numeric value, but we will round it and * store it as an integer, because it appears to be totally useless * except as an integer. */ - PropertyValue pv = standardParse(propertyList, value, true, false); + final PropertyValue pv = standardParse(propertyList, value, true, + false); if (pv instanceof DtInteger) { return pv; } @@ -55,7 +56,7 @@ public int getValue() { if (this.value instanceof DtInteger) { - DtInteger integer = (DtInteger) this.value; + final DtInteger integer = (DtInteger) this.value; return integer.getValue(); } return getValueNoInstance(); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphLadderCount.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphLadderCount.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphLadderCount.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -45,15 +45,16 @@ Constants.FOVAL_INHERIT, }; - public HyphLadderCount(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public HyphLadderCount(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -65,12 +66,12 @@ throw unexpectedValue(value, propertyList); } - public int getValue(FOContext context, FObj fobj) { + public int getValue(final FOContext context, final FObj fobj) { if (this.value instanceof DtInteger) { return ((DtInteger) this.value).getValue(); } if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getValueNoInstance(context, fobj); @@ -83,8 +84,9 @@ return getValueNoInstance(context, fobj); } - public static int getValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static int getValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent != null) { return parent.traitHyphLadderCount(context); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphPushCharCount.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphPushCharCount.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphPushCharCount.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -41,15 +41,16 @@ Constants.FOVAL_INHERIT, }; - public HyphPushCharCount(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public HyphPushCharCount(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -62,9 +63,9 @@ throw unexpectedValue(value, propertyList); } - public int traitValue(FOContext context, FObj fobj) { + public int traitValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return fobj.effectiveParent(context) @@ -78,8 +79,9 @@ return traitValueNoInstance(context, fobj); } - public static int traitValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static int traitValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent == null) { return 2; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphRemainCharCount.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphRemainCharCount.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphRemainCharCount.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -42,15 +42,16 @@ Constants.FOVAL_INHERIT, }; - public HyphRemainCharCount(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public HyphRemainCharCount(final PropertyList propertyList, + final short enumeration, final String propertyFullName, + final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -63,9 +64,9 @@ throw unexpectedValue(value, propertyList); } - public int traitValue(FOContext context, FObj fobj) { + public int traitValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return fobj.effectiveParent(context) @@ -79,8 +80,9 @@ return traitValueNoInstance(context, fobj); } - public static int traitValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static int traitValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent == null) { return 2; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Id.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Id.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Id.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -33,16 +33,17 @@ public class Id extends Property { - public Id(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public Id(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyValue pv = standardParse(propertyList, value, false, false); + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyValue pv = standardParse(propertyList, value, false, + false); if (pv instanceof DtName) { return pv; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Indent.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Indent.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Indent.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -49,15 +49,15 @@ Constants.FOVAL_INHERIT, }; - public Indent(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public Indent(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -76,7 +76,7 @@ return pv; } if (pv instanceof Expr) { - Expr expression = (Expr) pv; + final Expr expression = (Expr) pv; if (expression.canEvalUnitPower1()) { return pv; } @@ -84,10 +84,10 @@ throw unexpectedValue(value, propertyList); } - public int getValue(FOContext context, FObj fobj, byte direction, - int ipdContainingRA) { + public int getValue(final FOContext context, final FObj fobj, + final byte direction, final int ipdContainingRA) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); if (keyword == Constants.FOVAL_INHERIT) { return getValueNoInstance(context, fobj, direction, ipdContainingRA); @@ -98,34 +98,33 @@ 0); } if (this.value instanceof DtPercentage) { - DtPercentage percentageDT = (DtPercentage) this.value; - float percentage = percentageDT.getValue(); + final DtPercentage percentageDT = (DtPercentage) this.value; + final float percentage = percentageDT.getValue(); return Math.round(percentage * ipdContainingRA / 100); } if (this.value instanceof FnLabelEnd && direction == Constants.DIRECTION_END) { - FnLabelEnd function = (FnLabelEnd) this.value; - DtLength lengthDT = function.eval(fobj, ipdContainingRA); + final FnLabelEnd function = (FnLabelEnd) this.value; + final DtLength lengthDT = function.eval(fobj, ipdContainingRA); return lengthDT.getValue(fobj.traitFontSize(context), 0); } if (this.value instanceof FnBodyStart && direction == Constants.DIRECTION_START) { - FnBodyStart function = (FnBodyStart) this.value; - DtLength lengthDT = function.eval(fobj, ipdContainingRA); + final FnBodyStart function = (FnBodyStart) this.value; + final DtLength lengthDT = function.eval(fobj, ipdContainingRA); return lengthDT.getValue(fobj.traitFontSize(context), 0); } if (this.value instanceof Expr) { - Expr expression = (Expr) this.value; + final Expr expression = (Expr) this.value; return expression.evalUnitPower1(fobj.traitFontSize(context), ipdContainingRA); } return getValueNoInstance(context, fobj, direction, ipdContainingRA); } - public static int getValueNoInstance(FOContext context, FObj fobj, - byte direction, - int ipdContainingRA) { - FObj parent = fobj.effectiveParent(context); + public static int getValueNoInstance(final FOContext context, + final FObj fobj, final byte direction, final int ipdContainingRA) { + final FObj parent = fobj.effectiveParent(context); if (parent == null) { return 0; } @@ -137,7 +136,7 @@ * @param direction One of the directional constants. * @return String representation of the raw property name. */ - public static short rawPropertyType(int direction) { + public static short rawPropertyType(final int direction) { switch (direction) { case Constants.DIRECTION_START: { return Constants.FOPROP_START_INDENT; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InitialPageNumber.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InitialPageNumber.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InitialPageNumber.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -45,15 +45,16 @@ Constants.FOVAL_INHERIT, }; - public InitialPageNumber(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public InitialPageNumber(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -65,14 +66,15 @@ throw unexpectedValue(value, propertyList); } - public int getValue(FOContext context, FObj fobj, int lastPageNumberUsed) { + public int getValue(final FOContext context, final FObj fobj, + final int lastPageNumberUsed) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { - FObj parent = fobj.effectiveParent(context); + final FObj parent = fobj.effectiveParent(context); if (parent != null) { - InitialPageNumber property = (InitialPageNumber) + final InitialPageNumber property = (InitialPageNumber) parent.propertyList.getProperty (Constants.FOPROP_INITIAL_PAGE_NUMBER); return property.getValue(context, parent, @@ -103,13 +105,13 @@ return getValueNoInstance(lastPageNumberUsed); } - public short getRawValue(FObj fobj) { + public short getRawValue(final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); if (keyword == Constants.FOVAL_INHERIT) { - FObj parent = fobj.realParent(); + final FObj parent = fobj.realParent(); if (parent != null) { - PropertyList propertyList = parent.propertyList; + final PropertyList propertyList = parent.propertyList; return propertyList.getRawInitialPageNumber(); } return getRawValueNoInstance(); @@ -122,7 +124,7 @@ return getRawValueNoInstance(); } - public static int getValueNoInstance(int lastPageNumberUsed) { + public static int getValueNoInstance(final int lastPageNumberUsed) { return lastPageNumberUsed + 1; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InternalDestination.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InternalDestination.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InternalDestination.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -33,16 +33,17 @@ public class InternalDestination extends Property { - public InternalDestination(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public InternalDestination(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { - DtName pv = DtName.makeNameDT(value); + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { + final DtName pv = DtName.makeNameDT(value); if (pv == null) { throw unexpectedValue(value, propertyList, "Invalid NCName"); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Keep.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Keep.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Keep.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -60,11 +60,12 @@ Constants.FOVAL_ALWAYS, }; - public Keep(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public Keep(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); - String subPropertyName = Property.getSubPropertyName(propertyFullName); + final String subPropertyName = Property.getSubPropertyName( + propertyFullName); if (subPropertyName == null) { this.value = createPropertyValue(propertyList, attributeValue); return; @@ -73,24 +74,25 @@ subPropertyName, propertyFullName); } - public PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } pv = standardParse(propertyList, value, false, false); if (pv instanceof DtInteger) { - int integer = ((DtInteger) pv).getValue(); + final int integer = ((DtInteger) pv).getValue(); return new DtKeep(integer, integer, integer); } throw unexpectedValue(value, propertyList); } - private PropertyValue createPropertyValueSpace(PropertyList propertyList, - String value, String subPropertyName, String propertyFullName) + private PropertyValue createPropertyValueSpace( + final PropertyList propertyList, final String value, + final String subPropertyName, final String propertyFullName) throws PropertyException { - DtKeep keepDT = createOrAddKeep(null, propertyList, value, + final DtKeep keepDT = createOrAddKeep(null, propertyList, value, subPropertyName, propertyFullName); if (keepDT != null) { return keepDT; @@ -98,9 +100,10 @@ throw unexpectedValue(value, propertyList); } - public int getValue(FOContext context, int subProperty, FObj fobj) { + public int getValue(final FOContext context, final int subProperty, + final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getValueInherited(context, this.propertyType, @@ -115,7 +118,7 @@ } } if (this.value instanceof DtKeep) { - DtKeep keepDT = (DtKeep) this.value; + final DtKeep keepDT = (DtKeep) this.value; switch (subProperty) { case WITHIN_LINE: { return keepDT.getWithinLine(); @@ -133,9 +136,8 @@ fobj); } - public static int getValueNoInstance(FOContext context, short propertyType, - int subProperty, - FObj fobj) { + public static int getValueNoInstance(final FOContext context, + final short propertyType, final int subProperty, final FObj fobj) { // keep-together is inherited, the others are not if (propertyType != Constants.FOPROP_KEEP_TOGETHER) { return org.axsl.foR.Keep.AUTO; @@ -143,10 +145,10 @@ return getValueInherited(context, propertyType, subProperty, fobj); } - private static int getValueInherited(FOContext context, short propertyType, - int subProperty, - FObj fobj) { - FObj parent = fobj.effectiveParent(context); + private static int getValueInherited(final FOContext context, + final short propertyType, final int subProperty, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent == null) { return org.axsl.foR.Keep.AUTO; } @@ -207,22 +209,24 @@ * pre-existing value is not the correct type. * @throws PropertyException If the input is not valid. */ - public boolean addComponent(PropertyList propertyList, - String propertyFullName, String attributeValue) + public boolean addComponent(final PropertyList propertyList, + final String propertyFullName, final String attributeValue) throws PropertyException { if (! (value instanceof DtKeep)) { return false; } DtKeep keepDT = (DtKeep) value; - String subPropertyName = Property.getSubPropertyName(propertyFullName); + final String subPropertyName = Property.getSubPropertyName( + propertyFullName); keepDT = createOrAddKeep(keepDT, propertyList, attributeValue, subPropertyName, propertyFullName); return true; } - private DtKeep createOrAddKeep(DtKeep keepDT, PropertyList propertyList, - String value, String subPropertyName, String propertyFullName) - throws PropertyException { + private DtKeep createOrAddKeep(DtKeep keepDT, + final PropertyList propertyList, + final String value, final String subPropertyName, + final String propertyFullName) throws PropertyException { if (keepDT == null) { keepDT = DtKeep.createKeepDT(); } @@ -230,7 +234... [truncated message content] |
|
From: <vic...@us...> - 2006-07-23 00:55:53
|
Revision: 7813 Author: victormote Date: 2006-07-22 17:55:19 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7813&view=rev Log Message: ----------- Implement standard use of "final" modifier on local variables and parameters. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteDimension.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentAdjust.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentBaseline.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AudioDial.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Azimuth.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Background.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundColor.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundImage.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundPosition.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BaselineShift.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Boolean.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Border.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSeparation.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSpacing.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderStyle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderWidth.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/CaseTitle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Character.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Clip.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Color.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnCount.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnGap.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnNumber.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnWidth.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ContentDimension.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ContentType.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Country.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Cue.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DestinationPlacementOffset.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Dimension.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DisplayAlign.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DominantBaseline.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Elevation.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Enumerated.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Extent.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ExternalDestination.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Font.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteDimension.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteDimension.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteDimension.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -56,15 +56,15 @@ Constants.FOVAL_INHERIT, }; - public AbsoluteDimension(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) - throws PropertyException { + public AbsoluteDimension(final PropertyList propertyList, + final short enumeration, final String propertyFullName, + final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -79,21 +79,21 @@ throw unexpectedValue(value, propertyList); } - public int getValue(FOContext context, byte relativeAxis, - FObj fobj, int dimAncestorGenByBlockLevelFO) { + public int getValue(final FOContext context, final byte relativeAxis, + final FObj fobj, final int dimAncestorGenByBlockLevelFO) { if (this.value instanceof DtLength) { return ((DtLength) this.value).getValue(fobj.traitFontSize(context), 0); } if (this.value instanceof DtPercentage) { - int base = dimAncestorGenByBlockLevelFO; - DtPercentage percentageDT = (DtPercentage) this.value; - float percentage = percentageDT.getValue(); + final int base = dimAncestorGenByBlockLevelFO; + final DtPercentage percentageDT = (DtPercentage) this.value; + final float percentage = percentageDT.getValue(); return Math.round(percentage * base / 100); } if (this.value instanceof PropertyKeyword) { - PropertyKeyword kw = (PropertyKeyword) this.value; - short keyword = kw.getValue(); + final PropertyKeyword kw = (PropertyKeyword) this.value; + final short keyword = kw.getValue(); switch (keyword) { case Constants.FOVAL_AUTO: { return Constants.DIMENSION_AUTO; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -46,16 +46,18 @@ Constants.FOVAL_INHERIT, }; - public AbsoluteOffset(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public AbsoluteOffset(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, enumeration, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - short enumeration, String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final short enumeration, final String value) + throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -71,16 +73,16 @@ throw unexpectedValue(value, propertyList); } - public int getValue(FOContext context, byte direction, - FObj fobj, int dimensionContainingBlock) { + public int getValue(final FOContext context, final byte direction, + final FObj fobj, final int dimensionContainingBlock) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_AUTO: { return Constants.ABSOLUTE_POSITION_AUTO; } case Constants.FOVAL_INHERIT: { - FObj parent = fobj.effectiveParent(context); + final FObj parent = fobj.effectiveParent(context); if (parent == null) { return getValueNoInstance(); } @@ -89,17 +91,18 @@ } } if (this.value instanceof DtLength) { - DtLength length = (DtLength) this.value; + final DtLength length = (DtLength) this.value; /* * The XSL-FO Standard 1.0 does not specify whether negative values * are allowed or not, but the CSS2 standard says that they are * allowed. */ - int lengthValue = length.getValue(fobj.traitFontSize(context), 0); + final int lengthValue = length.getValue(fobj.traitFontSize(context), + 0); return lengthValue; } if (this.value instanceof DtPercentage) { - DtPercentage percent = (DtPercentage) this.value; + final DtPercentage percent = (DtPercentage) this.value; return Math.round(dimensionContainingBlock * percent.getValue() / 100); } @@ -119,7 +122,7 @@ * @param direction One of the absolute directional constants. * @return String representation of the raw property name. */ - public static short rawPropertyName(int direction) { + public static short rawPropertyName(final int direction) { switch (direction) { case Constants.DIRECTION_TOP: { return Constants.FOPROP_TOP; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentAdjust.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentAdjust.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentAdjust.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -57,15 +57,16 @@ Constants.FOVAL_INHERIT, }; - public AlignmentAdjust(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public AlignmentAdjust(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -80,9 +81,9 @@ throw unexpectedValue(value, propertyList); } - public short traitValue(FOContext context, FObj fobj) { + public short traitValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return fobj.effectiveParent(context).traitAlignmentAdjust( @@ -102,7 +103,8 @@ return traitValueNoInstance(); } - public int traitValueAmount(FOContext context, FObj fobj, int areaHeight) { + public int traitValueAmount(final FOContext context, final FObj fobj, + final int areaHeight) { if (this.value instanceof DtLength) { return ((DtLength) this.value).getValue(fobj.traitFontSize(context), 0); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentBaseline.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentBaseline.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentBaseline.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -52,25 +52,26 @@ Constants.FOVAL_INHERIT, }; - public AlignmentBaseline(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public AlignmentBaseline(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyValue pv = checkKeywords(value); + public PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } throw unexpectedValue(value, propertyList); } - public short traitValue(FOContext context, FObj fobj) { + public short traitValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return fobj.effectiveParent(context).traitAlignmentBaseline( Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AudioDial.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AudioDial.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AudioDial.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -48,22 +48,22 @@ Constants.FOVAL_INHERIT, }; - public AudioDial(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public AudioDial(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } pv = DtNumber.makeNumberDT(value); if (pv != null) { - double number = ((DtNumber) pv).getValue(); + final double number = ((DtNumber) pv).getValue(); if (number >= 0 && number <= 100) { return pv; } @@ -71,12 +71,12 @@ throw unexpectedValue(value, propertyList); } - public double getValue(FOContext context, FObj fobj) { + public double getValue(final FOContext context, final FObj fobj) { if (this.value instanceof DtNumber) { return ((DtNumber) this.value).getValue(); } if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getValueNoInstance(context, fobj, propertyType); @@ -86,9 +86,9 @@ return 50; } - public static double getValueNoInstance(FOContext context, FObj fobj, - short propertyType) { - FObj parent = fobj.effectiveParent(context); + public static double getValueNoInstance(final FOContext context, + final FObj fobj, final short propertyType) { + final FObj parent = fobj.effectiveParent(context); if (parent != null) { switch (propertyType) { case Constants.FOPROP_PITCH_RANGE: { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Azimuth.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Azimuth.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Azimuth.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -57,21 +57,21 @@ /** Set to true if the "behind" keyword is used. */ boolean isBehind = false; - public Azimuth(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public Azimuth(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { String remainingValue = value; - StringTokenizer st = new StringTokenizer(value); + final StringTokenizer st = new StringTokenizer(value); if (st.countTokens() == 2) { // One of the tokens should be "behind" while (st.hasMoreTokens()) { - String thisToken = st.nextToken(); + final String thisToken = st.nextToken(); if (thisToken.equals("behind")) { this.isBehind = true; } else { @@ -84,7 +84,7 @@ } PropertyValue pv = checkKeywords(remainingValue); if (pv != null) { - short keyword = ((PropertyKeyword) pv).getValue(); + final short keyword = ((PropertyKeyword) pv).getValue(); switch (keyword) { case Constants.FOVAL_LEFTWARDS: case Constants.FOVAL_RIGHTWARDS: @@ -106,12 +106,12 @@ throw unexpectedValue(value, propertyList); } - public float getValue(FOContext context, FObj fobj) { + public float getValue(final FOContext context, final FObj fobj) { if (this.value instanceof DtAngle) { return ((DtAngle) this.value).getValue(); } if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getValueNoInstance(context, fobj); @@ -175,8 +175,9 @@ return getValueNoInstance(context, fobj); } - public static float getValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static float getValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent != null) { return parent.traitAzimuth(context); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Background.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Background.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Background.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -45,18 +45,19 @@ Constants.FOVAL_INHERIT, }; - public Background(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public Background(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, propertyFullName, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String propertyFullName, String value) throws PropertyException { - PropertyCollection collection = new PropertyCollection(); - PropertyValue pv = checkKeywords(value); + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String propertyFullName, final String value) + throws PropertyException { + final PropertyCollection collection = new PropertyCollection(); + final PropertyValue pv = checkKeywords(value); if (pv != null) { collection.addItem(new BackgroundColor(propertyList, Constants.FOPROP_BACKGROUND_COLOR, pv)); @@ -73,18 +74,18 @@ // There are 5 properties supported, one of which can have 2 tokens final byte MAX_TOKENS = 6; // Tokenize the input & put the tokens into an ArrayList - StringTokenizer st = new StringTokenizer(value); + final StringTokenizer st = new StringTokenizer(value); if (st.countTokens() < 1 || st.countTokens() > MAX_TOKENS) { throw unexpectedValue(value, propertyList); } - ArrayList tokenList = new ArrayList(st.countTokens()); + final ArrayList tokenList = new ArrayList(st.countTokens()); while (st.hasMoreTokens()) { tokenList.add(st.nextToken()); } // Create an array indicating which property is in each position - short[] positionArray = new short[tokenList.size()]; + final short[] positionArray = new short[tokenList.size()]; for (int i = 0; i < tokenList.size(); i++) { - short contentType = getContentType((String) tokenList.get(i)); + final short contentType = getContentType((String) tokenList.get(i)); if (contentType < 0) { throw unexpectedValue(value, propertyList); } @@ -137,7 +138,7 @@ if (positionFound) { throw unexpectedValue(value, propertyList); } - String propertyInput = (String) tokenList.get(i); + final String propertyInput = (String) tokenList.get(i); if (i < positionArray.length && positionArray[i + 1] == Constants.FOPROP_BACKGROUND_POSITION) { propertyInput.concat(" " @@ -162,7 +163,7 @@ * BACKGROUND_IMAGE, BACKGROUND_REPEAT, BACKGROUND_ATTACHMENT, or * BACKGROUND_POSITION, or -1 for invalid input */ - private short getContentType(String input) { + private short getContentType(final String input) { if (input.equals("inherit")) { return -1; } @@ -195,19 +196,19 @@ if (keyword > -1) { return Constants.FOPROP_BACKGROUND_POSITION; } - DtColor color = DtColor.makeDtColor(input); + final DtColor color = DtColor.makeDtColor(input); if (color != null) { return Constants.FOPROP_BACKGROUND_COLOR; } - DtURI uri = DtURI.makeUriDT(input); + final DtURI uri = DtURI.makeUriDT(input); if (uri != null) { return Constants.FOPROP_BACKGROUND_IMAGE; } - DtLength length = DtLength.makeLengthDT(input); + final DtLength length = DtLength.makeLengthDT(input); if (length != null) { return Constants.FOPROP_BACKGROUND_POSITION; } - DtPercentage percentage = DtPercentage.makePercentageDT(input); + final DtPercentage percentage = DtPercentage.makePercentageDT(input); if (percentage != null) { return Constants.FOPROP_BACKGROUND_POSITION; } @@ -215,31 +216,31 @@ } public BackgroundColor getColor() { - PropertyCollection collection = (PropertyCollection) this.value; + final PropertyCollection collection = (PropertyCollection) this.value; return (BackgroundColor) collection.findProperty (Constants.FOPROP_BACKGROUND_COLOR); } public BackgroundImage getImage() { - PropertyCollection collection = (PropertyCollection) this.value; + final PropertyCollection collection = (PropertyCollection) this.value; return (BackgroundImage) collection.findProperty (Constants.FOPROP_BACKGROUND_IMAGE); } public Enumerated getRepeat() { - PropertyCollection collection = (PropertyCollection) this.value; + final PropertyCollection collection = (PropertyCollection) this.value; return (Enumerated) collection.findProperty (Constants.FOPROP_BACKGROUND_REPEAT); } public Enumerated getAttachment() { - PropertyCollection collection = (PropertyCollection) this.value; + final PropertyCollection collection = (PropertyCollection) this.value; return (Enumerated) collection.findProperty (Constants.FOPROP_BACKGROUND_ATTACHMENT); } public BackgroundPosition getPosition() { - PropertyCollection collection = (PropertyCollection) this.value; + final PropertyCollection collection = (PropertyCollection) this.value; return (BackgroundPosition) collection.findProperty (Constants.FOPROP_BACKGROUND_POSITION); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundColor.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundColor.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundColor.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -38,15 +38,17 @@ Constants.FOVAL_TRANSPARENT, }; - public BackgroundColor(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public BackgroundColor(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration, propertyFullName, attributeValue); this.value = createPropertyValue(propertyList, attributeValue); } - public BackgroundColor(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public BackgroundColor(final PropertyList propertyList, + final short enumeration, final PropertyValue value) + throws PropertyException { super(propertyList, enumeration, value); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundImage.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundImage.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundImage.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -47,20 +47,22 @@ Constants.FOVAL_INHERIT, }; - public BackgroundImage(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public BackgroundImage(final PropertyList propertyList, + final short enumeration, final String propertyFullName, + final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public BackgroundImage(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public BackgroundImage(final PropertyList propertyList, + final short enumeration, final PropertyValue value) + throws PropertyException { super(propertyList, enumeration, value); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -72,12 +74,12 @@ throw unexpectedValue(value, propertyList); } - public Graphic getValue(FOContext context, FObj fobj) { + public Graphic getValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { - FObj parent = fobj.effectiveParent(context); + final FObj parent = fobj.effectiveParent(context); if (parent != null) { return parent.traitBackgroundImage(context); } @@ -91,13 +93,13 @@ if (graphic != null) { return graphic; } - String src = ((DtURI) this.value).getValue(); + final String src = ((DtURI) this.value).getValue(); Graphic backgroundImage = null; try { backgroundImage = fobj.getGraphicServer().makeGraphic(src, fobj.getFOTreeBuilder().getGraphicSearchPath(), fobj.getFOTreeBuilder().getCachingGraphics()); - } catch (GraphicException imgex) { + } catch (final GraphicException imgex) { backgroundImage = null; fobj.getLogger().error("Error creating background image: " + imgex.getMessage()); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundPosition.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundPosition.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundPosition.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -60,8 +60,9 @@ Constants.FOVAL_INHERIT, }; - public BackgroundPosition(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public BackgroundPosition(final PropertyList propertyList, + final short enumeration, final String propertyFullName, + final String attributeValue) throws PropertyException { super(propertyList, enumeration); if (propertyType == Constants.FOPROP_BACKGROUND_POSITION) { @@ -71,13 +72,14 @@ } } - public BackgroundPosition(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public BackgroundPosition(final PropertyList propertyList, + final short enumeration, final PropertyValue value) + throws PropertyException { super(propertyList, enumeration, value); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -93,40 +95,42 @@ throw unexpectedValue(value, propertyList); } - private PropertyValue createShorthandValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyCollection collection = new PropertyCollection(); + private PropertyValue createShorthandValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyCollection collection = new PropertyCollection(); PropertyValue pv = checkKeywords(value); if (pv != null) { - BackgroundPosition property = new BackgroundPosition + final BackgroundPosition property = new BackgroundPosition (propertyList, propertyType, pv); collection.addItem(property); return collection; } - StringTokenizer st = new StringTokenizer(value); + final StringTokenizer st = new StringTokenizer(value); if (st.countTokens() < 1 || st.countTokens() > 2) { throw unexpectedValue(value, propertyList); } while (st.hasMoreTokens()) { - String token = st.nextToken(); + final String token = st.nextToken(); pv = DtPercentage.makePercentageDT(token); if (pv == null) { pv = DtLength.makeLengthDT(token); } if (pv == null) { - short keyword = getKeywordIndex(token, validKeywordsHorizontal); + final short keyword = getKeywordIndex(token, + validKeywordsHorizontal); if (keyword > 0 && keyword != Constants.FOVAL_INHERIT) { pv = new PropertyKeyword(keyword); } } if (pv == null) { - short keyword = getKeywordIndex(token, validKeywordsVertical); + final short keyword = getKeywordIndex(token, + validKeywordsVertical); if (keyword > 0 && keyword != Constants.FOVAL_INHERIT) { pv = new PropertyKeyword(keyword); } } if (pv != null) { - BackgroundPosition property = new BackgroundPosition + final BackgroundPosition property = new BackgroundPosition (propertyList, propertyType, pv); collection.addItem(property); } else { @@ -137,7 +141,7 @@ return collection; } pv = collection.getItem(0).getPropertyValue(); - PropertyValue pv2 = collection.getItem(1).getPropertyValue(); + final PropertyValue pv2 = collection.getItem(1).getPropertyValue(); /* * If the first item is a length or percentage, the other needs to be * also. @@ -157,8 +161,8 @@ } } // The two keywords need to be from each of the two sets. - short keyword = ((PropertyKeyword) pv).getValue(); - short keyword2 = ((PropertyKeyword) pv2).getValue(); + final short keyword = ((PropertyKeyword) pv).getValue(); + final short keyword2 = ((PropertyKeyword) pv2).getValue(); if (keywordInSet(keyword, validKeywordsHorizontal) && keywordInSet(keyword2, validKeywordsVertical)) { return collection; @@ -175,19 +179,20 @@ return collection; } - public int getValue(FOContext context, FObj fobj, byte axis, - int paddingRectangleDimension, int backgroundImageDimension) { + public int getValue(final FOContext context, final FObj fobj, + final byte axis, final int paddingRectangleDimension, + final int backgroundImageDimension) { if (this.value instanceof DtLength) { return ((DtLength) this.value).getValue(fobj.traitFontSize(context), 0); } if (this.value instanceof DtPercentage) { - float percent = ((DtPercentage) this.value).getValue(); + final float percent = ((DtPercentage) this.value).getValue(); return Math.round(percent/100 * (paddingRectangleDimension - backgroundImageDimension)); } if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); switch (keyword) { case Constants.FOVAL_TOP: case Constants.FOVAL_LEFT: { @@ -202,7 +207,7 @@ return paddingRectangleDimension - backgroundImageDimension; } case Constants.FOVAL_INHERIT: { - FObj parent = fobj.effectiveParent(context); + final FObj parent = fobj.effectiveParent(context); if (parent != null) { switch (axis) { case Constants.AXIS_HORIZONTAL: { @@ -223,13 +228,13 @@ return getValueNoInstance(); } - public int getShorthandValue(FOContext context, FObj fobj, - byte axis, int paddingRectangleDimension, - int backgroundImageDimension) { - PropertyCollection collection = (PropertyCollection) this.value; - BackgroundPosition bpProperty = (BackgroundPosition) collection + public int getShorthandValue(final FOContext context, final FObj fobj, + final byte axis, final int paddingRectangleDimension, + final int backgroundImageDimension) { + final PropertyCollection collection = (PropertyCollection) this.value; + final BackgroundPosition bpProperty = (BackgroundPosition) collection .getItem(0); - PropertyValue pv = bpProperty.getPropertyValue(); + final PropertyValue pv = bpProperty.getPropertyValue(); if (collection.getCount() == 1) { if (pv instanceof DtPercentage || pv instanceof DtLength) { if (axis == Constants.AXIS_VERTICAL) { @@ -238,7 +243,7 @@ } } if (pv instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) pv).getValue(); + final short keyword = ((PropertyKeyword) pv).getValue(); if (axis == Constants.AXIS_HORIZONTAL && keywordInSet(keyword, validKeywordsVertical)) { return (int) Math.round(.5 * (paddingRectangleDimension @@ -260,9 +265,9 @@ * What is left here is the case where there are two properties. The * only real trick is to make sure we use the right one. */ - BackgroundPosition bpProperty2 = (BackgroundPosition) collection + final BackgroundPosition bpProperty2 = (BackgroundPosition) collection .getItem(1); - PropertyValue pv2 = bpProperty2.getPropertyValue(); + final PropertyValue pv2 = bpProperty2.getPropertyValue(); BackgroundPosition bpPropertyToUse = null; if (pv instanceof DtPercentage || pv instanceof DtLength) { if (axis == Constants.AXIS_HORIZONTAL) { @@ -275,8 +280,8 @@ /* * What is left here should just be keywords. */ - short keyword = ((PropertyKeyword) pv).getValue(); - short keyword2 = ((PropertyKeyword) pv2).getValue(); + final short keyword = ((PropertyKeyword) pv).getValue(); + final short keyword2 = ((PropertyKeyword) pv2).getValue(); boolean horizontalFirst = false; if (keywordInSet(keyword, validKeywordsHorizontal)) { horizontalFirst = true; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BaselineShift.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BaselineShift.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BaselineShift.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -47,15 +47,16 @@ Constants.FOVAL_INHERIT, }; - public BaselineShift(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public BaselineShift(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -70,10 +71,10 @@ throw unexpectedValue(value, propertyList); } - public int traitValue(FOContext context, FObj fobj) { + public int traitValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); - FObj effectiveParent = fobj.effectiveParent(context); + final short keyword = ((PropertyKeyword) value).getValue(); + final FObj effectiveParent = fobj.effectiveParent(context); switch (keyword) { case Constants.FOVAL_BASELINE: { return 0; @@ -81,13 +82,13 @@ case Constants.FOVAL_SUB: { /* TODO: This is the legacy computation. It needs to be * rewritten from the spec. */ - int ascender = getAscender(context, effectiveParent); + final int ascender = getAscender(context, effectiveParent); return (int) Math.round(2 * ascender / 3.0); } case Constants.FOVAL_SUPER: { /* TODO: This is the legacy computation. It needs to be * rewritten from the spec. */ - int ascender = getAscender(context, effectiveParent); + final int ascender = getAscender(context, effectiveParent); return (int) Math.round(-2 * ascender / 3.0); } case Constants.FOVAL_INHERIT: { @@ -104,7 +105,7 @@ } if (this.value instanceof DtPercentage) { /* TODO: This base value is almost certainly wrong. */ - int base = fobj.effectiveParent(context) + final int base = fobj.effectiveParent(context) .propertyList.getLineHeight(context, OPTIMUM); return Math.round(((DtPercentage) this.value).getValue() * base); } @@ -116,10 +117,11 @@ * @param effectiveParent * @return The ascender for the primary font. */ - private int getAscender(FOContext context, FObj effectiveParent) { - FontUse primaryFont = effectiveParent.getPrimaryFont(context); - int fontSize = effectiveParent.traitFontSize(context); - int ascender = primaryFont.getFont().getAscender(fontSize); + private int getAscender(final FOContext context, + final FObj effectiveParent) { + final FontUse primaryFont = effectiveParent.getPrimaryFont(context); + final int fontSize = effectiveParent.traitFontSize(context); + final int ascender = primaryFont.getFont().getAscender(fontSize); return ascender; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Boolean.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Boolean.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Boolean.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -48,25 +48,25 @@ Constants.FOVAL_INHERIT, }; - public Boolean(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public Boolean(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyValue pv = checkKeywords(value); + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } throw unexpectedValue(value, propertyList); } - public boolean getValue(FOContext context, FObj fobj) { + public boolean getValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getValueNoInstance(context, fobj, propertyType); @@ -82,9 +82,9 @@ return false; } - public static boolean getValueNoInstance(FOContext context, FObj fobj, - short propertyType) { - FObj parent = fobj.effectiveParent(context); + public static boolean getValueNoInstance(final FOContext context, + final FObj fobj, final short propertyType) { + final FObj parent = fobj.effectiveParent(context); switch (propertyType) { case Constants.FOPROP_HYPHENATE: { if (parent != null) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Border.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Border.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Border.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -47,27 +47,28 @@ Constants.FOVAL_INHERIT, }; - public Border(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public Border(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, enumeration, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - short enumeration, String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final short enumeration, final String value) + throws PropertyException { PropertyCollection collection = null; /* * Must handle inherit specially, because it essentially propogates * to style, width, and color. */ if (value.equals("inherit")) { - BorderStyle borderStyle = new BorderStyle(propertyList, + final BorderStyle borderStyle = new BorderStyle(propertyList, Constants.FOPROP_BORDER_STYLE, "border-style", "inherit"); - BorderWidth borderWidth = new BorderWidth(propertyList, + final BorderWidth borderWidth = new BorderWidth(propertyList, Constants.FOPROP_BORDER_WIDTH, "border-width", "inherit"); - BorderColor borderColor = new BorderColor(propertyList, + final BorderColor borderColor = new BorderColor(propertyList, Constants.FOPROP_BORDER_COLOR, "border-color", "inherit"); collection = new PropertyCollection(); collection.addItem(borderStyle); @@ -75,9 +76,9 @@ collection.addItem(borderColor); return collection; } - StringTokenizer st = new StringTokenizer(value); + final StringTokenizer st = new StringTokenizer(value); while (st.hasMoreTokens()) { - Property property = parseToken(propertyList, st.nextToken()); + final Property property = parseToken(propertyList, st.nextToken()); if (property == null) { throw unexpectedValue(value, propertyList); } @@ -92,8 +93,8 @@ throw unexpectedValue(value, propertyList); } - public Property parseToken(PropertyList propertyList, String token) - throws PropertyException { + public Property parseToken(final PropertyList propertyList, + final String token) throws PropertyException { // Check style first, since it only has keywords short keyword = Property.getKeywordIndex(token, BorderStyle.validKeywords); @@ -108,13 +109,14 @@ new PropertyKeyword(keyword)); } // Now check for color keywords - DtColor dtColor = DtColor.mapNameToColorRGB(token); + final DtColor dtColor = DtColor.mapNameToColorRGB(token); if (dtColor != null) { return new BorderColor(Constants.FOPROP_BORDER_COLOR, dtColor); } // Now try using the standard parse - PropertyValue pv = standardParse(propertyList, token, false, false); + final PropertyValue pv = standardParse(propertyList, token, false, + false); if (pv instanceof DtLength) { return new BorderWidth(Constants.FOPROP_BORDER_WIDTH, pv); } @@ -124,12 +126,12 @@ return null; } - public BorderStyle getBorderStyle(byte absoluteDirection) { + public BorderStyle getBorderStyle(final byte absoluteDirection) { if (! (this.value instanceof PropertyCollection)) { return null; } - PropertyCollection collection = (PropertyCollection) this.value; - Property property = collection.findProperty( + final PropertyCollection collection = (PropertyCollection) this.value; + final Property property = collection.findProperty( Constants.FOPROP_BORDER_STYLE); if (property instanceof BorderStyle) { return (BorderStyle) property; @@ -141,8 +143,8 @@ if (! (this.value instanceof PropertyCollection)) { return null; } - PropertyCollection collection = (PropertyCollection) this.value; - Property property = collection.findProperty( + final PropertyCollection collection = (PropertyCollection) this.value; + final Property property = collection.findProperty( Constants.FOPROP_BORDER_WIDTH); if (property instanceof BorderWidth) { return (BorderWidth) property; @@ -154,8 +156,8 @@ if (! (this.value instanceof PropertyCollection)) { return null; } - PropertyCollection collection = (PropertyCollection) this.value; - Property property = collection.findProperty( + final PropertyCollection collection = (PropertyCollection) this.value; + final Property property = collection.findProperty( Constants.FOPROP_BORDER_COLOR); if (property instanceof BorderColor) { return (BorderColor) property; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -40,8 +40,8 @@ public class BorderColor extends Property { - public BorderColor(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public BorderColor(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, enumeration, @@ -53,39 +53,42 @@ * parsing. Specifically, this is used by classes that handle shorthand * properties. */ - protected BorderColor(short enumeration, PropertyValue value) { + protected BorderColor(final short enumeration, final PropertyValue value) { super(null, enumeration); this.value = value; } - public PropertyValue createPropertyValue(PropertyList propertyList, - short enumeration, String value) throws PropertyException { - DtColor color = DtColor.makeDtColor(value); + public PropertyValue createPropertyValue(final PropertyList propertyList, + final short enumeration, final String value) + throws PropertyException { + final DtColor color = DtColor.makeDtColor(value); if (color != null) { return color; } - StringTokenizer st = new StringTokenizer(value); + final StringTokenizer st = new StringTokenizer(value); if (st.countTokens() > 1) { return createShorthandValue(propertyList, st, enumeration, value); } return createSimpleValue(propertyList, value); } - private PropertyValue createSimpleValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyValue pv = standardParse(propertyList, value, false, false); + private PropertyValue createSimpleValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyValue pv = standardParse(propertyList, value, false, + false); if (pv instanceof ExprColor) { return pv; } throw unexpectedValue(value, propertyList); } - private PropertyValue createShorthandValue(PropertyList propertyList, - StringTokenizer st, short enumeration, String value) + private PropertyValue createShorthandValue(final PropertyList propertyList, + final StringTokenizer st, final short enumeration, + final String value) throws PropertyException { - PropertyCollection collection = new PropertyCollection(); + final PropertyCollection collection = new PropertyCollection(); while (st.hasMoreTokens()) { - BorderColor newBorderColor = new BorderColor(propertyList, + final BorderColor newBorderColor = new BorderColor(propertyList, enumeration, null, st.nextToken()); if (newBorderColor != null) { collection.addItem(newBorderColor); @@ -94,7 +97,7 @@ return collection; } - public Color getValue(byte direction, FObj fobj) { + public Color getValue(final byte direction, final FObj fobj) { if (this.value instanceof PropertyCollection) { return getCollectionValue(direction, fobj); } @@ -104,11 +107,12 @@ return getValueNoInstance(); } - private Color getCollectionValue(byte direction, FObj fobj) { - PropertyCollection collection = (PropertyCollection) this.value; - int whichElement = collection.whichElementForDirectional(direction); - Property insideProperty = collection.getItem(whichElement); - BorderColor borderColorProperty = (BorderColor) insideProperty; + private Color getCollectionValue(final byte direction, final FObj fobj) { + final PropertyCollection collection = (PropertyCollection) this.value; + final int whichElement = collection.whichElementForDirectional( + direction); + final Property insideProperty = collection.getItem(whichElement); + final BorderColor borderColorProperty = (BorderColor) insideProperty; return borderColorProperty.getValue(direction, fobj); } @@ -120,7 +124,7 @@ * @param direction One of the directional constants. * @return String representation of the raw property name. */ - public static short rawPropertyType(int direction) { + public static short rawPropertyType(final int direction) { switch (direction) { case Constants.DIRECTION_BEFORE: { return Constants.FOPROP_BORDER_BEFORE_COLOR; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -51,15 +51,16 @@ Constants.FOVAL_INHERIT, }; - public BorderPrecedence(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public BorderPrecedence(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -71,18 +72,19 @@ throw unexpectedValue(value, propertyList); } - public int getValue(FOContext context, FObj fobj, byte direction) { + public int getValue(final FOContext context, final FObj fobj, + final byte direction) { if (this.value instanceof DtInteger) { return ((DtInteger) this.value).getValue(); } if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); switch (keyword) { case Constants.FOVAL_FORCE: { return FORCE_VALUE; } case Constants.FOVAL_INHERIT: { - FObj parent = fobj.effectiveParent(context); + final FObj parent = fobj.effectiveParent(context); if (parent != null) { switch (direction) { case Constants.DIRECTION_BEFORE: { @@ -105,7 +107,7 @@ return getValueNoInstance(fobj); } - public static int getValueNoInstance(FObj fobj) { + public static int getValueNoInstance(final FObj fobj) { if (fobj instanceof Table) { return 6; } else if (fobj instanceof TableCell) { @@ -128,7 +130,7 @@ return validKeywords; } - public static short getPropertyType(byte direction) { + public static short getPropertyType(final byte direction) { switch (direction) { case Constants.DIRECTION_BEFORE: { return Constants.FOPROP_BORDER_BEFORE_PRECEDENCE; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSeparation.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSeparation.java 2006-07-23 00:19:1... [truncated message content] |
|
From: <vic...@us...> - 2006-07-23 00:19:48
|
Revision: 7812 Author: victormote Date: 2006-07-22 17:19:17 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7812&view=rev Log Message: ----------- Implement standard use of "final" modifier on local variables and parameters. Modified Paths: -------------- trunk/foray/foray-fotree/.project trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineNonText.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineText.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjMixed.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjScaled.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java trunk/foray/foray-fotree/src/java/org/foray/fotree/ForeignXML.java trunk/foray/foray-fotree/src/java/org/foray/fotree/Namespace.java trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyException.java trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyListUnparsed.java trunk/foray/foray-fotree/src/java/org/foray/fotree/foray/NamespaceExtensions.java trunk/foray/foray-fotree/src/java/org/foray/fotree/foray/ObjectMakerExtensions.java trunk/foray/foray-fotree/src/java/org/foray/fotree/foray/obj/ContinuedLabel.java trunk/foray/foray-fotree/src/java/org/foray/fotree/parse/PropertyParser.java trunk/foray/foray-fotree/src/java/org/foray/fotree/parse/PropertyTokenizer.java trunk/foray/foray-fotree/src/java/org/foray/fotree/svg/NamespaceSVG.java trunk/foray/foray-fotree/src/java/org/foray/fotree/svg/ObjectMakerSVG.java trunk/foray/foray-fotree/src/java/org/foray/fotree/svg/obj/SVGElement.java Modified: trunk/foray/foray-fotree/.project =================================================================== --- trunk/foray/foray-fotree/.project 2006-07-22 22:07:57 UTC (rev 7811) +++ trunk/foray/foray-fotree/.project 2006-07-23 00:19:17 UTC (rev 7812) @@ -10,14 +10,8 @@ <arguments> </arguments> </buildCommand> - <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> - <arguments> - </arguments> - </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> - <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> </natures> </projectDescription> Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineNonText.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineNonText.java 2006-07-22 22:07:57 UTC (rev 7811) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineNonText.java 2006-07-23 00:19:17 UTC (rev 7812) @@ -36,8 +36,8 @@ private org.axsl.foR.FOLineNonText realLineNonText; private FOContext context; - public FOLineNonText(org.axsl.foR.FOLineNonText realLineNonText, - FOContext context) { + public FOLineNonText(final org.axsl.foR.FOLineNonText realLineNonText, + final FOContext context) { this.realLineNonText = realLineNonText; this.context = context; } @@ -45,42 +45,45 @@ /** * {@inheritDoc} */ - public int inlineSizeOptimum(int lineLength) { + public int inlineSizeOptimum(final int lineLength) { return this.realLineNonText.inlineSizeOptimum(this.context, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeOptimum(FOContext context, int lineLength) { + public int inlineSizeOptimum(final FOContext context, + final int lineLength) { return this.realLineNonText.inlineSizeOptimum(context, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMinimum(int lineLength) { + public int inlineSizeMinimum(final int lineLength) { return this.realLineNonText.inlineSizeMinimum(this.context, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMinimum(FOContext context, int lineLength) { + public int inlineSizeMinimum(final FOContext context, + final int lineLength) { return this.realLineNonText.inlineSizeMinimum(context, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMaximum(int lineLength) { + public int inlineSizeMaximum(final int lineLength) { return this.realLineNonText.inlineSizeMaximum(this.context, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMaximum(FOContext context, int lineLength) { + public int inlineSizeMaximum(final FOContext context, + final int lineLength) { return this.realLineNonText.inlineSizeMaximum(context, lineLength); } @@ -94,7 +97,8 @@ /** * {@inheritDoc} */ - public org.axsl.foR.FOLineNonText getContextWrapper(FOContext context) { + public org.axsl.foR.FOLineNonText getContextWrapper( + final FOContext context) { /* This *is* the wrapper. */ return this; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineText.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineText.java 2006-07-22 22:07:57 UTC (rev 7811) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineText.java 2006-07-23 00:19:17 UTC (rev 7812) @@ -38,7 +38,8 @@ private org.axsl.foR.FOLineText realLineText; private FOContext context; - public FOLineText(org.axsl.foR.FOLineText realLineText, FOContext context) { + public FOLineText(final org.axsl.foR.FOLineText realLineText, + final FOContext context) { this.realLineText = realLineText; this.context = context; } @@ -53,7 +54,7 @@ /** * {@inheritDoc} */ - public char[] inlineText(FOContext context) { + public char[] inlineText(final FOContext context) { return realLineText.inlineText(context); } @@ -67,21 +68,21 @@ /** * {@inheritDoc} */ - public FontUse inlinePrimaryFont(FOContext context) { + public FontUse inlinePrimaryFont(final FOContext context) { return realLineText.inlinePrimaryFont(context); } /** * {@inheritDoc} */ - public FontUse inlineSecondaryFont(char c) { + public FontUse inlineSecondaryFont(final char c) { return realLineText.inlineSecondaryFont(this.context, c); } /** * {@inheritDoc} */ - public FontUse inlineSecondaryFont(FOContext context, char c) { + public FontUse inlineSecondaryFont(final FOContext context, final char c) { return realLineText.inlineSecondaryFont(context, c); } @@ -95,7 +96,7 @@ /** * {@inheritDoc} */ - public int inlineFontSize(FOContext context) { + public int inlineFontSize(final FOContext context) { return realLineText.inlineFontSize(context); } @@ -109,7 +110,7 @@ /** * {@inheritDoc} */ - public int inlineLetterSpacingOptimum(FOContext context) { + public int inlineLetterSpacingOptimum(final FOContext context) { return realLineText.inlineLetterSpacingOptimum(context); } @@ -123,7 +124,7 @@ /** * {@inheritDoc} */ - public boolean inlineWrapOption(FOContext context) { + public boolean inlineWrapOption(final FOContext context) { return realLineText.inlineWrapOption(context); } @@ -137,7 +138,7 @@ /** * {@inheritDoc} */ - public boolean inlineHyphenate(FOContext context) { + public boolean inlineHyphenate(final FOContext context) { return realLineText.inlineHyphenate(context); } @@ -151,7 +152,7 @@ /** * {@inheritDoc} */ - public String inlineLanguage(FOContext context) { + public String inlineLanguage(final FOContext context) { return realLineText.inlineLanguage(context); } @@ -165,7 +166,7 @@ /** * {@inheritDoc} */ - public String inlineCountry(FOContext context) { + public String inlineCountry(final FOContext context) { return realLineText.inlineCountry(context); } @@ -179,7 +180,7 @@ /** * {@inheritDoc} */ - public int inlineHyphenationRemainCount(FOContext context) { + public int inlineHyphenationRemainCount(final FOContext context) { return realLineText.inlineHyphenationRemainCount(context); } @@ -193,7 +194,7 @@ /** * {@inheritDoc} */ - public int inlineHyphenationPushCount(FOContext context) { + public int inlineHyphenationPushCount(final FOContext context) { return realLineText.inlineHyphenationPushCount(context); } @@ -207,7 +208,7 @@ /** * {@inheritDoc} */ - public char inlineHyphenationCharacter(FOContext context) { + public char inlineHyphenationCharacter(final FOContext context) { return realLineText.inlineHyphenationCharacter(context); } /** @@ -220,7 +221,7 @@ /** * {@inheritDoc} */ - public boolean inlineIsFauxSmallCaps(FOContext context) { + public boolean inlineIsFauxSmallCaps(final FOContext context) { return realLineText.inlineIsFauxSmallCaps(context); } @@ -234,7 +235,7 @@ /** * {@inheritDoc} */ - public int inlineFauxSmallCapsFontSize(FOContext context) { + public int inlineFauxSmallCapsFontSize(final FOContext context) { return realLineText.inlineFauxSmallCapsFontSize(context); } @@ -262,7 +263,7 @@ /** * {@inheritDoc} */ - public org.axsl.foR.FOLineText getContextWrapper(FOContext context) { + public org.axsl.foR.FOLineText getContextWrapper(final FOContext context) { /* This *is* the wrapper. */ return this; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2006-07-22 22:07:57 UTC (rev 7811) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2006-07-23 00:19:17 UTC (rev 7812) @@ -47,7 +47,7 @@ private FONodeResult result; - protected FONode(FObj parent) { + protected FONode(final FObj parent) { super(parent); } @@ -58,26 +58,26 @@ * issues. * @return This node's effective parent. */ - public FObj effectiveParent(FOContext context) { + public FObj effectiveParent(final FOContext context) { /* If either this or its parent is a Marker, we want to return that * Marker's surrogate RetrieveMarker's parent. */ if (this instanceof Marker) { return effectiveMarkerParent(context); } - TreeNode parent = this.getParent(); + final TreeNode parent = this.getParent(); if (parent instanceof Marker) { return effectiveMarkerParent(context); } return realParent(); } - private FObj effectiveMarkerParent(FOContext context) { + private FObj effectiveMarkerParent(final FOContext context) { if (context == null) { /* TODO: Consider throwing an Exception. This should NOT * happen. */ return realParent(); } - RetrieveMarker retrieve = context.getRetrieveMarker(); + final RetrieveMarker retrieve = context.getRetrieveMarker(); if (retrieve == null) { /* TODO: Consider throwing an Exception. This should NOT * happen. */ @@ -109,7 +109,7 @@ /** * {@inheritDoc} */ - public void setProxy(FONodeProxy proxy) { + public void setProxy(final FONodeProxy proxy) { this.proxy = proxy; } @@ -123,7 +123,7 @@ /** * {@inheritDoc} */ - public void setResult(FONodeResult result) { + public void setResult(final FONodeResult result) { this.result = result; } @@ -144,7 +144,7 @@ return; } for (int i = 0; i < this.getChildren().size(); i++) { - FONode node = (FONode) this.getChildren().get(i); + final FONode node = (FONode) this.getChildren().get(i); node.reset(); } } @@ -152,7 +152,7 @@ /** * {@inheritDoc} */ - public org.axsl.foR.FONode getFONodeChildAt(int childIndex) { + public org.axsl.foR.FONode getFONodeChildAt(final int childIndex) { return (FONode) super.getChildAt(childIndex); } @@ -164,7 +164,8 @@ this.getColumn()); } - public String getContextMessage(String systemId, int line, int column) { + public String getContextMessage(final String systemId, final int line, + final int column) { return " Context: " + systemId + "\n" + " (Line " + line + ", Column " + column + ")"; } @@ -173,7 +174,7 @@ * {@inheritDoc} */ public org.axsl.foR.fo.Marker ancestorMarker() { - FObj parent = this.realParent(); + final FObj parent = this.realParent(); if (parent == null) { return null; } @@ -191,13 +192,13 @@ return realParent().getLogger(); } - public void throwException(String message) throws FOTreeException { + public void throwException(final String message) throws FOTreeException { throwException(getContextMessage(), message); } - public void throwException(String contextMessage, String message) - throws FOTreeException{ - FOTreeException exception = new FOTreeException(message); + public void throwException(final String contextMessage, + final String message) throws FOTreeException{ + final FOTreeException exception = new FOTreeException(message); exception.setContextMessage(contextMessage); throw exception; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-07-22 22:07:57 UTC (rev 7811) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-07-23 00:19:17 UTC (rev 7812) @@ -74,7 +74,7 @@ private char[] ca; private byte filterStatus = FILTER_RAW; - public FOText(FObj parent, char[] chars) { + public FOText(final FObj parent, final char[] chars) { super(parent); this.ca = chars; filterContent(); @@ -86,7 +86,7 @@ if (this.getFOTreeBuilder().preserveRawContent()) { return; } - Marker ancestorMarker = this.ancestorMarker(); + final Marker ancestorMarker = this.ancestorMarker(); if (ancestorMarker != null) { /* There is an fo:marker ancestor, so we can't know what the values * are for white-space-treatment, linefeed-treatment, @@ -119,7 +119,7 @@ public boolean isAllWhiteSpace() { for (int i = 0; i < ca.length; i++) { - char ch = ca[i]; + final char ch = ca[i]; if ((ch == ' ') || (ch == '\n') || (ch == '\r') @@ -146,17 +146,17 @@ * * @return The text that should appear in the refined FO tree. */ - public char[] getRefinedText(FOContext context) { + public char[] getRefinedText(final FOContext context) { /* TODO: This needs to come from effectiveParent, with context. */ - FObj effectiveParent = this.realParent(); + final FObj effectiveParent = this.realParent(); if (this.filterStatus >= FILTER_REFINED_FO_TREE) { /* The stored text has already been filtered. Just return it. */ return this.ca; } - char[] charArray = getPreTextTransformText(context); + final char[] charArray = getPreTextTransformText(context); // Now handle text-transform. - short textTransform = effectiveParent.traitTextTransform(context); + final short textTransform = effectiveParent.traitTextTransform(context); if (textTransform != Constants.FOVAL_NONE) { for (int i = 0; i < charArray.length; i++) { charArray[i] = applyTextTransform(context, charArray, i, @@ -189,8 +189,8 @@ * @return The text that should appear in the refined FO tree, except that * text-transform is not applied. */ - private char[] getPreTextTransformText(FOContext context) { - FObj effectiveParent = this.effectiveParent(context); + private char[] getPreTextTransformText(final FOContext context) { + final FObj effectiveParent = this.effectiveParent(context); if (this.filterStatus >= FILTER_PRE_TRANSFORM) { /* The stored text has already been filtered. Just return it. */ return this.ca; @@ -221,9 +221,10 @@ * @param textTransform The value of the text-transform enumerated property. * @return The transformed char. */ - private char applyTextTransform(FOContext context, char[] charArray, - int index, short textTransform) { - char c = charArray[index]; + private char applyTextTransform(final FOContext context, + final char[] charArray, final int index, + final short textTransform) { + final char c = charArray[index]; switch (textTransform) { /* This method not be entered if value is NONE. */ case Constants.FOVAL_UPPERCASE: @@ -271,9 +272,10 @@ * @return True iff the character at this location is the start of a new * word. */ - private boolean isStartOfWord(FOContext context, char[] charArray, - int index) { - char prevChar = getRelativeCharInBlock(context, charArray, index, -1); + private boolean isStartOfWord(final FOContext context, + final char[] charArray, final int index) { + final char prevChar = getRelativeCharInBlock(context, charArray, + index, -1); /* All we are really concerned about here is of what type prevChar is. If inputChar is not part of a word, then the Java conversions will (we hope) simply return inputChar. @@ -288,7 +290,7 @@ * as a possessive or a contraction, or might be a closing quote. */ case IS_WORD_CHAR_MAYBE: - char prevPrevChar = getRelativeCharInBlock(context, charArray, + final char prevPrevChar = getRelativeCharInBlock(context, charArray, index, -2); switch (isWordChar(prevPrevChar)) { case IS_WORD_CHAR_TRUE: @@ -317,7 +319,7 @@ * depending on whether the character should be considered part of a word * or not. */ - public static int isWordChar(char inputChar) { + public static int isWordChar(final char inputChar) { switch (Character.getType(inputChar)) { case Character.COMBINING_SPACING_MARK: return IS_WORD_CHAR_TRUE; @@ -405,10 +407,10 @@ * @return the character in the offset position within the block; 0x0000 if * the offset points to an area outside of the block. */ - private char getRelativeCharInBlock(FOContext context, char[] charArray, - int index, int offset) { + private char getRelativeCharInBlock(final FOContext context, + final char[] charArray, final int index, final int offset) { // The easy case is where the desired character is in the same FOText - int desiredIndex = index + offset; + final int desiredIndex = index + offset; if (desiredIndex >= 0 && desiredIndex < charArray.length) { return ca[desiredIndex]; } @@ -419,7 +421,8 @@ remainingOffset = offset - (charArray.length - 1 - index); FOText nextFOText = this.getNextContiguousTextInBlock(); while (nextFOText != null) { - char[] nextText = nextFOText.getPreTextTransformText(context); + final char[] nextText = + nextFOText.getPreTextTransformText(context); if (nextText.length >= remainingOffset) { return nextText[remainingOffset - 1]; } @@ -432,7 +435,7 @@ remainingOffset = offset + index; FOText prevFOText = this.getPreviousContiguousTextInBlock(); while (prevFOText != null) { - char[] prevText = prevFOText.getPreTextTransformText(context); + final char[] prevText = prevFOText.getPreTextTransformText(context); if (prevText.length >= Math.abs(remainingOffset)) { return prevText[prevText.length + remainingOffset]; } @@ -450,7 +453,7 @@ * non-text leaf between, null is returned. */ private FOText getNextContiguousTextInBlock() { - FONode nextLeaf = (FONode) this.getNextLeaf(); + final FONode nextLeaf = (FONode) this.getNextLeaf(); return getContiguousTextInBlock(nextLeaf); } @@ -462,7 +465,7 @@ * non-text leaf between, null is returned. */ private FOText getPreviousContiguousTextInBlock() { - FONode previousLeaf = (FONode) this.getPreviousLeaf(); + final FONode previousLeaf = (FONode) this.getPreviousLeaf(); return getContiguousTextInBlock(previousLeaf); } @@ -475,9 +478,9 @@ * 3) #leafToTest has the same ancestor Block as this. * If any of these are not true, null is returned. */ - private FOText getContiguousTextInBlock(FONode leafToTest) { - FObj effectiveParent = this.realParent(); - FOContext context = null; + private FOText getContiguousTextInBlock(final FONode leafToTest) { + final FObj effectiveParent = this.realParent(); + final FOContext context = null; if (leafToTest == null) { return null; } @@ -486,15 +489,15 @@ } /* If either is within a Leader, they both need to be in the same one. */ - Leader thisLeader = effectiveParent.getNearestLeader(context); - Leader testLeader = leafToTest.effectiveParent(context) + final Leader thisLeader = effectiveParent.getNearestLeader(context); + final Leader testLeader = leafToTest.effectiveParent(context) .getNearestLeader(context); if (thisLeader != testLeader) { return null; } - Block thisBlock = this.effectiveParent(context).getContainingBlock( - context); - Block testBlock = leafToTest.effectiveParent(context) + final Block thisBlock = + this.effectiveParent(context).getContainingBlock(context); + final Block testBlock = leafToTest.effectiveParent(context) .getContainingBlock(context); if (thisBlock != testBlock) { return null; @@ -512,8 +515,8 @@ * * @return The text that should appear in the area tree. */ - public char[] getAreaTreeText(FOContext context) { - FObj effectiveParent = this.realParent(); + public char[] getAreaTreeText(final FOContext context) { + final FObj effectiveParent = this.realParent(); if (this.filterStatus >= FILTER_AREA_TREE) { /* The stored text has already been filtered. Just return it. */ return this.ca; @@ -522,8 +525,8 @@ // Start with the refined FO Tree text char[] returnArray = getRefinedText(context); // Apply white-space-collapse. - boolean whiteSpaceCollapse = effectiveParent.traitWhiteSpaceCollapse( - context); + final boolean whiteSpaceCollapse = + effectiveParent.traitWhiteSpaceCollapse(context); returnArray = applyWhiteSpaceCollapse(returnArray, whiteSpaceCollapse); /* Set the instance text to the more refined value and update the @@ -537,7 +540,7 @@ return this.inlineText(null); } - public char[] inlineText(FOContext context) { + public char[] inlineText(final FOContext context) { return getAreaTreeText(context); } @@ -545,17 +548,17 @@ return this.inlinePrimaryFont(null); } - public FontUse inlinePrimaryFont(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public FontUse inlinePrimaryFont(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.getPrimaryFont(context); } - public FontUse inlineSecondaryFont(char c) { + public FontUse inlineSecondaryFont(final char c) { return this.inlineSecondaryFont(null, c); } - public FontUse inlineSecondaryFont(FOContext context, char c) { - FObj effectiveParent = effectiveParent(context); + public FontUse inlineSecondaryFont(final FOContext context, final char c) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.getSecondaryFont(context, c); } @@ -563,8 +566,8 @@ return this.inlineFontSize(null); } - public int inlineFontSize(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public int inlineFontSize(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.traitFontSize(context); } @@ -572,8 +575,8 @@ return this.inlineLetterSpacingOptimum(null); } - public int inlineLetterSpacingOptimum(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public int inlineLetterSpacingOptimum(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.traitLetterSpacingOpt(context); } @@ -581,8 +584,8 @@ return this.inlineWrapOption(null); } - public boolean inlineWrapOption(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public boolean inlineWrapOption(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return (effectiveParent.traitWrapOption(context) == Constants.FOVAL_WRAP); } @@ -591,8 +594,8 @@ return this.inlineHyphenate(null); } - public boolean inlineHyphenate(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public boolean inlineHyphenate(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.traitHyphenate(context); } @@ -600,8 +603,8 @@ return this.inlineLanguage(null); } - public String inlineLanguage(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public String inlineLanguage(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.traitLanguage(context); } @@ -609,8 +612,8 @@ return this.inlineCountry(null); } - public String inlineCountry(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public String inlineCountry(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.traitCountry(context); } @@ -618,8 +621,8 @@ return this.inlineHyphenationRemainCount(null); } - public int inlineHyphenationRemainCount(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public int inlineHyphenationRemainCount(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.traitHyphenationRemainCharacterCount(context); } @@ -627,8 +630,8 @@ return this.inlineHyphenationPushCount(null); } - public int inlineHyphenationPushCount(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public int inlineHyphenationPushCount(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.traitHyphenationPushCharacterCount(context); } @@ -636,8 +639,8 @@ return this.inlineHyphenationCharacter(null); } - public char inlineHyphenationCharacter(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public char inlineHyphenationCharacter(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.traitHyphenationCharacter(context); } @@ -645,8 +648,8 @@ return this.inlineIsFauxSmallCaps(null); } - public boolean inlineIsFauxSmallCaps(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public boolean inlineIsFauxSmallCaps(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); if (effectiveParent.traitFontVariant(context) != Constants.FOVAL_SMALL_CAPS) { return false; @@ -665,8 +668,8 @@ return this.inlineFauxSmallCapsFontSize(null); } - public int inlineFauxSmallCapsFontSize(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public int inlineFauxSmallCapsFontSize(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.getFauxSmallCapFontSize(context); } @@ -692,9 +695,9 @@ * Note that {@link #DISCARD_CHAR} is not a valid Unicode codepoint, and * should therefore never be in the input. */ - public static char applyWhiteSpaceTreatment(char[] charArray, int index, - short whiteSpaceTreatment) { - char c = charArray[index]; + public static char applyWhiteSpaceTreatment(final char[] charArray, + final int index, final short whiteSpaceTreatment) { + final char c = charArray[index]; if (! XMLCharacter.isXMLWhitespace(c)) { /* If it is not whitespace, it cannot be changed. */ return c; @@ -774,7 +777,7 @@ * white-space-treatment, <code>charArray</code> is returned. * Otherwise, a new char array with the result is returned. */ - public static char[] applyWhiteSpaceTreatment(char[] charArray, + public static char[] applyWhiteSpaceTreatment(final char[] charArray, short whiteSpaceTreatment) { switch (whiteSpaceTreatment) { case Constants.FOVAL_IGNORE: @@ -796,8 +799,8 @@ int discardElements = 0; int changeElements = 0; for (int i = 0; i < charArray.length; i++) { - char c = charArray[i]; - char conversionChar = applyWhiteSpaceTreatment(charArray, i, + final char c = charArray[i]; + final char conversionChar = applyWhiteSpaceTreatment(charArray, i, whiteSpaceTreatment); if (conversionChar == DISCARD_CHAR) { discardElements ++; @@ -812,11 +815,11 @@ /* We now know that changes of some sort must be made. Create a new * array in which to put the results. */ - char[] returnArray = new char[charArray.length - discardElements]; + final char[] returnArray = new char[charArray.length - discardElements]; discardElements = 0; for (int i = 0; i < charArray.length; i++) { - char conversionChar = applyWhiteSpaceTreatment(charArray, + final char conversionChar = applyWhiteSpaceTreatment(charArray, i, whiteSpaceTreatment); if (conversionChar == DISCARD_CHAR) { discardElements ++; @@ -827,7 +830,8 @@ return returnArray; } - public static char applyLinefeedTreatment(char c, short linefeedTreatment) { + public static char applyLinefeedTreatment(final char c, + final short linefeedTreatment) { assert c == 0x000a: "Invalid linefeed-treatment input."; switch (linefeedTreatment) { case Constants.FOVAL_IGNORE: { @@ -859,7 +863,7 @@ * <code>charArray</code> is returned. Otherwise, a new char array with the * result is returned. */ - public static char[] applyLinefeedTreatment(char[] charArray, + public static char[] applyLinefeedTreatment(final char[] charArray, short linefeedTreatment) { switch (linefeedTreatment) { case Constants.FOVAL_PRESERVE: { @@ -881,7 +885,7 @@ int discardElements = 0; int changeElements = 0; for (int i = 0; i < charArray.length; i++) { - char c = charArray[i]; + final char c = charArray[i]; if (c == 0x000a) { if (linefeedTreatment == Constants.FOVAL_IGNORE) { discardElements ++; @@ -897,12 +901,12 @@ /* We now know that changes of some sort must be made. Create a new * array in which to put the results. */ - char[] returnArray = new char[charArray.length - discardElements]; + final char[] returnArray = new char[charArray.length - discardElements]; discardElements = 0; for (int i = 0; i < charArray.length; i++) { - char c = charArray[i]; + final char c = charArray[i]; if (c == 0x000a) { - char conversionChar = applyLinefeedTreatment(c, + final char conversionChar = applyLinefeedTreatment(c, linefeedTreatment); if (conversionChar == DISCARD_CHAR) { discardElements ++; @@ -928,8 +932,9 @@ * if the next character is a line-feed. * If neither of these is true, returns the original character. */ - public static char applyWhiteSpaceCollapse(char[] charArray, int index) { - char c = charArray[index]; + public static char applyWhiteSpaceCollapse(final char[] charArray, + final int index) { + final char c = charArray[index]; if (! XMLCharacter.isXMLWhitespace(c)) { /* If it is not whitespace, nothing should change. */ return c; @@ -961,15 +966,15 @@ * white-space-collapse, <code>charArray</code> is returned. * Otherwise, a new char array with the result is returned. */ - public static char[] applyWhiteSpaceCollapse(char[] charArray, - boolean whiteSpaceCollapse) { + public static char[] applyWhiteSpaceCollapse(final char[] charArray, + final boolean whiteSpaceCollapse) { if (! whiteSpaceCollapse) { return charArray; } int discardElements = 0; for (int i = 0; i < charArray.length; i++) { - char convertChar = applyWhiteSpaceCollapse(charArray, i); + final char convertChar = applyWhiteSpaceCollapse(charArray, i); if (convertChar == DISCARD_CHAR) { discardElements ++; } @@ -981,10 +986,10 @@ /* We now know that changes of some sort must be made. Create a new * array in which to put the results. */ - char[] returnArray = new char[charArray.length - discardElements]; + final char[] returnArray = new char[charArray.length - discardElements]; discardElements = 0; for (int i = 0; i < charArray.length; i++) { - char conversionChar = applyWhiteSpaceCollapse(charArray, i); + final char conversionChar = applyWhiteSpaceCollapse(charArray, i); if (conversionChar == DISCARD_CHAR) { discardElements ++; } else { @@ -1006,12 +1011,12 @@ return this.parentFO().getColumn(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } - public org.axsl.foR.FOLineText getContextWrapper(FOContext context) { - org.axsl.foR.fo.Marker marker = this.ancestorMarker(); + public org.axsl.foR.FOLineText getContextWrapper(final FOContext context) { + final org.axsl.foR.fo.Marker marker = this.ancestorMarker(); if (marker == null) { return this; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2006-07-22 22:07:57 UTC (rev 7811) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2006-07-23 00:19:17 UTC (rev 7812) @@ -90,7 +90,7 @@ URL[] graphicSearchPath; boolean cachingGraphics; - public FOTreeBuilder(FOrayFOTreeServer server, Log logger) { + public FOTreeBuilder(final FOrayFOTreeServer server, final Log logger) { this.server = server; this.logger = logger; } @@ -98,7 +98,7 @@ /** * SAX Handler for characters */ - public void characters(char[] data, int start, int length) + public void characters(final char[] data, final int start, final int length) throws SAXException { if (activeForeignXML != null) { // If inside foreign XML, let the ForeignXML instance handle it. @@ -110,7 +110,7 @@ currentFObj.addCharacters(data, start, length, locator.getSystemId(), locator.getLineNumber(), locator.getColumnNumber()); - } catch (FOTreeException e) { + } catch (final FOTreeException e) { throw new SAXException(e); } } @@ -119,8 +119,8 @@ /** * SAX Handler for the end of an element */ - public void endElement(String uri, String localName, String rawName) - throws SAXException { + public void endElement(final String uri, final String localName, + final String rawName) throws SAXException { if (activeForeignXML != null) { // If inside foreign XML, let the ForeignXML instance handle it. activeForeignXML.endElement(uri, localName, rawName); @@ -131,7 +131,7 @@ } try { currentFObj.end(); - } catch (FOTreeException e) { + } catch (final FOTreeException e) { throw new SAXException(e); } notifyFObjComplete(currentFObj); @@ -157,31 +157,32 @@ notifyDocumentComplete(); } - public void setDocumentLocator(Locator locator) { + public void setDocumentLocator(final Locator locator) { this.locator = locator; } /** * SAX Handler for the start of an element */ - public void startElement(String namespaceURI, String localName, - String rawName, Attributes attlist) throws SAXException { + public void startElement(final String namespaceURI, final String localName, + final String rawName, final Attributes attlist) + throws SAXException { if (activeForeignXML != null) { // If inside foreign XML, let the ForeignXML instance handle it. activeForeignXML.startElement(namespaceURI, localName, rawName, attlist); return; } - Namespace namespace = getTreeServer().getNamespace(namespaceURI); + final Namespace namespace = getTreeServer().getNamespace(namespaceURI); if (namespace == null) { - String message = "Unregistered namespace: " + namespaceURI; + final String message = "Unregistered namespace: " + namespaceURI; getLogger().error(message + ": " + getLine() + ":" + getColumn()); throw new SAXException(message); } /* the formatting object started */ FObj fobj = null; try { - PropertyList list = namespace.createNewPropertyList(localName, + final PropertyList list = namespace.createNewPropertyList(localName, attlist); fobj = namespace.parseElement(localName, currentFObj, list, locator, this); @@ -196,7 +197,7 @@ rootFObj.addId(fobj); // Let Root register an unmatched "ref-id", if any. rootFObj.checkUnmatchedReference(fobj); - } catch (FOTreeException e) { + } catch (final FOTreeException e) { throw new SAXException(e); } currentFObj = fobj; @@ -206,7 +207,7 @@ * @param fobj * @throws SAXException */ - private void checkRoot(FObj fobj) throws SAXException { + private void checkRoot(final FObj fobj) throws SAXException { if (rootFObj != null) { return; } @@ -216,13 +217,13 @@ return; } if (fobj.getName().equals("root")) { - FOTreeException fote = new FOTreeException("Root element is " + final FOTreeException fote = new FOTreeException("Root element is " + "missing the namespace declaration: " + "http://www.w3.org/1999/XSL/Format"); fote.setContextMessage(fobj.getContextMessage()); throw new SAXException(fote); } - FOTreeException fote = new FOTreeException("Root element must be " + final FOTreeException fote = new FOTreeException("Root element must be " + "root, not " + fobj.getName()); fote.setContextMessage(fobj.getContextMessage()); throw new SAXException(new FOTreeException(fote)); @@ -262,7 +263,7 @@ * FOTreeEvent firings. * @param listener the Object which should be notified */ - public void registerListener (FOTreeListener listener) { + public void registerListener (final FOTreeListener listener) { if (listener == null) { return; } @@ -277,7 +278,7 @@ * about FOTreeEvent firings. * @param listener the Object which should no longer be notified */ - public void removeFOTreeListener (FOTreeListener listener) { + public void removeFOTreeListener (final FOTreeListener listener) { if (listener == null) { return; } @@ -292,15 +293,16 @@ * FOTreeEvent has been fired. * @param fobj The FObj instance that was just completed. */ - private void notifyFObjComplete(FObj fobj) { + private void notifyFObjComplete(final FObj fobj) { /* If nobody wants these events, don't waste resources creating * them. */ if (this.qtyFObjListeners < 1) { return; } - FOTreeEvent event = new FOTreeEvent(this, fobj); + final FOTreeEvent event = new FOTreeEvent(this, fobj); for (int i = 0; i < foTreeListeners.size(); i++) { - FOTreeListener listener = (FOTreeListener) foTreeListeners.get(i); + final FOTreeListener listener = + (FOTreeListener) foTreeListeners.get(i); listener.foFObjComplete(event); } } @@ -310,10 +312,11 @@ * FOTreeEvent has been fired. * @param pageSequence The PageSequence instance that was just completed. */ - private void notifyPageSequenceComplete(PageSequence pageSequence) { - FOTreeEvent event = new FOTreeEvent(this, pageSequence); + private void notifyPageSequenceComplete(final PageSequence pageSequence) { + final FOTreeEvent event = new FOTreeEvent(this, pageSequence); for (int i = 0; i < foTreeListeners.size(); i++) { - FOTreeListener listener = (FOTreeListener) foTreeListeners.get(i); + final FOTreeListener listener = + (FOTreeListener) foTreeListeners.get(i); listener.foPageSequenceComplete(event); } } @@ -323,9 +326,10 @@ * FOTreeEvent has been fired. */ private void notifyDocumentComplete() { - FOTreeEvent event = new FOTreeEvent(this); + final FOTreeEvent event = new FOTreeEvent(this); for (int i = 0; i < foTreeListeners.size(); i++) { - FOTreeListener listener = (FOTreeListener) foTreeListeners.get(i); + final FOTreeListener listener = + (FOTreeListener) foTreeListeners.get(i); listener.foDocumentComplete(event); } } @@ -346,7 +350,7 @@ return getTreeServer().getXMLNamespace(); } - public String getPropertyName(short propertyType) { + public String getPropertyName(final short propertyType) { return this.server.getPropertyName(propertyType); } @@ -354,7 +358,7 @@ return this.rootFObj; } - public void activateForeignXML(ForeignXML foreign) { + public void activateForeignXML(final ForeignXML foreign) { this.activeForeignXML = foreign; } @@ -366,7 +370,7 @@ return this.server; } - public void setGraphicServer(GraphicServer graphicServer) { + public void setGraphicServer(final GraphicServer graphicServer) { this.graphicServer = graphicServer; } @@ -374,7 +378,7 @@ return this.graphicServer; } - public void setTextServer(TextServer textServer) { + public void setTextServer(final TextServer textServer) { this.textServer = textServer; } @@ -382,7 +386,7 @@ return this.textServer; } - public void setFontConsumer(FontConsumer consumer) { + public void setFontConsumer(final FontConsumer consumer) { this.fontConsumer = consumer; } @@ -390,7 +394,7 @@ return this.fontConsumer; } - public void setGraphicSearchPath(URL[] graphicSearchPath) { + public void setGraphicSearchPath(final URL[] graphicSearchPath) { this.graphicSearchPath = graphicSearchPath; } @@ -398,7 +402,7 @@ return this.graphicSearchPath; } - public void setCachingGraphics(boolean cachingGraphics) { + public void setCachingGraphics(final boolean cachingGraphics) { this.cachingGraphics = cachingGraphics; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-07-22 22:07:57 UTC (rev 7811) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-07-23 00:19:17 UTC (rev 7812) @@ -59,8 +59,9 @@ protected int line; protected int column; - protected FObj(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + protected FObj(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { // Register the parent as the parent of this. super(parent); // Register this as a child of the parent. @@ -114,15 +115,17 @@ * @param column The columns number of the location of the text being * added (used in error messages). */ - protected void addCharacters(char[] data, int start, int length, - String systemId, int line, int column) throws FOTreeException { + protected void addCharacters(final char[] data, final int start, + final int length, final String systemId, final int line, + final int column) throws FOTreeException { if (containsText(data, start, length)) { throwException(getContextMessage(systemId, line, column), "May not contain non-whitespace text."); } } - protected boolean containsText(char[] data, int start, int length) { + protected boolean containsText(final char[] data, final int start, + final int length) { if (data == null || data.length < 1) { return false; } @@ -131,7 +134,7 @@ return false; } for (int i = start; i < start + length; i++) { - char c = data[i]; + final char c = data[i]; if (! XMLCharacter.isXMLWhitespace(c)) { return true; } @@ -191,7 +194,7 @@ * issues. * @return The nearest ancestor FObj that generates reference areas. */ - public org.axsl.foR.FObj ancestorGeneratingRA(FOContext context) { + public org.axsl.foR.FObj ancestorGeneratingRA(final FOContext context) { if (effectiveParent(context).isRAGenerator()) { return effectiveParent(context); } @@ -201,7 +204,7 @@ /** * @return Self or the nearest ancestor FObj that generates reference areas. */ - public org.axsl.foR.FObj nearestGeneratingRA(FOContext context) { + public org.axsl.foR.FObj nearestGeneratingRA(final FOContext context) { if (this.isRAGenerator()) { return this; } @@ -213,7 +216,8 @@ * issues. * @return Self or the nearest ancestor FObj that is a ListItem. */ - public org.axsl.foR.fo.ListItem getNearestListItem(FOContext context) { + public org.axsl.foR.fo.ListItem getNearestListItem( + final FOContext context) { return effectiveParent(context).getNearestListItem(context); } @@ -223,7 +227,7 @@ * @return The nearest ancestor FObj that is a ListBlock. */ public org.axsl.foR.fo.ListBlock getNearestAncestorListBlock( - FOContext context) { + final FOContext context) { if (getParent() == null) { return null; } @@ -245,11 +249,11 @@ * the nearest ancestor that is a Block, or null if there is no ancestor * Block. */ - public org.axsl.foR.fo.Block getContainingBlock(FOContext context) { + public org.axsl.foR.fo.Block getContainingBlock(final FOContext context) { return effectiveParent(context).getContainingBlock(context); } - public org.axsl.foR.fo.Flow getFlow(FOContext context) { + public org.axsl.foR.fo.Flow getFlow(final FOContext context) { if (getParent() == null) { return null; } @@ -259,36 +263,37 @@ /** * {@inheritDoc} */ - public org.axsl.foR.fo.Table getNearestTable(FOContext context) { + public org.axsl.foR.fo.Table getNearestTable(final FOContext context) { return effectiveParent(context).getNearestTable(context); } - public org.axsl.foR.fo.Leader getNearestLeader(FOContext context) { + public org.axsl.foR.fo.Leader getNearestLeader(final FOContext context) { return effectiveParent(context).getNearestLeader(context); } /** * {@inheritDoc} */ - public org.axsl.foR.fo.BasicLink getBasicLink(FOContext context) { + public org.axsl.foR.fo.BasicLink getBasicLink(final FOContext context) { return effectiveParent(context).getBasicLink(context); } /** * {@inheritDoc} */ - public org.axsl.foR.FObj ancestorListRelatedObject(FOContext context) { + public org.axsl.foR.FObj ancestorListRelatedObject( + final FOContext context) { return effectiveParent(context).ancestorListRelatedObject(context); } /** * {@inheritDoc} */ - public String refIdNeeded(FOContext context) { + public String refIdNeeded(final FOContext context) { return null; } - protected void addChild(FONode child) throws FOTreeException { + protected void addChild(final FONode child) throws FOTreeException { children.add(child); } @@ -313,14 +318,14 @@ return true; } - public void checkExceptionLocation(FOTreeException exception) { + public void checkExceptionLocation(final FOTreeException exception) { if (exception.isContextSet()) { return; } exception.setContextMessage(getContextMessage()); } - public void logWarning(String message) { + public void logWarning(final String message) { getLogger().warn(message + "\n" + getContextMessage()); } @@ -342,84 +347,88 @@ */ public abstract Namespace getNamespace() ; - public String getPropertyName(short propertyType) { + public String getPropertyName(final short propertyType) { return getFOTreeBuilder().getPropertyName(propertyType); } /** * {@inheritDoc} */ - public int getMarginLeft(FOContext context, int widthContainingBlock) { + public int getMarginLeft(final FOContext context, + final int widthContainingBlock) { return propertyList.getMarginLeft(context, widthContainingBlock); } /** * {@inheritDoc} */ - public int getMarginRight(FOContext context, int widthContainingBlock) { + public int getMarginRight(final FOContext context, + final int widthContainingBlock) { return propertyList.getMarginRight(context, widthContainingBlock); } /** * {@inheritDoc} */ - public int getMarginTop(FOContext context, int widthContainingBlock) { + public int getMarginTop(final FOContext context, + final int widthContainingBlock) { return propertyList.getMarginTop(context, widthContainingBlock); } /** * {@inheritDoc} */ - public int getMarginBottom(FOContext context, int widthContainingBlock) { + public int getMarginBottom(final FOContext context, + final int widthContainingBlock) { return propertyList.getMarginBottom(context, widthContainingBlock); } /** * {@inheritDoc} */ - public Color traitColor(FOContext context) { + public Color traitColor(final FOContext context) { return propertyList.getColor(context); } /** * {@inheritDoc} */ - public short traitWrapOption(FOContext context) { + public short traitWrapOption(final FOContext context) { return propertyList.getWrapOption(context); } /** * {@inheritDoc} */ - public boolean traitWhiteSpaceCollapse(FOContext context) { + public boolean traitWhiteSpaceCollapse(final FOContext context) { return propertyList.getWhiteSpaceCollapse(context); } /** * {@inheritDoc} */ - public boolean traitUnderlineScore(FOContext context) { + public boolean traitUnderlineScore(final FOContext context) { return propertyList.getUnderlineScore(context); } /** * {@inheritDoc} */ - public boolean traitOverlineScore(FOContext context) { + public boolean traitOverlineScore(final FOContext context) { return propertyList.getOverlineScore(context); } /** * {@inheritDoc} */ - public boolean traitThroughScore(FOContext context) { + public boolean traitThroughScore(final FOContext context) { return propertyList.getThroughScore(context); } /** * {@inheritDoc} */ - public Color traitUnderlineScoreColor(FOContext context) { + public Color traitUnderlineScoreColor(final FOContext context) { /* TODO: This is not right. See Sections 5.5.6 and 7.16.4. Inheritance * is unusual here, and we need to fix it. */ return traitColor(context); @@ -428,7 +437,7 @@ /** * {@inheritDoc} */ - public Color traitOverlineScoreColor(FOContext context) { + public Color traitOverlineScoreColor(final FOContext context) { // Value is the same as for underline. return traitUnderlineScoreColor(context); } @@ -436,7 +445,7 @@ /** * {@inheritDoc} */ - public Color traitThroughScoreColor(FOContext context) { + public Color traitThroughScoreColor(final FOContext context) { // Value is the same as for underline. return traitUnderlineScoreColor(context); } @@ -444,7 +453,7 @@ /** * {@inheritDoc} */ - public boolean traitBlink(FOContext context) { + public boolean traitBlink(final FOContext context) { return propertyList.getBlink(context); } @@ -472,7 +481,8 @@ /** * {@inheritDoc} */ - public int traitStartIndent(FOContext context, int ipdContainingRA) { + public int traitStartIndent(final FOContext context, + final int ipdContainingRA) { return propertyList.getIndent(context, Constants.DIRECTION_START, ipdContainingRA); } @@ -480,7 +490,7 @@ /** * {@inheritDoc} */ - public short traitSpan(FOContext context) { + public short traitSpan(final FOContext context) { /* * Only block-level FOs are affected by column-count, so, for all other * FOs, treat them as if the span trait were "all". @@ -514,7 +524,7 @@ return propertyList.getRetrieveBoundary(); } - public int traitColumnNumber(FOContext context) { + public int traitColumnNumber(final FOContext context) { return propertyList.getColumnNumber(context); } @@ -529,35 +539,35 @@ /** * {@inheritDoc} */ - public short traitBorderCollapse(FOContext context) { + public short traitBorderCollapse(final FOContext context) { return propertyList.getBorderCollapse(context); } /** * {@inheritDoc} */ - public short traitDisplayAlign(FOContext context) { + public short traitDisplayAlign(final FOContext context) { return propertyList.getDisplayAlign(context); } /** * {@inheritDoc} */ - public short traitRelativeAlign(FOContext context) { + public short traitRelativeAlign(final FOContext context) { return propertyList.getRelativeAlign(context); } /** * {@inheritDoc} */ - public int traitBorderSeparationIPD(FOContext context) { + public int traitBorderSeparationIPD(final FOContext context) { return propertyList.getBorderSeparationIPD(context); } /** * {@inheritDoc} */ - public int traitBorderSeparationBPD(FOContext context) { + public int traitBorderSeparationBPD(final FOContext context) { return propertyList.getBorderSeparationBPD(context); } @@ -571,7 +581,7 @@ /** * {@inheritDoc} */ - public int traitColumnWidth(FOContext context, int tableWidth) { + public int traitColumnWidth(final FOContext context, final int tableWidth) { return propertyList.getColumnWidth(context, tableWidth); } @@ -585,70 +595,70 @@ /** * {@inheritDoc} */ - public short traitBreakAfter(FOContext context) { + public short traitBreakAfter(final FOContext context) { return propertyList.getBreakAfter(context); } /** * {@inheritDoc} */ - public int traitKeepTogetherWithinLine(FOContext context) { + public int traitKeepTogetherWithinLine(final FOContext context) { return propertyList.traitKeepTogetherWithinLine(context); } /** * {@inheritDoc} */ - public int traitKeepTogetherWithinColumn(FOContext context) { + public int traitKeepTogetherWithinColumn(final FOContext context) { return propertyList.traitKeepTogetherWithinColumn(context); } /** * {@inheritDoc} */ - public int traitKeepTogetherWithinPage(FOContext context) { + public int traitKeepTogetherWithinPage(final FOContext context) { return propertyList.traitKeepTogetherWithinPage(context); } /** * {@inheritDoc} */ - public int traitKeepWithNextWithinLine(FOContext context) { + public int traitKeepWithNextWithinLine(final FOContext context) { return propertyList.traitKeepWithNextWithinLine(context); } /** * {@inheritDoc} */ - public int traitKeepWithNextWithinColumn(FOContext context) { + public int traitKeepWithNextWithinColumn(final FOContext context) { return propertyList.traitKeepWithNextWithinColumn(context); } /** * {@inheritDoc} */ - public int traitKeepWithNextWithinPage(FOContext context) { + public in... [truncated message content] |
|
From: <vic...@us...> - 2006-07-22 22:08:37
|
Revision: 7811 Author: victormote Date: 2006-07-22 15:07:57 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7811&view=rev Log Message: ----------- Implement standard use of "final" modifier on local variables and parameters. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtAngle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCharacter.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtColor.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCountry.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtFrequency.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtInteger.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtKeep.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLanguage.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLength.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthBPIPDirection.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthConditional.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthRange.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtName.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtNumber.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtPercentage.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtRectangle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtScript.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShadowEffect.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShape.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtSpace.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtString.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtTextDeco.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtTime.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtURI.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtWritingMode.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/Expr.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprAdditiveOper.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprInner.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprMultiplicativeOper.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprUnaryOper.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnAbs.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnBodyStart.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnCeiling.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnFloor.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnFromParent.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnFromTableColumn.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnInheritedProp.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnLabelEnd.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnMax.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnMin.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnNearestSpecProp.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnProportionalColWidth.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnRGB.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnRound.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/Function.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/PropertyCollection.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/PropertyKeyword.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ValueCollection.java trunk/foray/foray-fotree/src/java/org/foray/fotree/xml/NamespaceXML.java trunk/foray/foray-fotree/src/java/org/foray/fotree/xml/PropertyMakerXML.java trunk/foray/foray-fotree/src/java/org/foray/fotree/xml/prop/Lang.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtAngle.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtAngle.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtAngle.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -46,7 +46,8 @@ * @param value The signed angle value. * @param units One of AngleDT.DEGREEES, AngleDT.GRADS, or AngleDT.RADIANS. */ - public DtAngle(float value, byte units) throws PropertyException { + public DtAngle(final float value, final byte units) + throws PropertyException { if (! validUnits(units)) { throw new PropertyException("Illegal angle unit ID: " + units); } @@ -74,7 +75,7 @@ * @param units One of AngleDT.DEGREES, AngleDT.GRADS, or AngleDT.RADIANS. * @return The value, in degrees, of the angle. */ - public static float convertToDegrees(float value, byte units) { + public static float convertToDegrees(final float value, final byte units) { switch (units) { case DEGREES: { return value; @@ -99,7 +100,7 @@ * datatype in the XSL-FO spec, 1.0, Section 5.11. * @return An AngleDT instance if input is valid, otherwise null; */ - public static DtAngle makeAngleDT(String input) { + public static DtAngle makeAngleDT(final String input) { byte unitID = 0; int index = input.indexOf("deg"); if (index > -1) { @@ -120,16 +121,16 @@ if (! validUnits(unitID)) { return null; } - String valuePortion = input.substring(0, index - 1); + final String valuePortion = input.substring(0, index - 1); float value = 0; try { value = Float.parseFloat(valuePortion); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { return null; } try { return new DtAngle(value, unitID); - } catch (PropertyException e1) { + } catch (final PropertyException e1) { /* * The exception thrown by the constructor is to ensure that the * units are valid, which we have already done above. Therefore, @@ -139,7 +140,7 @@ } } - public static boolean validUnits(byte units) { + public static boolean validUnits(final byte units) { if (units < DtAngle.DEGREES) { return false; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCharacter.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCharacter.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCharacter.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -36,7 +36,7 @@ * Constructor. * @param value The char value. */ - public DtCharacter(char value) { + public DtCharacter(final char value) { this.value = value; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtColor.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtColor.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtColor.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -251,7 +251,7 @@ * {@link #makeDtColor(String)}, {@link #makeDtColor(Color)}, or * {@link #makeDtColor(float, float, float, float)}. */ - private DtColor(Color color) { + private DtColor(final Color color) { this.value = color; } @@ -273,36 +273,36 @@ * @return A ColorDT instance, or null if input is not a defined XSL-FO * named color. */ - public static DtColor makeDtColor(String input) { + public static DtColor makeDtColor(final String input) { /* The names colors are static instances anyway, so no need to check * the list of used colors. */ return mapNameToColorRGB(input); } - public static DtColor makeDtColor(Color color) { - DtColor foundColor = DtColor.findColor(color); + public static DtColor makeDtColor(final Color color) { + final DtColor foundColor = DtColor.findColor(color); /* If it has already been created, return the previously-created * instance. */ if (foundColor != null) { return foundColor; } /* Otherwise, create a new instance. */ - DtColor newDtColor = new DtColor(color); + final DtColor newDtColor = new DtColor(color); DtColor.colorsUsed.add(newDtColor); return newDtColor; } - public static DtColor makeDtColor(float red, float green, float blue, - float alpha) { - DtColor foundColor = DtColor.findColor(red, green, blue, alpha); + public static DtColor makeDtColor(final float red, final float green, + final float blue, final float alpha) { + final DtColor foundColor = DtColor.findColor(red, green, blue, alpha); /* If it has already been created, return the previously-created * instance. */ if (foundColor != null) { return foundColor; } /* Otherwise, create a new instance. */ - Color newColor = new Color(red, green, blue, alpha); - DtColor newDtColor = new DtColor(newColor); + final Color newColor = new Color(red, green, blue, alpha); + final DtColor newDtColor = new DtColor(newColor); DtColor.colorsUsed.add(newDtColor); return newDtColor; } @@ -314,9 +314,9 @@ * @return The already-created instance for <code>color</code>, or null * if it has not yet been created. */ - private static DtColor findColor(Color color) { + private static DtColor findColor(final Color color) { for (int i = 0; i < DtColor.getColorsUsed().size(); i++) { - DtColor usedColor = (DtColor) DtColor.getColorsUsed().get(i); + final DtColor usedColor = (DtColor) DtColor.getColorsUsed().get(i); if (usedColor.value.equals(color)) { return usedColor; } @@ -334,12 +334,12 @@ * @return The already-created instance, or null if it has not yet been * created. */ - private static DtColor findColor(float red, float green, float blue, - float alpha) { + private static DtColor findColor(final float red, final float green, + final float blue, final float alpha) { for (int i = 0; i < DtColor.getColorsUsed().size(); i++) { - DtColor usedColor = (DtColor) DtColor.getColorsUsed().get(i); - Color colorValue = usedColor.value; - float[] components = colorValue.getRGBComponents(null); + final DtColor usedColor = (DtColor) DtColor.getColorsUsed().get(i); + final Color colorValue = usedColor.value; + final float[] components = colorValue.getRGBComponents(null); if (components == null || components.length != 4) { continue; @@ -362,9 +362,9 @@ return DtColor.colorsUsed; } - public static DtColor mapNameToColorRGB(String colorName) { + public static DtColor mapNameToColorRGB(final String colorName) { // Do a binary search to find the name in the names list. - int index = Arrays.binarySearch(names, colorName); + final int index = Arrays.binarySearch(names, colorName); if (index < 0 || index >= names.length) { return null; } @@ -409,7 +409,7 @@ throw new PropertyException("Unknown colour format. Must " + "be #RGB or #RRGGBB"); } - } catch (Exception e) { + } catch (final Exception e) { red = 0; green = 0; blue = 0; @@ -417,14 +417,14 @@ + "#RGB or #RRGGBB"); } } else if (value.startsWith("rgb(")) { - int poss = value.indexOf("("); - int pose = value.indexOf(")"); + final int poss = value.indexOf("("); + final int pose = value.indexOf(")"); if (poss != -1 && pose != -1) { value = value.substring(poss + 1, pose); - StringTokenizer st = new StringTokenizer(value, ","); + final StringTokenizer st = new StringTokenizer(value, ","); try { if (st.hasMoreTokens()) { - String str = st.nextToken().trim(); + final String str = st.nextToken().trim(); if (str.endsWith("%")) { red = Integer.parseInt(str.substring(0, str.length() @@ -435,7 +435,7 @@ } } if (st.hasMoreTokens()) { - String str = st.nextToken().trim(); + final String str = st.nextToken().trim(); if (str.endsWith("%")) { green = Integer.parseInt(str.substring(0, str.length() @@ -446,7 +446,7 @@ } } if (st.hasMoreTokens()) { - String str = st.nextToken().trim(); + final String str = st.nextToken().trim(); if (str.endsWith("%")) { blue = Integer.parseInt(str.substring(0, str.length() @@ -456,7 +456,7 @@ blue = Integer.parseInt(str) / 255f; } } - } catch (Exception e) { + } catch (final Exception e) { red = 0; green = 0; blue = 0; @@ -473,7 +473,8 @@ blue = 0; alpha = 1; } else { - DtColor foundColor = mapNameToColorRGB(value.toLowerCase()); + final DtColor foundColor = mapNameToColorRGB( + value.toLowerCase()); if (foundColor == null) { red = 0; green = 0; @@ -484,7 +485,7 @@ return foundColor; } } - DtColor dtColor = DtColor.makeDtColor(red, green, blue, alpha); + final DtColor dtColor = DtColor.makeDtColor(red, green, blue, alpha); return dtColor; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCountry.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCountry.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCountry.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -542,7 +542,7 @@ * Constructor. * @param value The country code. */ - public DtCountry(String value) { + public DtCountry(final String value) { this.value = value.toLowerCase(); } @@ -556,7 +556,7 @@ /** * Set the value. */ - public void setValue(String value) { + public void setValue(final String value) { this.value = value; } @@ -565,8 +565,8 @@ * @param countryCode A 2-letter or 3-letter ISO 3166 code. * @return True if countryCode is found in validCountries, false otherwise. */ - public static boolean validCountry(String countryCode) { - String normalized = countryCode.toLowerCase(); + public static boolean validCountry(final String countryCode) { + final String normalized = countryCode.toLowerCase(); int index = Arrays.binarySearch(validCountries, normalized); if (index >= 0) { return true; @@ -578,7 +578,7 @@ return false; } - public static DtCountry makeCountryDT(String countryCode) { + public static DtCountry makeCountryDT(final String countryCode) { if (! validCountry(countryCode)) { return null; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtFrequency.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtFrequency.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtFrequency.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -40,7 +40,8 @@ /** * Constructor. */ - public DtFrequency(double quantity, byte units) throws PropertyException { + public DtFrequency(final double quantity, final byte units) + throws PropertyException { if (units < 1 || units > 2) { throw new PropertyException("Invalid FrequencyDT unit ID."); } @@ -70,9 +71,9 @@ * @return The FrequencyDT instance constructed, or null if input is not * valid. */ - public static DtFrequency makeFrequencyDT(String input) { + public static DtFrequency makeFrequencyDT(final String input) { // Make a copy of input - String useInput = new String(input); + final String useInput = new String(input); useInput.trim(); byte units = -1; int unitsLength = -1; @@ -86,17 +87,17 @@ if (units < 1) { return null; } - String quantityPart = useInput.substring(0, useInput.length() + final String quantityPart = useInput.substring(0, useInput.length() - unitsLength); double quantity; try { quantity = Double.parseDouble(quantityPart); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { return null; } try { return new DtFrequency(quantity, units); - } catch (PropertyException e1) { + } catch (final PropertyException e1) { /* * This should never happen, because we have already validated the * input. Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtInteger.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtInteger.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtInteger.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -37,7 +37,7 @@ * Constructor. * @param value The signed number value. */ - public DtInteger(int value) { + public DtInteger(final int value) { this.value = value; } @@ -51,7 +51,7 @@ /** * Set the value. */ - public void setValue(int value) { + public void setValue(final int value) { this.value = value; } @@ -59,7 +59,7 @@ return value; } - public void setNumericValue(double value) { + public void setNumericValue(final double value) { this.value = (int) Math.round(value); } @@ -67,13 +67,13 @@ return this; } - public void setMinimumValue(int num) { + public void setMinimumValue(final int num) { if (num > this.value) { this.value = num; } } - public void setMaximumValue(int num) { + public void setMaximumValue(final int num) { if (num < this.value) { this.value = num; } @@ -90,14 +90,14 @@ * created. * @return An IntegerDT instance, or null if input is not valid. */ - public static DtInteger makeIntegerDT(String input) { + public static DtInteger makeIntegerDT(final String input) { // Make a copy of input - String useInput = new String(input); + final String useInput = new String(input); useInput.trim(); int value = 0; try { value = Integer.parseInt(useInput); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { return null; } return new DtInteger(value); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtKeep.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtKeep.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtKeep.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -40,21 +40,22 @@ /** * Constructor. */ - public DtKeep(int withinLine, int withinColumn, int withinPage) { + public DtKeep(final int withinLine, final int withinColumn, + final int withinPage) { this.withinLine = withinLine; this.withinColumn = withinColumn; this.withinPage = withinPage; } - public void setWithinLine(int withinLine) { + public void setWithinLine(final int withinLine) { this.withinLine = withinLine; } - public void setWithinColumn(int withinColumn) { + public void setWithinColumn(final int withinColumn) { this.withinColumn = withinColumn; } - public void setWithinPage(int withinPage) { + public void setWithinPage(final int withinPage) { this.withinPage = withinPage; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLanguage.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLanguage.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLanguage.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -39,7 +39,7 @@ * Constructor. * @param value The language code. */ - public DtLanguage(String value) { + public DtLanguage(final String value) { this.value = value; } @@ -53,11 +53,11 @@ /** * Set the value. */ - public void setValue(String value) { + public void setValue(final String value) { this.value = value; } - public static DtLanguage makeLanguageDT(String languageCode) { + public static DtLanguage makeLanguageDT(final String languageCode) { if (! ISO639.validLanguage(languageCode)) { return null; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLength.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLength.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLength.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -73,7 +73,8 @@ * @param units A byte representation of the unit of measure (points, * inches, etc.) */ - public DtLength(float value, String units) throws PropertyException { + public DtLength(final float value, final String units) + throws PropertyException { this.value = value; this.units = convertUnits(units); if (this.units < 1 || this.units > 8) { @@ -87,7 +88,7 @@ * @param percentBase The base to be used for percentage computations. * @return The value of this length in millipoints. */ - public int getValue(int pointSize, int percentBase) { + public int getValue(final int pointSize, final int percentBase) { switch (this.units) { case UNIT_INCHES: { return Math.round(this.value * 72 * 1000); @@ -120,7 +121,7 @@ } } - public static byte convertUnits(String units) { + public static byte convertUnits(final String units) { // Start at 1, not 0, as 0 is not a valid value. for (byte i = 1; i < unitArray.length; i++) { if (units.equals(unitArray[i])) { @@ -140,7 +141,7 @@ /** * Note that this sets the raw numeric value, without regard to units. */ - public void setNumericValue(double value) { + public void setNumericValue(final double value) { this.value = (int) Math.round(value); } @@ -155,9 +156,9 @@ * created. * @return A LengthDT instance, or null if input is not valid. */ - public static DtLength makeLengthDT(String input) { + public static DtLength makeLengthDT(final String input) { // Make a copy of input - String useInput = new String(input); + final String useInput = new String(input); useInput.trim(); byte unitArrayIndex = -1; for (byte i = 1; i < unitArray.length; i++) { @@ -168,18 +169,18 @@ if (unitArrayIndex < 1) { return null; } - int charsToTruncate = unitArray[unitArrayIndex].length(); - String valuePart = useInput.substring(0, useInput.length() + final int charsToTruncate = unitArray[unitArrayIndex].length(); + final String valuePart = useInput.substring(0, useInput.length() - charsToTruncate); float value = 0; try { value = Float.parseFloat(valuePart); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { return null; } try { return new DtLength(value, unitArray[unitArrayIndex]); - } catch (PropertyException e1) { + } catch (final PropertyException e1) { // This should never happen as we have already validated the input. return null; } @@ -196,7 +197,7 @@ return true; } - public int evalUnitPower1(int pointSize, int percentBase) { + public int evalUnitPower1(final int pointSize, final int percentBase) { return getValue(pointSize, percentBase); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthBPIPDirection.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthBPIPDirection.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthBPIPDirection.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -36,12 +36,13 @@ /** * Constructor. */ - public DtLengthBPIPDirection(DtLength bpdLength, DtLength ipdLength) { + public DtLengthBPIPDirection(final DtLength bpdLength, + final DtLength ipdLength) { this.bpdLength = bpdLength; this.ipdLength = ipdLength; } - public void setBPDLength(DtLength length) { + public void setBPDLength(final DtLength length) { this.bpdLength = length; } @@ -49,7 +50,7 @@ return this.bpdLength; } - public void setIPDLength(DtLength length) { + public void setIPDLength(final DtLength length) { this.ipdLength = length; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthConditional.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthConditional.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthConditional.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -36,16 +36,17 @@ /** * Constructor. */ - public DtLengthConditional(DtLength length, byte conditionality) { + public DtLengthConditional(final DtLength length, + final byte conditionality) { this.length = length; this.conditionality = conditionality; } - public void setLength(DtLength length) { + public void setLength(final DtLength length) { this.length = length; } - public void setConditionality(byte conditionality) { + public void setConditionality(final byte conditionality) { this.conditionality = conditionality; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthRange.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthRange.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthRange.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -37,22 +37,22 @@ /** * Constructor. */ - public DtLengthRange(DtLength lengthMinimum, DtLength lengthOptimum, - DtLength lengthMaximum) { + public DtLengthRange(final DtLength lengthMinimum, + final DtLength lengthOptimum, final DtLength lengthMaximum) { this.lengthMinimum = lengthMinimum; this.lengthOptimum = lengthOptimum; this.lengthMaximum = lengthMaximum; } - public void setLengthMinimum(DtLength lengthMinimum) { + public void setLengthMinimum(final DtLength lengthMinimum) { this.lengthMinimum = lengthMinimum; } - public void setLengthOptimum(DtLength lengthOptimum) { + public void setLengthOptimum(final DtLength lengthOptimum) { this.lengthOptimum = lengthOptimum; } - public void setLengthMaximum(DtLength lengthMaximum) { + public void setLengthMaximum(final DtLength lengthMaximum) { this.lengthMaximum = lengthMaximum; } @@ -75,7 +75,8 @@ * should be set. * @return True if successful, false if the subPropertyName is not valid. */ - public boolean setComponent(String subPropertyName, DtLength length) { + public boolean setComponent(final String subPropertyName, + final DtLength length) { if (subPropertyName.equals("minimum")) { setLengthMinimum(length); return true; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtName.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtName.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtName.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -38,7 +38,7 @@ * Constructor. * @param value The string value of the name. */ - public DtName(String value) { + public DtName(final String value) { this.value = value; } @@ -56,7 +56,7 @@ * @param input String containing the value to be converted to a NameDT. * @return A new NameDT instance, or null if input is not valid. */ - public static DtName makeNameDT(String input) { + public static DtName makeNameDT(final String input) { if (! XMLCharacter.isNCName(input)) { return null; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtNumber.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtNumber.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtNumber.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -37,7 +37,7 @@ * Constructor. * @param value The signed length value. */ - public DtNumber(double value) { + public DtNumber(final double value) { this.value = value; } @@ -52,12 +52,12 @@ return value; } - public void setNumericValue(double value) { + public void setNumericValue(final double value) { this.value = value; } public DtInteger round() { - int integer = (int) Math.round(this.value); + final int integer = (int) Math.round(this.value); return new DtInteger(integer); } @@ -66,11 +66,11 @@ return 0; } - public static DtNumber makeNumberDT(String input) { + public static DtNumber makeNumberDT(final String input) { double aNumber = 0; try { aNumber = Double.parseDouble(input); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { return null; } return new DtNumber(aNumber); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtPercentage.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtPercentage.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtPercentage.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -38,7 +38,7 @@ * @param value The percentage value. 85.6% should be expressed as 85.6, * not .856. */ - public DtPercentage(float value) { + public DtPercentage(final float value) { this.value = value; } @@ -53,7 +53,7 @@ return value; } - public void setNumericValue(double value) { + public void setNumericValue(final double value) { this.value = (float) value; } @@ -67,18 +67,19 @@ * @return The PercentageDT instance constructed, or null if input is not * valid. */ - public static DtPercentage makePercentageDT(String input) { + public static DtPercentage makePercentageDT(final String input) { // Make a copy of input - String useInput = new String(input); + final String useInput = new String(input); useInput.trim(); if (! useInput.endsWith("%")) { return null; } - String quantityPart = useInput.substring(0, useInput.length() - 1); + final String quantityPart = useInput.substring(0, + useInput.length() - 1); float quantity; try { quantity = Float.parseFloat(quantityPart); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { return null; } return new DtPercentage(quantity); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtRectangle.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtRectangle.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtRectangle.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -48,8 +48,9 @@ /** * Constructor. */ - public DtRectangle(PropertyValue topOffset, PropertyValue rightOffset, - PropertyValue bottomOffset, PropertyValue leftOffset) + public DtRectangle(final PropertyValue topOffset, + final PropertyValue rightOffset, + final PropertyValue bottomOffset, final PropertyValue leftOffset) throws PropertyException { if (! validOffset(topOffset) || ! validOffset(rightOffset) || ! validOffset(bottomOffset) || ! validOffset(leftOffset)) { @@ -61,9 +62,9 @@ this.leftOffset = leftOffset; } - private boolean validOffset(PropertyValue pv) { + private boolean validOffset(final PropertyValue pv) { if (pv instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) pv).getValue(); + final short keyword = ((PropertyKeyword) pv).getValue(); if (keyword == Constants.FOVAL_AUTO) { return true; } @@ -75,25 +76,26 @@ return false; } - public int getTopOffset(int pointSize, int percentBase) { + public int getTopOffset(final int pointSize, final int percentBase) { return getOffset(topOffset, pointSize, percentBase); } - public int getRightOffset(int pointSize, int percentBase) { + public int getRightOffset(final int pointSize, final int percentBase) { return getOffset(rightOffset, pointSize, percentBase); } - public int getBottomOffset(int pointSize, int percentBase) { + public int getBottomOffset(final int pointSize, final int percentBase) { return getOffset(bottomOffset, pointSize, percentBase); } - public int getLeftOffset(int pointSize, int percentBase) { + public int getLeftOffset(final int pointSize, final int percentBase) { return getOffset(leftOffset, pointSize, percentBase); } - private int getOffset(PropertyValue pv, int pointSize, int percentBase) { + private int getOffset(final PropertyValue pv, final int pointSize, + final int percentBase) { if (pv instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) pv).getValue(); + final short keyword = ((PropertyKeyword) pv).getValue(); if (keyword == Constants.FOVAL_AUTO) { return 0; } @@ -110,7 +112,7 @@ * @return The RectangleDT instance constructed, or null if input is not * valid. */ - public static DtRectangle makeRectangleDT(String input) { + public static DtRectangle makeRectangleDT(final String input) { // Make a copy of input String useInput = new String(input); useInput.trim(); @@ -122,19 +124,19 @@ return null; } useInput = useInput.substring(1, useInput.length() - 1); - StringTokenizer st = new StringTokenizer(useInput, " ,"); + final StringTokenizer st = new StringTokenizer(useInput, " ,"); if (st.countTokens() != 4) { return null; } - PropertyValue[] pvArray = new PropertyValue[4]; + final PropertyValue[] pvArray = new PropertyValue[4]; int pvIndex = 0; while (st.hasMoreTokens()) { - String token = st.nextToken(); + final String token = st.nextToken(); if (token.equals("inherit")) { pvArray[pvIndex] = new PropertyKeyword (Constants.FOVAL_INHERIT); } - DtLength length = DtLength.makeLengthDT(token); + final DtLength length = DtLength.makeLengthDT(token); if (length != null) { pvArray[pvIndex] = length; } @@ -146,7 +148,7 @@ try { return new DtRectangle(pvArray[0], pvArray[1], pvArray[2], pvArray[3]); - } catch (PropertyException e) { + } catch (final PropertyException e) { // This should never happen, as we have already validated the input. return null; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtScript.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtScript.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtScript.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -152,7 +152,7 @@ * Constructor. * @param value The 4-character script identifier. */ - public DtScript(String value) { + public DtScript(final String value) { this.value = value; } @@ -166,7 +166,7 @@ /** * Set the String value of this script. */ - public void setValue(String value) { + public void setValue(final String value) { this.value = value; } @@ -175,8 +175,8 @@ * @param scriptCode A 4-character ISO 15924 code. * @return True if scriptCode is found in validScripts, false otherwise. */ - public static boolean validScript(String scriptCode) { - int index = Arrays.binarySearch(validScripts, scriptCode); + public static boolean validScript(final String scriptCode) { + final int index = Arrays.binarySearch(validScripts, scriptCode); if (index >= 0) { return true; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShadowEffect.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShadowEffect.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShadowEffect.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -44,29 +44,30 @@ * Constructor. See Section 7.16.5 in the XSL-FO Standard for the meanings * of the parameters. */ - public DtShadowEffect(DtLength horizontalDistance, - DtLength verticalDistance, DtLength blurRadius, DtColor color) { + public DtShadowEffect(final DtLength horizontalDistance, + final DtLength verticalDistance, final DtLength blurRadius, + final DtColor color) { this.horizontalDistance = horizontalDistance; this.verticalDistance = verticalDistance; this.blurRadius = blurRadius; this.color = color; } - public int getHorizontalDistance(int fontSize) { + public int getHorizontalDistance(final int fontSize) { if (this.horizontalDistance == null) { return 0; } return horizontalDistance.getValue(fontSize, 0); } - public int getVerticalDistance(int fontSize) { + public int getVerticalDistance(final int fontSize) { if (this.verticalDistance == null) { return 0; } return verticalDistance.getValue(fontSize, 0); } - public int getblurRadius(int fontSize) { + public int getblurRadius(final int fontSize) { if (this.blurRadius == null) { return 0; } @@ -87,21 +88,21 @@ * @return The ShadowEffectDT instance constructed, or null if input is not * valid. */ - public static DtShadowEffect makeShadowEffectDT(String input) { + public static DtShadowEffect makeShadowEffectDT(final String input) { // Make a copy of input - String useInput = new String(input); + final String useInput = new String(input); useInput.trim(); DtLength horizontalDistance = null; DtLength verticalDistance = null; DtLength blurRadius = null; DtColor color = null; - StringTokenizer st = new StringTokenizer(input); + final StringTokenizer st = new StringTokenizer(input); if (st.countTokens() < 2 || st.countTokens() > 4) { return null; } for (int i = 0; i < st.countTokens(); i++) { - String token = st.nextToken(); - DtColor aColor = DtColor.makeDtColor(token); + final String token = st.nextToken(); + final DtColor aColor = DtColor.makeDtColor(token); if (aColor != null) { // If it is a color, it must be either the first or last token. if (i == 0 || i == st.countTokens() - 1 @@ -112,7 +113,7 @@ } return null; } - DtLength aLength = DtLength.makeLengthDT(token); + final DtLength aLength = DtLength.makeLengthDT(token); if (aLength == null) { // This can only happen if the input is bad. return null; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShape.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShape.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShape.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -40,8 +40,8 @@ * @return The ShapeDT subclass instance if one is found, or null if one * is not. */ - public static DtShape makeShapeDT(String input) { - DtShape shape = DtRectangle.makeRectangleDT(input); + public static DtShape makeShapeDT(final String input) { + final DtShape shape = DtRectangle.makeRectangleDT(input); if (shape != null) { return shape; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtSpace.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtSpace.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtSpace.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -56,9 +56,9 @@ /** * Constructor. */ - public DtSpace(Expr lengthMinimum, Expr lengthOptimum, - Expr lengthMaximum, short conditionality, int precedence) - throws PropertyException { + public DtSpace(final Expr lengthMinimum, final Expr lengthOptimum, + final Expr lengthMaximum, final short conditionality, + final int precedence) throws PropertyException { if (lengthMinimum.unitPower() != 1 || lengthOptimum.unitPower() != 1 || lengthMaximum.unitPower() != 1) { @@ -71,35 +71,35 @@ this.precedence = precedence; } - public void setLengthMinimum(DtLength lengthMinimum) { + public void setLengthMinimum(final DtLength lengthMinimum) { this.lengthMinimum = lengthMinimum; } - public void setLengthOptimum(DtLength lengthOptimum) { + public void setLengthOptimum(final DtLength lengthOptimum) { this.lengthOptimum = lengthOptimum; } - public void setLengthMaximum(DtLength lengthMaximum) { + public void setLengthMaximum(final DtLength lengthMaximum) { this.lengthMaximum = lengthMaximum; } - public void setConditionality(short conditionality) { + public void setConditionality(final short conditionality) { this.conditionality = conditionality; } - public void setPrecedence(int precedence) { + public void setPrecedence(final int precedence) { this.precedence = precedence; } - public int getLengthMinimum(int pointSize, int percentBase) { + public int getLengthMinimum(final int pointSize, final int percentBase) { return this.lengthMinimum.evalUnitPower1(pointSize, percentBase); } - public int getLengthOptimum(int pointSize, int percentBase) { + public int getLengthOptimum(final int pointSize, final int percentBase) { return this.lengthOptimum.evalUnitPower1(pointSize, percentBase); } - public int getLengthMaximum(int pointSize, int percentBase) { + public int getLengthMaximum(final int pointSize, final int percentBase) { return this.lengthMaximum.evalUnitPower1(pointSize, percentBase); } @@ -120,10 +120,10 @@ * for the subPropertyName given. * @throws PropertyException If the subPropertyName is not valid. */ - public boolean addComponent(String subPropertyName, String value) - throws PropertyException { + public boolean addComponent(final String subPropertyName, + final String value) throws PropertyException { if (subPropertyName.equals("conditionality")) { - short keyword = Property.getKeywordIndex(value, + final short keyword = Property.getKeywordIndex(value, DtSpace.CONDITIONALITY_KEYWORDS); if (keyword > 0) { this.setConditionality(keyword); @@ -132,7 +132,7 @@ return false; } if (subPropertyName.equals("precedence")) { - short keyword = Property.getKeywordIndex(value, + final short keyword = Property.getKeywordIndex(value, DtSpace.PRECEDENCE_KEYWORDS); if (keyword == Constants.FOVAL_FORCE) { this.setPrecedence(DtSpace.PRECEDENCE_FORCE); @@ -141,13 +141,13 @@ int precedence = -1; try { precedence = Integer.parseInt(value); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { return false; } this.setPrecedence(precedence); return true; } - DtLength length = DtLength.makeLengthDT(value); + final DtLength length = DtLength.makeLengthDT(value); if (length != null) { if (subPropertyName.equals("minimum")) { this.setLengthMaximum(length); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtString.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtString.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtString.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -36,7 +36,7 @@ * Constructor. * @param value The string value. */ - public DtString(String value) { + public DtString(final String value) { this.value = value; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtTextDeco.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtTextDeco.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtTextDeco.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -46,8 +46,8 @@ /** * Constructor. */ - public DtTextDeco(boolean isUnderlined, boolean isOverlined, - boolean isLineThrough, boolean isBlink) { + public DtTextDeco(final boolean isUnderlined, final boolean isOverlined, + final boolean isLineThrough, final boolean isBlink) { this.isUnderlined = isUnderlined; this.isOverlined = isOverlined; this.isLineThrough = isLineThrough; @@ -63,7 +63,7 @@ /** * @param isBlink The isBlink to set. */ - public void setBlink(boolean isBlink) { + public void setBlink(final boolean isBlink) { this.isBlink = isBlink; } /** @@ -75,7 +75,7 @@ /** * @param isLineThrough The isLineThrough to set. */ - public void setLineThrough(boolean isLineThrough) { + public void setLineThrough(final boolean isLineThrough) { this.isLineThrough = isLineThrough; } /** @@ -87,7 +87,7 @@ /** * @param isOverlined The isOverlined to set. */ - public void setOverlined(boolean isOverlined) { + public void setOverlined(final boolean isOverlined) { this.isOverlined = isOverlined; } /** @@ -99,7 +99,7 @@ /** * @param isUnderlined The isUnderlined to set. */ - public void setUnderlined(boolean isUnderlined) { + public void setUnderlined(final boolean isUnderlined) { this.isUnderlined = isUnderlined; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtTime.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtTime.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtTime.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -40,7 +40,8 @@ /** * Constructor. */ - public DtTime(double quantity, byte units) throws PropertyException { + public DtTime(final double quantity, final byte units) + throws PropertyException { if (units < 1 || units > 2) { throw new PropertyException("Invalid TimeDT unit ID."); } @@ -70,9 +71,9 @@ * @return The TimeDT instance constructed, or null if input is not * valid. */ - public static DtTime makeTimeDT(String input) { + public static DtTime makeTimeDT(final String input) { // Make a copy of input - String useInput = new String(input); + final String useInput = new String(input); useInput.trim(); byte units = -1; int unitsLength = -1; @@ -86,17 +87,17 @@ if (units < 1) { return null; } - String quantityPart = useInput.substring(0, useInput.length() + final String quantityPart = useInput.substring(0, useInput.length() - unitsLength); double quantity; try { quantity = Double.parseDouble(quantityPart); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { return null; } try { return new DtTime(quantity, units); - } catch (PropertyException e1) { + } catch (final PropertyException e1) { /* * This should never happen, because we have already validated the * input. Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtURI.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtURI.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtURI.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -40,7 +40,7 @@ * Constructor. * @param uriSpecification The String containing the URI specification. */ - public DtURI(String uriSpecification) { + public DtURI(final String uriSpecification) { this.value = uriSpecification; } @@ -56,16 +56,16 @@ * @param input The String containing the URI specification. * @return The created UriDT instance, or null if input is invalid. */ - public static DtURI makeUriDT(String input) { - String useInput = URLUtil.normalizeURISpecification(input); + public static DtURI makeUriDT(final String input) { + final String useInput = URLUtil.normalizeURISpecification(input); if (useInput == null) { return null; } return new DtURI(useInput); } - public static ArrayList tokenizeURIList(String unparsedList) { - ArrayList tokenizedList = new ArrayList(); + public static ArrayList tokenizeURIList(final String unparsedList) { + final ArrayList tokenizedList = new ArrayList(); int startIndex = 0; int endIndex = 0; boolean stillProcessing = true; @@ -76,7 +76,8 @@ break; } assert endIndex > startIndex: "URI list tokenization problem."; - String substring = unparsedList.substring(startIndex, endIndex); + final String substring = unparsedList.substring(startIndex, + endIndex); tokenizedList.add(substring); startIndex = endIndex + 1; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtWritingMode.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtWritingMode.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtWritingMode.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -54,8 +54,8 @@ /** * Constructor. */ - private DtWritingMode(byte ipdOdd, byte ipdEven, byte bpd, byte shiftOdd, - byte shiftEven, boolean paired) { + private DtWritingMode(final byte ipdOdd, final byte ipdEven, final byte bpd, + final byte shiftOdd, final byte shiftEven, final boolean paired) { this.ipdOdd = ipdOdd; this.ipdEven = ipdEven; this.bpd = bpd; @@ -64,7 +64,8 @@ this.paired = paired; } - public static DtWritingMode obtainWritingMode(String writingModeName) { + public static DtWritingMode obtainWritingMode( + final String writingModeName) { // See if it has already been created. DtWritingMode wm = (DtWritingMode) writingModes.get(writingModeName); // If it has already been created, return it. @@ -83,7 +84,8 @@ return null; } - private static DtWritingMode createWritingMode(String writingModeName) { + private static DtWritingMode createWritingMode( + final String writingModeName) { if (writingModeName.equals("lr-tb")) { return new DtWritingMode( Constants.DIRECTION_LEFT_TO_RIGHT, @@ -335,7 +337,7 @@ * @return Either AXIS_HORIZONTAL or AXIS_VERTICAL, or -1 if writing-mode * or input is invalid. */ - public byte getAbsoluteAxis(byte relativeAxis) { + public byte getAbsoluteAxis(final byte relativeAxis) { switch (relativeAxis) { case Constants.AXIS_BP: { return getBPAxis(); @@ -354,7 +356,7 @@ * @return Either AXIS_IP or AXIS_BP, or -1 if writing-mode or input * is invalid. */ - public byte getRelativeAxis(byte absoluteAxis) { + public byte getRelativeAxis(final byte absoluteAxis) { switch (absoluteAxis) { case Constants.AXIS_HORIZONTAL: { return getHorizontalAxis(); @@ -565,7 +567,7 @@ * DIRECTION_RIGHT, DIRECTION_TOP, DIRECTION_BOTTOM, or -1 for invalid * input or writing mode. */ - public byte getAbsoluteDirection(byte relativeDir) { + public byte getAbsoluteDirection(final byte relativeDir) { switch (relativeDir) { case Constants.DIRECTION_START: { return getStart(); @@ -592,7 +594,7 @@ * DIRECTION_LEFT_TO_RIGHT, or DIRECTION_RIGHT_TO_LEFT, or -1 for invalid * input or writing mode. */ - public byte getAbsoluteDirFromRelativeAxis(byte relativeAxis) { + public byte getAbsoluteDirFromRelativeAxis(final byte relativeAxis) { switch (relativeAxis) { case Constants.AXIS_BP: { return this.bpd; @@ -611,7 +613,7 @@ * DIRECTION_END, DIRECTION_BEFORE, DIRECTION_AFTER, or -1 for invalid * input or writing mode. */ - public byte getRelativeDirection(byte absoluteDir) { + public byte getRelativeDirection(final byte absoluteDir) { switch (absoluteDir) { case Constants.DIRECTION_LEFT: { return getLeft(); @@ -638,7 +640,7 @@ * direction. For relative direction input, the corresponding absolute * direction. For an error either in the input or a bad writing mode, -1. */ - public int getCorresponding(int inputDirection) { + public int getCorresponding(final int inputDirection) { switch (inputDirection) { case Constants.DIRECTION_START: { return getStart(); @@ -668,7 +670,7 @@ return -1; } - public static byte getOtherAxis(byte axis) { + public static byte getOtherAxis(final byte axis) { if (axis == Constants.AXIS_HORIZONTAL) { return Constants.AXIS_VERTICAL; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/Expr.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/Expr.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/Expr.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -68,7 +68,7 @@ * length must override this method. * @return The unit power 1 value (length) of this expression. */ - public int evalUnitPower1(int pointSize, int percentBase) { + public int evalUnitPower1(final int pointSize, final int percentBase) { return 0; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprAdditiveOper.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprAdditiveOper.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprAdditiveOper.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -35,8 +35,9 @@ private ExprMultiplicative operand2; private byte operation; - public ExprAdditiveOper(ExprAdditive operand1, ExprMultiplicative operand2, - byte operation) throws PropertyException { + public ExprAdditiveOper(final ExprAdditive operand1, + final ExprMultiplicative operand2, + final byte operation) throws PropertyException { if (operand1.unitPower() < 0) { throw new PropertyException("AdditiveExpr: Non-numeric operand: " + operand1.toString()); @@ -70,7 +71,7 @@ return false; } - public int evalUnitPower1(int pointSize, int percentBase) { + public int evalUnitPower1(final int pointSize, final int percentBase... [truncated message content] |
|
From: <vic...@us...> - 2006-07-22 21:40:20
|
Revision: 7810 Author: victormote Date: 2006-07-22 14:39:22 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7810&view=rev Log Message: ----------- Implement standard use of "final" modifier on local variables and parameters. Modified Paths: -------------- trunk/foray/foray-font/.project trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java trunk/foray/foray-font/src/java/org/foray/font/FOrayFontUse.java trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java trunk/foray/foray-font/src/java/org/foray/font/FontConfig.java trunk/foray/foray-font/src/java/org/foray/font/FontConfigParser.java trunk/foray/foray-font/src/java/org/foray/font/FontSelector.java trunk/foray/foray-font/src/java/org/foray/font/FontSelectorCBC.java trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java trunk/foray/foray-font/src/java/org/foray/font/RegisteredFontDesc.java trunk/foray/foray-font/src/java/org/foray/font/RegisteredFontFamily.java trunk/foray/foray-font/src/java/org/foray/font/Subset.java trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java trunk/foray/foray-font/src/java/org/foray/font/charset/CharSet.java trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetParser.java trunk/foray/foray-font/src/java/org/foray/font/format/FontFile.java trunk/foray/foray-font/src/java/org/foray/font/format/FontFileReader.java trunk/foray/foray-font/src/java/org/foray/font/format/Kerning.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFile.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFilePFM.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileReader.java trunk/foray/foray-font/src/java/org/foray/font/format/TTCTableHeader.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFFile.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFFileCollection.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFFileSingle.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFReader.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFSubSetFile.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTable.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCFF.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableDirEntry.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableDirectory.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableGLYF.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableHEAD.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableHHEA.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableHMTX.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableKERN.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableLOCA.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableMAXP.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableNAME.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableOS2.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTablePCLT.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTablePOST.java trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFAFile.java trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFBFile.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontOutput.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontOutputFactory.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPDF.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPDFFactory.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPS.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPSFactory.java Modified: trunk/foray/foray-font/.project =================================================================== --- trunk/foray/foray-font/.project 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/.project 2006-07-22 21:39:22 UTC (rev 7810) @@ -8,12 +8,12 @@ </projects> <buildSpec> <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> <arguments> </arguments> </buildCommand> Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java 2006-07-22 21:39:22 UTC (rev 7810) @@ -60,7 +60,8 @@ /** List of all child FontUse instances. */ private ArrayList fontUses = new ArrayList(1); - public FOrayConsumerFont(FOrayFont font, FOrayFontConsumer consumer) { + public FOrayConsumerFont(final FOrayFont font, + final FOrayFontConsumer consumer) { this.font = font; this.consumer = consumer; if (this.font.isSubsettable()) { @@ -116,15 +117,17 @@ return this.fontUses; } - public FOrayFontUse selectFontUse(RegisteredFontDesc rfd, int codePoint) { + public FOrayFontUse selectFontUse(final RegisteredFontDesc rfd, + final int codePoint) { if (rfd == null) { return null; } FOrayFontUse fontUse = null; - SystemFont sf = getSystemFont(); + final SystemFont sf = getSystemFont(); /* Check existing FontUse instances. */ for (int i = 0; i < this.fontUses.size() && fontUse == null; i++) { - FOrayFontUse trialFontUse = (FOrayFontUse) this.fontUses.get(i); + final FOrayFontUse trialFontUse = + (FOrayFontUse) this.fontUses.get(i); if (trialFontUse.getRegisteredFontDesc() != rfd) { continue; } @@ -133,7 +136,8 @@ continue; } } else { - org.axsl.psR.Encoding encoding = trialFontUse.getEncoding(); + final org.axsl.psR.Encoding encoding = + trialFontUse.getEncoding(); if (! encoding.canEncode(codePoint)) { continue; } @@ -148,7 +152,7 @@ /* We don't care about encodings for SystemFonts. */ fontUse = new FOrayFontUse(this, rfd, null); } else { - Encoding encoding = findEncoding(rfd, codePoint); + final Encoding encoding = findEncoding(rfd, codePoint); if (encoding == null) { /* We can't encode this character. * Return null so that the upstream font selection routines can @@ -164,9 +168,10 @@ /** * Returns the described FontUse instance, creating it if necessary. */ - public FOrayFontUse getFontUse(RegisteredFontDesc rfd, Encoding encoding) { + public FOrayFontUse getFontUse(final RegisteredFontDesc rfd, + final Encoding encoding) { for (int i = 0; i < this.fontUses.size(); i++) { - FOrayFontUse fontUse = (FOrayFontUse) this.fontUses.get(i); + final FOrayFontUse fontUse = (FOrayFontUse) this.fontUses.get(i); if (fontUse.getRegisteredFontDesc() != rfd) { continue; } @@ -178,7 +183,8 @@ return new FOrayFontUse(this, rfd, encoding); } - public Encoding findEncoding(RegisteredFontDesc rfd, int codePoint) { + public Encoding findEncoding(final RegisteredFontDesc rfd, + final int codePoint) { switch (this.consumer.getEncodingLatitude()) { case FOrayFontConsumer.ENCODING_SPECIFIED_ONLY: { return rfd.getEncoding(); @@ -193,9 +199,9 @@ return null; } - private Encoding getBestEncoding(int codePoint) { + private Encoding getBestEncoding(final int codePoint) { Encoding trialEncoding = null; - Encoding internalEncoding = this.font.getInternalEncoding(); + final Encoding internalEncoding = this.font.getInternalEncoding(); if (! (internalEncoding instanceof EncodingVector)) { /* CMap encodings should be able to handle any character in the * font's character set. */ Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java 2006-07-22 21:39:22 UTC (rev 7810) @@ -44,7 +44,7 @@ /** Valid values are Font.FONT_SIMPLE and Font.FONT_COMPOSITE */ protected byte fontComplexity = org.axsl.fontR.Font.FONT_COMPLEXITY_UNKNOWN; - protected FOrayFont(RegisteredFont rf) { + protected FOrayFont(final RegisteredFont rf) { this.registeredFont = rf; } @@ -68,11 +68,11 @@ */ public abstract int getXHeight(int fontSize); - private int getEmWidth(int fontSize) { + private int getEmWidth(final int fontSize) { return fontSize; } - private int getEnWidth(int fontSize) { + private int getEnWidth(final int fontSize) { return Math.round(fontSize / 2); } @@ -84,7 +84,7 @@ /** * {@inheritDoc} */ - public int widthEstimate(int c, int fontSize) { + public int widthEstimate(final int c, final int fontSize) { switch (c) { case 0x09: // horizontal tab case 0x0A: // linefeed @@ -127,15 +127,15 @@ /** * {@inheritDoc} */ - public int width(CharSequence word, int fontSize, int letterSpacing, - int wordSpacing) { + public int width(final CharSequence word, final int fontSize, + final int letterSpacing, final int wordSpacing) { if (word == null) { return 0; } int width = 0; for (int i = 0; i < word.length(); i++) { // Add the width of the character itself. - int charWidth = width(word.charAt(i), fontSize); + final int charWidth = width(word.charAt(i), fontSize); if (charWidth == Integer.MIN_VALUE) { width += widthUndefinedGlyph(fontSize); } else { @@ -285,7 +285,7 @@ /** * {@inheritDoc} */ - public float normalLineHeightFactor(int algorithm) { + public float normalLineHeightFactor(final int algorithm) { switch (algorithm) { case LH_ALGORITHM_DEFAULT: default: { @@ -297,8 +297,10 @@ /** * {@inheritDoc} */ - public int baselineOffset(int writingMode, int baselineType, int fontSize) { - int baseline = extractBaseline(writingMode, baselineType, fontSize); + public int baselineOffset(final int writingMode, final int baselineType, + final int fontSize) { + final int baseline = extractBaseline(writingMode, baselineType, + fontSize); if (baseline == Integer.MIN_VALUE) { return estimateBaseline(writingMode, baselineType, fontSize); } @@ -325,8 +327,8 @@ * @param fontSize Same as for {@link #baselineOffset(int, int, int)}. * @return The estimated value of the baseline. */ - public int estimateBaseline(int writingMode, int baselineType, - int fontSize) { + public int estimateBaseline(final int writingMode, final int baselineType, + final int fontSize) { switch (baselineType) { case Constants.BASELINE_ALPHABETIC: { return fontSize + this.getDescender(fontSize); @@ -367,7 +369,7 @@ } } - public int baseline(String script) { + public int baseline(final String script) { /* TODO: Fix this. */ return Constants.BASELINE_ALPHABETIC; } @@ -375,7 +377,7 @@ /** * {@inheritDoc} */ - public int underlineSize(int fontSize) { + public int underlineSize(final int fontSize) { /* TODO: Where possible, replace this heuristic with data from the * font itself. */ /* Until we learn better, make this the same size as the strikeout. */ @@ -385,7 +387,7 @@ /** * {@inheritDoc} */ - public int underlinePosition(int fontSize) { + public int underlinePosition(final int fontSize) { /* TODO: Where possible, replace this heuristic with data from the * font itself. */ return (fontSize / 10) * -1; @@ -394,7 +396,7 @@ /** * {@inheritDoc} */ - public int overlineSize(int fontSize) { + public int overlineSize(final int fontSize) { /* TODO: Where possible, replace this heuristic with data from the * font itself. */ /* Until we learn better, make this the same size as the strikeout. */ @@ -404,7 +406,7 @@ /** * {@inheritDoc} */ - public int overlinePosition(int fontSize) { + public int overlinePosition(final int fontSize) { /* TODO: Where possible, replace this heuristic with data from the * font itself. */ return getAscender(fontSize) + (fontSize / 10); @@ -413,7 +415,7 @@ /** * {@inheritDoc} */ - public int strikeoutSize(int fontSize) { + public int strikeoutSize(final int fontSize) { /* TODO: Where possible, replace this heuristic with data from the * font itself. */ /* This computation comes from the OpenType manual, Section OS/2 @@ -425,7 +427,7 @@ /** * {@inheritDoc} */ - public int strikeoutPosition(int fontSize) { + public int strikeoutPosition(final int fontSize) { /* TODO: Where possible, replace this heuristic with data from the * font itself. */ return getAscender(fontSize) * 3 / 8; Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java 2006-07-22 21:39:22 UTC (rev 7810) @@ -111,14 +111,14 @@ * Constructor. * @param server The FOrayFontServer instance serving this FontConsumer. */ - public FOrayFontConsumer(FOrayFontServer server) { + public FOrayFontConsumer(final FOrayFontServer server) { this.server = server; this.usesFreeStandingFonts = true; this.usesSystemFonts = true; this.prefersFreeStandingFonts = true; } - public void setFontSources(int[] fontSources) { + public void setFontSources(final int[] fontSources) { if (fontSources == null || fontSources.length < 1) { return; @@ -145,7 +145,7 @@ * override the logger used by FOrayFontServer. * @param logger */ - public void setLogger(Log logger) { + public void setLogger(final Log logger) { this.logger = logger; } @@ -178,7 +178,7 @@ return this.server; } - private FontSelector getFontSelector(int strategy) { + private FontSelector getFontSelector(final int strategy) { switch (strategy) { case Font.FONT_SELECTION_CBC: { return this.getFontSelectorCBC(); @@ -195,7 +195,7 @@ return this.fontSelectorAutoType; } - public void setFontSelectorAutoType(String newFontSelectorAutoType) { + public void setFontSelectorAutoType(final String newFontSelectorAutoType) { if (this.fontSelectorAuto == null) { /* Fails silently if the "auto" FontSelector has already been * created. */ @@ -220,14 +220,14 @@ /** * {@inheritDoc} */ - public org.axsl.fontR.FontUse selectFontXSL(int selectionStrategy, - String [] familyList, int style, - int weight, int variant, int stretch, int size, int codePoint) - throws FontException { - FontSelector selector = getFontSelector(selectionStrategy); + public org.axsl.fontR.FontUse selectFontXSL(final int selectionStrategy, + final String [] familyList, final int style, final int weight, + final int variant, final int stretch, final int size, + final int codePoint) throws FontException { + final FontSelector selector = getFontSelector(selectionStrategy); FOrayFont fontSelected = null; - RegisteredFontDesc fontDescSelected = selector.selectFont(familyList, - style, weight, variant, stretch, size, codePoint); + final RegisteredFontDesc fontDescSelected = selector.selectFont( + familyList, style, weight, variant, stretch, size, codePoint); if (fontDescSelected != null) { fontSelected = whichUse(fontDescSelected, codePoint); @@ -235,7 +235,7 @@ if (fontSelected == null) { /* None of the requested font-family items can provide a suitable * font. */ - FOrayFontUse fontUse = getDefaultFontUse(); + final FOrayFontUse fontUse = getDefaultFontUse(); if (fontUse == null) { throw new FontException("Unable to provide even a default " + "font."); @@ -245,10 +245,10 @@ if (fontSelected == null) { return null; } - FOrayConsumerFont consumerFont = registerFontUse(fontSelected); + final FOrayConsumerFont consumerFont = registerFontUse(fontSelected); /* Selection of the actual FontUse is delegated to consumerFont. */ - FOrayFontUse fontUse = consumerFont.selectFontUse(fontDescSelected, - codePoint); + final FOrayFontUse fontUse = consumerFont.selectFontUse( + fontDescSelected, codePoint); return fontUse; } @@ -256,7 +256,7 @@ * Return a default font. We don't care what it can encode. */ protected FOrayFontUse getDefaultFontUse() { - RegisteredFontDesc fontDescSelected = selectDefaultFont(); + final RegisteredFontDesc fontDescSelected = selectDefaultFont(); if (fontDescSelected == null) { return null; } @@ -268,7 +268,7 @@ fontSelected = fontDescSelected.getRegisteredFont() .getSystemFont(); } - FOrayConsumerFont consumerFont = registerFontUse(fontSelected); + final FOrayConsumerFont consumerFont = registerFontUse(fontSelected); return consumerFont.getFontUse(fontDescSelected, fontSelected.getInternalEncoding()); } @@ -290,10 +290,11 @@ * font. * @return The FontUse instance dictated by the parameters of consumer. */ - protected FOrayFont whichUse(RegisteredFontDesc rfd, int codePoint) { - RegisteredFont rf = rfd.getRegisteredFont(); - FreeStandingFont fsf = eligibleFreeStandingFont(rfd, codePoint); - SystemFont sf = eligibleSystemFont(rf, codePoint); + protected FOrayFont whichUse(final RegisteredFontDesc rfd, + final int codePoint) { + final RegisteredFont rf = rfd.getRegisteredFont(); + final FreeStandingFont fsf = eligibleFreeStandingFont(rfd, codePoint); + final SystemFont sf = eligibleSystemFont(rf, codePoint); /* Consumer uses and prefers FreeStandingFont and it is available. */ if (fsf != null && preferFreeStandingFonts()) { @@ -313,17 +314,18 @@ return sf; } - private FreeStandingFont eligibleFreeStandingFont(RegisteredFontDesc rfd, - int codePoint) { + private FreeStandingFont eligibleFreeStandingFont( + final RegisteredFontDesc rfd, final int codePoint) { if (! isUsingFreeStandingFonts()) { return null; } - FreeStandingFont fsf = rfd.getRegisteredFont().getFreeStandingFont(); + final FreeStandingFont fsf = + rfd.getRegisteredFont().getFreeStandingFont(); if (fsf == null) { return null; } - FOrayConsumerFont consumerFont = this.getConsumerFont(fsf); - Encoding encoding = consumerFont.findEncoding(rfd, codePoint); + final FOrayConsumerFont consumerFont = this.getConsumerFont(fsf); + final Encoding encoding = consumerFont.findEncoding(rfd, codePoint); if (encoding == null) { /* Either no known encoding for this font can encode this character * or we have been restricted from using an encoding that can. @@ -333,11 +335,12 @@ return fsf; } - private SystemFont eligibleSystemFont(RegisteredFont rf, int codePoint) { + private SystemFont eligibleSystemFont(final RegisteredFont rf, + final int codePoint) { if (! isUsingSystemFonts()) { return null; } - SystemFont sf = rf.getSystemFont(); + final SystemFont sf = rf.getSystemFont(); if (sf == null) { return null; } @@ -364,8 +367,9 @@ /** * {@inheritDoc} */ - public org.axsl.fontR.FontUse selectFontCSS(String [] familyList, int style, - int weight, int variant, int stretch, int size, int codePoint) + public org.axsl.fontR.FontUse selectFontCSS(final String [] familyList, + final int style, final int weight, final int variant, + final int stretch, final int size, final int codePoint) throws FontException { return selectFontXSL(Font.FONT_SELECTION_CBC, familyList, style, weight, variant, stretch, size, codePoint); @@ -378,11 +382,12 @@ if (this.usedFonts.size() < 1) { return new FOrayFont[0]; } - FOrayFont[] usedFontsToReturn = new FOrayFont[this.usedFonts.size()]; + final FOrayFont[] usedFontsToReturn = + new FOrayFont[this.usedFonts.size()]; int index = 0; - Iterator iterator = usedFonts.keySet().iterator(); + final Iterator iterator = usedFonts.keySet().iterator(); while (iterator.hasNext()) { - FOrayFont realFont = (FOrayFont) iterator.next(); + final FOrayFont realFont = (FOrayFont) iterator.next(); usedFontsToReturn[index] = realFont; index++; } @@ -400,23 +405,23 @@ int count = 0; Iterator iterator = this.usedFonts.entrySet().iterator(); while (iterator.hasNext()) { - FOrayConsumerFont consumerFont = + final FOrayConsumerFont consumerFont = (FOrayConsumerFont) iterator.next(); count += consumerFont.getFontUses().size(); } if (count < 1) { return new FOrayFontUse[0]; } - FOrayFontUse[] toReturn = new FOrayFontUse[count]; + final FOrayFontUse[] toReturn = new FOrayFontUse[count]; count = 0; /* Get a new iterator. */ iterator = this.usedFonts.entrySet().iterator(); while (iterator.hasNext()) { - FOrayConsumerFont consumerFont = + final FOrayConsumerFont consumerFont = (FOrayConsumerFont) iterator.next(); - ArrayList fontUses = consumerFont.getFontUses(); + final ArrayList fontUses = consumerFont.getFontUses(); for (int i = 0; i < fontUses.size(); i++) { - FOrayFontUse fontUse = (FOrayFontUse) fontUses.get(i); + final FOrayFontUse fontUse = (FOrayFontUse) fontUses.get(i); toReturn[count] = fontUse; count ++; } @@ -428,7 +433,7 @@ * Record the fact that this FontConsumer has used this font. * @param font The Font instance that was used. */ - protected FOrayConsumerFont registerFontUse(FOrayFont font) { + protected FOrayConsumerFont registerFontUse(final FOrayFont font) { FOrayConsumerFont consumerFont = (FOrayConsumerFont) usedFonts.get(font); if (consumerFont == null) { @@ -442,10 +447,10 @@ * {@inheritDoc} */ public void optimizeFonts() { - Iterator iter = usedFonts.keySet().iterator(); + final Iterator iter = usedFonts.keySet().iterator(); while (iter.hasNext()) { - Object obj = iter.next(); - FOrayConsumerFont consumerFont = (FOrayConsumerFont) + final Object obj = iter.next(); + final FOrayConsumerFont consumerFont = (FOrayConsumerFont) usedFonts.get(obj); consumerFont.optimize(); } @@ -457,7 +462,7 @@ * related FontUse instance. * @return The related FontUse instance. */ - public FOrayConsumerFont getConsumerFont(FOrayFont font) { + public FOrayConsumerFont getConsumerFont(final FOrayFont font) { FOrayConsumerFont consumerFont = (FOrayConsumerFont) usedFonts.get(font); if (consumerFont != null) { @@ -477,7 +482,7 @@ return encodingLatitude; } - private boolean validEncodingLatitude(int encodingLatitude) { + private boolean validEncodingLatitude(final int encodingLatitude) { for (int i = 0; i < VALID_ENCODING_LATITUDES.length; i++) { if (encodingLatitude == VALID_ENCODING_LATITUDES[i]) { return true; @@ -493,7 +498,8 @@ * {@link #ENCODING_INTERNAL_ONLY}, {@link #ENCODING_SPECIFIED_ONLY}, or * {@link #ENCODING_ANY}. */ - public void setEncodingLatitude(int encodingLatitude) throws FontException { + public void setEncodingLatitude(final int encodingLatitude) + throws FontException { if (! validEncodingLatitude(encodingLatitude)) { throw new FontException("FOrayFontConsumer invalid encoding " + "latitude: " + encodingLatitude); Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java 2006-07-22 21:39:22 UTC (rev 7810) @@ -135,11 +135,11 @@ * messages that are more client-related can be logged to the FontConsumer * logger. */ - public FOrayFontServer(Log logger) { + public FOrayFontServer(final Log logger) { this.logger = logger; try { registerStandardOutputFactories(); - } catch (FontException e) { + } catch (final FontException e) { getLogger().error("Error registering standard Font output " + "factories:\n" + e.getMessage()); e.printStackTrace(); @@ -151,7 +151,7 @@ } protected RegisteredFontFamily getRegisteredFontFamily( - String fontFamilyName) { + final String fontFamilyName) { RegisteredFontFamily rff = (RegisteredFontFamily) this.fontFamilies.get(fontFamilyName); if (rff != null) { @@ -183,19 +183,19 @@ } /* Punt and try to create something that will work. */ try { - RegisteredFont rf = new RegisteredFont(this, null, null, null, null, - null, "serif"); - RegisteredFontFamily rff = this.registerFontFamily2("serif"); + final RegisteredFont rf = new RegisteredFont(this, null, null, null, + null, null, "serif"); + final RegisteredFontFamily rff = this.registerFontFamily2("serif"); rff.registerFontDesc(rf, null, "normal", "normal", "normal", "normal", null, null, null, null); - } catch (FontException e) { + } catch (final FontException e) { getLogger().error("Unable to create default system font."); } this.defaultSystemFont = getDefaultFont(false); return this.defaultSystemFont; } - protected RegisteredFontDesc getDefaultFont(boolean freeStandingFont){ + protected RegisteredFontDesc getDefaultFont(final boolean freeStandingFont){ RegisteredFontDesc defaultFont = null; RegisteredFontFamily rff = getRegisteredFontFamily("any"); if (rff != null) { @@ -222,9 +222,9 @@ if (defaultFont != null) { return defaultFont; } - Iterator iterator = this.fontFamilies.entrySet().iterator(); + final Iterator iterator = this.fontFamilies.entrySet().iterator(); while (iterator.hasNext() && defaultFont == null) { - Map.Entry entry = (Map.Entry) iterator.next(); + final Map.Entry entry = (Map.Entry) iterator.next(); rff = (RegisteredFontFamily) entry.getValue(); defaultFont = rff.findRegisteredFontDesc( FOrayFont.FONT_STYLE_ANY, @@ -241,7 +241,7 @@ * Set the base URL for general resources, unless it has already been set. * @param url The base URL for general resources. */ - public void setBaseURL(URL url) { + public void setBaseURL(final URL url) { /* If not already set, set it */ if (baseURL == null) { baseURL = url; @@ -263,7 +263,7 @@ * Set the base URL for Font locations, unless it has already been set. * @param url The base URL for fonts. */ - public void setBaseFontURL(URL url) { + public void setBaseFontURL(final URL url) { /* If not already set, set it */ if (baseFontURL == null) { baseFontURL = url; @@ -297,7 +297,7 @@ * parsing. * @throws FontException on font configuration error. */ - public void setup(URL fontConfigFile, Map fontConfigOptions) + public void setup(final URL fontConfigFile, final Map fontConfigOptions) throws FontException { if (setupCompleted) { return; @@ -328,13 +328,15 @@ registerBase14Font("Base14-ZapfDingbats", "ZapfDingbats.afm"); } - private void registerBase14Font(String fontName, String fileName) { - String resourceName = "org/foray/font/resources/base-14/" + fileName; - ClassLoader loader = ClassLoader.getSystemClassLoader(); - URL metricURL = loader.getResource(resourceName); + private void registerBase14Font(final String fontName, + final String fileName) { + final String resourceName = "org/foray/font/resources/base-14/" + + fileName; + final ClassLoader loader = ClassLoader.getSystemClassLoader(); + final URL metricURL = loader.getResource(resourceName); try { registerFont(fontName, null, metricURL, null, "none", null); - } catch (FontException e) { + } catch (final FontException e) { this.logger.warn(e); } } @@ -343,18 +345,18 @@ if (! this.usingSystemFonts) { return; } - Font[] fontList = this.getSystemFontList(); + final Font[] fontList = this.getSystemFontList(); if (fontList == null) { return; } for (int i = 0; i < fontList.length; i++) { - Font awtFont = fontList[i]; + final Font awtFont = fontList[i]; RegisteredFontFamily rff = this.getRegisteredFontFamily( awtFont.getFamily()); if (rff == null) { try { rff = registerFontFamily2(awtFont.getFamily()); - } catch (FontException e) { + } catch (final FontException e) { /* This should never happen. We just made sure it doesn't * already exist. */ continue; @@ -364,7 +366,7 @@ try { rf = new RegisteredFont(this, awtFont.getFontName(), null, null, null, "none", awtFont.getFontName()); - } catch (FontException e) { + } catch (final FontException e) { this.logger.error(e.getMessage()); continue; } @@ -376,15 +378,15 @@ if (awtFont.isBold()) { fontWeight = org.axsl.fontR.Font.FONT_WEIGHT_BOLD; } - byte fontVariant = org.axsl.fontR.Font.FONT_VARIANT_NORMAL; - byte fontStretch = org.axsl.fontR.Font.FONT_STRETCH_NORMAL; + final byte fontVariant = org.axsl.fontR.Font.FONT_VARIANT_NORMAL; + final byte fontStretch = org.axsl.fontR.Font.FONT_STRETCH_NORMAL; new RegisteredFontDesc(rf, rff, null, fontStyle, fontWeight, fontVariant, fontStretch); try { rff.registerFontDesc(rf, null, fontStyle, fontWeight, fontVariant, fontStretch, Float.NaN, Float.NaN, Float.NaN, null); - } catch (FontException e) { + } catch (final FontException e) { this.logger.error(e.getMessage()); } } @@ -393,18 +395,18 @@ /** * Reads the font configuration file */ - private void readFontConfig(URL fontConfigURL) throws FontException { + private void readFontConfig(final URL fontConfigURL) throws FontException { if (fontConfigURL == null) { return; } InputStream inputStream; try { inputStream = fontConfigURL.openStream(); - } catch (IOException e) { + } catch (final IOException e) { throw new FontException(e.getMessage()); } - InputSource source = new InputSource(inputStream); - FontConfigParser parser = + final InputSource source = new InputSource(inputStream); + final FontConfigParser parser = new FontConfigParser(this, source); parser.start(); if (hasFatalConfigurationError) { @@ -414,11 +416,11 @@ protected Graphics2D getGraphics2D() { if (this.graphic == null) { - BufferedImage fontImage = + final BufferedImage fontImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); try { this.graphic = fontImage.createGraphics(); - } catch (InternalError e) { + } catch (final InternalError e) { return null; } this.graphic.setRenderingHint (RenderingHints.KEY_FRACTIONALMETRICS, @@ -441,9 +443,9 @@ + "Unable to get System fonts."); return; } - GraphicsEnvironment ge + final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - String[] list = ge.getAvailableFontFamilyNames(); + final String[] list = ge.getAvailableFontFamilyNames(); // Make sure they are sorted for fast searching Arrays.sort(list); this.systemFontFamilyList = list; @@ -453,7 +455,7 @@ * Add a RegisteredFontFamily to the Collection. * @param name the name of the font family (e.g. "Courier") */ - protected RegisteredFontFamily registerFontFamily2(String name) + protected RegisteredFontFamily registerFontFamily2(final String name) throws FontException { /* Make sure it is not already registered. */ RegisteredFontFamily rff = this.getRegisteredFontFamily(name); @@ -472,16 +474,17 @@ * @param realFamily The name of the real font family to which this alias * should be associated (e.g. "Helvetica"). */ - public void registerFontFamilyAlias(String alias, String realFamily) + public void registerFontFamilyAlias(final String alias, + final String realFamily) throws FontException { - RegisteredFontFamily rff + final RegisteredFontFamily rff = (RegisteredFontFamily)fontFamilies.get(realFamily); if (rff == null) { throw new FontException("Font family " + realFamily + " not found. Can't register alias: " + alias); } if (fontFamilyAliases.containsKey(alias)) { - RegisteredFontFamily family = + final RegisteredFontFamily family = ((RegisteredFontFamily)fontFamilyAliases.get(alias)); throw new FontException("Alias " + alias + " already registered to family " + family.getName()); @@ -508,7 +511,7 @@ * have. * @param using When true, FreeStanding fonts will be configured. */ - public void setUsingFreeStandingFonts(boolean using) { + public void setUsingFreeStandingFonts(final boolean using) { if (setupCompleted) { if (using != usingFreeStandingFonts) { getLogger().error("Font setup already completed. " + @@ -526,7 +529,7 @@ * SystemFonts, regardless of what settings that FontConsumer may have. * @param using When true, System fonts will be configured. */ - public void setUsingSystemFonts(boolean using) { + public void setUsingSystemFonts(final boolean using) { if (setupCompleted) { if (using != usingSystemFonts) { getLogger().error("Font setup already completed. " + @@ -537,7 +540,7 @@ usingSystemFonts = using; } - protected void setFatalConfigurationError(boolean hasError) { + protected void setFatalConfigurationError(final boolean hasError) { if (hasError) { hasFatalConfigurationError = true; } @@ -562,7 +565,7 @@ + "Unable to get System fonts."); return null; } - GraphicsEnvironment ge + final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); return ge.getAllFonts(); } @@ -570,27 +573,27 @@ /** * {@inheritDoc} */ - public Encoding getEncoding(String name) { + public Encoding getEncoding(final String name) { return org.foray.ps.encode.EncodingVector.getPredefinedEncoding(name); } /** * {@inheritDoc} */ - public org.axsl.fontR.Font[] getAllFonts(boolean freeStandingFonts, - boolean systemFonts) { - ArrayList fontList = new ArrayList(); - Iterator iterator = this.fontFamilies.entrySet().iterator(); + public org.axsl.fontR.Font[] getAllFonts(final boolean freeStandingFonts, + final boolean systemFonts) { + final ArrayList fontList = new ArrayList(); + final Iterator iterator = this.fontFamilies.entrySet().iterator(); while (iterator.hasNext()) { - Map.Entry entry = (Map.Entry) iterator.next(); - RegisteredFontFamily family = (RegisteredFontFamily) + final Map.Entry entry = (Map.Entry) iterator.next(); + final RegisteredFontFamily family = (RegisteredFontFamily) entry.getValue(); - ArrayList rfdList = family.getFontDescriptions(); + final ArrayList rfdList = family.getFontDescriptions(); if (rfdList != null) { for (int i = 0; i < rfdList.size(); i++) { - RegisteredFontDesc rfd = (RegisteredFontDesc) + final RegisteredFontDesc rfd = (RegisteredFontDesc) rfdList.get(i); - RegisteredFont rf = rfd.getRegisteredFont(); + final RegisteredFont rf = rfd.getRegisteredFont(); if (freeStandingFonts && rf.getFreeStandingFont() != null) { fontList.add(rf.getFreeStandingFont()); @@ -605,11 +608,11 @@ if (fontList.size() < 1) { return null; } - ArrayList returnList = new ArrayList(); + final ArrayList returnList = new ArrayList(); for (int i = 0; i < fontList.size(); i++) { - org.axsl.fontR.FontUse fontUse = + final org.axsl.fontR.FontUse fontUse = (org.axsl.fontR.FontUse) fontList.get(i); - org.axsl.fontR.Font font = fontUse.getFont(); + final org.axsl.fontR.Font font = fontUse.getFont(); boolean duplicateFound = false; for (int j = 0; j < returnList.size() && ! duplicateFound; j++) { if (font == returnList.get(j)) { @@ -621,7 +624,7 @@ returnList.add(font); } } - FOrayFont[] returnArray = new FOrayFont[returnList.size()]; + final FOrayFont[] returnArray = new FOrayFont[returnList.size()]; for (int i = 0; i < returnArray.length; i++) { returnArray[i] = (FOrayFont) returnList.get(i); } @@ -637,20 +640,20 @@ /** * @param entityResolver The entityResolver to set. */ - public void setEntityResolver(EntityResolver entityResolver) { + public void setEntityResolver(final EntityResolver entityResolver) { this.entityResolver = entityResolver; } /** * {@inheritDoc} */ - public void registerFontOutputFactory(FontOutputFactory factory) + public void registerFontOutputFactory(final FontOutputFactory factory) throws FontException { /* */ if (factory == null) { throw new FontException("Cannot register a null FontOutputFactory"); } - String mimeType = factory.getMimeType(); + final String mimeType = factory.getMimeType(); if (mimeType == null || mimeType.equals("")) { throw new FontException("Mime type invalid: " + mimeType); @@ -658,38 +661,38 @@ this.fontOutputFactories.put(mimeType, factory); } - public FontOutputFactory getOutputFactory(String mimeType) { + public FontOutputFactory getOutputFactory(final String mimeType) { return (FontOutputFactory) this.fontOutputFactories.get(mimeType); } /** * {@inheritDoc} */ - public boolean fontOutputFactoryAvailable(String mimeType) { - FontOutputFactory factory = getOutputFactory(mimeType); + public boolean fontOutputFactoryAvailable(final String mimeType) { + final FontOutputFactory factory = getOutputFactory(mimeType); return factory != null; } /** * {@inheritDoc} */ - public void registerFontFamily(String name) throws FontException { + public void registerFontFamily(final String name) throws FontException { registerFontFamily2(name); } /** * {@inheritDoc} */ - public boolean isRegisteredFontFamily(String name) { - RegisteredFontFamily rff = this.getRegisteredFontFamily(name); + public boolean isRegisteredFontFamily(final String name) { + final RegisteredFontFamily rff = this.getRegisteredFontFamily(name); return (rff != null); } /** * {@inheritDoc} */ - public String getFontFamilyForAlias(String alias) { - RegisteredFontFamily family = + public String getFontFamilyForAlias(final String alias) { + final RegisteredFontFamily family = (RegisteredFontFamily)fontFamilyAliases.get(alias); if (family == null) { return null; @@ -700,9 +703,9 @@ /** * {@inheritDoc} */ - public void registerFont(String fontID, URL fontFileURL, - URL metricsFileURL, String collectionID, String embed, - String systemName) throws FontException { + public void registerFont(final String fontID, final URL fontFileURL, + final URL metricsFileURL, final String collectionID, + final String embed, final String systemName) throws FontException { if (! isUsableFont(systemName, fontFileURL, metricsFileURL)) { return; } @@ -710,7 +713,7 @@ if (fontFileURL != null) { try { fontFileReader = new FontFileReader(this.logger, fontFileURL); - } catch (IOException e) { + } catch (final IOException e) { throw new FontException(e); } } @@ -719,7 +722,7 @@ try { metricsFileReader = new MetricsFileReader(this.getLogger(), metricsFileURL); - } catch (IOException e) { + } catch (final IOException e) { throw new FontException(e); } } @@ -727,10 +730,11 @@ collectionID, embed, systemName); } - public void registerFont(String fontID, String fontFileDescription, - byte[] fontFileContents, String metricsFileDescription, - byte[] metricsFileContents, String collectionID, String embed, - String systemName) throws FontException { + public void registerFont(final String fontID, + final String fontFileDescription, final byte[] fontFileContents, + final String metricsFileDescription, + final byte[] metricsFileContents, final String collectionID, + final String embed, final String systemName) throws FontException { if (! isUsableFont(systemName, fontFileContents, metricsFileContents)) { return; } @@ -739,7 +743,7 @@ try { fontFileReader = new FontFileReader(this.logger, fontFileDescription, fontFileContents); - } catch (IOException e) { + } catch (final IOException e) { throw new FontException(e); } } @@ -748,7 +752,7 @@ try { metricsFileReader = new MetricsFileReader(this.getLogger(), metricsFileDescription, metricsFileContents); - } catch (IOException e) { + } catch (final IOException e) { throw new FontException(e); } } @@ -756,8 +760,8 @@ collectionID, embed, systemName); } - private boolean isUsableFont(String systemName, Object fontFile, - Object metricsFile) { + private boolean isUsableFont(final String systemName, final Object fontFile, + final Object metricsFile) { if (! usingFreeStandingFonts) { /* If not using FreeStandingFonts, then this font should not be * registered unless it will be able to generate a SystemFont. */ @@ -777,13 +781,13 @@ return true; } - public RegisteredFont getRegisteredFont(String name) { + public RegisteredFont getRegisteredFont(final String name) { return (RegisteredFont) this.registeredFonts.get(name); } - public void registerFont(String fontID, RegisteredFont rf) + public void registerFont(final String fontID, final RegisteredFont rf) throws FontException { - Object object = this.registeredFonts.get(fontID); + final Object object = this.registeredFonts.get(fontID); if (object != null) { throw new FontException("Font ID already registered: " + fontID); } @@ -793,29 +797,31 @@ /** * {@inheritDoc} */ - public boolean isRegisteredFont(String fontID) { - Object object = this.registeredFonts.get(fontID); + public boolean isRegisteredFont(final String fontID) { + final Object object = this.registeredFonts.get(fontID); return (object != null); } /** * {@inheritDoc} */ - public void registerFontDescription(String fontFamily, String fontID, - Encoding encoding, byte style, short weight, byte variant, - byte stretch, float simulatedSmallCaps, float simulatedOblique, - float simulatedBackslant, float[] simulatedStretch) + public void registerFontDescription(final String fontFamily, + final String fontID, final Encoding encoding, final byte style, + final short weight, final byte variant, final byte stretch, + final float simulatedSmallCaps, final float simulatedOblique, + final float simulatedBackslant, final float[] simulatedStretch) throws FontException { - RegisteredFontFamily rff = this.getRegisteredFontFamily(fontFamily); - RegisteredFont rf = this.getRegisteredFont(fontID); + final RegisteredFontFamily rff = this.getRegisteredFontFamily( + fontFamily); + final RegisteredFont rf = this.getRegisteredFont(fontID); rff.registerFontDesc(rf, encoding, style, weight, variant, stretch, simulatedSmallCaps, simulatedOblique, simulatedBackslant, simulatedStretch); } - public FontSelector makeFontSelector(FOrayFontConsumer consumer) { - String selectorName = consumer.getFontSelectorAutoType(); - FontSelectorFactory factory = (FontSelectorFactory) + public FontSelector makeFontSelector(final FOrayFontConsumer consumer) { + final String selectorName = consumer.getFontSelectorAutoType(); + final FontSelectorFactory factory = (FontSelectorFactory) this.registeredFontSelectorFactories.get(selectorName); if (factory != null) { return factory.makeFontSelector(consumer); @@ -835,8 +841,8 @@ * @throws FontException If either <code>name</code>, or * <code>factory</code> is invalid. */ - public void registerFontSelectorFactory(String name, - FontSelectorFactory factory) throws FontException { + public void registerFontSelectorFactory(final String name, + final FontSelectorFactory factory) throws FontException { if (name == null || factory == null) { throw new FontException("Unable to register null or unnamed " Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFontUse.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontUse.java 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFontUse.java 2006-07-22 21:39:22 UTC (rev 7810) @@ -64,8 +64,8 @@ private HashMap fontOutputs = new HashMap(); - public FOrayFontUse(FOrayConsumerFont consumerFont, RegisteredFontDesc rfd, - Encoding encoding) { + public FOrayFontUse(final FOrayConsumerFont consumerFont, + final RegisteredFontDesc rfd, final Encoding encoding) { this.consumerFont = consumerFont; this.registeredFontDesc = rfd; this.encoding = encoding; @@ -86,7 +86,7 @@ /** * {@inheritDoc} */ - public int encodeCharacter(int codePoint) { + public int encodeCharacter(final int codePoint) { /* First get the font's encoding for the character. */ int fontEncodedChar = codePoint; if (this.encoding != null) { @@ -110,7 +110,8 @@ * {@inheritDoc} */ public short nextBolderWeight() { - RegisteredFontDesc desc = this.registeredFontDesc.nextBolderFont(); + final RegisteredFontDesc desc = + this.registeredFontDesc.nextBolderFont(); if (desc != null) { return desc.getFontWeight(); } @@ -122,7 +123,8 @@ * {@inheritDoc} */ public short nextLighterWeight() { - RegisteredFontDesc desc = this.registeredFontDesc.nextLighterFont(); + final RegisteredFontDesc desc = + this.registeredFontDesc.nextLighterFont(); if (desc != null) { return desc.getFontWeight(); } @@ -134,7 +136,8 @@ * {@inheritDoc} */ public org.axsl.fontR.FontUse nextBolderFont() { - RegisteredFontDesc desc = this.registeredFontDesc.nextBolderFont(); + final RegisteredFontDesc desc = + this.registeredFontDesc.nextBolderFont(); return fontUseForDesc(desc); } @@ -142,26 +145,29 @@ * {@inheritDoc} */ public org.axsl.fontR.FontUse nextLighterFont() { - RegisteredFontDesc desc = this.registeredFontDesc.nextLighterFont(); + final RegisteredFontDesc desc = + this.registeredFontDesc.nextLighterFont(); return fontUseForDesc(desc); } - private org.axsl.fontR.FontUse fontUseForDesc(RegisteredFontDesc desc) { + private org.axsl.fontR.FontUse fontUseForDesc( + final RegisteredFontDesc desc) { if (desc == null) { return null; } - FOrayFontConsumer consumer = this.getFOrayFontConsumer(); - FOrayFont font = consumer.whichUse(desc, ' '); - FOrayConsumerFont consumerFont = consumer.registerFontUse(font); + final FOrayFontConsumer consumer = this.getFOrayFontConsumer(); + final FOrayFont font = consumer.whichUse(desc, ' '); + final FOrayConsumerFont consumerFont = consumer.registerFontUse(font); return consumerFont.selectFontUse(desc, ' '); } /** * {@inheritDoc} */ - public int unavailableChar(CharSequence charSequence, int beginIndex) { + public int unavailableChar(final CharSequence charSequence, + final int beginIndex) { for (int i = 0; i < charSequence.length(); i++) { - char c = charSequence.charAt(i); + final char c = charSequence.charAt(i); if (! glyphAvailable(c)) { return i; } @@ -172,11 +178,12 @@ /** * {@inheritDoc} */ - public int[] unavailableChars(CharSequence charSequence, int beginIndex) { + public int[] unavailableChars(final CharSequence charSequence, + final int beginIndex) { int count = 0; /* Count them first. */ for (int i = 0; i < charSequence.length(); i++) { - char c = charSequence.charAt(i); + final char c = charSequence.charAt(i); if (! glyphAvailable(c)) { count++; } @@ -185,11 +192,11 @@ return null; } /* Create empty array. */ - int[] returnArray = new int[count]; + final int[] returnArray = new int[count]; /* Read through them again, completing the array. */ count = 0; for (int i = 0; i < charSequence.length(); i++) { - char c = charSequence.charAt(i); + final char c = charSequence.charAt(i); if (! glyphAvailable(c)) { returnArray[count] = i; count++; @@ -201,7 +208,7 @@ /** * {@inheritDoc} */ - public boolean glyphAvailable(int codePoint) { + public boolean glyphAvailable(final int codePoint) { /* Does the font have the glyph? */ if (! this.getFOrayFont().glyphAvailable(codePoint)) { return false; @@ -212,14 +219,14 @@ return true; } /* Can my encoding encode it? */ - int encodedChar = this.encoding.encodeCharacter(codePoint); + final int encodedChar = this.encoding.encodeCharacter(codePoint); return (encodedChar != 0); } /** * {@inheritDoc} */ - public int compareTo(Object object) { + public int compareTo(final Object object) { if (object == this) { return 0; } @@ -229,8 +236,8 @@ /** * {@inheritDoc} */ - public int smallCapsSize(int fontSize) { - float percent = this.registeredFontDesc.getSimulateSmallCaps(); + public int smallCapsSize(final int fontSize) { + final float percent = this.registeredFontDesc.getSimulateSmallCaps(); if (percent == Float.NaN) { return fontSize; } @@ -311,7 +318,7 @@ * {@inheritDoc} */ public String getPostscriptName() { - String postScriptName = this.getFont().getPostscriptName(); + final String postScriptName = this.getFont().getPostscriptName(); if (this.encoding == this.getFont().getInternalEncoding()) { return postScriptName; } @@ -332,14 +339,14 @@ /** * {@inheritDoc} */ - public void registerCharUsed(int c) { + public void registerCharUsed(final int c) { this.anyCharsUsed = true; /* If we are not subsetting, there is no need to spend the overhead to * register the use. */ if (this.getSubset() == null) { return; } - int glyphIndex = this.encodeCharacter(c); + final int glyphIndex = this.encodeCharacter(c); /* This just "touches" the subsetting logic. */ this.getSubset().encodeSubsetIndex(glyphIndex); } @@ -347,7 +354,7 @@ /** * {@inheritDoc} */ - public void registerCharsUsed(CharSequence charSequence) { + public void registerCharsUsed(final CharSequence charSequence) { if (charSequence == null) { return; } @@ -358,7 +365,7 @@ return; } for (int i = 0; i < charSequence.length(); i++) { - char c = charSequence.charAt(i); + final char c = charSequence.charAt(i); registerCharUsed(c); } } @@ -385,16 +392,16 @@ /** * {@inheritDoc} */ - public FontOutput getFontOutput(String mimeType) { + public FontOutput getFontOutput(final String mimeType) { FontOutput output = (FontOutput) this.fontOutputs.get(mimeType); if (output != null) { return output; } - FontOutputFactory factory = getFOrayFontServer().getOutputFactory( + final FontOutputFactory factory = getFOrayFontServer().getOutputFactory( mimeType); try { output = factory.createFontOutput(this); - } catch (FontException e) { + } catch (final FontException e) { getLogger().error("Error creating Font output for: " + mimeType + "\n" + e.getMessage()); } Modified: trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java 2006-07-22 21:39:22 UTC (rev 7810) @@ -44,28 +44,29 @@ * Construct an instance. * @param rf The RegisteredFont that should be used to create this font. */ - protected FSTrueTypeFont(RegisteredFont rf) { + protected FSTrueTypeFont(final RegisteredFont rf) { super(rf); parseFont(); } - public byte[] getRawFontFile(FOrayFontUse fontUse) throws IOException { - Subset subset = fontUse.getSubset(); + public byte[] getRawFontFile(final FOrayFontUse fontUse) + throws IOException { + final Subset subset = fontUse.getSubset(); if (subset != null) { - TTFSubSetFile ttfSubset = new TTFSubSetFile(ttf, subset); + final TTFSubSetFile ttfSubset = new TTFSubSetFile(ttf, subset); return ttfSubset.buildEmbeddableSubset(); } - InputStream instream = getFontInputStream(); + final InputStream instream = getFontInputStream(); return IOUtil.toByteArray(instream, 128000); } public void parseFont() { - TTFFile ttfFile = (TTFFile) getRegisteredFont().getFontFileReader() - .cre... [truncated message content] |
|
From: <vic...@us...> - 2006-07-22 19:56:33
|
Revision: 7809 Author: victormote Date: 2006-07-22 12:56:23 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7809&view=rev Log Message: ----------- Implement standard use of "final" modifier on local variables and parameters. Modified Paths: -------------- trunk/foray/foray-core/src/java/org/foray/core/ConfigurationParser.java trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java trunk/foray/foray-core/src/java/org/foray/core/FOraySession.java trunk/foray/foray-core/src/java/org/foray/core/FOrayTarget.java trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java Modified: trunk/foray/foray-core/src/java/org/foray/core/ConfigurationParser.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/ConfigurationParser.java 2006-07-22 19:42:06 UTC (rev 7808) +++ trunk/foray/foray-core/src/java/org/foray/core/ConfigurationParser.java 2006-07-22 19:56:23 UTC (rev 7809) @@ -87,9 +87,9 @@ * @param logger The logger to which errors and other messages * should be sent. */ - public ConfigurationParser(SessionConfig sessionConfig, - Configuration outputConfig, InputSource source, Log logger) - throws FOrayException { + public ConfigurationParser(final SessionConfig sessionConfig, + final Configuration outputConfig, final InputSource source, + final Log logger) throws FOrayException { this.sessionConfig = sessionConfig; this.outputConfig = outputConfig; this.filename = source; @@ -108,16 +108,16 @@ * @throws FOrayException If there are errors parsing the input. */ public void parseDocument() throws FOrayException { - XMLReader parser = createParser(); + final XMLReader parser = createParser(); parser.setContentHandler(this); try { parser.parse(filename); - } catch (SAXException e) { + } catch (final SAXException e) { if (e.getException() instanceof FOrayException) { throw (FOrayException)e.getException(); } throw new FOrayException(e); - } catch (IOException e) { + } catch (final IOException e) { throw new FOrayException(e); } } @@ -129,16 +129,16 @@ */ private XMLReader createParser() throws FOrayException { try { - SAXParserFactory spf = javax.xml.parsers.SAXParserFactory + final SAXParserFactory spf = javax.xml.parsers.SAXParserFactory .newInstance(); spf.setNamespaceAware(true); - XMLReader xmlReader = spf.newSAXParser().getXMLReader(); + final XMLReader xmlReader = spf.newSAXParser().getXMLReader(); logger.info("Config: Using " + xmlReader.getClass().getName() + " as SAX2 Parser."); return xmlReader; - } catch (javax.xml.parsers.ParserConfigurationException e) { + } catch (final javax.xml.parsers.ParserConfigurationException e) { throw new FOrayException(e); - } catch (SAXException e) { + } catch (final SAXException e) { throw new FOrayException(e); } } @@ -150,7 +150,7 @@ * Set the locator which is used to report the position of the element * in the source document. */ - public void setDocumentLocator(Locator locator) { + public void setDocumentLocator(final Locator locator) { this.locator = locator; } @@ -158,8 +158,8 @@ * extracts the element and attribute name and sets the fitting status and * datatype values */ - public void startElement(String uri, String localName, String qName, - Attributes attributes) { + public void startElement(final String uri, final String localName, + final String qName, final Attributes attributes) { if (localName.equals("key")) { status += IN_KEY; return; @@ -183,7 +183,8 @@ * stores subentries or entries into their hashes (map for subentries, * configuration for entry) */ - public void endElement(String uri, String localName, String qName) { + public void endElement(final String uri, final String localName, + final String qName) { if (localName.equals("entry")) { this.store(key, value); status = OUT; @@ -200,10 +201,10 @@ * extracts characters from text nodes and puts them into their respective * variables */ - public void characters(char[] ch, int start, int length) { - char characters[] = new char[length]; + public void characters(final char[] ch, final int start, final int length) { + final char characters[] = new char[length]; System.arraycopy(ch, start, characters, 0, length); - String text = new String(characters); + final String text = new String(characters); switch (status) { case IN_KEY: key = text; @@ -220,7 +221,7 @@ * @param key a string containing the key value for the configuration * @param value a string containing the value for the configuration */ - private void store(String key, String value) { + private void store(final String key, final String value) { // Try the SessionConfig first. if (this.sessionConfig.parseOption(key, value, SessionConfig.PRECEDENCE_CONFIG_FILE)) { Modified: trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java 2006-07-22 19:42:06 UTC (rev 7808) +++ trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java 2006-07-22 19:56:23 UTC (rev 7809) @@ -112,7 +112,7 @@ * Private constructor used only by the other constructors. * @param session The parent FOraySession. */ - private FOrayDocument(FOraySession session) { + private FOrayDocument(final FOraySession session) { this.session = session; session.registerDocument(this); treeBuilder = this.session.getFOTreeServer().makeFOTree(); @@ -127,8 +127,9 @@ * @throws FOrayException If "null" parser is passed and there is an error * creating one. */ - public FOrayDocument(FOraySession session, InputSource inputSource, - XMLReader parser) throws FOrayException { + public FOrayDocument(final FOraySession session, + final InputSource inputSource, XMLReader parser) + throws FOrayException { this(session); this.inputSource = inputSource; if (parser == null) { @@ -143,8 +144,8 @@ * @param session The parent FOraySession. * @param domDocument A DOM Document. */ - public FOrayDocument (FOraySession session, Document domDocument) - throws FOrayException { + public FOrayDocument (final FOraySession session, + final Document domDocument) throws FOrayException { this(session); this.inputSource = new DocumentInputSource(domDocument); this.parser = new DocumentReader(); @@ -156,8 +157,9 @@ * @param session The parent FOraySession. * @param jaxpTransformer A JAXP Transformer. */ - public FOrayDocument (FOraySession session, Transformer jaxpTransformer, - Source jaxpSource) throws FOrayException { + public FOrayDocument (final FOraySession session, + final Transformer jaxpTransformer, final Source jaxpSource) + throws FOrayException { this(session); this.jaxpTransformer = jaxpTransformer; this.jaxpSource = jaxpSource; @@ -169,28 +171,28 @@ * xslt input. * @param session The parent FOraySession. */ - public FOrayDocument (FOraySession session, URL xmlInput, URL xsltInput) - throws FOrayException { + public FOrayDocument (final FOraySession session, final URL xmlInput, + final URL xsltInput) throws FOrayException { this(session); InputStream xmlInputStream = null; try { xmlInputStream = xmlInput.openStream(); - } catch (IOException e) { + } catch (final IOException e) { throw new FOrayException(e); } this.jaxpSource = new StreamSource(xmlInputStream); InputStream xsltInputStream = null; try { xsltInputStream = xsltInput.openStream(); - } catch (IOException e) { + } catch (final IOException e) { throw new FOrayException(e); } - Source xsltSource = new StreamSource(xsltInputStream); - TransformerFactory factory = TransformerFactory.newInstance(); + final Source xsltSource = new StreamSource(xsltInputStream); + final TransformerFactory factory = TransformerFactory.newInstance(); this.jaxpTransformer = null; try { this.jaxpTransformer = factory.newTransformer(xsltSource); - } catch (TransformerConfigurationException e) { + } catch (final TransformerConfigurationException e) { throw new FOrayException(e); } this.jaxpResult = new SAXResult(this.treeBuilder); @@ -200,7 +202,7 @@ * Registers a FOrayTarget instance that this FOrayDocument should process. * @param target The FOrayTarget instance that should be processed. */ - protected void registerTarget(FOrayTarget target) { + protected void registerTarget(final FOrayTarget target) { if (target == null) { return; } @@ -229,7 +231,7 @@ return this.jaxpResult; } - public void setTarget(FOrayTarget target) throws FOrayException { + public void setTarget(final FOrayTarget target) throws FOrayException { if (target.getDocument() != this) { throw new FOrayException("FOrayTarget not a child of this " + "FOrayDocument."); @@ -239,14 +241,14 @@ public synchronized void process() throws FOrayException { // Get the FOrayTarget to process. - FOrayTarget target = (FOrayTarget) targetList.get(0); + final FOrayTarget target = (FOrayTarget) targetList.get(0); processTarget(target); } /** * Build the formatting object tree from the input. */ - public synchronized void processTarget(FOrayTarget target) + public synchronized void processTarget(final FOrayTarget target) throws FOrayException { this.setTarget(target); this.treeBuilder.setFontConsumer(this.getFontConsumer()); @@ -258,34 +260,34 @@ // SAX Events generated by a JAXP Transformer jaxpTransformer.transform(this.jaxpSource, jaxpResult); } - } catch (SAXException e) { + } catch (final SAXException e) { if (e.getException() instanceof FOrayException) { throw (FOrayException)e.getException(); } throw new FOrayException(e); - } catch (TransformerException e) { + } catch (final TransformerException e) { if (e.getException() instanceof FOrayException) { throw (FOrayException)e.getException(); } throw new FOrayException(e); - } catch (IOException e) { + } catch (final IOException e) { throw new FOrayException(e); } finally { cleanup(currentTarget); } } - public void cleanup(FOrayTarget target) { + public void cleanup(final FOrayTarget target) { } /** * Dumps an error */ - public void dumpError(Exception e) { + public void dumpError(final Exception e) { if (! this.getConfiguration().optionVerbosity().equals("debug")) { return; } - Log log = getLogger(); + final Log log = getLogger(); if (e instanceof SAXException) { log.error(e.getMessage()); if (((SAXException)e).getException() != null) { @@ -371,20 +373,21 @@ * @return The newly-created SAX parser. */ XMLReader createParser() throws FOrayException { - SAXParserFactory spf = javax.xml.parsers.SAXParserFactory.newInstance(); + final SAXParserFactory spf = + javax.xml.parsers.SAXParserFactory.newInstance(); spf.setNamespaceAware(true); XMLReader xmlReader = null; try { xmlReader = spf.newSAXParser().getXMLReader(); - } catch (javax.xml.parsers.ParserConfigurationException e) { + } catch (final javax.xml.parsers.ParserConfigurationException e) { throw new FOrayException(e); - } catch (SAXException e) { + } catch (final SAXException e) { throw new FOrayException(e); } try { xmlReader.setFeature( "http://xml.org/sax/features/namespace-prefixes", true); - } catch (SAXException e) { + } catch (final SAXException e) { throw new FOrayException("Error in setting up parser feature " + "namespace-prefixes\n" + "You need a parser which supports SAX version 2", e); Modified: trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java 2006-07-22 19:42:06 UTC (rev 7808) +++ trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java 2006-07-22 19:56:23 UTC (rev 7809) @@ -46,41 +46,42 @@ * * @param message descriptive message */ - public FOrayException(String message) { + public FOrayException(final String message) { super(message); this.contextMessage = null; } - public FOrayException(String message, String contextMessage) { + public FOrayException(final String message, final String contextMessage) { super(message); this.contextMessage = contextMessage; } - public FOrayException(Throwable e) { + public FOrayException(final Throwable e) { super(e.getMessage()); setException(e); this.contextMessage = null; } - public FOrayException(Throwable e, String contextMessage) { + public FOrayException(final Throwable e, final String contextMessage) { super(e.getMessage()); setException(e); this.contextMessage = contextMessage; } - public FOrayException(String message, Throwable e) { + public FOrayException(final String message, final Throwable e) { super(message); setException(e); this.contextMessage = null; } - public FOrayException(String message, Throwable e, String contextMessage) { + public FOrayException(final String message, final Throwable e, + final String contextMessage) { super(message); setException(e); this.contextMessage = contextMessage; } - protected void setException(Throwable t) { + protected void setException(final Throwable t) { _exception = t; } @@ -88,7 +89,7 @@ return _exception; } - public void setContextMessage(String contextMessage) { + public void setContextMessage(final String contextMessage) { this.contextMessage = contextMessage; } @@ -135,7 +136,7 @@ } } - public void printStackTrace(PrintStream stream) { + public void printStackTrace(final PrintStream stream) { synchronized (stream) { super.printStackTrace(stream); if (_exception != null) { @@ -149,7 +150,7 @@ } } - public void printStackTrace(PrintWriter writer) { + public void printStackTrace(final PrintWriter writer) { synchronized (writer) { super.printStackTrace(writer); if (_exception != null) { Modified: trunk/foray/foray-core/src/java/org/foray/core/FOraySession.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/FOraySession.java 2006-07-22 19:42:06 UTC (rev 7808) +++ trunk/foray/foray-core/src/java/org/foray/core/FOraySession.java 2006-07-22 19:56:23 UTC (rev 7809) @@ -110,11 +110,12 @@ * instance will be created by this FOray Session. If an instance is passed, * it needs to be fully configured and ready to be used. */ - public FOraySession(Log logger, SessionConfig configuration, - FontServer fontServer, HyphenationServer hyphenServer, - TextServer textServer, GraphicServer graphicServer, - FOTreeFactory foTreeFactory, AreaTreeFactory areaTreeFactory, - LayoutFactory layoutFactory) throws FOrayException { + public FOraySession(final Log logger, final SessionConfig configuration, + final FontServer fontServer, final HyphenationServer hyphenServer, + final TextServer textServer, final GraphicServer graphicServer, + final FOTreeFactory foTreeFactory, + final AreaTreeFactory areaTreeFactory, + final LayoutFactory layoutFactory) throws FOrayException { /* Validate Logger. */ if (logger == null) { throw new FOrayException("Logger required for FOraySession."); @@ -185,7 +186,7 @@ * Registers a FOrayDocument instance that this FOraySession should process. * @param document The FOrayDocument instance that should be processed. */ - protected void registerDocument(FOrayDocument document) { + protected void registerDocument(final FOrayDocument document) { if (document == null) { return; } @@ -197,14 +198,15 @@ */ private void setupFontServer() { if (log.isDebugEnabled()) { - String[] systemFontFamilies = fontServer.getSystemFontFamilyList(); + final String[] systemFontFamilies = + fontServer.getSystemFontFamilyList(); if (systemFontFamilies != null) { log.debug("Java font family names:"); for (int i = 0; i < systemFontFamilies.length; i++) { log.debug(" " + systemFontFamilies[i]); } } - java.awt.Font[] systemFonts = fontServer.getSystemFontList(); + final java.awt.Font[] systemFonts = fontServer.getSystemFontList(); if (systemFonts != null) { log.debug("Java font names:"); for (int i = 0; i < systemFonts.length; i++) { @@ -242,9 +244,9 @@ * processes each one. */ public void process() throws FOrayException { - Iterator iter = documentList.iterator(); + final Iterator iter = documentList.iterator(); while (iter.hasNext()) { - FOrayDocument document = (FOrayDocument) iter.next(); + final FOrayDocument document = (FOrayDocument) iter.next(); document.process(); } } @@ -257,7 +259,7 @@ * Sets the EntityResolver that should be used to resolve XML entities. * @param entityResolver The EntityResolver that should be set. */ - public void setEntityResolver(EntityResolver entityResolver) { + public void setEntityResolver(final EntityResolver entityResolver) { this.entityResolver = entityResolver; } Modified: trunk/foray/foray-core/src/java/org/foray/core/FOrayTarget.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/FOrayTarget.java 2006-07-22 19:42:06 UTC (rev 7808) +++ trunk/foray/foray-core/src/java/org/foray/core/FOrayTarget.java 2006-07-22 19:56:23 UTC (rev 7809) @@ -110,9 +110,9 @@ private FontConsumer fontConsumer; - public FOrayTarget(FOrayDocument document, OutputTarget outputTarget, - Layout layout, OutputStream outputStream) - throws FOrayException { + public FOrayTarget(final FOrayDocument document, + final OutputTarget outputTarget, final Layout layout, + final OutputStream outputStream) throws FOrayException { // Validate the FOrayDocument. this.document = document; if (this.document == null) { @@ -144,7 +144,7 @@ } /* Obtain a FontConsumer instance. */ - FontServer server = getFontServer(); + final FontServer server = getFontServer(); this.fontConsumer = server.makeFontConsumer(); this.fontConsumer.setFontSources(this.getOutputTarget() .getFontSources()); @@ -177,7 +177,7 @@ startTime = System.currentTimeMillis(); try { outputTarget.startOutput(); - } catch (IOException e) { + } catch (final IOException e) { throw new FOrayException(e); } } @@ -190,10 +190,10 @@ try { processQueue(true); outputTarget.stopOutput(); - } catch (AreaRException e) { + } catch (final AreaRException e) { throw new SAXException(e); } - catch (IOException e) { + catch (final IOException e) { throw new SAXException(e); } @@ -201,8 +201,8 @@ System.gc(); // This takes time but gives better results } - long memoryNow = runtime.totalMemory() - runtime.freeMemory(); - long memoryUsed = (memoryNow - initialMemory) / 1024L; + final long memoryNow = runtime.totalMemory() - runtime.freeMemory(); + final long memoryUsed = (memoryNow - initialMemory) / 1024L; getLogger().debug("Initial heap size: " + (initialMemory/1024L) + "Kb"); getLogger().debug("Current heap size: " + (memoryNow/1024L) + "Kb"); @@ -215,7 +215,7 @@ + "comparatively"); } - long timeUsed = System.currentTimeMillis() - startTime; + final long timeUsed = System.currentTimeMillis() - startTime; getLogger().debug("Total time used: " + timeUsed + "ms"); getLogger().debug("Pages rendered: " + pageCount); @@ -236,28 +236,28 @@ are not all valid. In this case we defer the rendering until they are all valid. */ - public void render(PageSequence pageSequence) throws FOrayException { + public void render(final PageSequence pageSequence) throws FOrayException { pageSequenceCount ++; getLogger().info("Starting layout of page-sequence " + pageSequenceCount + "."); if (this.outputTarget instanceof Renderer) { - Renderer renderer = (Renderer) this.outputTarget; - org.axsl.areaR.AreaTree areaTreeR = getRenderedAreaTree(); + final Renderer renderer = (Renderer) this.outputTarget; + final org.axsl.areaR.AreaTree areaTreeR = getRenderedAreaTree(); renderer.setAreaTree(areaTreeR); - org.axsl.areaW.PageCollection pageCollection = - areaTree.makePageCollection(pageSequence); + final org.axsl.areaW.PageCollection pageCollection = + areaTree.makePageCollection(pageSequence); try { layout.formatPageSequence(pageCollection); - } catch (AreaWException e) { + } catch (final AreaWException e) { throw new FOrayException(e); - } catch (LayoutException e) { + } catch (final LayoutException e) { throw new FOrayException(e); } try { processQueue(false); - } catch (AreaRException e1) { + } catch (final AreaRException e1) { throw new FOrayException(e1); - } catch (IOException e1) { + } catch (final IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } @@ -277,25 +277,26 @@ private org.axsl.areaR.AreaTree getRenderedAreaTree() throws FOrayException { - org.axsl.areaW.AreaTree areaTreeW = getCreatedAreaTree(); + final org.axsl.areaW.AreaTree areaTreeW = getCreatedAreaTree(); if (! (areaTreeW instanceof org.axsl.areaR.AreaTree)) { throw new FOrayException("Area Tree cannot be rendered."); } return (org.axsl.areaR.AreaTree) areaTreeW; } - public void pageComplete(AreaTreeEvent event) { - org.axsl.areaW.PageArea page = event.getPage(); - org.axsl.areaR.PageArea pageToRender = (PageArea) page; + public void pageComplete(final AreaTreeEvent event) { + final org.axsl.areaW.PageArea page = event.getPage(); + final org.axsl.areaR.PageArea pageToRender = (PageArea) page; try { queuePage(pageToRender); - } catch (AreaWException e) { + } catch (final AreaWException e) { /* TODO: Do something better with this. */ e.printStackTrace(); } } - public synchronized void queuePage(PageArea page) throws AreaWException { + public synchronized void queuePage(final PageArea page) + throws AreaWException { /* * We run the pages through a queue because any page page that contains * an unresolved ref-id prevents subsequent pages from being rendered. @@ -321,14 +322,14 @@ If an entry can't be processed, then the queue can't move forward, so return. */ - private synchronized void processQueue(boolean force) + private synchronized void processQueue(final boolean force) throws AreaRException, IOException { if (! (this.outputTarget instanceof Renderer)) { return; } - Renderer renderer = (Renderer) this.outputTarget; + final Renderer renderer = (Renderer) this.outputTarget; while (renderQueue.size() > 0) { - PageArea page = (PageArea) renderQueue.get(0); + final PageArea page = (PageArea) renderQueue.get(0); if (force || page.firstUnresolvedRefId() == null) { renderer.render(page); renderQueue.remove(0); @@ -351,7 +352,7 @@ * do not need to do anything with it, so we ignore it. * @param event The FOTreeEvent that was fired. */ - public void foFObjComplete(FOTreeEvent event) { + public void foFObjComplete(final FOTreeEvent event) { } /** @@ -359,13 +360,13 @@ * FOTreeEvent that is fired when a PageSequence object has been completed. * @param event the FOTreeEvent that was fired */ - public void foPageSequenceComplete(FOTreeEvent event) { + public void foPageSequenceComplete(final FOTreeEvent event) { try { - boolean shouldRender = this.getConfiguration().isModeRender(); + final boolean shouldRender = this.getConfiguration().isModeRender(); if (shouldRender) { render(event.getPageSequence()); } - } catch (FOrayException e) { + } catch (final FOrayException e) { // TODO Auto-generated catch block e.printStackTrace(); } @@ -376,11 +377,11 @@ * is fired when the Document has been completely parsed. * @param event the FOTreeEvent that was fired */ - public void foDocumentComplete(FOTreeEvent event) { + public void foDocumentComplete(final FOTreeEvent event) { getCreatedAreaTree().createDocumentNodes(); try { stopRenderer(); - } catch (SAXException e) { + } catch (final SAXException e) { e.printStackTrace(); } } @@ -431,7 +432,7 @@ if (this.outputStream != null) { try { this.outputStream.close(); - } catch (Exception e) { + } catch (final Exception e) { } } } Modified: trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java 2006-07-22 19:42:06 UTC (rev 7808) +++ trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java 2006-07-22 19:56:23 UTC (rev 7809) @@ -41,7 +41,7 @@ * if any. */ URL baseDocument = null; - public SessionConfig(Log logger) { + public SessionConfig(final Log logger) { super(logger); } @@ -53,7 +53,7 @@ * Sets the default values that should be used unless overridden later. */ protected void setDefaults() { - URL baseDirectory = parseURLDirectory("base-directory", + final URL baseDirectory = parseURLDirectory("base-directory", System.getProperty("user.dir")); put("base-directory", baseDirectory, PRECEDENCE_DEFAULT); @@ -69,12 +69,13 @@ put("mode", "render", PRECEDENCE_DEFAULT); } - public boolean parseOption(String key, String value, int precedenceValue) { + public boolean parseOption(final String key, final String value, + final int precedenceValue) { if (key.equals("cache-graphics") || key.equals("dump-configuration") || key.equals("stroke-svg-text")) { // Boolean value. - Boolean booleanValue = this.parseBoolean(key, value); + final Boolean booleanValue = this.parseBoolean(key, value); put(key, booleanValue, precedenceValue); return true; } @@ -82,13 +83,13 @@ || key.equals("font-base-directory") || key.equals("hyphenation-base-directory")) { // URL for a directory. - URL baseDir = parseURLDirectory(key, value); + final URL baseDir = parseURLDirectory(key, value); put (key, baseDir, precedenceValue); return true; } if (key.equals("font-configuration")) { // URL for a file. - URL baseDir = parseURLFile(key, value); + final URL baseDir = parseURLFile(key, value); put (key, baseDir, precedenceValue); return true; } @@ -127,7 +128,7 @@ return (URL) getValue("base-directory"); } - public void setBaseDirectory(URL newBaseDir, int precedence) { + public void setBaseDirectory(final URL newBaseDir, final int precedence) { put ("base-directory", newBaseDir, precedence); } @@ -142,7 +143,7 @@ } public URL optionFontBaseDirectory() { - URL value = (URL) getValue("font-base-directory"); + final URL value = (URL) getValue("font-base-directory"); return value; } @@ -155,7 +156,7 @@ } public URL optionHyphenationBaseDirectory() { - URL value = (URL) getValue("hyphenation-base-directory"); + final URL value = (URL) getValue("hyphenation-base-directory"); if (value == null) { return optionBaseDirectory(); } @@ -187,7 +188,7 @@ * resources with relative URLs. * @param baseDocument The path to the base document. */ - public void setBaseDocument(URL baseDocument) { + public void setBaseDocument(final URL baseDocument) { this.baseDocument = baseDocument; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-22 19:42:39
|
Revision: 7808 Author: victormote Date: 2006-07-22 12:42:06 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7808&view=rev Log Message: ----------- Implement standard use of "final" modifier on local variables and parameters. Modified Paths: -------------- trunk/foray/foray-common/.project trunk/foray/foray-common/src/java/org/foray/common/ClassService.java trunk/foray/foray-common/src/java/org/foray/common/ColorSpaceCMYK.java trunk/foray/foray-common/src/java/org/foray/common/Configuration.java trunk/foray/foray-common/src/java/org/foray/common/Environment.java trunk/foray/foray-common/src/java/org/foray/common/IOUtil.java trunk/foray/foray-common/src/java/org/foray/common/ISO639.java trunk/foray/foray-common/src/java/org/foray/common/Logging.java trunk/foray/foray-common/src/java/org/foray/common/MUserAgent.java trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java trunk/foray/foray-common/src/java/org/foray/common/RandomReaderRAFile.java trunk/foray/foray-common/src/java/org/foray/common/RandomReaderURL.java trunk/foray/foray-common/src/java/org/foray/common/SVGUserAgent.java trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java trunk/foray/foray-common/src/java/org/foray/common/StringUtilPre5.java trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java trunk/foray/foray-common/src/java/org/foray/common/XMLParser.java trunk/foray/foray-common/src/java/org/foray/common/XMLUtil.java trunk/foray/foray-common/src/java/org/foray/common/sax/DocumentInputSource.java trunk/foray/foray-common/src/java/org/foray/common/sax/DocumentReader.java trunk/foray/foray-common/src/java/org/foray/common/url/AbstractProtocolRegistration.java trunk/foray/foray-common/src/java/org/foray/common/url/FOrayURLStreamHandlerFactory.java trunk/foray/foray-common/src/java/org/foray/common/url/FactoryProtocolRegistration.java trunk/foray/foray-common/src/java/org/foray/common/url/PropertyProtocolRegistration.java trunk/foray/foray-common/src/java/org/foray/common/url/ProtocolRegistrationBroker.java trunk/foray/foray-common/src/java/org/foray/common/url/URLFactory.java trunk/foray/foray-common/src/java/org/foray/common/url/URLUtil.java trunk/foray/foray-common/src/java/org/foray/common/url/UniversalProtocolRegistration.java trunk/foray/foray-common/src/java/org/foray/common/url/classpath/Handler.java Modified: trunk/foray/foray-common/.project =================================================================== --- trunk/foray/foray-common/.project 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/.project 2006-07-22 19:42:06 UTC (rev 7808) @@ -6,12 +6,12 @@ </projects> <buildSpec> <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> <arguments> </arguments> </buildCommand> Modified: trunk/foray/foray-common/src/java/org/foray/common/ClassService.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/ClassService.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/ClassService.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -43,14 +43,14 @@ static HashMap providerMap = new HashMap(); - public static synchronized Enumeration providers(Class cls) { + public static synchronized Enumeration providers(final Class cls) { ClassLoader cl = cls.getClassLoader(); // null if loaded by bootstrap class loader if(cl == null) { cl = ClassLoader.getSystemClassLoader(); } - String serviceFile = "META-INF/services/" + cls.getName(); + final String serviceFile = "META-INF/services/" + cls.getName(); Vector v = (Vector)providerMap.get(serviceFile); if (v != null) { @@ -63,23 +63,23 @@ Enumeration e; try { e = cl.getResources(serviceFile); - } catch (IOException ioe) { + } catch (final IOException ioe) { return v.elements(); } while (e.hasMoreElements()) { try { - URL u = (URL)e.nextElement(); + final URL u = (URL)e.nextElement(); - InputStream is = u.openStream(); - InputStreamReader r = new InputStreamReader(is, "UTF-8"); - BufferedReader br = new BufferedReader(r); + final InputStream is = u.openStream(); + final InputStreamReader r = new InputStreamReader(is, "UTF-8"); + final BufferedReader br = new BufferedReader(r); String line = br.readLine(); while (line != null) { try { // First strip any comment... - int idx = line.indexOf('#'); + final int idx = line.indexOf('#'); if (idx != -1) { line = line.substring(0, idx); } @@ -97,13 +97,13 @@ // Object obj = cl.loadClass(line).newInstance(); // stick it into our vector... v.add(line); - } catch (Exception ex) { + } catch (final Exception ex) { // Just try the next line } line = br.readLine(); } - } catch (Exception ex) { + } catch (final Exception ex) { // Just try the next file... } Modified: trunk/foray/foray-common/src/java/org/foray/common/ColorSpaceCMYK.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/ColorSpaceCMYK.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/ColorSpaceCMYK.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -41,45 +41,45 @@ /** * {@inheritDoc} */ - public float[] toRGB(float[] colorvalue) { + public float[] toRGB(final float[] colorvalue) { if (colorvalue == null) { return null; } if (colorvalue.length < this.getNumComponents()) { throw new ArrayIndexOutOfBoundsException(); } - float cyan = colorvalue[0]; - float magenta = colorvalue[1]; - float yellow = colorvalue[2]; - float black = colorvalue[3]; + final float cyan = colorvalue[0]; + final float magenta = colorvalue[1]; + final float yellow = colorvalue[2]; + final float black = colorvalue[3]; - float red = 1.0f - cyan + (black / BLACK_FACTOR); - float green = 1.0f - magenta + (black / BLACK_FACTOR); - float blue = 1.0f - yellow + (black / BLACK_FACTOR); + final float red = 1.0f - cyan + (black / BLACK_FACTOR); + final float green = 1.0f - magenta + (black / BLACK_FACTOR); + final float blue = 1.0f - yellow + (black / BLACK_FACTOR); return new float[] {red, green, blue}; } /** * {@inheritDoc} */ - public float[] fromRGB(float[] rgbvalue) { + public float[] fromRGB(final float[] rgbvalue) { if (rgbvalue == null) { return null; } if (rgbvalue.length < 3) { throw new ArrayIndexOutOfBoundsException(); } - float red = rgbvalue[0]; - float green = rgbvalue[1]; - float blue = rgbvalue[2]; + final float red = rgbvalue[0]; + final float green = rgbvalue[1]; + final float blue = rgbvalue[2]; - float cyan = 1.0f - red; - float magenta = 1.0f - green; - float yellow = 1.0f - blue; + final float cyan = 1.0f - red; + final float magenta = 1.0f - green; + final float yellow = 1.0f - blue; /* Pick the lowest color. */ - float temp = Math.min(red, Math.min(green, blue)); - float black = temp / BLACK_FACTOR; + final float temp = Math.min(red, Math.min(green, blue)); + final float black = temp / BLACK_FACTOR; return new float[] {cyan, magenta, yellow, black}; } @@ -87,7 +87,7 @@ /** * {@inheritDoc} */ - public float[] toCIEXYZ(float[] colorvalue) { + public float[] toCIEXYZ(final float[] colorvalue) { /* TODO: Implement this. */ return null; } @@ -95,7 +95,7 @@ /** * {@inheritDoc} */ - public float[] fromCIEXYZ(float[] colorvalue) { + public float[] fromCIEXYZ(final float[] colorvalue) { /* TODO: Implement this. */ return null; } @@ -107,9 +107,9 @@ return THE_INSTANCE; } - public static Color makeColor(float cyan, float magenta, float yellow, - float black) { - float[] cmykArray = new float[] {cyan, magenta, yellow, black}; + public static Color makeColor(final float cyan, final float magenta, + final float yellow, final float black) { + final float[] cmykArray = new float[] {cyan, magenta, yellow, black}; return new Color(ColorSpaceCMYK.theInstance(), cmykArray, 0); } Modified: trunk/foray/foray-common/src/java/org/foray/common/Configuration.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/Configuration.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/Configuration.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -73,7 +73,7 @@ */ private Map precedence = new HashMap(30); - protected Configuration(Log logger) { + protected Configuration(final Log logger) { this.logger = logger; setDefaults(); } @@ -95,7 +95,7 @@ * convenience methods, which return the correct form, * null if the key is not defined. */ - protected Object getValue(String key) { + protected Object getValue(final String key) { return options.get(key); } @@ -105,8 +105,8 @@ * @return String a string containing the value, * null if the key is not defined. */ - protected String getStringValue(String key) { - Object obj = getValue(key); + protected String getStringValue(final String key) { + final Object obj = getValue(key); if (obj instanceof String) { return (String)obj; } @@ -119,8 +119,8 @@ * @return int a int containing the value, * -1 if the key is not defined. */ - protected int getIntValue(String key) { - Object obj = getValue(key); + protected int getIntValue(final String key) { + final Object obj = getValue(key); if (obj instanceof String) { return Integer.parseInt((String)obj); } @@ -133,8 +133,8 @@ * @return Boolean true or false as value, * null if the key is not defined. */ - protected Boolean getBooleanValue(String key) { - Object obj = getValue(key); + protected Boolean getBooleanValue(final String key) { + final Object obj = getValue(key); if (obj instanceof String) { return new Boolean((String)obj); } else if (obj instanceof Boolean) { @@ -150,8 +150,8 @@ * @return List a List containing the values, * null if the key is not defined. */ - protected List getListValue(String key) { - Object obj = getValue(key); + protected List getListValue(final String key) { + final Object obj = getValue(key); if (obj instanceof List) { return (List)obj; } @@ -168,8 +168,9 @@ * @param key A string containing the key value for the configuration value. * @param value The object containing the configuration value. */ - protected void put(String key, Object value, int precedenceValue) { - Integer oldPrecedence = (Integer) this.precedence.get(key); + protected void put(final String key, final Object value, + final int precedenceValue) { + final Integer oldPrecedence = (Integer) this.precedence.get(key); if (oldPrecedence == null) { // Key does not already exist. Add it. putInMap(key, value, precedenceValue); @@ -199,18 +200,19 @@ * Adds an item to the configuration without giving the subclass an * opportunity to validate it. */ - protected void addUnvalidatedOption(String key, Object value, - int precedenceValue) { + protected void addUnvalidatedOption(final String key, final Object value, + final int precedenceValue) { put(key, value, precedenceValue); } - private void putInMap(String key, Object value, int precedenceValue) { - Integer newPrecedence = new Integer(precedenceValue); + private void putInMap(final String key, final Object value, + final int precedenceValue) { + final Integer newPrecedence = new Integer(precedenceValue); this.precedence.put(key, newPrecedence); this.options.put(key, value); } - protected Boolean parseBoolean(String key, String value) { + protected Boolean parseBoolean(final String key, final String value) { if (value.equalsIgnoreCase("true")) { return Boolean.TRUE; } @@ -222,49 +224,50 @@ return null; } - protected URL parseURLDirectory(String key, String directory) { + protected URL parseURLDirectory(final String key, final String directory) { URL baseURL = null; try { if (directory == null) { return URLFactory.createURL("."); } - File dir = new File(directory); + final File dir = new File(directory); if (dir.isDirectory()) { return dir.toURL(); } baseURL = URLFactory.createURL(directory); - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { this.getLogger().error("Invalid " + key + ": " + directory + " (" + e.getMessage() + ")"); } return baseURL; } - protected URL parseURLFile(String key, String fileName) { + protected URL parseURLFile(final String key, final String fileName) { URL url = null; if (fileName == null) { return null; } try { - File file = new File(fileName); + final File file = new File(fileName); if (file.isFile()) { url = file.toURL(); } else { this.getLogger().error("Invalid URL (" + key + "): " + fileName); } - } catch (MalformedURLException mfue) { + } catch (final MalformedURLException mfue) { this.getLogger().error("Invalid " + key + ": " + fileName + " (" + mfue.getMessage() + ")"); } return url; } - protected ArrayList parseSpaceDelimitedList(String key, String value) { - ArrayList list = new ArrayList(); - StringTokenizer tokenizer = new StringTokenizer(value); + protected ArrayList parseSpaceDelimitedList(final String key, + final String value) { + final ArrayList list = new ArrayList(); + final StringTokenizer tokenizer = new StringTokenizer(value); while (tokenizer.hasMoreTokens()) { - String item = tokenizer.nextToken(); + final String item = tokenizer.nextToken(); list.add(item); } return list; @@ -276,19 +279,19 @@ */ public void dumpConfiguration() { logger.info("Dumping configuration: " + getName()); - Iterator iterator = options.keySet().iterator(); + final Iterator iterator = options.keySet().iterator(); while (iterator.hasNext()) { - String key = (String)iterator.next(); + final String key = (String)iterator.next(); logger.info("key: " + key); - Object value = options.get(key); + final Object value = options.get(key); if (value instanceof String) { logger.info(" value: " + value); } else if (value instanceof List) { - StringBuffer valueString = new StringBuffer(); - List list = (List) value; + final StringBuffer valueString = new StringBuffer(); + final List list = (List) value; valueString.append(" value: "); for (int i = 0; i < list.size(); i++) { - String item = (String) list.get(i); + final String item = (String) list.get(i); valueString.append(item + " "); } logger.info(valueString.toString()); Modified: trunk/foray/foray-common/src/java/org/foray/common/Environment.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/Environment.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/Environment.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -54,9 +54,9 @@ GraphicsEnvironment ge = null; try { ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - } catch (LinkageError e) { + } catch (final LinkageError e) { return false; - } catch (InternalError e1) { + } catch (final InternalError e1) { return false; } return (ge != null); @@ -75,9 +75,9 @@ /* TODO: Remove this method and replace all dependencies on it with * System.getenv(String name) after Java 1.5 is the lowest supported * runtime. */ - public static String getenv(String name) { + public static String getenv(final String name) { String[] command = null; - String fileSeparator = System.getProperty("file.separator"); + final String fileSeparator = System.getProperty("file.separator"); if (fileSeparator.equals("/")) { command = new String[2]; command[0] = "printenv"; @@ -92,23 +92,23 @@ String value = null; Process process = null; try { - Runtime runtime = Runtime.getRuntime(); + final Runtime runtime = Runtime.getRuntime(); process = runtime.exec(command); if (process == null) { return null; } - InputStream stdout = process.getInputStream(); - InputStreamReader isr = new InputStreamReader(stdout); - BufferedReader br = new BufferedReader(isr); + final InputStream stdout = process.getInputStream(); + final InputStreamReader isr = new InputStreamReader(stdout); + final BufferedReader br = new BufferedReader(isr); value = br.readLine(); - int exitValue = process.waitFor(); + final int exitValue = process.waitFor(); if (exitValue != 0) { return null; } - } catch (IOException e) { + } catch (final IOException e) { // Punt. return null; - } catch (InterruptedException e) { + } catch (final InterruptedException e) { // Punt. return null; } finally { Modified: trunk/foray/foray-common/src/java/org/foray/common/IOUtil.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/IOUtil.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/IOUtil.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -47,7 +47,7 @@ * @param out OutputStream to write to * @throws IOException In case of an I/O problem */ - public static void copyStream(InputStream in, OutputStream out) + public static void copyStream(final InputStream in, final OutputStream out) throws IOException { final int bufferSize = 2048; final byte[] buf = new byte[bufferSize]; @@ -67,9 +67,9 @@ * @return byte[] the array of bytes requested * @throws IOException In case of an I/O problem */ - public static byte[] toByteArray(InputStream in, - int initialTargetBufferSize) throws IOException { - ByteArrayOutputStream baout = + public static byte[] toByteArray(final InputStream in, + final int initialTargetBufferSize) throws IOException { + final ByteArrayOutputStream baout = new ByteArrayOutputStream(initialTargetBufferSize); try { copyStream(in, baout); Modified: trunk/foray/foray-common/src/java/org/foray/common/ISO639.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/ISO639.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/ISO639.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -627,7 +627,7 @@ * @return True iff <code>languageCode</code> is a valid 2- or 3-character * ISO 639 language code. */ - public static boolean validLanguage(String languageCode) { + public static boolean validLanguage(final String languageCode) { int index = Arrays.binarySearch(codes3Letter, languageCode); if (index >= 0) { return true; Modified: trunk/foray/foray-common/src/java/org/foray/common/Logging.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/Logging.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/Logging.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -43,22 +43,22 @@ } public static Log makeDefaultLogger() { - Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO); + final Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO); return new AvalonLogger(logger); } public static Log makeDebugLogger() { - Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_DEBUG); + final Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_DEBUG); return new AvalonLogger(logger); } public static Log makeQuietLogger() { - Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_ERROR); + final Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_ERROR); return new AvalonLogger(logger); } public static Log makeWarningLogger() { - Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_WARN); + final Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_WARN); return new AvalonLogger(logger); } Modified: trunk/foray/foray-common/src/java/org/foray/common/MUserAgent.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/MUserAgent.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/MUserAgent.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -43,14 +43,14 @@ /** * Creates a new SVGUserAgent. */ - public MUserAgent(AffineTransform at) { + public MUserAgent(final AffineTransform at) { super(at); } /** * Opens a link in a new component. */ - public void openLink(SVGAElement elt) { + public void openLink(final SVGAElement elt) { // application.openLink(uri); } @@ -58,7 +58,7 @@ return new Point(0, 0); } - public void setSVGCursor(Cursor cursor) {} + public void setSVGCursor(final Cursor cursor) {} public Dimension2D getViewportSize() { return new Dimension(100, 100); Modified: trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -64,7 +64,7 @@ List children; int nextIndex = 0; - ListEnumeration(List children) { + ListEnumeration(final List children) { this.children = children; nextIndex = 0; } @@ -80,7 +80,7 @@ if (! hasMoreElements()) { throw new NoSuchElementException("No more elements"); } - Object nextElement = children.get(this.nextIndex); + final Object nextElement = children.get(this.nextIndex); this.nextIndex ++; return nextElement; } @@ -88,7 +88,7 @@ private OrderedTreeNode parent; - public OrderedTreeNode(OrderedTreeNode parent) { + public OrderedTreeNode(final OrderedTreeNode parent) { this.parent = parent; } @@ -115,7 +115,7 @@ /** * {@inheritDoc} */ - public TreeNode getChildAt(int childIndex) { + public TreeNode getChildAt(final int childIndex) { if (childIndex < 0) { return null; } @@ -138,7 +138,7 @@ /** * {@inheritDoc} */ - public int getIndex(TreeNode node) { + public int getIndex(final TreeNode node) { if (getChildren() == null) { return -1; } @@ -169,7 +169,7 @@ if (parent == null) { return null; } - List children = parent.getChildren(); + final List children = parent.getChildren(); if (children == null) { return null; } @@ -180,7 +180,7 @@ * {@inheritDoc} */ public int siblingIndex() { - List siblings = getSiblings(); + final List siblings = getSiblings(); if (siblings == null) { return -1; } @@ -191,7 +191,7 @@ * {@inheritDoc} */ public org.axsl.common.OrderedTreeNode getPreviousSibling() { - int mySiblingIndex = siblingIndex(); + final int mySiblingIndex = siblingIndex(); if (mySiblingIndex < 1) { return null; } @@ -202,7 +202,7 @@ * {@inheritDoc} */ public org.axsl.common.OrderedTreeNode getNextSibling() { - int mySiblingIndex = siblingIndex(); + final int mySiblingIndex = siblingIndex(); if (mySiblingIndex < 0) { return null; } @@ -217,7 +217,7 @@ * Changes this nodes parent. * @param newParent The new parent of this node. */ - public void setParent(OrderedTreeNode newParent) { + public void setParent(final OrderedTreeNode newParent) { this.parent = newParent; } @@ -235,7 +235,7 @@ * {@inheritDoc} */ public org.axsl.common.OrderedTreeNode getFirstChild() { - List children = getChildren(); + final List children = getChildren(); if (children == null) { return null; } @@ -249,7 +249,7 @@ * {@inheritDoc} */ public org.axsl.common.OrderedTreeNode getLastChild() { - List children = getChildren(); + final List children = getChildren(); if (children == null) { return null; } @@ -310,7 +310,7 @@ */ public org.axsl.common.OrderedTreeNode getNextLeaf() { org.axsl.common.OrderedTreeNode nextSibling; - OrderedTreeNode myParent = (OrderedTreeNode) getParent(); + final OrderedTreeNode myParent = (OrderedTreeNode) getParent(); if (myParent == null) { return null; } @@ -327,7 +327,7 @@ */ public org.axsl.common.OrderedTreeNode getPreviousLeaf() { org.axsl.common.OrderedTreeNode previousSibling; - OrderedTreeNode myParent = (OrderedTreeNode) getParent(); + final OrderedTreeNode myParent = (OrderedTreeNode) getParent(); if (myParent == null) { return null; } Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -73,7 +73,7 @@ * Constructor suitable for a local file. * @param url The URL to the file that will be read. */ - public RandomReader(URL url) throws IOException { + public RandomReader(final URL url) throws IOException { this.realReader = randomInputFactory(url); } @@ -84,15 +84,15 @@ * <code>byteArray</code>. * @param byteArray The byte array that should be read. */ - public RandomReader(String description, byte[] byteArray) { + public RandomReader(final String description, final byte[] byteArray) { this.realReader = randomInputFactory(description, byteArray); } - private RandomInput randomInputFactory(URL url) throws IOException { + private RandomInput randomInputFactory(final URL url) throws IOException { if (url == null) { throw new IOException("URL is null."); } - File file = new File(url.getFile()); + final File file = new File(url.getFile()); if (! file.canRead()) { /* If we can't get a readable file out of it, we need to use the URL * implementation instead. */ @@ -101,8 +101,8 @@ return new RandomReaderRAFile(file); } - private RandomInput randomInputFactory(String description, - byte[] byteArray) { + private RandomInput randomInputFactory(final String description, + final byte[] byteArray) { /* Right now, there is only one available implementation. */ return new RandomReaderArray(description, byteArray); } @@ -110,7 +110,7 @@ /** * {@inheritDoc} */ - public void seek(long pos) throws IOException { + public void seek(final long pos) throws IOException { realReader.seek(pos); } @@ -131,21 +131,22 @@ /** * {@inheritDoc} */ - public void readFully(byte[] b) throws IOException { + public void readFully(final byte[] b) throws IOException { realReader.readFully(b); } /** * {@inheritDoc} */ - public void readFully(byte[] b, int off, int len) throws IOException { + public void readFully(final byte[] b, final int off, final int len) + throws IOException { realReader.readFully(b, off, len); } /** * {@inheritDoc} */ - public int skipBytes(int n) throws IOException { + public int skipBytes(final int n) throws IOException { return realReader.skipBytes(n); } @@ -260,10 +261,10 @@ * @return The unsigned integral. */ public long readUnsignedIntLoHi() throws IOException { - int byte1 = readUnsignedByte(); - int byte2 = readUnsignedByte(); - int byte3 = readUnsignedByte(); - int byte4 = readUnsignedByte(); + final int byte1 = readUnsignedByte(); + final int byte2 = readUnsignedByte(); + final int byte3 = readUnsignedByte(); + final int byte4 = readUnsignedByte(); return ((byte4 << 24) + (byte3 << 16) + (byte2 << 8) + (byte1 << 0)); } @@ -275,8 +276,8 @@ * @return The unsigned integral. */ public int readUnsignedShortLoHi() throws IOException { - int byte1 = readUnsignedByte(); - int byte2 = readUnsignedByte(); + final int byte1 = readUnsignedByte(); + final int byte2 = readUnsignedByte(); return ((byte2 << 8) + (byte1 << 0)); } @@ -287,8 +288,8 @@ * @return The unsigned integral. */ public int readShortLoHi() throws IOException { - int byte1 = readByte(); - int byte2 = readByte(); + final int byte1 = readByte(); + final int byte2 = readByte(); return ((byte2 << 8) + (byte1 << 0)); } @@ -298,14 +299,14 @@ * @param charEncoding The encoding scheme to be used for interpreting the * characters in the string. */ - public String readString(int stringSize, String charEncoding) + public String readString(final int stringSize, String charEncoding) throws IOException { if ((stringSize + getFilePointer()) > length()) { throw new EOFException("Reached EOF, file size=" + length()); } charEncoding = stringEncodingToUse(charEncoding); - byte[] tmp = new byte[stringSize]; + final byte[] tmp = new byte[stringSize]; for (int i = 0; i < stringSize; i++) { tmp[i] = readByte(); } @@ -318,10 +319,10 @@ * * @return The string read. */ - public String readTerminatedString(byte terminatingChar, - String charEncoding) throws IOException { + public String readTerminatedString(final byte terminatingChar, + final String charEncoding) throws IOException { // We're going to read ahead here, so save the location - long saveLocation = getFilePointer(); + final long saveLocation = getFilePointer(); int stringSize = 0; byte inByte = readByte(); while (inByte != terminatingChar) { @@ -347,7 +348,7 @@ * @return charEncoding, if it is valid. Otherwise, the best valid character * encoding scheme found. */ - private String stringEncodingToUse(String charEncoding) { + private String stringEncodingToUse(final String charEncoding) { if (charEncoding == null) { return CHAR_ENCODE_US_ASCII; } @@ -397,11 +398,11 @@ public long searchBytes(final byte[] bytesToFind, final long startRange, final long endRange, final boolean readBackward) throws IOException { - ByteSearcher bSearcher = new ByteSearcher(bytesToFind, startRange, + final ByteSearcher bSearcher = new ByteSearcher(bytesToFind, startRange, endRange, readBackward); try { return bSearcher.searchBytes(); - } catch (IOException e) { + } catch (final IOException e) { return -1; } } @@ -416,8 +417,8 @@ * to be matched in bytesToSearch. * @return True if the contents match, false otherwise. */ - public static final boolean byteArrayCompare(byte[] bytesToSearch, - int bytesToSearchOffset, byte[] bytesToFind) { + public static final boolean byteArrayCompare(final byte[] bytesToSearch, + final int bytesToSearchOffset, final byte[] bytesToFind) { // Make sure we don't go off the end of bytesToSearch if (bytesToSearchOffset + bytesToFind.length > bytesToSearch.length) { return false; @@ -436,11 +437,11 @@ * @param urlArray An array containing a list of URLs to be tested. * @return The first qualifying URL, or null if there are none. */ - public static URL resolveURLInput(URL[] urlArray) { + public static URL resolveURLInput(final URL[] urlArray) { for (int i = 0; i < urlArray.length; i++) { - URL url = urlArray[i]; + final URL url = urlArray[i]; if (url != null) { - File file = new File(url.getFile()); + final File file = new File(url.getFile()); if (file.exists()) { return url; } @@ -604,7 +605,7 @@ } } - private void computeOffsetToContent(int i) { + private void computeOffsetToContent(final int i) { offsetToContent = lastReadStart - lastViewboxTarget + i; } Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -45,7 +45,8 @@ * useful in user messages. * @byteArray The byte array which will be "read" by this reader. */ - protected RandomReaderArray(String description, byte[] byteArray) { + protected RandomReaderArray(final String description, + final byte[] byteArray) { this.description = description; this.byteArray = byteArray; } @@ -53,14 +54,14 @@ /** * {@inheritDoc} */ - public void seek(long offset) throws IOException { + public void seek(final long offset) throws IOException { arrayIndex = (int) offset; } /** * {@inheritDoc} */ - public int skipBytes(int add) throws IOException { + public int skipBytes(final int add) throws IOException { return arrayIndex += add; } @@ -78,7 +79,7 @@ if (arrayIndex >= this.byteArray.length) { throw new EOFException(); } - byte theByte = this.byteArray[arrayIndex]; + final byte theByte = this.byteArray[arrayIndex]; arrayIndex ++; return theByte; } @@ -90,7 +91,7 @@ if (this.arrayIndex >= this.byteArray.length) { throw new EOFException(); } - char c = (char) this.byteArray[this.arrayIndex]; + final char c = (char) this.byteArray[this.arrayIndex]; this.arrayIndex ++; return c; } @@ -99,8 +100,8 @@ * {@inheritDoc} */ public final short readShort() throws IOException { - int byte1 = readUnsignedByte(); - int byte2 = readUnsignedByte(); + final int byte1 = readUnsignedByte(); + final int byte2 = readUnsignedByte(); return (short)((byte1 << 8) + (byte2 << 0)); } @@ -108,8 +109,8 @@ * {@inheritDoc} */ public final int readUnsignedShort() throws IOException { - int byte1 = readUnsignedByte(); - int byte2 = readUnsignedByte(); + final int byte1 = readUnsignedByte(); + final int byte2 = readUnsignedByte(); return (byte1 << 8) + (byte2 << 0); } @@ -124,21 +125,22 @@ * {@inheritDoc} */ public final boolean readBoolean() throws IOException { - int ch = readUnsignedByte(); + final int ch = readUnsignedByte(); return (ch != 0); } /** * {@inheritDoc} */ - public final void readFully(byte[] b) throws IOException { + public final void readFully(final byte[] b) throws IOException { readFully(b, 0, b.length); } /** * {@inheritDoc} */ - public final void readFully(byte[] b, int off, int len) throws IOException { + public final void readFully(final byte[] b, final int off, int len) + throws IOException { boolean eofDetected = false; if (this.arrayIndex + len >= this.byteArray.length) { eofDetected = true; @@ -169,8 +171,8 @@ * {@inheritDoc} */ public final char readChar() throws IOException { - int byte1 = this.readUnsignedByte(); - int byte2 = this.readUnsignedByte(); + final int byte1 = this.readUnsignedByte(); + final int byte2 = this.readUnsignedByte(); return (char)((byte1 << 8) + (byte2 << 0)); } @@ -185,10 +187,10 @@ * {@inheritDoc} */ public final int readInt() throws IOException { - int byte1 = this.readUnsignedByte(); - int byte2 = this.readUnsignedByte(); - int byte3 = this.readUnsignedByte(); - int byte4 = this.readUnsignedByte(); + final int byte1 = this.readUnsignedByte(); + final int byte2 = this.readUnsignedByte(); + final int byte3 = this.readUnsignedByte(); + final int byte4 = this.readUnsignedByte(); return ((byte1 << 24) + (byte2 << 16) + (byte3 << 8) + (byte4 << 0)); } @@ -196,7 +198,7 @@ * {@inheritDoc} */ public final String readLine() throws IOException { - StringBuffer input = new StringBuffer(); + final StringBuffer input = new StringBuffer(); int byteRead = -1; boolean eol = false; @@ -213,7 +215,7 @@ } case '\r': { eol = true; - long cur = getFilePointer(); + final long cur = getFilePointer(); if (this.arrayIndex >= this.length()) { eol = true; break; Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomReaderRAFile.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomReaderRAFile.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomReaderRAFile.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -43,7 +43,7 @@ /** * Constructor. */ - protected RandomReaderRAFile(File file) throws IOException { + protected RandomReaderRAFile(final File file) throws IOException { this.file = file; if (file == null) { return; @@ -52,11 +52,11 @@ seek(0); } - public void seek(long offset) throws IOException { + public void seek(final long offset) throws IOException { raFile.seek(offset); } - public int skipBytes(int add) throws IOException { + public int skipBytes(final int add) throws IOException { return raFile.skipBytes(add); } @@ -88,11 +88,12 @@ return raFile.readBoolean(); } - public final void readFully(byte[] b) throws IOException { + public final void readFully(final byte[] b) throws IOException { raFile.readFully(b); } - public final void readFully(byte[] b, int off, int len) throws IOException { + public final void readFully(final byte[] b, final int off, final int len) + throws IOException { raFile.readFully(b, off, len); } Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomReaderURL.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomReaderURL.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomReaderURL.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -46,7 +46,7 @@ * Constructor. * @param url The URL which contains the stream to be used. */ - protected RandomReaderURL(URL url) { + protected RandomReaderURL(final URL url) { this.url = url; } @@ -54,15 +54,15 @@ if (this.array != null) { return; } - InputStream input = this.getInputStream(); - byte[] theBytes = IOUtil.toByteArray(input, 20000); + final InputStream input = this.getInputStream(); + final byte[] theBytes = IOUtil.toByteArray(input, 20000); this.array = new RandomReaderArray(this.url.toExternalForm(), theBytes); } /** * {@inheritDoc} */ - public void seek(long offset) throws IOException { + public void seek(final long offset) throws IOException { checkArray(); this.array.seek(offset); } @@ -70,7 +70,7 @@ /** * {@inheritDoc} */ - public int skipBytes(int add) throws IOException { + public int skipBytes(final int add) throws IOException { checkArray(); return this.array.skipBytes(add); } @@ -134,7 +134,7 @@ /** * {@inheritDoc} */ - public final void readFully(byte[] b) throws IOException { + public final void readFully(final byte[] b) throws IOException { checkArray(); this.array.readFully(b); } @@ -142,7 +142,8 @@ /** * {@inheritDoc} */ - public final void readFully(byte[] b, int off, int len) throws IOException { + public final void readFully(final byte[] b, final int off, final int len) + throws IOException { checkArray(); this.array.readFully(b, off, len); } @@ -209,7 +210,7 @@ public String getDescription() { try { checkArray(); - } catch (IOException e) { + } catch (final IOException e) { return this.url.toExternalForm(); } return this.array.getDescription(); @@ -228,7 +229,7 @@ public void reset() { try { checkArray(); - } catch (IOException e) { + } catch (final IOException e) { /* Nothing to do here. */ } this.array = null; Modified: trunk/foray/foray-common/src/java/org/foray/common/SVGUserAgent.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/SVGUserAgent.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/SVGUserAgent.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -41,25 +41,25 @@ /** * Creates a new SVGUserAgent. */ - public SVGUserAgent(AffineTransform at) { + public SVGUserAgent(final AffineTransform at) { currentTransform = at; } - public void setLogger(Log logger) { + public void setLogger(final Log logger) { log = logger; } /** * Displays an error message. */ - public void displayError(String message) { + public void displayError(final String message) { log.error(message); } /** * Displays an error resulting from the specified Exception. */ - public void displayError(Exception ex) { + public void displayError(final Exception ex) { log.error("SVG Error" + ex.getMessage()); log.error(ex.getMessage()); } @@ -68,7 +68,7 @@ * Displays a message in the User Agent interface. * The given message is typically displayed in a status bar. */ - public void displayMessage(String message) { + public void displayMessage(final String message) { log.info(message); } Modified: trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -41,7 +41,7 @@ * @param input The character to be tested. * @return True iff the character is a valid hexadecimal character. */ - public static boolean isASCIIHex(char input) { + public static boolean isASCIIHex(final char input) { // "0" thru "9" if (input >= 0x30 && input <= 0x39) { return true; @@ -60,7 +60,7 @@ /** * Same as {@link #isASCIIHex(byte)}, except with a char as input. */ - public static boolean isASCIIHex(byte input) { + public static boolean isASCIIHex(final byte input) { // Make sure the byte is not negative before casting as char. if (input < 0x00) { return false; @@ -78,7 +78,7 @@ * @return The byte containing the hex value of the 2 input bytes, or -1 if * the input is valid. */ - public static byte asciiHexBytesToHex(byte byte1, byte byte2) { + public static byte asciiHexBytesToHex(final byte byte1, final byte byte2) { if (! isASCIIHex(byte1)) { return -1; } @@ -86,9 +86,9 @@ return -1; } // Convert the high-order byte and shift it into the high position. - byte convert1 = (byte) (asciiHexByteToHex(byte1) << 4); + final byte convert1 = (byte) (asciiHexByteToHex(byte1) << 4); // Convert the low-order byte. - byte convert2 = asciiHexByteToHex(byte2); + final byte convert2 = asciiHexByteToHex(byte2); // "Or" the two half-bytes together and return it. return (byte) (convert1 | convert2); } @@ -99,7 +99,7 @@ * @param inputByte The ASCII Hex byte to convert. * @return The hex equivalent of inputByte. */ - public static byte asciiHexByteToHex(byte inputByte) { + public static byte asciiHexByteToHex(final byte inputByte) { if (inputByte >= 0x30 && inputByte <= 0x39) { // numerals return (byte) (inputByte - 0x30); } @@ -125,8 +125,8 @@ * @return The index (0 through stringArray.length - 1) of the matching * element, or -1 if no match is found. */ - public static int indexOfSortedCharArray(char[] charArray, - char inputChar, int startIndex, int endIndex) { + public static int indexOfSortedCharArray(final char[] charArray, + final char inputChar, final int startIndex, final int endIndex) { if (charArray == null) { return -1; } @@ -136,8 +136,8 @@ int bottom = startIndex; int top = endIndex; while (top >= bottom) { - int mid = (bottom + top) / 2; - char testChar = charArray[mid]; + final int mid = (bottom + top) / 2; + final char testChar = charArray[mid]; if (inputChar == testChar) { // This is the item we are looking for. Return it. return mid; @@ -166,8 +166,8 @@ * ensure this size. * @return The String representing c's hex value. */ - public static String charToHexString(char c, boolean upperCase, - int minimumSize) { + public static String charToHexString(final char c, final boolean upperCase, + final int minimumSize) { String returnString = Integer.toHexString(c); if (upperCase) { returnString.toUpperCase(); @@ -190,7 +190,8 @@ * ensure this size. * @return The String representing c's octal value. */ - public static String charToOctalString(char c, int minimumSize) { + public static String charToOctalString(final char c, + final int minimumSize) { String returnString = Integer.toOctalString(c); int bytesToPad = minimumSize - returnString.length(); while (bytesToPad > 0) { @@ -208,12 +209,12 @@ * spaces to the end of eol. * @param length The maximum length that a line should contain. */ - public static void lineBreakStringBuffer(StringBuffer buffer, String eol, - int length) { + public static void lineBreakStringBuffer(final StringBuffer buffer, + final String eol, final int length) { int currentLineStarts = 0; int lastOpportunity = -1; for (int i = 0; i < buffer.length(); i++) { - int currentLineLength = i - currentLineStarts; + final int currentLineLength = i - currentLineStarts; if (currentLineLength > length && lastOpportunity > 0) { buffer.replace(lastOpportunity, lastOpportunity + 1, eol); @@ -221,7 +222,7 @@ lastOpportunity = -1; i =+ eol.length() - 1; } - char c = buffer.charAt(i); + final char c = buffer.charAt(i); if (c == ' ') { lastOpportunity = i; } @@ -233,13 +234,14 @@ * @param input The CharSequence to be converted. * @return An array of Unicode code points. */ - public static int[] toCodePoints(CharSequence input) { + public static int[] toCodePoints(final CharSequence input) { if (input == null || input.length() < 1) { return new int[0]; } - int length = StringUtilPre5.codePointCount(input, 0, input.length()); - int[] output = new int[length]; + final int length = StringUtilPre5.codePointCount(input, 0, + input.length()); + final int[] output = new int[length]; int outputIndex = 0; for (int i = 0; i < input.length(); i++) { output[outputIndex] = StringUtilPre5.codePointAt(input, i); @@ -256,13 +258,14 @@ * @param input The char[] to be converted. * @return An array of Unicode code points. */ - public static int[] toCodePoints(char[] input) { + public static int[] toCodePoints(final char[] input) { if (input == null || input.length < 1) { return new int[0]; } - int length = StringUtilPre5.codePointCount(input, 0, input.length); - int[] output = new int[length]; + final int length = StringUtilPre5.codePointCount(input, 0, + input.length); + final int[] output = new int[length]; int outputIndex = 0; for (int i = 0; i < input.length; i++) { output[outputIndex] = StringUtilPre5.codePointAt(input, i); @@ -282,12 +285,13 @@ * @return The index to the first character in the Strings that is * different. If the Strings are identical, returns -1. */ - public static int firstDifferent(String string1, String string2) { + public static int firstDifferent(final String string1, + final String string2) { if (string2.equals(string1)) { return -1; } - char[] chars1 = string1.toCharArray(); - char[] chars2 = string2.toCharArray(); + final char[] chars1 = string1.toCharArray(); + final char[] chars2 = string2.toCharArray(); for (int i = 0; i < chars1.length; i++) { if (i >= chars2.length) { return i; @@ -309,13 +313,13 @@ * @param newString The substring that should replace oldString. * @return The number of replacements that were made. */ - public static int replace(StringBuffer buffer, String oldString, - String newString) { + public static int replace(final StringBuffer buffer, final String oldString, + final String newString) { int numChanges = 0; boolean anyChanges = true; while (anyChanges) { anyChanges = false; - int index = buffer.indexOf(oldString); + final int index = buffer.indexOf(oldString); if (index > -1) { buffer.replace(index, index + oldString.length(), newString); anyChanges = true; Modified: trunk/foray/foray-common/src/java/org/foray/common/StringUtilPre5.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/StringUtilPre5.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/StringUtilPre5.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -42,65 +42,67 @@ /** * Mimics Java 5.0: Character.charCount(int). */ - public static int charCount(int codePoint) { + public static int charCount(final int codePoint) { return UCharacter.charCount(codePoint); } /** * Mimics Java 5.0: Character.codePointAt(char[], int). */ - public static int codePointAt(char[] chars, int index) { + public static int codePointAt(final char[] chars, final int index) { return UCharacter.codePointAt(chars, index); } /** * Mimics Java 5.0: Character.codePointAt(CharSequence, int). */ - public static int codePointAt(CharSequence chars, int index) { + public static int codePointAt(final CharSequence chars, final int index) { return UCharacter.codePointAt(chars, index); } /** * Mimics Java 5.0: Character.codePointCount(char[], int, int). */ - public static int codePointCount(char[] input, int offset, int count) { + public static int codePointCount(final char[] input, final int offset, + final int count) { return UTF16.countCodePoint(input, offset, count); } /** * Mimics Java 5.0: Character.codePointCount(char[], int, int). */ - public static int codePointCount(CharSequence input, int beginIndex, - int endIndex) { - char[] array = input.toString().toCharArray(); + public static int codePointCount(final CharSequence input, + final int beginIndex, final int endIndex) { + final char[] array = input.toString().toCharArray(); return codePointCount(array, beginIndex, endIndex); } /** * Mimics Java 5.0: Character.isHighSurrogate(char). */ - public static boolean isHighSurrogate(char ch) { + public static boolean isHighSurrogate(final char ch) { return UCharacter.isHighSurrogate(ch); } /** * Mimics Java 5.0: Character.isLetter(int). */ - public static boolean isLetter(int codePoint) { + public static boolean isLetter(final int codePoint) { return UCharacter.isLetter(codePoint); } /** * Mimics Java 5.0: Character.isSupplementaryCodePoint(int). */ - public static boolean isSupplementaryCodePoint(int codePoint) { + public static boolean isSupplementaryCodePoint(final int codePoint) { return UCharacter.isSupplementaryCodePoint(codePoint); } /** * Mimics Java 5.0: String(int[], int, int). */ - public static String newString(int[] codePoints, int offset, int count) { + public static String newString(final int[] codePoints, final int offset, + final int count) { return UTF16.newString(codePoints, offset, count); } Modified: trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -382,7 +382,7 @@ */ private XMLCharacter() { } - private static boolean isInClass(char[] charArray, char c) { + private static boolean isInClass(final char[] charArray, final char c) { for (int i = 0; i < charArray.length; i += 2) { if (c >= charArray[i] && c <= charArray[i + 1]) { return true; @@ -391,27 +391,27 @@ return false; } - public static boolean isBaseChar(char c) { + public static boolean isBaseChar(final char c) { return isInClass(BASE_CHAR, c); } - public static boolean isIdeographic(char c) { + public static boolean isIdeographic(final char c) { return isInClass(IDEOGRAPHIC, c); } - public static boolean isCombiningChar(char c) { + public static boolean isCombiningChar(final char c) { return isInClass(COMBINING_CHAR, c); } - public static boolean isDigit(char c) { + public static boolean isDigit(final char c) { return isInClass(DIGIT, c); } - public static boolean isExtender(char c) { + public static boolean isExtender(final char c) { return isInClass(EXTENDER, c); } - public static boolean isLetter(char c) { + public static boolean isLetter(final char c) { if (isBaseChar(c)) { return true; } @@ -427,7 +427,7 @@ * http://www.w3.org/TR/REC-xml-names/#NT-NCName * @param c The character to check */ - private static boolean isNameStartChar(char c) { + private static boolean isNameStartChar(final char c) { if (isLetter(c)) { return true; } @@ -443,7 +443,7 @@ * http://www.w3.org/TR/REC-xml-names/#NT-NCNameChar * @param c The character to check */ - private static boolean isNameChar(char c) { + private static boolean isNameChar(final char c) { if (isLetter(c)) { return true; } @@ -475,7 +475,7 @@ * @pa... [truncated message content] |