foray-commit Mailing List for FOray (Page 285)
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
(4) |
Dec
(23) |
| 2026 |
Jan
(119) |
Feb
(335) |
Mar
(103) |
Apr
(43) |
May
(154) |
Jun
(107) |
Jul
(187) |
Aug
(4) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <vic...@us...> - 2006-08-27 23:55:19
|
Revision: 7840 Author: victormote Date: 2006-08-27 16:55:08 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7840&view=rev Log Message: ----------- Conform to axsl changes: Using relative instead of absolute traits. Modified Paths: -------------- trunk/foray/foray-areatree/src/java/org/foray/area/Area.java trunk/foray/foray-render/src/java/org/foray/render/PrintRenderer.java trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java Modified: trunk/foray/foray-areatree/src/java/org/foray/area/Area.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2006-08-27 23:42:57 UTC (rev 7839) +++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2006-08-27 23:55:08 UTC (rev 7840) @@ -68,38 +68,6 @@ return this.traitGeneratedBy().traitBackgroundImage(this); } - public int getPaddingTop() { - return this.traitGeneratedBy().traitPaddingTop(this); - } - - public int getPaddingLeft() { - return this.traitGeneratedBy().traitPaddingLeft(this); - } - - public int getPaddingBottom() { - return this.traitGeneratedBy().traitPaddingBottom(this); - } - - public int getPaddingRight() { - return this.traitGeneratedBy().traitPaddingRight(this); - } - - public int getBorderTopWidth() { - return this.traitGeneratedBy().traitBorderTopWidth(this); - } - - public int getBorderRightWidth() { - return this.traitGeneratedBy().traitBorderRightWidth(this); - } - - public int getBorderLeftWidth() { - return this.traitGeneratedBy().traitBorderLeftWidth(this); - } - - public int getBorderBottomWidth() { - return this.traitGeneratedBy().traitBorderBottomWidth(this); - } - public BlockContainerRA getNearestAncestorAreaContainer() { AreaNode areaNode = this.getAreaNodeParent(); while (areaNode != null && !(areaNode instanceof BlockContainerRA)) { @@ -187,20 +155,20 @@ return getPrimaryFont().getFont().getDescender(traitFontSize()); } - public Color traitBorderTopColor() { - return traitGeneratedBy().traitBorderTopColor(this); + public Color traitBorderBeforeColor() { + return traitGeneratedBy().traitBorderBeforeColor(this); } - public Color traitBorderLeftColor() { - return traitGeneratedBy().traitBorderLeftColor(this); + public Color traitBorderStartColor() { + return traitGeneratedBy().traitBorderStartColor(this); } - public Color traitBorderRightColor() { - return traitGeneratedBy().traitBorderRightColor(this); + public Color traitBorderEndColor() { + return traitGeneratedBy().traitBorderEndColor(this); } - public Color traitBorderBottomColor() { - return traitGeneratedBy().traitBorderBottomColor(this); + public Color traitBorderAfterColor() { + return traitGeneratedBy().traitBorderAfterColor(this); } public String traitFontFamily() { Modified: trunk/foray/foray-render/src/java/org/foray/render/PrintRenderer.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/PrintRenderer.java 2006-08-27 23:42:57 UTC (rev 7839) +++ trunk/foray/foray-render/src/java/org/foray/render/PrintRenderer.java 2006-08-27 23:55:08 UTC (rev 7840) @@ -62,23 +62,23 @@ final int bottom = area.traitBorderAfterWidth(); // If style is solid, use filled rectangles if (top != 0) { - drawRectangle(rx, ry, w, top, true, area.traitBorderTopColor(), - true, area.traitBorderTopColor()); + drawRectangle(rx, ry, w, top, true, area.traitBorderBeforeColor(), + true, area.traitBorderBeforeColor()); } if (left != 0) { drawRectangle(rx - left, ry - h - bottom, left, h + top + bottom, - true, area.traitBorderLeftColor(), - true, area.traitBorderLeftColor()); + true, area.traitBorderStartColor(), + true, area.traitBorderStartColor()); } if (right != 0) { drawRectangle(rx + w, ry - h - bottom, right, h + top + bottom, - true, area.traitBorderRightColor(), - true, area.traitBorderRightColor()); + true, area.traitBorderEndColor(), + true, area.traitBorderEndColor()); } if (bottom != 0) { drawRectangle(rx, ry - h - bottom, w, bottom, - true, area.traitBorderBottomColor(), - true, area.traitBorderBottomColor()); + true, area.traitBorderAfterColor(), + true, area.traitBorderAfterColor()); } } 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-08-27 23:42:57 UTC (rev 7839) +++ trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java 2006-08-27 23:55:08 UTC (rev 7840) @@ -450,22 +450,22 @@ if (area.traitBorderBeforeWidth() != 0) { drawLine(rx, ry, rx + w, ry, -area.traitBorderBeforeWidth(), - Constants.FOVAL_SOLID, area.traitBorderTopColor()); + Constants.FOVAL_SOLID, area.traitBorderBeforeColor()); } if (area.traitBorderStartWidth() != 0) { drawLine(rx, ry, rx, ry - h, area.traitBorderStartWidth(), - Constants.FOVAL_SOLID, area.traitBorderLeftColor()); + Constants.FOVAL_SOLID, area.traitBorderStartColor()); } if (area.traitBorderEndWidth() != 0) { drawLine(rx + w, ry, rx + w, ry - h, -area.traitBorderEndWidth(), - Constants.FOVAL_SOLID, area.traitBorderRightColor()); + Constants.FOVAL_SOLID, area.traitBorderEndColor()); } if (area.traitBorderAfterWidth() != 0) { drawLine(rx, ry - h, rx + w, ry - h, area.traitBorderAfterWidth(), - Constants.FOVAL_SOLID, area.traitBorderBottomColor()); + Constants.FOVAL_SOLID, area.traitBorderAfterColor()); } } 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-08-27 23:42:57 UTC (rev 7839) +++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2006-08-27 23:55:08 UTC (rev 7840) @@ -991,7 +991,7 @@ write(w + " 0 rlineto"); write(area.traitBorderBeforeWidth() + " setlinewidth"); write("0 setlinecap"); - useColor(area.traitBorderTopColor()); + useColor(area.traitBorderBeforeColor()); write("stroke"); } if (area.traitBorderStartWidth() != 0) { @@ -1000,7 +1000,7 @@ write("0 " + (-h) + " rlineto"); write(area.traitBorderStartWidth() + " setlinewidth"); write("0 setlinecap"); - useColor(area.traitBorderLeftColor()); + useColor(area.traitBorderStartColor()); write("stroke"); } if (area.traitBorderEndWidth() != 0) { @@ -1009,7 +1009,7 @@ write("0 " + (-h) + " rlineto"); write(area.traitBorderEndWidth() + " setlinewidth"); write("0 setlinecap"); - useColor(area.traitBorderRightColor()); + useColor(area.traitBorderEndColor()); write("stroke"); } if (area.traitBorderAfterWidth() != 0) { @@ -1018,7 +1018,7 @@ write(w + " 0 rlineto"); write(area.traitBorderAfterWidth() + " setlinewidth"); write("0 setlinecap"); - useColor(area.traitBorderBottomColor()); + useColor(area.traitBorderAfterColor()); write("stroke"); } } Modified: trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java 2006-08-27 23:42:57 UTC (rev 7839) +++ trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java 2006-08-27 23:55:08 UTC (rev 7840) @@ -311,22 +311,22 @@ if (area.traitBorderBeforeWidth() != 0) { drawLine(rx, ry, rx + w, ry, area.traitBorderBeforeWidth(), - Constants.FOVAL_SOLID, area.traitBorderTopColor()); + Constants.FOVAL_SOLID, area.traitBorderBeforeColor()); } if (area.traitBorderStartWidth() != 0) { drawLine(rx, ry, rx, ry - h, area.traitBorderStartWidth(), - Constants.FOVAL_DASHED, area.traitBorderLeftColor()); + Constants.FOVAL_DASHED, area.traitBorderStartColor()); } if (area.traitBorderEndWidth() != 0) { drawLine(rx + w, ry, rx + w, ry - h, area.traitBorderEndWidth(), - Constants.FOVAL_DASHED, area.traitBorderRightColor()); + Constants.FOVAL_DASHED, area.traitBorderEndColor()); } if (area.traitBorderAfterWidth() != 0) { drawLine(rx, ry - h, rx + w, ry - h, area.traitBorderAfterWidth(), - Constants.FOVAL_DASHED, area.traitBorderBottomColor()); + Constants.FOVAL_DASHED, area.traitBorderAfterColor()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-08-27 23:43:01
|
Revision: 7839 Author: victormote Date: 2006-08-27 16:42:57 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7839&view=rev Log Message: ----------- Remove unneeded method override. Modified Paths: -------------- trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 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-08-27 23:30:49 UTC (rev 7838) +++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2006-08-27 23:42:57 UTC (rev 7839) @@ -35,12 +35,10 @@ import org.axsl.areaR.Area; import org.axsl.areaR.BasicLinkArea; import org.axsl.areaR.BookmarkTreeArea; -import org.axsl.areaR.ExternalGraphicArea; import org.axsl.areaR.ForeignObjectArea; import org.axsl.areaR.GeneralInlineArea; import org.axsl.areaR.GraphicArea; import org.axsl.areaR.LeaderArea; -import org.axsl.areaR.LineArea; import org.axsl.areaR.PageArea; import org.axsl.areaR.SVGArea; import org.axsl.common.Constants; @@ -754,35 +752,6 @@ } /** - * Render an image area. - * - * @param area the image area to render - */ - 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(); - } - final int y = area.rrOriginY() + ploffset; - final int w = area.rrIPD(); - final int h = area.rrBPD(); - - x += w; - - final Graphic img = area.getGraphic(); - - if (img == null) { - getLogger().error("Error while loading image: area.getImage() is " - + "null"); - } else { - final Rectangle rect = new Rectangle(x, y, w, h); - drawImage(area, img, rect, null); - } - } - - /** * render an image area to PostScript * * @param area the area to render This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-08-27 23:31:00
|
Revision: 7838 Author: victormote Date: 2006-08-27 16:30:49 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7838&view=rev Log Message: ----------- Use the relative-direction methods instead of the absolute-direction methods. Modified Paths: -------------- trunk/foray/foray-render/src/java/org/foray/render/PrintRenderer.java trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.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-08-27 21:26:23 UTC (rev 7837) +++ trunk/foray/foray-render/src/java/org/foray/render/PrintRenderer.java 2006-08-27 23:30:49 UTC (rev 7838) @@ -56,10 +56,10 @@ final int rx = area.brOriginX(); final int ry = area.brOriginY(); - final int left = area.getBorderLeftWidth(); - final int right = area.getBorderRightWidth(); - final int top = area.getBorderTopWidth(); - final int bottom = area.getBorderBottomWidth(); + final int left = area.traitBorderStartWidth(); + final int right = area.traitBorderEndWidth(); + final int top = area.traitBorderBeforeWidth(); + final int bottom = area.traitBorderAfterWidth(); // If style is solid, use filled rectangles if (top != 0) { drawRectangle(rx, ry, w, top, true, area.traitBorderTopColor(), 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-08-27 21:26:23 UTC (rev 7837) +++ trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java 2006-08-27 23:30:49 UTC (rev 7838) @@ -448,23 +448,23 @@ final int w = area.brIPD(); final int h = area.brBPD(); - if (area.getBorderTopWidth() != 0) { - drawLine(rx, ry, rx + w, ry, -area.getBorderTopWidth(), + if (area.traitBorderBeforeWidth() != 0) { + drawLine(rx, ry, rx + w, ry, -area.traitBorderBeforeWidth(), Constants.FOVAL_SOLID, area.traitBorderTopColor()); } - if (area.getBorderLeftWidth() != 0) { - drawLine(rx, ry, rx, ry - h, area.getBorderLeftWidth(), + if (area.traitBorderStartWidth() != 0) { + drawLine(rx, ry, rx, ry - h, area.traitBorderStartWidth(), Constants.FOVAL_SOLID, area.traitBorderLeftColor()); } - if (area.getBorderRightWidth() != 0) { - drawLine(rx + w, ry, rx + w, ry - h, -area.getBorderRightWidth(), + if (area.traitBorderEndWidth() != 0) { + drawLine(rx + w, ry, rx + w, ry - h, -area.traitBorderEndWidth(), Constants.FOVAL_SOLID, area.traitBorderRightColor()); } - if (area.getBorderBottomWidth() != 0) { - drawLine(rx, ry - h, rx + w, ry - h, area.getBorderBottomWidth(), + if (area.traitBorderAfterWidth() != 0) { + drawLine(rx, ry - h, rx + w, ry - h, area.traitBorderAfterWidth(), Constants.FOVAL_SOLID, area.traitBorderBottomColor()); } } 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-08-27 21:26:23 UTC (rev 7837) +++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2006-08-27 23:30:49 UTC (rev 7838) @@ -1016,38 +1016,38 @@ final int w = area.crIPD(); final int h = area.crBPD(); - if (area.getBorderTopWidth() != 0) { + if (area.traitBorderBeforeWidth() != 0) { write("newpath"); write(rx + " " + ry + " M"); write(w + " 0 rlineto"); - write(area.getBorderTopWidth() + " setlinewidth"); + write(area.traitBorderBeforeWidth() + " setlinewidth"); write("0 setlinecap"); useColor(area.traitBorderTopColor()); write("stroke"); } - if (area.getBorderLeftWidth() != 0) { + if (area.traitBorderStartWidth() != 0) { write("newpath"); write(rx + " " + ry + " M"); write("0 " + (-h) + " rlineto"); - write(area.getBorderLeftWidth() + " setlinewidth"); + write(area.traitBorderStartWidth() + " setlinewidth"); write("0 setlinecap"); useColor(area.traitBorderLeftColor()); write("stroke"); } - if (area.getBorderRightWidth() != 0) { + if (area.traitBorderEndWidth() != 0) { write("newpath"); write((rx + w) + " " + ry + " M"); write("0 " + (-h) + " rlineto"); - write(area.getBorderRightWidth() + " setlinewidth"); + write(area.traitBorderEndWidth() + " setlinewidth"); write("0 setlinecap"); useColor(area.traitBorderRightColor()); write("stroke"); } - if (area.getBorderBottomWidth() != 0) { + if (area.traitBorderAfterWidth() != 0) { write("newpath"); write(rx + " " + (ry - h) + " M"); write(w + " 0 rlineto"); - write(area.getBorderBottomWidth() + " setlinewidth"); + write(area.traitBorderAfterWidth() + " setlinewidth"); write("0 setlinecap"); useColor(area.traitBorderBottomColor()); write("stroke"); Modified: trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java 2006-08-27 21:26:23 UTC (rev 7837) +++ trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java 2006-08-27 23:30:49 UTC (rev 7838) @@ -309,23 +309,23 @@ final int w = area.crIPD(); final int h = area.crBPD(); - if (area.getBorderTopWidth() != 0) { - drawLine(rx, ry, rx + w, ry, area.getBorderTopWidth(), + if (area.traitBorderBeforeWidth() != 0) { + drawLine(rx, ry, rx + w, ry, area.traitBorderBeforeWidth(), Constants.FOVAL_SOLID, area.traitBorderTopColor()); } - if (area.getBorderLeftWidth() != 0) { - drawLine(rx, ry, rx, ry - h, area.getBorderLeftWidth(), + if (area.traitBorderStartWidth() != 0) { + drawLine(rx, ry, rx, ry - h, area.traitBorderStartWidth(), Constants.FOVAL_DASHED, area.traitBorderLeftColor()); } - if (area.getBorderRightWidth() != 0) { - drawLine(rx + w, ry, rx + w, ry - h, area.getBorderRightWidth(), + if (area.traitBorderEndWidth() != 0) { + drawLine(rx + w, ry, rx + w, ry - h, area.traitBorderEndWidth(), Constants.FOVAL_DASHED, area.traitBorderRightColor()); } - if (area.getBorderBottomWidth() != 0) { - drawLine(rx, ry - h, rx + w, ry - h, area.getBorderBottomWidth(), + if (area.traitBorderAfterWidth() != 0) { + drawLine(rx, ry - h, rx + w, ry - h, area.traitBorderAfterWidth(), Constants.FOVAL_DASHED, area.traitBorderBottomColor()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-08-27 21:26:29
|
Revision: 7837 Author: victormote Date: 2006-08-27 14:26:23 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7837&view=rev Log Message: ----------- Conform to axsl change. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableColumn.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-08-27 19:28:25 UTC (rev 7836) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-08-27 21:26:23 UTC (rev 7837) @@ -588,13 +588,6 @@ /** * {@inheritDoc} */ - public double traitColumnWidthTableUnits() { - return propertyList.getColumnWidthTableUnits(); - } - - /** - * {@inheritDoc} - */ public short traitBreakAfter(final FOContext context) { return propertyList.getBreakAfter(context); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableColumn.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableColumn.java 2006-08-27 19:28:25 UTC (rev 7836) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableColumn.java 2006-08-27 21:26:23 UTC (rev 7837) @@ -107,4 +107,11 @@ return factory.makeProxy(this); } + /** + * {@inheritDoc} + */ + public double traitColumnWidthTableUnits() { + return propertyList.getColumnWidthTableUnits(); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-08-27 19:28:30
|
Revision: 7836 Author: victormote Date: 2006-08-27 12:28:25 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7836&view=rev Log Message: ----------- Conform to some minor axsl changes. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GlyphOrientation.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/SwitchTo.java 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-08-21 00:21:41 UTC (rev 7835) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GlyphOrientation.java 2006-08-27 19:28:25 UTC (rev 7836) @@ -91,7 +91,7 @@ switch (keyword) { case Constants.FOVAL_AUTO: { // AUTO only applies to glyph-orientation-vertical - return -1; + return Short.MIN_VALUE; } case Constants.FOVAL_INHERIT: { return getValueNoInstance(context, fobj, axis); 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-08-21 00:21:41 UTC (rev 7835) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphLadderCount.java 2006-08-27 19:28:25 UTC (rev 7836) @@ -38,7 +38,7 @@ public class HyphLadderCount extends Property { - public static final int NO_LIMIT_VALUE = 2147483647; + public static final int NO_LIMIT_VALUE = Integer.MAX_VALUE; private static final short[] validKeywords = { Constants.FOVAL_NO_LIMIT, Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/SwitchTo.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/SwitchTo.java 2006-08-21 00:21:41 UTC (rev 7835) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/SwitchTo.java 2006-08-27 19:28:25 UTC (rev 7836) @@ -41,7 +41,7 @@ private static final short[] validKeywords = { Constants.FOVAL_XSL_PRECEDING, Constants.FOVAL_XSL_FOLLOWING, - Constants.FOVAL_ANY, + Constants.FOVAL_XSL_ANY, }; public SwitchTo(final PropertyList propertyList, final short enumeration, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-08-21 00:21:49
|
Revision: 7835 Author: victormote Date: 2006-08-20 17:21:41 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7835&view=rev Log Message: ----------- Change the table-layout property return value from an int to a short. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TableLayout.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-08-21 00:20:42 UTC (rev 7834) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-08-21 00:21:41 UTC (rev 7835) @@ -1095,7 +1095,7 @@ /** * {@inheritDoc} */ - public int traitTableLayout() { + public short traitTableLayout() { return propertyList.getTableLayout(); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2006-08-21 00:20:42 UTC (rev 7834) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2006-08-21 00:21:41 UTC (rev 7835) @@ -1544,7 +1544,7 @@ return property.getValue(context, fobj); } - public int getTableLayout() { + public short getTableLayout() { final TableLayout property = (TableLayout) getProperty(Constants .FOPROP_TABLE_LAYOUT); if (property == null) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TableLayout.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TableLayout.java 2006-08-21 00:20:42 UTC (rev 7834) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TableLayout.java 2006-08-21 00:21:41 UTC (rev 7835) @@ -56,14 +56,14 @@ throw unexpectedValue(value, propertyList); } - public int getValue() { + public short getValue() { if (this.value instanceof PropertyKeyword) { return ((PropertyKeyword) this.value).getValue(); } return getValueNoInstance(); } - public static int getValueNoInstance() { + public static short getValueNoInstance() { return Constants.FOVAL_AUTO; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-08-21 00:20:49
|
Revision: 7834 Author: victormote Date: 2006-08-20 17:20:42 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7834&view=rev Log Message: ----------- Use the constant instead of describing it. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtSpace.java 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-08-19 22:19:46 UTC (rev 7833) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtSpace.java 2006-08-21 00:20:42 UTC (rev 7834) @@ -35,8 +35,7 @@ */ public class DtSpace extends Datatype { - /* Set to the maximum integer value. */ - public static final int PRECEDENCE_FORCE = 2147483647; + public static final int PRECEDENCE_FORCE = Integer.MAX_VALUE; public static final short[] CONDITIONALITY_KEYWORDS = { Constants.FOVAL_DISCARD, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-08-19 22:19:54
|
Revision: 7833 Author: victormote Date: 2006-08-19 15:19:46 -0700 (Sat, 19 Aug 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7833&view=rev Log Message: ----------- Remove unneeded comment. Modified Paths: -------------- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPathPaint.java 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 23:52:22 UTC (rev 7832) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPathPaint.java 2006-08-19 22:19:46 UTC (rev 7833) @@ -29,12 +29,10 @@ public abstract class PDFPathPaint extends PDFObject implements org.axsl.pdfW.PDFPathPaint { - // protected int colorspace = 0; //default is 0:RGB, not 1:CMYK protected ColorSpace colorSpace; public PDFPathPaint(final PDFDocument doc) { super(doc); - } public PDFPathPaint() { 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: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. |