foray-commit Mailing List for FOray (Page 286)
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-07-23 17:20:38
|
Revision: 7815 Author: victormote Date: 2006-07-23 10:19:43 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7815&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractFlow.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractTableBody.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BasicLink.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Bookmark.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTree.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ColorProfile.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Declarations.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Float.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Footnote.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FootnoteBody.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InitialPropertySet.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListBlock.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemBody.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemLabel.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Marker.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiCase.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiProperties.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiPropertySet.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiSwitch.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiToggle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageMasterReference.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumber.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberCitation.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberGenerator.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequence.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequenceMaster.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Region.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionAfter.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionBefore.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionBody.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionEnd.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionStart.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RepeatablePMAlternatives.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RepeatablePMReference.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RetrieveMarker.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Root.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SimplePageMaster.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SinglePageMasterReference.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/StaticContent.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Table.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableAndCaption.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableBody.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCaption.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCell.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableColumn.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableFooter.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableHeader.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableRow.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Title.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Wrapper.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractFlow.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractFlow.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractFlow.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -32,8 +32,9 @@ public abstract class AbstractFlow extends FObj { - protected AbstractFlow(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + protected AbstractFlow(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); if (! (parent instanceof PageSequence)) { throwException(getFullName() + " must be child of " @@ -42,7 +43,7 @@ } protected void start() throws FOTreeException { - String name = traitFlowName(); + final String name = traitFlowName(); if (name == null || name.equals("")) { throwException(getFullName() + "requires a 'flow-name'."); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractTableBody.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractTableBody.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractTableBody.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -33,8 +33,9 @@ public abstract class AbstractTableBody extends FObj implements org.axsl.foR.fo.AbstractTableBody { - public AbstractTableBody(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public AbstractTableBody(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); if (! (parent instanceof Table)) { throwException(getFullName() + " must be child of fo:table."); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BasicLink.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BasicLink.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BasicLink.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -33,8 +33,9 @@ public class BasicLink extends Inline implements org.axsl.foR.fo.BasicLink { - public BasicLink(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public BasicLink(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -66,7 +67,7 @@ /** * Override the FONode method, because "this" is the object being sought. */ - public org.axsl.foR.fo.BasicLink getBasicLink(FOContext context) { + public org.axsl.foR.fo.BasicLink getBasicLink(final FOContext context) { return this; } @@ -118,7 +119,7 @@ /** * {@inheritDoc} */ - public String refIdNeeded(FOContext context) { + public String refIdNeeded(final FOContext context) { return traitInternalDestination(); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -37,8 +37,9 @@ public class BidiOverride extends FObj implements org.axsl.foR.fo.BidiOverride { - public BidiOverride(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public BidiOverride(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -54,7 +55,7 @@ return true; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -42,8 +42,9 @@ public class Block extends FObjMixed implements org.axsl.foR.fo.Block { - public Block(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public Block(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -58,7 +59,7 @@ /** * Overrides the method in FObj, because this is the containing block. */ - public org.axsl.foR.fo.Block getContainingBlock(FOContext context) { + public org.axsl.foR.fo.Block getContainingBlock(final FOContext context) { return this; } @@ -98,9 +99,9 @@ * @return The List of this block's logical blocks, as defined. */ public List getLogicalBlocks() { - ArrayList outsideList = new ArrayList(); + final ArrayList outsideList = new ArrayList(); ArrayList insideList = new ArrayList(); - Stack stack = new Stack(); + final Stack stack = new Stack(); /* * Place the children on the stack in reverse order (last item on the * bottom, first on the top). @@ -109,13 +110,13 @@ stack.push(getChildren().get(i)); } while (! stack.isEmpty()) { - FONode node = (FONode) stack.pop(); + final FONode node = (FONode) stack.pop(); // FOText is always a leaf. Include in list. if (node instanceof FOText) { insideList.add(node); continue; } - FObj fobj = (FObj) node; + final FObj fobj = (FObj) node; /* Block-type content is a special case. Include it in list instead * of its descendants. */ if (fobj.isContentBlock()) { @@ -126,7 +127,7 @@ outsideList.add(node); continue; } - List children = fobj.getChildren(); + final List children = fobj.getChildren(); // If there are no children, it is a leaf. Include in list. if (children == null || children.size() < 1) { insideList.add(node); @@ -151,7 +152,7 @@ return true; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -35,8 +35,9 @@ public class BlockContainer extends FObj implements org.axsl.foR.fo.BlockContainer { - public BlockContainer(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public BlockContainer(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -61,7 +62,7 @@ return true; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Bookmark.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Bookmark.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Bookmark.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -38,8 +38,9 @@ * An fo:bookmark object in XSL-FO. */ public class Bookmark extends FObj implements org.axsl.foR.fo.Bookmark { - public Bookmark(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public Bookmark(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); /* * Validate that this is a child of either fo:bookmark-tree or @@ -53,12 +54,12 @@ } public void start() throws FOTreeException { - String _internalDestination = this.traitInternalDestination(); + final String _internalDestination = this.traitInternalDestination(); if (_internalDestination == null || _internalDestination.equals("")) { getLogger().warn(getFullName() + "requires an internal-destination."); } - String _externalDestination = this.traitExternalDestination(); + final String _externalDestination = this.traitExternalDestination(); if (_externalDestination != null &&!_externalDestination.equals("")) { getLogger().warn(getFullName() + "external-destination not supported currently."); @@ -75,7 +76,7 @@ } // Validate that all other children are Outline instances. for (int i = 1; i < children.size(); i++) { - FObj child = (FObj) children.get(i); + final FObj child = (FObj) children.get(i); if (child instanceof BookmarkTitle) { throwException("Child fo:bookmark-title not allowed in this " + "position."); @@ -87,7 +88,7 @@ } } - public Bookmark getParentOutline(FOContext context) { + public Bookmark getParentOutline(final FOContext context) { for (FONode node = (FONode) getParent(); node != null; node = node.effectiveParent(context)) { if (node instanceof Bookmark) { @@ -113,11 +114,11 @@ /** * {@inheritDoc} */ - public String refIdNeeded(FOContext context) { + public String refIdNeeded(final FOContext context) { return traitInternalDestination(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -40,8 +40,9 @@ public class BookmarkTitle extends FObjMixed implements org.axsl.foR.fo.BookmarkTitle { - public BookmarkTitle(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public BookmarkTitle(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -82,7 +83,7 @@ return false; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTree.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTree.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTree.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -38,8 +38,9 @@ public class BookmarkTree extends FObj implements org.axsl.foR.fo.BookmarkTree { - public BookmarkTree(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public BookmarkTree(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); // Validate that this is a child of fo:root. if (! (parent instanceof Root)) { @@ -50,7 +51,7 @@ public void end() throws FOTreeException { // Validate that all children are Bookmark instances. for (int i = 1; i < children.size(); i++) { - FObj child = (FObj) children.get(i); + final FObj child = (FObj) children.get(i); if (! (child instanceof Bookmark)) { throwException(child.getFullName() + " cannot be child of " + this.getFullName()); @@ -66,7 +67,7 @@ return this.getFOTreeBuilder().getFONamespace(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -39,8 +39,9 @@ */ public class Character extends FObj implements org.axsl.foR.fo.Character { - public Character(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public Character(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -57,24 +58,24 @@ } public void start() throws FOTreeException { - char c = traitCharacter(); + final char c = traitCharacter(); if (c == org.foray.fotree.fo.prop.Character.CHARACTER_NOT_SPECIFIED) { throwException("Property \"character\" is required."); } /* This is a duplication of data, but is deemed acceptable at the * moment, because it is expected that use of fo:character will normally * be very limited. */ - char[] chars = new char[] {c}; - FOText text = new FOText(this, chars); + final char[] chars = new char[] {c}; + final FOText text = new FOText(this, chars); super.addChild(text); } - public char[] getAreaTreeText(FOContext context) { - FOText text = (FOText) this.children.get(0); + public char[] getAreaTreeText(final FOContext context) { + final FOText text = (FOText) this.children.get(0); return text.getAreaTreeText(context); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ColorProfile.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ColorProfile.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ColorProfile.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -36,8 +36,9 @@ public class ColorProfile extends FObj implements org.axsl.foR.fo.ColorProfile { - public ColorProfile(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public ColorProfile(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); logWarning(getFullName() + " not implemented."); } @@ -50,7 +51,7 @@ return this.getFOTreeBuilder().getFONamespace(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -41,9 +41,9 @@ */ public class ConditionalPageMasterReference extends FObj { - public ConditionalPageMasterReference(FObj parent, - PropertyList propertyList, String systemId, int line, int column) - throws FOTreeException { + public ConditionalPageMasterReference(final FObj parent, + final PropertyList propertyList, final String systemId, + final int line, final int column) throws FOTreeException { super(parent, propertyList, systemId, line, column); /* Validate ancestry. */ if (! (parent instanceof RepeatablePMAlternatives)) { @@ -73,9 +73,9 @@ return (RepeatablePMAlternatives) this.parentFO(); } - protected boolean isValid(boolean isOddPage, boolean isFirstPage, - boolean isEmptyPage) { - int pagePosition = traitPagePosition(); + protected boolean isValid(final boolean isOddPage, + final boolean isFirstPage, final boolean isEmptyPage) { + final int pagePosition = traitPagePosition(); if (isFirstPage) { if (pagePosition == Constants.FOVAL_REST) { return false; @@ -124,7 +124,7 @@ return this.getFOTreeBuilder().getFONamespace(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Declarations.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Declarations.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Declarations.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -36,8 +36,9 @@ public class Declarations extends FObj implements org.axsl.foR.fo.Declarations { - public Declarations(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public Declarations(final FObj parent,final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -49,7 +50,7 @@ return this.getFOTreeBuilder().getFONamespace(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -58,8 +58,9 @@ * computations. */ protected int pixelsPerInch = 96; - public ExternalGraphic(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public ExternalGraphic(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -78,14 +79,14 @@ /** * @return The resolved Graphic instance encapsulated by this FO. */ - public Graphic getGraphic(FOContext context) { + public Graphic getGraphic(final FOContext context) { if (this.graphic == null && ! makeGraphicAttempted) { makeGraphicAttempted = true; try { this.graphic = getGraphicServer().makeGraphic(traitSrc(context), getFOTreeBuilder().getGraphicSearchPath(), getFOTreeBuilder().getCachingGraphics()); - } catch (GraphicException e) { + } catch (final GraphicException e) { getLogger().error(e.getMessage() + "\n" + this.getContextMessage()); } @@ -96,7 +97,7 @@ /** * {@inheritDoc} */ - protected int intrinsicContentWidth(FOContext context) { + protected int intrinsicContentWidth(final FOContext context) { if (getGraphic(context) == null) { return Constants.DIMENSION_AUTO; } @@ -107,7 +108,7 @@ /* Use conversion formula 1 pixel = 1/96 inch. See XSL-FO Standard * 1.0, Section 6.6.5, where this formula is suggested. */ return pixelsToMillipoints(getGraphic(context).pixelWidth(), 96); - } catch (GraphicException e) { + } catch (final GraphicException e) { return Constants.DIMENSION_AUTO; } } @@ -115,7 +116,7 @@ /** * {@inheritDoc} */ - protected int intrinsicContentHeight(FOContext context) { + protected int intrinsicContentHeight(final FOContext context) { if (getGraphic(context) == null) { return Constants.DIMENSION_AUTO; } @@ -126,20 +127,20 @@ /* Use conversion formula 1 pixel = 1/96 inch. See XSL-FO Standard * 1.0, Section 6.6.5, where this formula is suggested. */ return pixelsToMillipoints(getGraphic(context).pixelHeight(), 96); - } catch (GraphicException e) { + } catch (final GraphicException e) { return Constants.DIMENSION_AUTO; } } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } /** * {@inheritDoc} */ - public FOLineNonText getContextWrapper(FOContext context) { - org.axsl.foR.fo.Marker marker = this.ancestorMarker(); + public FOLineNonText getContextWrapper(final FOContext context) { + final org.axsl.foR.fo.Marker marker = this.ancestorMarker(); if (marker == null) { return this; } @@ -161,42 +162,45 @@ return null; } - public int inlineSizeOptimum(int lineLength) { + public int inlineSizeOptimum(final int lineLength) { return inlineSizeOptimum(null, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeOptimum(FOContext context, int lineLength) { + public int inlineSizeOptimum(final FOContext context, + final int lineLength) { return this.viewportIPD(context, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMinimum(int lineLength) { + public int inlineSizeMinimum(final int lineLength) { return inlineSizeMinimum(null, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMinimum(FOContext context, int lineLength) { + public int inlineSizeMinimum(final FOContext context, + final int lineLength) { return this.viewportIPD(context, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMaximum(int lineLength) { + public int inlineSizeMaximum(final int lineLength) { return inlineSizeMaximum(null, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMaximum(FOContext context, int lineLength) { + public int inlineSizeMaximum(final FOContext context, + final int lineLength) { return this.viewportIPD(context, lineLength); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Float.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Float.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Float.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -36,8 +36,9 @@ */ public class Float extends FObj implements org.axsl.foR.fo.Float { - public Float(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public Float(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -61,7 +62,7 @@ return true; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -35,8 +35,9 @@ public class Flow extends AbstractFlow implements org.axsl.foR.fo.Flow { - public Flow(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public Flow(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -49,7 +50,7 @@ for (int i = 0; i < getChildren().size(); i++) { /* Cast to FObj should be OK, because it is not possible to create * an FOText item whose parent is anything but an FObjMixed. */ - FObj child = (FObj) getChildren().get(i); + final FObj child = (FObj) getChildren().get(i); if (child.isContentBlock()) { anyBlockContent = true; continue; @@ -79,11 +80,11 @@ * Overrides the method in FObj, because this is the object being sought. * @return this, because this is the ancestor flow object. */ - public org.axsl.foR.fo.Flow getFlow(FOContext context) { + public org.axsl.foR.fo.Flow getFlow(final FOContext context) { return this; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Footnote.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Footnote.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Footnote.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -35,8 +35,9 @@ public class Footnote extends FObj implements org.axsl.foR.fo.Footnote { - public Footnote(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public Footnote(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -79,7 +80,7 @@ return (FootnoteBody) this.children.get(1); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FootnoteBody.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FootnoteBody.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FootnoteBody.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -36,8 +36,9 @@ public class FootnoteBody extends FObj implements org.axsl.foR.fo.FootnoteBody { - public FootnoteBody(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public FootnoteBody(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -49,7 +50,7 @@ return this.getFOTreeBuilder().getFONamespace(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InitialPropertySet.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InitialPropertySet.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InitialPropertySet.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -37,8 +37,9 @@ public class InitialPropertySet extends FObj implements org.axsl.foR.fo.InitialPropertySet { - public InitialPropertySet(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public InitialPropertySet(final FObj parent, + final PropertyList propertyList, final String systemId, + final int line, final int column) throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -50,7 +51,7 @@ return this.getFOTreeBuilder().getFONamespace(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -36,8 +36,9 @@ public class Inline extends FObjMixed implements org.axsl.foR.fo.Inline { - public Inline(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public Inline(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); if (parent instanceof Flow) { throwException(getFullName() + " cannot be child of fo:flow."); @@ -63,7 +64,7 @@ return true; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -37,8 +37,9 @@ public class InlineContainer extends FObj implements org.axsl.foR.fo.InlineContainer { - public InlineContainer(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public InlineContainer(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -59,7 +60,7 @@ return true; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -40,8 +40,9 @@ public class InstreamForeignObject extends FObjScaled implements org.axsl.foR.fo.InstreamForeignObject { - public InstreamForeignObject(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public InstreamForeignObject(final FObj parent, + final PropertyList propertyList, final String systemId, + final int line, final int column) throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -78,26 +79,26 @@ /** * {@inheritDoc} */ - protected int intrinsicContentWidth(FOContext context) { + protected int intrinsicContentWidth(final FOContext context) { return ((ForeignXML) getForeignXML()).intrinsicContentWidth(); } /** * {@inheritDoc} */ - protected int intrinsicContentHeight(FOContext context) { + protected int intrinsicContentHeight(final FOContext context) { return ((ForeignXML) getForeignXML()).intrinsicContentHeight(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } /** * {@inheritDoc} */ - public FOLineNonText getContextWrapper(FOContext context) { - org.axsl.foR.fo.Marker marker = this.ancestorMarker(); + public FOLineNonText getContextWrapper(final FOContext context) { + final org.axsl.foR.fo.Marker marker = this.ancestorMarker(); if (marker == null) { return this; } @@ -119,42 +120,45 @@ return null; } - public int inlineSizeOptimum(int lineLength) { + public int inlineSizeOptimum(final int lineLength) { return inlineSizeOptimum(null, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeOptimum(FOContext context, int lineLength) { + public int inlineSizeOptimum(final FOContext context, + final int lineLength) { return this.viewportIPD(context, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMinimum(int lineLength) { + public int inlineSizeMinimum(final int lineLength) { return inlineSizeMinimum(null, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMinimum(FOContext context, int lineLength) { + public int inlineSizeMinimum(final FOContext context, + final int lineLength) { return this.viewportIPD(context, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMaximum(int lineLength) { + public int inlineSizeMaximum(final int lineLength) { return inlineSizeMaximum(null, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMaximum(FOContext context, int lineLength) { + public int inlineSizeMaximum(final FOContext context, + final int lineLength) { return this.viewportIPD(context, lineLength); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -52,8 +52,9 @@ */ private HashMap regionMap; - public LayoutMasterSet(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public LayoutMasterSet(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); if (! (parent instanceof Root)) { throwException(getFullName() + " must be child of fo:root."); @@ -67,7 +68,7 @@ return "layout-master-set"; } - protected void addSimplePageMaster(SimplePageMaster simplePageMaster) + protected void addSimplePageMaster(final SimplePageMaster simplePageMaster) throws FOTreeException { // check against duplication of master-name if (existsName(simplePageMaster.traitMasterName())) { @@ -80,12 +81,12 @@ simplePageMaster); } - public SimplePageMaster getSimplePageMaster(String masterName) { + public SimplePageMaster getSimplePageMaster(final String masterName) { return (SimplePageMaster)this.simplePageMasters.get(masterName); } - protected void addPageSequenceMaster(String masterName, - PageSequenceMaster pageSequenceMaster) + protected void addPageSequenceMaster(final String masterName, + final PageSequenceMaster pageSequenceMaster) throws FOTreeException { // check against duplication of master-name if (existsName(masterName)) { @@ -96,11 +97,11 @@ this.pageSequenceMasters.put(masterName, pageSequenceMaster); } - public PageSequenceMaster getPageSequenceMaster(String masterName) { + public PageSequenceMaster getPageSequenceMaster(final String masterName) { return (PageSequenceMaster)this.pageSequenceMasters.get(masterName); } - private boolean existsName(String masterName) { + private boolean existsName(final String masterName) { if (simplePageMasters.containsKey(masterName) || pageSequenceMasters.containsKey(masterName)) { return true; @@ -114,8 +115,8 @@ * @return True iff at least one region in this layout-master-set has its * region-name matching regionName. */ - protected boolean regionNameExists(String regionName) { - String regionClass = (String) this.regionMap.get(regionName); + protected boolean regionNameExists(final String regionName) { + final String regionClass = (String) this.regionMap.get(regionName); return (regionClass != null); } @@ -123,7 +124,7 @@ return this.getFOTreeBuilder().getFONamespace(); } - public org.axsl.foR.fo.Root getRoot(FOContext context) { + public org.axsl.foR.fo.Root getRoot(final FOContext context) { // Cast verified at construction. return (org.axsl.foR.fo.Root) this.getParent(); } @@ -138,15 +139,15 @@ * @return The region-class for regionName, or null if the region-name has * not yet been registered. */ - public String getRegionClass(String regionName) { + public String getRegionClass(final String regionName) { return (String) regionMap.get(traitRegionName()); } - protected void registerRegionName(Region region) { + protected void registerRegionName(final Region region) { regionMap.put(region.traitRegionName(), region.getName()); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -44,8 +44,9 @@ public class Leader extends FObjMixed implements org.axsl.foR.fo.Leader { - public Leader(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public Leader(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -53,7 +54,7 @@ /* Using a null context here is OK, because we are not computing * a length to be used anywhere, only testing the relative values of * the min, max, and optimum. */ - FOContext context = null; + final FOContext context = null; final int testConstant = 1000000; if (traitLeaderLengthMin(context, testConstant) > traitLeaderLengthOpt(context, testConstant)) { @@ -82,8 +83,8 @@ /** * {@inheritDoc} */ - public FOLineNonText getContextWrapper(FOContext context) { - org.axsl.foR.fo.Marker marker = this.ancestorMarker(); + public FOLineNonText getContextWrapper(final FOContext context) { + final org.axsl.foR.fo.Marker marker = this.ancestorMarker(); if (marker == null) { return this; } @@ -105,34 +106,37 @@ return null; } - public int inlineSizeOptimum(int lineLength) { + public int inlineSizeOptimum(final int lineLength) { return traitLeaderLengthOpt(null, lineLength); } - public int inlineSizeOptimum(FOContext context, int lineLength) { + public int inlineSizeOptimum(final FOContext context, + final int lineLength) { return traitLeaderLengthOpt(context, lineLength); } - public int inlineSizeMinimum(int lineLength) { + public int inlineSizeMinimum(final int lineLength) { return traitLeaderLengthMin(null, lineLength); } - public int inlineSizeMinimum(FOContext context, int lineLength) { + public int inlineSizeMinimum(final FOContext context, + final int lineLength) { return traitLeaderLengthMin(context, lineLength); } - public int inlineSizeMaximum(int lineLength) { + public int inlineSizeMaximum(final int lineLength) { return traitLeaderLengthMax(null, lineLength); } - public int inlineSizeMaximum(FOContext context, int lineLength) { + public int inlineSizeMaximum(final FOContext context, + final int lineLength) { return traitLeaderLengthMax(context, lineLength); } /** * Overrides FObj method, because this is the Leader being sought. */ - public org.axsl.foR.fo.Leader getNearestLeader(FOContext context) { + public org.axsl.foR.fo.Leader getNearestLeader(final FOContext context) { return this; } @@ -147,7 +151,7 @@ return true; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListBlock.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListBlock.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListBlock.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -34,8 +34,9 @@ public class ListBlock extends FObj implements org.axsl.foR.fo.ListBlock { - public ListBlock(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public ListBlock(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -56,7 +57,7 @@ this.throwException("fo:list-block must have at least one child."); } for (int i = 0; i < this.getChildren().size(); i++) { - FObj fobj = (FObj) this.getChildAt(i); + final FObj fobj = (FObj) this.getChildAt(i); if (! (fobj instanceof ListItem)) { this.throwException("Child of fo:list-block must be " + "fo:list-item", fobj.getContextMessage()); @@ -64,7 +65,7 @@ } } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -35,8 +35,9 @@ public class ListItem extends FObj implements org.axsl.foR.fo.ListItem { - public ListItem(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public ListItem(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -57,7 +58,8 @@ /** * Override the FObj method, because this is a ListItem instance. */ - public org.axsl.foR.fo.ListItem getNearestListItem(FOContext context) { + public org.axsl.foR.fo.ListItem getNearestListItem( + final FOContext context) { return this; } @@ -69,7 +71,7 @@ return this.getFOTreeBuilder().getFONamespace(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemBody.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemBody.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemBody.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -36,8 +36,9 @@ public class ListItemBody extends FObj implements org.axsl.foR.fo.ListItemBody { - public ListItemBody(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public ListItemBody(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -53,11 +54,12 @@ * Overrides the FObj method, because this is the object that is being * sought. */ - public org.axsl.foR.FObj ancestorListRelatedObject(FOContext context) { + public org.axsl.foR.FObj ancestorListRelatedObject( + final FOContext context) { return this; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemLabel.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemLabel.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemLabel.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -37,8 +37,9 @@ public class ListItemLabel extends FObj implements org.axsl.foR.fo.ListItemLabel { - public ListItemLabel(FObj parent, PropertyList propertyList, - String systemId, int line, int column) throws FOTreeException { + public ListItemLabel(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -54,11 +55,12 @@ * Overrides the FObj method, because this is the object that is being * sought. */ - public org.axsl.foR.FObj ancestorListRelatedObject(FOContext context) { + public org.axsl.foR.FObj ancestorListRelatedObject( + final FOContext context) { return this; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Marker.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Marker.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Marker.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -39,17 +39,18 @@ public class Marker extends FObjMixed implements org.axsl.foR.fo.Marker { - public Marker(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public Marker(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); // Validate that we are inside an fo:flow. if (getFlow(null) == null) { throwException(getFullName() + " must be descendant of fo:flow."); } // Validate that there is not content before this and other markers. - List siblings = realParent().getChildren(); + final List siblings = realParent().getChildren(); for (int i = 0; i < siblings.size(); i++) { - FONode sibling = (FONode) siblings.get(i); + final FONode sibling = (FONode) siblings.get(i); if ((sibling instanceof Marker) || (sibling instanceof FOText && ((FOText) sibling).isAllWhiteSpace())) { @@ -62,12 +63,12 @@ public void start() throws FOTreeException { // Make sure that no sibling marker has the same 'marker-class-name'. - List siblings = realParent().getChildren(); + final List siblings = realParent().getChildren(); for (int i = 0; i < siblings.size(); i++) { if (! (siblings.get(i) instanceof Marker)) { continue; } - Marker siblingMarker = (Marker) siblings.get(i); + final Marker siblingMarker = (Marker) siblings.get(i); /* * Since this is already registered as a child of parent, we must * exclude it from the test. @@ -99,7 +100,7 @@ return true; } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiCase.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiCase.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiCase.java 2006-07-23 17:19:43 UTC (rev 7815) @@ -37,8 +37,9 @@ */ public class MultiCase extends FObj implements org.axsl.foR.fo.MultiCase { - public MultiCase(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + public MultiCase(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { super(parent, propertyList, systemId, line, column); } @@ -50,7 +51,7 @@ return this.getFOTreeBuilder().getFONamespace(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiProperties.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiProperties.java 2006-07-23 14:56:47 UTC (rev 7814) +++ trunk/foray/foray-fotree/src/j... [truncated message content] |
|
From: <vic...@us...> - 2006-07-23 14:57:47
|
Revision: 7814 Author: victormote Date: 2006-07-23 07:56:47 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7814&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-fotree/.project trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontFamily.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSize.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSizeAdjust.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStretch.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStyle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontVariant.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontWeight.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ForcePageCount.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Format.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GlyphOrientation.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GroupingSize.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphLadderCount.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphPushCharCount.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphRemainCharCount.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Id.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Indent.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InitialPageNumber.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InternalDestination.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Keep.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Language.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LastLineEndIndent.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LeaderLength.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LeaderPatternWidth.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LetterSpacing.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LineHeight.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Margin.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/MaximumRepeats.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Name.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/NumberColumnsRepeated.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/NumberColumnsSpanned.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/NumberRowsSpanned.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Orphans.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Padding.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/PageDimension.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Pause.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Pitch.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/PlayDuring.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ProvDistanceBetween.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ProvLabelSeparation.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RefId.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RegionName.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeDimension.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeSpace.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Role.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RuleThickness.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Script.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Size.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/SourceDocument.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/SpeechRate.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Src.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/SwitchTo.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TableLayout.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TargetPresentationContext.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TargetProcessingContext.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TargetStylesheet.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextAlign.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextAlignLast.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextAltitude.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextDecoration.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextDepth.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextIndent.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextShadow.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TreatAsWordSpace.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/VerticalAlign.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/VoiceFamily.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Volume.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Widows.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/WordSpacing.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/WritingMode.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ZIndex.java Modified: trunk/foray/foray-fotree/.project =================================================================== --- trunk/foray/foray-fotree/.project 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/.project 2006-07-23 14:56:47 UTC (rev 7814) @@ -10,8 +10,14 @@ <arguments> </arguments> </buildCommand> + <buildCommand> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <arguments> + </arguments> + </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> </natures> </projectDescription> Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontFamily.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontFamily.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontFamily.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -55,30 +55,30 @@ Constants.FOVAL_INHERIT, }; - public FontFamily(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public FontFamily(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public FontFamily(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public FontFamily(final PropertyList propertyList, final short enumeration, + final PropertyValue value) throws PropertyException { super(propertyList, enumeration, value); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyValue pv = checkKeywords(value); + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } return new DtString(value); } - public String[] getValue(FOContext context, FObj fobj) { + public String[] getValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getValueNoInstance(context, fobj); @@ -88,23 +88,24 @@ case Constants.FOVAL_CURSIVE: case Constants.FOVAL_FANTASY: case Constants.FOVAL_MONOSPACE: { - String[] returnArray + final String[] returnArray = {Constants.propertyKeywordValues[keyword]}; return returnArray; } } } if (this.value instanceof DtString) { - DtString stringDT = (DtString) this.value; - String[] returnArray = FontUtility.foFontFamily( + final DtString stringDT = (DtString) this.value; + final String[] returnArray = FontUtility.foFontFamily( stringDT.getValue()); return returnArray; } return DEFAULT_FONT_FAMILY; } - public static String[] getValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static String[] getValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent != null) { return parent.traitFontFamily(context); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSize.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSize.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSize.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -70,20 +70,20 @@ 20700, }; - public FontSize(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public FontSize(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public FontSize(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public FontSize(final PropertyList propertyList, final short enumeration, + final PropertyValue value) throws PropertyException { super(propertyList, enumeration, value); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -100,9 +100,9 @@ throw unexpectedValue(value, propertyList); } - public int getValue(FOContext context, FObj fobj) { + public int getValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getBaseFontSize(context, fobj); @@ -137,12 +137,12 @@ } } if (this.value instanceof DtLength) { - DtLength length = (DtLength) this.value; + final DtLength length = (DtLength) this.value; return length.getValue(getBaseFontSize(context, fobj), 0); } if (this.value instanceof DtPercentage) { - DtPercentage percentageDT = (DtPercentage) this.value; - float percentage = percentageDT.getValue(); + final DtPercentage percentageDT = (DtPercentage) this.value; + final float percentage = percentageDT.getValue(); return Math.round(percentage * getBaseFontSize(context, fobj) / 100); } @@ -153,16 +153,18 @@ return getBaseFontSize(context, fobj); } - public static int getValueNoInstance(FOContext context, FObj fobj) { + public static int getValueNoInstance(final FOContext context, + final FObj fobj) { return getBaseFontSize(context, fobj); } - private static int getBaseFontSize(FOContext context, FObj fobj) { + private static int getBaseFontSize(final FOContext context, + final FObj fobj) { /* * The base font size comes from the parent object, and is needed * for "em" and percentage computations. */ - FObj parent = fobj.effectiveParent(context); + final FObj parent = fobj.effectiveParent(context); int baseFontSize = getDefaultFontSize(); if (parent != null) { baseFontSize = parent.traitFontSize(context); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSizeAdjust.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSizeAdjust.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSizeAdjust.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -43,20 +43,22 @@ Constants.FOVAL_INHERIT, }; - public FontSizeAdjust(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public FontSizeAdjust(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public FontSizeAdjust(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public FontSizeAdjust(final PropertyList propertyList, + final short enumeration, + final PropertyValue value) throws PropertyException { super(propertyList, enumeration, value); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -68,12 +70,12 @@ throw unexpectedValue(value, propertyList); } - public double getValue(FOContext context, FObj fobj) { + public double getValue(final FOContext context, final FObj fobj) { if (this.value instanceof DtNumber) { return ((DtNumber) this.value).getValue(); } if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getValueNoInstance(context, fobj); @@ -87,8 +89,9 @@ return getValueNoInstance(context, fobj); } - public static double getValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static double getValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (fobj != null) { return parent.traitFontSizeAdjust(context); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStretch.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStretch.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStretch.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -52,30 +52,30 @@ Constants.FOVAL_INHERIT, }; - public FontStretch(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public FontStretch(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public FontStretch(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public FontStretch(final PropertyList propertyList, final short enumeration, + final PropertyValue value) throws PropertyException { super(propertyList, enumeration, value); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyValue pv = checkKeywords(value); + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } throw unexpectedValue(value, propertyList); } - public short getValue(FObj fobj) { + public short getValue(final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { } @@ -84,8 +84,9 @@ return 0; } - public static short getValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static short getValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent != null) { return parent.traitFontStretch(context); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStyle.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStyle.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStyle.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -45,30 +45,30 @@ Constants.FOVAL_INHERIT, }; - public FontStyle(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public FontStyle(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public FontStyle(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public FontStyle(final PropertyList propertyList, final short enumeration, + final PropertyValue value) throws PropertyException { super(propertyList, enumeration, value); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyValue pv = checkKeywords(value); + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } throw unexpectedValue(value, propertyList); } - public short getValue(FOContext context, FObj fobj) { + public short getValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getValueNoInstance(context, fobj); @@ -81,8 +81,9 @@ return Constants.FOVAL_NORMAL; } - public static short getValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static short getValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent != null) { return parent.traitFontStyle(context); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontVariant.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontVariant.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontVariant.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -43,30 +43,30 @@ Constants.FOVAL_INHERIT, }; - public FontVariant(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public FontVariant(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public FontVariant(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public FontVariant(final PropertyList propertyList, final short enumeration, + final PropertyValue value) throws PropertyException { super(propertyList, enumeration, value); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyValue pv = checkKeywords(value); + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } throw unexpectedValue(value, propertyList); } - public short getValue(FOContext context, FObj fobj) { + public short getValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); if (keyword == Constants.FOVAL_INHERIT) { return getValueNoInstance(context, fobj); } @@ -75,8 +75,9 @@ return Constants.FOVAL_NORMAL; } - public static short getValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static short getValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent != null) { return parent.traitFontVariant(context); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontWeight.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontWeight.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontWeight.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -47,27 +47,27 @@ Constants.FOVAL_INHERIT, }; - public FontWeight(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public FontWeight(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public FontWeight(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public FontWeight(final PropertyList propertyList, final short enumeration, + final PropertyValue value) throws PropertyException { super(propertyList, enumeration, value); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } pv = standardParse(propertyList, value, false, false); if (pv instanceof DtInteger) { - int integer = ((DtInteger) pv).getValue(); + final int integer = ((DtInteger) pv).getValue(); switch (integer) { case 100: case 200: @@ -86,9 +86,9 @@ throw unexpectedValue(value, propertyList); } - public short getValue(FOContext context, FObj fobj) { + public short getValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getValueNoInstance(context, fobj); @@ -109,7 +109,7 @@ * font-family using that weight, and 3) find the relative font * in that font-family. */ - FontUse font = getInheritedFont(context, fobj); + final FontUse font = getInheritedFont(context, fobj); if (font == null) { break; } @@ -117,7 +117,7 @@ } case Constants.FOVAL_LIGHTER: { /* See comments re: algorithm in FOVAL_BOLDER case above. */ - FontUse font = getInheritedFont(context, fobj); + final FontUse font = getInheritedFont(context, fobj); if (font == null) { break; } @@ -131,8 +131,9 @@ return 400; } - public static short getValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static short getValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent != null) { return parent.traitFontWeight(context); } @@ -143,12 +144,12 @@ return validKeywords; } - FontUse getInheritedFont(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + FontUse getInheritedFont(final FOContext context, final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent == null) { return null; } - FontUse font = parent.getPrimaryFont(context); + final FontUse font = parent.getPrimaryFont(context); return font; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ForcePageCount.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ForcePageCount.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ForcePageCount.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -47,28 +47,29 @@ Constants.FOVAL_INHERIT, }; - public ForcePageCount(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public ForcePageCount(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyValue pv = checkKeywords(value); + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } throw unexpectedValue(value, propertyList); } - public short getValue(FOContext context, FObj fobj) { + public short getValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { - FObj parent = fobj.effectiveParent(context); + final FObj parent = fobj.effectiveParent(context); if (parent != null) { return parent.traitForcePageCount(context); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Format.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Format.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Format.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -33,15 +33,15 @@ public class Format extends Property { - public Format(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public Format(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { if (value.length() != 0) { return new DtString(value); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GlyphOrientation.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GlyphOrientation.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GlyphOrientation.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -50,15 +50,16 @@ Constants.FOVAL_INHERIT, }; - public GlyphOrientation(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public GlyphOrientation(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -70,9 +71,10 @@ throw unexpectedValue(value, propertyList); } - public short getValue(FOContext context, FObj fobj, byte axis) { + public short getValue(final FOContext context, final FObj fobj, + final byte axis) { if (this.value instanceof DtAngle) { - double angleValue = ((DtAngle) this.value).getValue(); + final double angleValue = ((DtAngle) this.value).getValue(); if (angleValue < 45) { return 0; } @@ -85,7 +87,7 @@ return 270; } if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); switch (keyword) { case Constants.FOVAL_AUTO: { // AUTO only applies to glyph-orientation-vertical @@ -99,9 +101,9 @@ return getValueNoInstance(context, fobj, axis); } - public static short getValueNoInstance(FOContext context, FObj fobj, - byte axis) { - FObj parent = fobj.effectiveParent(context); + public static short getValueNoInstance(final FOContext context, + final FObj fobj, final byte axis) { + final FObj parent = fobj.effectiveParent(context); if (parent != null) { switch (axis) { case Constants.AXIS_HORIZONTAL: { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GroupingSize.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GroupingSize.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GroupingSize.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -33,20 +33,21 @@ public class GroupingSize extends Property { - public GroupingSize(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) - throws PropertyException { + public GroupingSize(final PropertyList propertyList, + final short enumeration, final String propertyFullName, + final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { /* The standard allows for a numeric value, but we will round it and * store it as an integer, because it appears to be totally useless * except as an integer. */ - PropertyValue pv = standardParse(propertyList, value, true, false); + final PropertyValue pv = standardParse(propertyList, value, true, + false); if (pv instanceof DtInteger) { return pv; } @@ -55,7 +56,7 @@ public int getValue() { if (this.value instanceof DtInteger) { - DtInteger integer = (DtInteger) this.value; + final DtInteger integer = (DtInteger) this.value; return integer.getValue(); } return getValueNoInstance(); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphLadderCount.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphLadderCount.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphLadderCount.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -45,15 +45,16 @@ Constants.FOVAL_INHERIT, }; - public HyphLadderCount(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public HyphLadderCount(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -65,12 +66,12 @@ throw unexpectedValue(value, propertyList); } - public int getValue(FOContext context, FObj fobj) { + public int getValue(final FOContext context, final FObj fobj) { if (this.value instanceof DtInteger) { return ((DtInteger) this.value).getValue(); } if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getValueNoInstance(context, fobj); @@ -83,8 +84,9 @@ return getValueNoInstance(context, fobj); } - public static int getValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static int getValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent != null) { return parent.traitHyphLadderCount(context); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphPushCharCount.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphPushCharCount.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphPushCharCount.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -41,15 +41,16 @@ Constants.FOVAL_INHERIT, }; - public HyphPushCharCount(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public HyphPushCharCount(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -62,9 +63,9 @@ throw unexpectedValue(value, propertyList); } - public int traitValue(FOContext context, FObj fobj) { + public int traitValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return fobj.effectiveParent(context) @@ -78,8 +79,9 @@ return traitValueNoInstance(context, fobj); } - public static int traitValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static int traitValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent == null) { return 2; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphRemainCharCount.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphRemainCharCount.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphRemainCharCount.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -42,15 +42,16 @@ Constants.FOVAL_INHERIT, }; - public HyphRemainCharCount(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public HyphRemainCharCount(final PropertyList propertyList, + final short enumeration, final String propertyFullName, + final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -63,9 +64,9 @@ throw unexpectedValue(value, propertyList); } - public int traitValue(FOContext context, FObj fobj) { + public int traitValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return fobj.effectiveParent(context) @@ -79,8 +80,9 @@ return traitValueNoInstance(context, fobj); } - public static int traitValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static int traitValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent == null) { return 2; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Id.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Id.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Id.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -33,16 +33,17 @@ public class Id extends Property { - public Id(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public Id(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyValue pv = standardParse(propertyList, value, false, false); + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyValue pv = standardParse(propertyList, value, false, + false); if (pv instanceof DtName) { return pv; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Indent.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Indent.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Indent.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -49,15 +49,15 @@ Constants.FOVAL_INHERIT, }; - public Indent(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public Indent(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -76,7 +76,7 @@ return pv; } if (pv instanceof Expr) { - Expr expression = (Expr) pv; + final Expr expression = (Expr) pv; if (expression.canEvalUnitPower1()) { return pv; } @@ -84,10 +84,10 @@ throw unexpectedValue(value, propertyList); } - public int getValue(FOContext context, FObj fobj, byte direction, - int ipdContainingRA) { + public int getValue(final FOContext context, final FObj fobj, + final byte direction, final int ipdContainingRA) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); if (keyword == Constants.FOVAL_INHERIT) { return getValueNoInstance(context, fobj, direction, ipdContainingRA); @@ -98,34 +98,33 @@ 0); } if (this.value instanceof DtPercentage) { - DtPercentage percentageDT = (DtPercentage) this.value; - float percentage = percentageDT.getValue(); + final DtPercentage percentageDT = (DtPercentage) this.value; + final float percentage = percentageDT.getValue(); return Math.round(percentage * ipdContainingRA / 100); } if (this.value instanceof FnLabelEnd && direction == Constants.DIRECTION_END) { - FnLabelEnd function = (FnLabelEnd) this.value; - DtLength lengthDT = function.eval(fobj, ipdContainingRA); + final FnLabelEnd function = (FnLabelEnd) this.value; + final DtLength lengthDT = function.eval(fobj, ipdContainingRA); return lengthDT.getValue(fobj.traitFontSize(context), 0); } if (this.value instanceof FnBodyStart && direction == Constants.DIRECTION_START) { - FnBodyStart function = (FnBodyStart) this.value; - DtLength lengthDT = function.eval(fobj, ipdContainingRA); + final FnBodyStart function = (FnBodyStart) this.value; + final DtLength lengthDT = function.eval(fobj, ipdContainingRA); return lengthDT.getValue(fobj.traitFontSize(context), 0); } if (this.value instanceof Expr) { - Expr expression = (Expr) this.value; + final Expr expression = (Expr) this.value; return expression.evalUnitPower1(fobj.traitFontSize(context), ipdContainingRA); } return getValueNoInstance(context, fobj, direction, ipdContainingRA); } - public static int getValueNoInstance(FOContext context, FObj fobj, - byte direction, - int ipdContainingRA) { - FObj parent = fobj.effectiveParent(context); + public static int getValueNoInstance(final FOContext context, + final FObj fobj, final byte direction, final int ipdContainingRA) { + final FObj parent = fobj.effectiveParent(context); if (parent == null) { return 0; } @@ -137,7 +136,7 @@ * @param direction One of the directional constants. * @return String representation of the raw property name. */ - public static short rawPropertyType(int direction) { + public static short rawPropertyType(final int direction) { switch (direction) { case Constants.DIRECTION_START: { return Constants.FOPROP_START_INDENT; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InitialPageNumber.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InitialPageNumber.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InitialPageNumber.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -45,15 +45,16 @@ Constants.FOVAL_INHERIT, }; - public InitialPageNumber(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public InitialPageNumber(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -65,14 +66,15 @@ throw unexpectedValue(value, propertyList); } - public int getValue(FOContext context, FObj fobj, int lastPageNumberUsed) { + public int getValue(final FOContext context, final FObj fobj, + final int lastPageNumberUsed) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { - FObj parent = fobj.effectiveParent(context); + final FObj parent = fobj.effectiveParent(context); if (parent != null) { - InitialPageNumber property = (InitialPageNumber) + final InitialPageNumber property = (InitialPageNumber) parent.propertyList.getProperty (Constants.FOPROP_INITIAL_PAGE_NUMBER); return property.getValue(context, parent, @@ -103,13 +105,13 @@ return getValueNoInstance(lastPageNumberUsed); } - public short getRawValue(FObj fobj) { + public short getRawValue(final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); if (keyword == Constants.FOVAL_INHERIT) { - FObj parent = fobj.realParent(); + final FObj parent = fobj.realParent(); if (parent != null) { - PropertyList propertyList = parent.propertyList; + final PropertyList propertyList = parent.propertyList; return propertyList.getRawInitialPageNumber(); } return getRawValueNoInstance(); @@ -122,7 +124,7 @@ return getRawValueNoInstance(); } - public static int getValueNoInstance(int lastPageNumberUsed) { + public static int getValueNoInstance(final int lastPageNumberUsed) { return lastPageNumberUsed + 1; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InternalDestination.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InternalDestination.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InternalDestination.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -33,16 +33,17 @@ public class InternalDestination extends Property { - public InternalDestination(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public InternalDestination(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { - DtName pv = DtName.makeNameDT(value); + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { + final DtName pv = DtName.makeNameDT(value); if (pv == null) { throw unexpectedValue(value, propertyList, "Invalid NCName"); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Keep.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Keep.java 2006-07-23 00:55:19 UTC (rev 7813) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Keep.java 2006-07-23 14:56:47 UTC (rev 7814) @@ -60,11 +60,12 @@ Constants.FOVAL_ALWAYS, }; - public Keep(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public Keep(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); - String subPropertyName = Property.getSubPropertyName(propertyFullName); + final String subPropertyName = Property.getSubPropertyName( + propertyFullName); if (subPropertyName == null) { this.value = createPropertyValue(propertyList, attributeValue); return; @@ -73,24 +74,25 @@ subPropertyName, propertyFullName); } - public PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } pv = standardParse(propertyList, value, false, false); if (pv instanceof DtInteger) { - int integer = ((DtInteger) pv).getValue(); + final int integer = ((DtInteger) pv).getValue(); return new DtKeep(integer, integer, integer); } throw unexpectedValue(value, propertyList); } - private PropertyValue createPropertyValueSpace(PropertyList propertyList, - String value, String subPropertyName, String propertyFullName) + private PropertyValue createPropertyValueSpace( + final PropertyList propertyList, final String value, + final String subPropertyName, final String propertyFullName) throws PropertyException { - DtKeep keepDT = createOrAddKeep(null, propertyList, value, + final DtKeep keepDT = createOrAddKeep(null, propertyList, value, subPropertyName, propertyFullName); if (keepDT != null) { return keepDT; @@ -98,9 +100,10 @@ throw unexpectedValue(value, propertyList); } - public int getValue(FOContext context, int subProperty, FObj fobj) { + public int getValue(final FOContext context, final int subProperty, + final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getValueInherited(context, this.propertyType, @@ -115,7 +118,7 @@ } } if (this.value instanceof DtKeep) { - DtKeep keepDT = (DtKeep) this.value; + final DtKeep keepDT = (DtKeep) this.value; switch (subProperty) { case WITHIN_LINE: { return keepDT.getWithinLine(); @@ -133,9 +136,8 @@ fobj); } - public static int getValueNoInstance(FOContext context, short propertyType, - int subProperty, - FObj fobj) { + public static int getValueNoInstance(final FOContext context, + final short propertyType, final int subProperty, final FObj fobj) { // keep-together is inherited, the others are not if (propertyType != Constants.FOPROP_KEEP_TOGETHER) { return org.axsl.foR.Keep.AUTO; @@ -143,10 +145,10 @@ return getValueInherited(context, propertyType, subProperty, fobj); } - private static int getValueInherited(FOContext context, short propertyType, - int subProperty, - FObj fobj) { - FObj parent = fobj.effectiveParent(context); + private static int getValueInherited(final FOContext context, + final short propertyType, final int subProperty, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent == null) { return org.axsl.foR.Keep.AUTO; } @@ -207,22 +209,24 @@ * pre-existing value is not the correct type. * @throws PropertyException If the input is not valid. */ - public boolean addComponent(PropertyList propertyList, - String propertyFullName, String attributeValue) + public boolean addComponent(final PropertyList propertyList, + final String propertyFullName, final String attributeValue) throws PropertyException { if (! (value instanceof DtKeep)) { return false; } DtKeep keepDT = (DtKeep) value; - String subPropertyName = Property.getSubPropertyName(propertyFullName); + final String subPropertyName = Property.getSubPropertyName( + propertyFullName); keepDT = createOrAddKeep(keepDT, propertyList, attributeValue, subPropertyName, propertyFullName); return true; } - private DtKeep createOrAddKeep(DtKeep keepDT, PropertyList propertyList, - String value, String subPropertyName, String propertyFullName) - throws PropertyException { + private DtKeep createOrAddKeep(DtKeep keepDT, + final PropertyList propertyList, + final String value, final String subPropertyName, + final String propertyFullName) throws PropertyException { if (keepDT == null) { keepDT = DtKeep.createKeepDT(); } @@ -230,7 +234... [truncated message content] |
|
From: <vic...@us...> - 2006-07-23 00:55:53
|
Revision: 7813 Author: victormote Date: 2006-07-22 17:55:19 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7813&view=rev Log Message: ----------- Implement standard use of "final" modifier on local variables and parameters. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteDimension.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentAdjust.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentBaseline.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AudioDial.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Azimuth.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Background.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundColor.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundImage.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundPosition.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BaselineShift.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Boolean.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Border.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSeparation.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSpacing.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderStyle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderWidth.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/CaseTitle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Character.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Clip.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Color.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnCount.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnGap.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnNumber.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnWidth.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ContentDimension.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ContentType.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Country.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Cue.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DestinationPlacementOffset.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Dimension.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DisplayAlign.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DominantBaseline.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Elevation.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Enumerated.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Extent.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ExternalDestination.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Font.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteDimension.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteDimension.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteDimension.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -56,15 +56,15 @@ Constants.FOVAL_INHERIT, }; - public AbsoluteDimension(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) - throws PropertyException { + public AbsoluteDimension(final PropertyList propertyList, + final short enumeration, final String propertyFullName, + final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -79,21 +79,21 @@ throw unexpectedValue(value, propertyList); } - public int getValue(FOContext context, byte relativeAxis, - FObj fobj, int dimAncestorGenByBlockLevelFO) { + public int getValue(final FOContext context, final byte relativeAxis, + final FObj fobj, final int dimAncestorGenByBlockLevelFO) { if (this.value instanceof DtLength) { return ((DtLength) this.value).getValue(fobj.traitFontSize(context), 0); } if (this.value instanceof DtPercentage) { - int base = dimAncestorGenByBlockLevelFO; - DtPercentage percentageDT = (DtPercentage) this.value; - float percentage = percentageDT.getValue(); + final int base = dimAncestorGenByBlockLevelFO; + final DtPercentage percentageDT = (DtPercentage) this.value; + final float percentage = percentageDT.getValue(); return Math.round(percentage * base / 100); } if (this.value instanceof PropertyKeyword) { - PropertyKeyword kw = (PropertyKeyword) this.value; - short keyword = kw.getValue(); + final PropertyKeyword kw = (PropertyKeyword) this.value; + final short keyword = kw.getValue(); switch (keyword) { case Constants.FOVAL_AUTO: { return Constants.DIMENSION_AUTO; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -46,16 +46,18 @@ Constants.FOVAL_INHERIT, }; - public AbsoluteOffset(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public AbsoluteOffset(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, enumeration, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - short enumeration, String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final short enumeration, final String value) + throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -71,16 +73,16 @@ throw unexpectedValue(value, propertyList); } - public int getValue(FOContext context, byte direction, - FObj fobj, int dimensionContainingBlock) { + public int getValue(final FOContext context, final byte direction, + final FObj fobj, final int dimensionContainingBlock) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_AUTO: { return Constants.ABSOLUTE_POSITION_AUTO; } case Constants.FOVAL_INHERIT: { - FObj parent = fobj.effectiveParent(context); + final FObj parent = fobj.effectiveParent(context); if (parent == null) { return getValueNoInstance(); } @@ -89,17 +91,18 @@ } } if (this.value instanceof DtLength) { - DtLength length = (DtLength) this.value; + final DtLength length = (DtLength) this.value; /* * The XSL-FO Standard 1.0 does not specify whether negative values * are allowed or not, but the CSS2 standard says that they are * allowed. */ - int lengthValue = length.getValue(fobj.traitFontSize(context), 0); + final int lengthValue = length.getValue(fobj.traitFontSize(context), + 0); return lengthValue; } if (this.value instanceof DtPercentage) { - DtPercentage percent = (DtPercentage) this.value; + final DtPercentage percent = (DtPercentage) this.value; return Math.round(dimensionContainingBlock * percent.getValue() / 100); } @@ -119,7 +122,7 @@ * @param direction One of the absolute directional constants. * @return String representation of the raw property name. */ - public static short rawPropertyName(int direction) { + public static short rawPropertyName(final int direction) { switch (direction) { case Constants.DIRECTION_TOP: { return Constants.FOPROP_TOP; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentAdjust.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentAdjust.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentAdjust.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -57,15 +57,16 @@ Constants.FOVAL_INHERIT, }; - public AlignmentAdjust(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public AlignmentAdjust(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -80,9 +81,9 @@ throw unexpectedValue(value, propertyList); } - public short traitValue(FOContext context, FObj fobj) { + public short traitValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return fobj.effectiveParent(context).traitAlignmentAdjust( @@ -102,7 +103,8 @@ return traitValueNoInstance(); } - public int traitValueAmount(FOContext context, FObj fobj, int areaHeight) { + public int traitValueAmount(final FOContext context, final FObj fobj, + final int areaHeight) { if (this.value instanceof DtLength) { return ((DtLength) this.value).getValue(fobj.traitFontSize(context), 0); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentBaseline.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentBaseline.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentBaseline.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -52,25 +52,26 @@ Constants.FOVAL_INHERIT, }; - public AlignmentBaseline(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public AlignmentBaseline(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyValue pv = checkKeywords(value); + public PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } throw unexpectedValue(value, propertyList); } - public short traitValue(FOContext context, FObj fobj) { + public short traitValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return fobj.effectiveParent(context).traitAlignmentBaseline( Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AudioDial.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AudioDial.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AudioDial.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -48,22 +48,22 @@ Constants.FOVAL_INHERIT, }; - public AudioDial(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public AudioDial(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } pv = DtNumber.makeNumberDT(value); if (pv != null) { - double number = ((DtNumber) pv).getValue(); + final double number = ((DtNumber) pv).getValue(); if (number >= 0 && number <= 100) { return pv; } @@ -71,12 +71,12 @@ throw unexpectedValue(value, propertyList); } - public double getValue(FOContext context, FObj fobj) { + public double getValue(final FOContext context, final FObj fobj) { if (this.value instanceof DtNumber) { return ((DtNumber) this.value).getValue(); } if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getValueNoInstance(context, fobj, propertyType); @@ -86,9 +86,9 @@ return 50; } - public static double getValueNoInstance(FOContext context, FObj fobj, - short propertyType) { - FObj parent = fobj.effectiveParent(context); + public static double getValueNoInstance(final FOContext context, + final FObj fobj, final short propertyType) { + final FObj parent = fobj.effectiveParent(context); if (parent != null) { switch (propertyType) { case Constants.FOPROP_PITCH_RANGE: { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Azimuth.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Azimuth.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Azimuth.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -57,21 +57,21 @@ /** Set to true if the "behind" keyword is used. */ boolean isBehind = false; - public Azimuth(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public Azimuth(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { String remainingValue = value; - StringTokenizer st = new StringTokenizer(value); + final StringTokenizer st = new StringTokenizer(value); if (st.countTokens() == 2) { // One of the tokens should be "behind" while (st.hasMoreTokens()) { - String thisToken = st.nextToken(); + final String thisToken = st.nextToken(); if (thisToken.equals("behind")) { this.isBehind = true; } else { @@ -84,7 +84,7 @@ } PropertyValue pv = checkKeywords(remainingValue); if (pv != null) { - short keyword = ((PropertyKeyword) pv).getValue(); + final short keyword = ((PropertyKeyword) pv).getValue(); switch (keyword) { case Constants.FOVAL_LEFTWARDS: case Constants.FOVAL_RIGHTWARDS: @@ -106,12 +106,12 @@ throw unexpectedValue(value, propertyList); } - public float getValue(FOContext context, FObj fobj) { + public float getValue(final FOContext context, final FObj fobj) { if (this.value instanceof DtAngle) { return ((DtAngle) this.value).getValue(); } if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getValueNoInstance(context, fobj); @@ -175,8 +175,9 @@ return getValueNoInstance(context, fobj); } - public static float getValueNoInstance(FOContext context, FObj fobj) { - FObj parent = fobj.effectiveParent(context); + public static float getValueNoInstance(final FOContext context, + final FObj fobj) { + final FObj parent = fobj.effectiveParent(context); if (parent != null) { return parent.traitAzimuth(context); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Background.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Background.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Background.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -45,18 +45,19 @@ Constants.FOVAL_INHERIT, }; - public Background(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public Background(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, propertyFullName, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String propertyFullName, String value) throws PropertyException { - PropertyCollection collection = new PropertyCollection(); - PropertyValue pv = checkKeywords(value); + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String propertyFullName, final String value) + throws PropertyException { + final PropertyCollection collection = new PropertyCollection(); + final PropertyValue pv = checkKeywords(value); if (pv != null) { collection.addItem(new BackgroundColor(propertyList, Constants.FOPROP_BACKGROUND_COLOR, pv)); @@ -73,18 +74,18 @@ // There are 5 properties supported, one of which can have 2 tokens final byte MAX_TOKENS = 6; // Tokenize the input & put the tokens into an ArrayList - StringTokenizer st = new StringTokenizer(value); + final StringTokenizer st = new StringTokenizer(value); if (st.countTokens() < 1 || st.countTokens() > MAX_TOKENS) { throw unexpectedValue(value, propertyList); } - ArrayList tokenList = new ArrayList(st.countTokens()); + final ArrayList tokenList = new ArrayList(st.countTokens()); while (st.hasMoreTokens()) { tokenList.add(st.nextToken()); } // Create an array indicating which property is in each position - short[] positionArray = new short[tokenList.size()]; + final short[] positionArray = new short[tokenList.size()]; for (int i = 0; i < tokenList.size(); i++) { - short contentType = getContentType((String) tokenList.get(i)); + final short contentType = getContentType((String) tokenList.get(i)); if (contentType < 0) { throw unexpectedValue(value, propertyList); } @@ -137,7 +138,7 @@ if (positionFound) { throw unexpectedValue(value, propertyList); } - String propertyInput = (String) tokenList.get(i); + final String propertyInput = (String) tokenList.get(i); if (i < positionArray.length && positionArray[i + 1] == Constants.FOPROP_BACKGROUND_POSITION) { propertyInput.concat(" " @@ -162,7 +163,7 @@ * BACKGROUND_IMAGE, BACKGROUND_REPEAT, BACKGROUND_ATTACHMENT, or * BACKGROUND_POSITION, or -1 for invalid input */ - private short getContentType(String input) { + private short getContentType(final String input) { if (input.equals("inherit")) { return -1; } @@ -195,19 +196,19 @@ if (keyword > -1) { return Constants.FOPROP_BACKGROUND_POSITION; } - DtColor color = DtColor.makeDtColor(input); + final DtColor color = DtColor.makeDtColor(input); if (color != null) { return Constants.FOPROP_BACKGROUND_COLOR; } - DtURI uri = DtURI.makeUriDT(input); + final DtURI uri = DtURI.makeUriDT(input); if (uri != null) { return Constants.FOPROP_BACKGROUND_IMAGE; } - DtLength length = DtLength.makeLengthDT(input); + final DtLength length = DtLength.makeLengthDT(input); if (length != null) { return Constants.FOPROP_BACKGROUND_POSITION; } - DtPercentage percentage = DtPercentage.makePercentageDT(input); + final DtPercentage percentage = DtPercentage.makePercentageDT(input); if (percentage != null) { return Constants.FOPROP_BACKGROUND_POSITION; } @@ -215,31 +216,31 @@ } public BackgroundColor getColor() { - PropertyCollection collection = (PropertyCollection) this.value; + final PropertyCollection collection = (PropertyCollection) this.value; return (BackgroundColor) collection.findProperty (Constants.FOPROP_BACKGROUND_COLOR); } public BackgroundImage getImage() { - PropertyCollection collection = (PropertyCollection) this.value; + final PropertyCollection collection = (PropertyCollection) this.value; return (BackgroundImage) collection.findProperty (Constants.FOPROP_BACKGROUND_IMAGE); } public Enumerated getRepeat() { - PropertyCollection collection = (PropertyCollection) this.value; + final PropertyCollection collection = (PropertyCollection) this.value; return (Enumerated) collection.findProperty (Constants.FOPROP_BACKGROUND_REPEAT); } public Enumerated getAttachment() { - PropertyCollection collection = (PropertyCollection) this.value; + final PropertyCollection collection = (PropertyCollection) this.value; return (Enumerated) collection.findProperty (Constants.FOPROP_BACKGROUND_ATTACHMENT); } public BackgroundPosition getPosition() { - PropertyCollection collection = (PropertyCollection) this.value; + final PropertyCollection collection = (PropertyCollection) this.value; return (BackgroundPosition) collection.findProperty (Constants.FOPROP_BACKGROUND_POSITION); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundColor.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundColor.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundColor.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -38,15 +38,17 @@ Constants.FOVAL_TRANSPARENT, }; - public BackgroundColor(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public BackgroundColor(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration, propertyFullName, attributeValue); this.value = createPropertyValue(propertyList, attributeValue); } - public BackgroundColor(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public BackgroundColor(final PropertyList propertyList, + final short enumeration, final PropertyValue value) + throws PropertyException { super(propertyList, enumeration, value); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundImage.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundImage.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundImage.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -47,20 +47,22 @@ Constants.FOVAL_INHERIT, }; - public BackgroundImage(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public BackgroundImage(final PropertyList propertyList, + final short enumeration, final String propertyFullName, + final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public BackgroundImage(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public BackgroundImage(final PropertyList propertyList, + final short enumeration, final PropertyValue value) + throws PropertyException { super(propertyList, enumeration, value); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -72,12 +74,12 @@ throw unexpectedValue(value, propertyList); } - public Graphic getValue(FOContext context, FObj fobj) { + public Graphic getValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { - FObj parent = fobj.effectiveParent(context); + final FObj parent = fobj.effectiveParent(context); if (parent != null) { return parent.traitBackgroundImage(context); } @@ -91,13 +93,13 @@ if (graphic != null) { return graphic; } - String src = ((DtURI) this.value).getValue(); + final String src = ((DtURI) this.value).getValue(); Graphic backgroundImage = null; try { backgroundImage = fobj.getGraphicServer().makeGraphic(src, fobj.getFOTreeBuilder().getGraphicSearchPath(), fobj.getFOTreeBuilder().getCachingGraphics()); - } catch (GraphicException imgex) { + } catch (final GraphicException imgex) { backgroundImage = null; fobj.getLogger().error("Error creating background image: " + imgex.getMessage()); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundPosition.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundPosition.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundPosition.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -60,8 +60,9 @@ Constants.FOVAL_INHERIT, }; - public BackgroundPosition(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public BackgroundPosition(final PropertyList propertyList, + final short enumeration, final String propertyFullName, + final String attributeValue) throws PropertyException { super(propertyList, enumeration); if (propertyType == Constants.FOPROP_BACKGROUND_POSITION) { @@ -71,13 +72,14 @@ } } - public BackgroundPosition(PropertyList propertyList, short enumeration, - PropertyValue value) throws PropertyException { + public BackgroundPosition(final PropertyList propertyList, + final short enumeration, final PropertyValue value) + throws PropertyException { super(propertyList, enumeration, value); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -93,40 +95,42 @@ throw unexpectedValue(value, propertyList); } - private PropertyValue createShorthandValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyCollection collection = new PropertyCollection(); + private PropertyValue createShorthandValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyCollection collection = new PropertyCollection(); PropertyValue pv = checkKeywords(value); if (pv != null) { - BackgroundPosition property = new BackgroundPosition + final BackgroundPosition property = new BackgroundPosition (propertyList, propertyType, pv); collection.addItem(property); return collection; } - StringTokenizer st = new StringTokenizer(value); + final StringTokenizer st = new StringTokenizer(value); if (st.countTokens() < 1 || st.countTokens() > 2) { throw unexpectedValue(value, propertyList); } while (st.hasMoreTokens()) { - String token = st.nextToken(); + final String token = st.nextToken(); pv = DtPercentage.makePercentageDT(token); if (pv == null) { pv = DtLength.makeLengthDT(token); } if (pv == null) { - short keyword = getKeywordIndex(token, validKeywordsHorizontal); + final short keyword = getKeywordIndex(token, + validKeywordsHorizontal); if (keyword > 0 && keyword != Constants.FOVAL_INHERIT) { pv = new PropertyKeyword(keyword); } } if (pv == null) { - short keyword = getKeywordIndex(token, validKeywordsVertical); + final short keyword = getKeywordIndex(token, + validKeywordsVertical); if (keyword > 0 && keyword != Constants.FOVAL_INHERIT) { pv = new PropertyKeyword(keyword); } } if (pv != null) { - BackgroundPosition property = new BackgroundPosition + final BackgroundPosition property = new BackgroundPosition (propertyList, propertyType, pv); collection.addItem(property); } else { @@ -137,7 +141,7 @@ return collection; } pv = collection.getItem(0).getPropertyValue(); - PropertyValue pv2 = collection.getItem(1).getPropertyValue(); + final PropertyValue pv2 = collection.getItem(1).getPropertyValue(); /* * If the first item is a length or percentage, the other needs to be * also. @@ -157,8 +161,8 @@ } } // The two keywords need to be from each of the two sets. - short keyword = ((PropertyKeyword) pv).getValue(); - short keyword2 = ((PropertyKeyword) pv2).getValue(); + final short keyword = ((PropertyKeyword) pv).getValue(); + final short keyword2 = ((PropertyKeyword) pv2).getValue(); if (keywordInSet(keyword, validKeywordsHorizontal) && keywordInSet(keyword2, validKeywordsVertical)) { return collection; @@ -175,19 +179,20 @@ return collection; } - public int getValue(FOContext context, FObj fobj, byte axis, - int paddingRectangleDimension, int backgroundImageDimension) { + public int getValue(final FOContext context, final FObj fobj, + final byte axis, final int paddingRectangleDimension, + final int backgroundImageDimension) { if (this.value instanceof DtLength) { return ((DtLength) this.value).getValue(fobj.traitFontSize(context), 0); } if (this.value instanceof DtPercentage) { - float percent = ((DtPercentage) this.value).getValue(); + final float percent = ((DtPercentage) this.value).getValue(); return Math.round(percent/100 * (paddingRectangleDimension - backgroundImageDimension)); } if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); switch (keyword) { case Constants.FOVAL_TOP: case Constants.FOVAL_LEFT: { @@ -202,7 +207,7 @@ return paddingRectangleDimension - backgroundImageDimension; } case Constants.FOVAL_INHERIT: { - FObj parent = fobj.effectiveParent(context); + final FObj parent = fobj.effectiveParent(context); if (parent != null) { switch (axis) { case Constants.AXIS_HORIZONTAL: { @@ -223,13 +228,13 @@ return getValueNoInstance(); } - public int getShorthandValue(FOContext context, FObj fobj, - byte axis, int paddingRectangleDimension, - int backgroundImageDimension) { - PropertyCollection collection = (PropertyCollection) this.value; - BackgroundPosition bpProperty = (BackgroundPosition) collection + public int getShorthandValue(final FOContext context, final FObj fobj, + final byte axis, final int paddingRectangleDimension, + final int backgroundImageDimension) { + final PropertyCollection collection = (PropertyCollection) this.value; + final BackgroundPosition bpProperty = (BackgroundPosition) collection .getItem(0); - PropertyValue pv = bpProperty.getPropertyValue(); + final PropertyValue pv = bpProperty.getPropertyValue(); if (collection.getCount() == 1) { if (pv instanceof DtPercentage || pv instanceof DtLength) { if (axis == Constants.AXIS_VERTICAL) { @@ -238,7 +243,7 @@ } } if (pv instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) pv).getValue(); + final short keyword = ((PropertyKeyword) pv).getValue(); if (axis == Constants.AXIS_HORIZONTAL && keywordInSet(keyword, validKeywordsVertical)) { return (int) Math.round(.5 * (paddingRectangleDimension @@ -260,9 +265,9 @@ * What is left here is the case where there are two properties. The * only real trick is to make sure we use the right one. */ - BackgroundPosition bpProperty2 = (BackgroundPosition) collection + final BackgroundPosition bpProperty2 = (BackgroundPosition) collection .getItem(1); - PropertyValue pv2 = bpProperty2.getPropertyValue(); + final PropertyValue pv2 = bpProperty2.getPropertyValue(); BackgroundPosition bpPropertyToUse = null; if (pv instanceof DtPercentage || pv instanceof DtLength) { if (axis == Constants.AXIS_HORIZONTAL) { @@ -275,8 +280,8 @@ /* * What is left here should just be keywords. */ - short keyword = ((PropertyKeyword) pv).getValue(); - short keyword2 = ((PropertyKeyword) pv2).getValue(); + final short keyword = ((PropertyKeyword) pv).getValue(); + final short keyword2 = ((PropertyKeyword) pv2).getValue(); boolean horizontalFirst = false; if (keywordInSet(keyword, validKeywordsHorizontal)) { horizontalFirst = true; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BaselineShift.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BaselineShift.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BaselineShift.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -47,15 +47,16 @@ Constants.FOVAL_INHERIT, }; - public BaselineShift(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public BaselineShift(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -70,10 +71,10 @@ throw unexpectedValue(value, propertyList); } - public int traitValue(FOContext context, FObj fobj) { + public int traitValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); - FObj effectiveParent = fobj.effectiveParent(context); + final short keyword = ((PropertyKeyword) value).getValue(); + final FObj effectiveParent = fobj.effectiveParent(context); switch (keyword) { case Constants.FOVAL_BASELINE: { return 0; @@ -81,13 +82,13 @@ case Constants.FOVAL_SUB: { /* TODO: This is the legacy computation. It needs to be * rewritten from the spec. */ - int ascender = getAscender(context, effectiveParent); + final int ascender = getAscender(context, effectiveParent); return (int) Math.round(2 * ascender / 3.0); } case Constants.FOVAL_SUPER: { /* TODO: This is the legacy computation. It needs to be * rewritten from the spec. */ - int ascender = getAscender(context, effectiveParent); + final int ascender = getAscender(context, effectiveParent); return (int) Math.round(-2 * ascender / 3.0); } case Constants.FOVAL_INHERIT: { @@ -104,7 +105,7 @@ } if (this.value instanceof DtPercentage) { /* TODO: This base value is almost certainly wrong. */ - int base = fobj.effectiveParent(context) + final int base = fobj.effectiveParent(context) .propertyList.getLineHeight(context, OPTIMUM); return Math.round(((DtPercentage) this.value).getValue() * base); } @@ -116,10 +117,11 @@ * @param effectiveParent * @return The ascender for the primary font. */ - private int getAscender(FOContext context, FObj effectiveParent) { - FontUse primaryFont = effectiveParent.getPrimaryFont(context); - int fontSize = effectiveParent.traitFontSize(context); - int ascender = primaryFont.getFont().getAscender(fontSize); + private int getAscender(final FOContext context, + final FObj effectiveParent) { + final FontUse primaryFont = effectiveParent.getPrimaryFont(context); + final int fontSize = effectiveParent.traitFontSize(context); + final int ascender = primaryFont.getFont().getAscender(fontSize); return ascender; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Boolean.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Boolean.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Boolean.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -48,25 +48,25 @@ Constants.FOVAL_INHERIT, }; - public Boolean(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public Boolean(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyValue pv = checkKeywords(value); + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; } throw unexpectedValue(value, propertyList); } - public boolean getValue(FOContext context, FObj fobj) { + public boolean getValue(final FOContext context, final FObj fobj) { if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) value).getValue(); + final short keyword = ((PropertyKeyword) value).getValue(); switch (keyword) { case Constants.FOVAL_INHERIT: { return getValueNoInstance(context, fobj, propertyType); @@ -82,9 +82,9 @@ return false; } - public static boolean getValueNoInstance(FOContext context, FObj fobj, - short propertyType) { - FObj parent = fobj.effectiveParent(context); + public static boolean getValueNoInstance(final FOContext context, + final FObj fobj, final short propertyType) { + final FObj parent = fobj.effectiveParent(context); switch (propertyType) { case Constants.FOPROP_HYPHENATE: { if (parent != null) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Border.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Border.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Border.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -47,27 +47,28 @@ Constants.FOVAL_INHERIT, }; - public Border(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public Border(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, enumeration, attributeValue); } - public PropertyValue createPropertyValue(PropertyList propertyList, - short enumeration, String value) throws PropertyException { + public PropertyValue createPropertyValue(final PropertyList propertyList, + final short enumeration, final String value) + throws PropertyException { PropertyCollection collection = null; /* * Must handle inherit specially, because it essentially propogates * to style, width, and color. */ if (value.equals("inherit")) { - BorderStyle borderStyle = new BorderStyle(propertyList, + final BorderStyle borderStyle = new BorderStyle(propertyList, Constants.FOPROP_BORDER_STYLE, "border-style", "inherit"); - BorderWidth borderWidth = new BorderWidth(propertyList, + final BorderWidth borderWidth = new BorderWidth(propertyList, Constants.FOPROP_BORDER_WIDTH, "border-width", "inherit"); - BorderColor borderColor = new BorderColor(propertyList, + final BorderColor borderColor = new BorderColor(propertyList, Constants.FOPROP_BORDER_COLOR, "border-color", "inherit"); collection = new PropertyCollection(); collection.addItem(borderStyle); @@ -75,9 +76,9 @@ collection.addItem(borderColor); return collection; } - StringTokenizer st = new StringTokenizer(value); + final StringTokenizer st = new StringTokenizer(value); while (st.hasMoreTokens()) { - Property property = parseToken(propertyList, st.nextToken()); + final Property property = parseToken(propertyList, st.nextToken()); if (property == null) { throw unexpectedValue(value, propertyList); } @@ -92,8 +93,8 @@ throw unexpectedValue(value, propertyList); } - public Property parseToken(PropertyList propertyList, String token) - throws PropertyException { + public Property parseToken(final PropertyList propertyList, + final String token) throws PropertyException { // Check style first, since it only has keywords short keyword = Property.getKeywordIndex(token, BorderStyle.validKeywords); @@ -108,13 +109,14 @@ new PropertyKeyword(keyword)); } // Now check for color keywords - DtColor dtColor = DtColor.mapNameToColorRGB(token); + final DtColor dtColor = DtColor.mapNameToColorRGB(token); if (dtColor != null) { return new BorderColor(Constants.FOPROP_BORDER_COLOR, dtColor); } // Now try using the standard parse - PropertyValue pv = standardParse(propertyList, token, false, false); + final PropertyValue pv = standardParse(propertyList, token, false, + false); if (pv instanceof DtLength) { return new BorderWidth(Constants.FOPROP_BORDER_WIDTH, pv); } @@ -124,12 +126,12 @@ return null; } - public BorderStyle getBorderStyle(byte absoluteDirection) { + public BorderStyle getBorderStyle(final byte absoluteDirection) { if (! (this.value instanceof PropertyCollection)) { return null; } - PropertyCollection collection = (PropertyCollection) this.value; - Property property = collection.findProperty( + final PropertyCollection collection = (PropertyCollection) this.value; + final Property property = collection.findProperty( Constants.FOPROP_BORDER_STYLE); if (property instanceof BorderStyle) { return (BorderStyle) property; @@ -141,8 +143,8 @@ if (! (this.value instanceof PropertyCollection)) { return null; } - PropertyCollection collection = (PropertyCollection) this.value; - Property property = collection.findProperty( + final PropertyCollection collection = (PropertyCollection) this.value; + final Property property = collection.findProperty( Constants.FOPROP_BORDER_WIDTH); if (property instanceof BorderWidth) { return (BorderWidth) property; @@ -154,8 +156,8 @@ if (! (this.value instanceof PropertyCollection)) { return null; } - PropertyCollection collection = (PropertyCollection) this.value; - Property property = collection.findProperty( + final PropertyCollection collection = (PropertyCollection) this.value; + final Property property = collection.findProperty( Constants.FOPROP_BORDER_COLOR); if (property instanceof BorderColor) { return (BorderColor) property; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -40,8 +40,8 @@ public class BorderColor extends Property { - public BorderColor(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public BorderColor(final PropertyList propertyList, final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, enumeration, @@ -53,39 +53,42 @@ * parsing. Specifically, this is used by classes that handle shorthand * properties. */ - protected BorderColor(short enumeration, PropertyValue value) { + protected BorderColor(final short enumeration, final PropertyValue value) { super(null, enumeration); this.value = value; } - public PropertyValue createPropertyValue(PropertyList propertyList, - short enumeration, String value) throws PropertyException { - DtColor color = DtColor.makeDtColor(value); + public PropertyValue createPropertyValue(final PropertyList propertyList, + final short enumeration, final String value) + throws PropertyException { + final DtColor color = DtColor.makeDtColor(value); if (color != null) { return color; } - StringTokenizer st = new StringTokenizer(value); + final StringTokenizer st = new StringTokenizer(value); if (st.countTokens() > 1) { return createShorthandValue(propertyList, st, enumeration, value); } return createSimpleValue(propertyList, value); } - private PropertyValue createSimpleValue(PropertyList propertyList, - String value) throws PropertyException { - PropertyValue pv = standardParse(propertyList, value, false, false); + private PropertyValue createSimpleValue(final PropertyList propertyList, + final String value) throws PropertyException { + final PropertyValue pv = standardParse(propertyList, value, false, + false); if (pv instanceof ExprColor) { return pv; } throw unexpectedValue(value, propertyList); } - private PropertyValue createShorthandValue(PropertyList propertyList, - StringTokenizer st, short enumeration, String value) + private PropertyValue createShorthandValue(final PropertyList propertyList, + final StringTokenizer st, final short enumeration, + final String value) throws PropertyException { - PropertyCollection collection = new PropertyCollection(); + final PropertyCollection collection = new PropertyCollection(); while (st.hasMoreTokens()) { - BorderColor newBorderColor = new BorderColor(propertyList, + final BorderColor newBorderColor = new BorderColor(propertyList, enumeration, null, st.nextToken()); if (newBorderColor != null) { collection.addItem(newBorderColor); @@ -94,7 +97,7 @@ return collection; } - public Color getValue(byte direction, FObj fobj) { + public Color getValue(final byte direction, final FObj fobj) { if (this.value instanceof PropertyCollection) { return getCollectionValue(direction, fobj); } @@ -104,11 +107,12 @@ return getValueNoInstance(); } - private Color getCollectionValue(byte direction, FObj fobj) { - PropertyCollection collection = (PropertyCollection) this.value; - int whichElement = collection.whichElementForDirectional(direction); - Property insideProperty = collection.getItem(whichElement); - BorderColor borderColorProperty = (BorderColor) insideProperty; + private Color getCollectionValue(final byte direction, final FObj fobj) { + final PropertyCollection collection = (PropertyCollection) this.value; + final int whichElement = collection.whichElementForDirectional( + direction); + final Property insideProperty = collection.getItem(whichElement); + final BorderColor borderColorProperty = (BorderColor) insideProperty; return borderColorProperty.getValue(direction, fobj); } @@ -120,7 +124,7 @@ * @param direction One of the directional constants. * @return String representation of the raw property name. */ - public static short rawPropertyType(int direction) { + public static short rawPropertyType(final int direction) { switch (direction) { case Constants.DIRECTION_BEFORE: { return Constants.FOPROP_BORDER_BEFORE_COLOR; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java 2006-07-23 00:19:17 UTC (rev 7812) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java 2006-07-23 00:55:19 UTC (rev 7813) @@ -51,15 +51,16 @@ Constants.FOVAL_INHERIT, }; - public BorderPrecedence(PropertyList propertyList, short enumeration, - String propertyFullName, String attributeValue) + public BorderPrecedence(final PropertyList propertyList, + final short enumeration, + final String propertyFullName, final String attributeValue) throws PropertyException { super(propertyList, enumeration); this.value = createPropertyValue(propertyList, attributeValue); } - private PropertyValue createPropertyValue(PropertyList propertyList, - String value) throws PropertyException { + private PropertyValue createPropertyValue(final PropertyList propertyList, + final String value) throws PropertyException { PropertyValue pv = checkKeywords(value); if (pv != null) { return pv; @@ -71,18 +72,19 @@ throw unexpectedValue(value, propertyList); } - public int getValue(FOContext context, FObj fobj, byte direction) { + public int getValue(final FOContext context, final FObj fobj, + final byte direction) { if (this.value instanceof DtInteger) { return ((DtInteger) this.value).getValue(); } if (this.value instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) this.value).getValue(); + final short keyword = ((PropertyKeyword) this.value).getValue(); switch (keyword) { case Constants.FOVAL_FORCE: { return FORCE_VALUE; } case Constants.FOVAL_INHERIT: { - FObj parent = fobj.effectiveParent(context); + final FObj parent = fobj.effectiveParent(context); if (parent != null) { switch (direction) { case Constants.DIRECTION_BEFORE: { @@ -105,7 +107,7 @@ return getValueNoInstance(fobj); } - public static int getValueNoInstance(FObj fobj) { + public static int getValueNoInstance(final FObj fobj) { if (fobj instanceof Table) { return 6; } else if (fobj instanceof TableCell) { @@ -128,7 +130,7 @@ return validKeywords; } - public static short getPropertyType(byte direction) { + public static short getPropertyType(final byte direction) { switch (direction) { case Constants.DIRECTION_BEFORE: { return Constants.FOPROP_BORDER_BEFORE_PRECEDENCE; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSeparation.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSeparation.java 2006-07-23 00:19:1... [truncated message content] |
|
From: <vic...@us...> - 2006-07-23 00:19:48
|
Revision: 7812 Author: victormote Date: 2006-07-22 17:19:17 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7812&view=rev Log Message: ----------- Implement standard use of "final" modifier on local variables and parameters. Modified Paths: -------------- trunk/foray/foray-fotree/.project trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineNonText.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineText.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjMixed.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjScaled.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java trunk/foray/foray-fotree/src/java/org/foray/fotree/ForeignXML.java trunk/foray/foray-fotree/src/java/org/foray/fotree/Namespace.java trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyException.java trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyListUnparsed.java trunk/foray/foray-fotree/src/java/org/foray/fotree/foray/NamespaceExtensions.java trunk/foray/foray-fotree/src/java/org/foray/fotree/foray/ObjectMakerExtensions.java trunk/foray/foray-fotree/src/java/org/foray/fotree/foray/obj/ContinuedLabel.java trunk/foray/foray-fotree/src/java/org/foray/fotree/parse/PropertyParser.java trunk/foray/foray-fotree/src/java/org/foray/fotree/parse/PropertyTokenizer.java trunk/foray/foray-fotree/src/java/org/foray/fotree/svg/NamespaceSVG.java trunk/foray/foray-fotree/src/java/org/foray/fotree/svg/ObjectMakerSVG.java trunk/foray/foray-fotree/src/java/org/foray/fotree/svg/obj/SVGElement.java Modified: trunk/foray/foray-fotree/.project =================================================================== --- trunk/foray/foray-fotree/.project 2006-07-22 22:07:57 UTC (rev 7811) +++ trunk/foray/foray-fotree/.project 2006-07-23 00:19:17 UTC (rev 7812) @@ -10,14 +10,8 @@ <arguments> </arguments> </buildCommand> - <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> - <arguments> - </arguments> - </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> - <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> </natures> </projectDescription> Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineNonText.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineNonText.java 2006-07-22 22:07:57 UTC (rev 7811) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineNonText.java 2006-07-23 00:19:17 UTC (rev 7812) @@ -36,8 +36,8 @@ private org.axsl.foR.FOLineNonText realLineNonText; private FOContext context; - public FOLineNonText(org.axsl.foR.FOLineNonText realLineNonText, - FOContext context) { + public FOLineNonText(final org.axsl.foR.FOLineNonText realLineNonText, + final FOContext context) { this.realLineNonText = realLineNonText; this.context = context; } @@ -45,42 +45,45 @@ /** * {@inheritDoc} */ - public int inlineSizeOptimum(int lineLength) { + public int inlineSizeOptimum(final int lineLength) { return this.realLineNonText.inlineSizeOptimum(this.context, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeOptimum(FOContext context, int lineLength) { + public int inlineSizeOptimum(final FOContext context, + final int lineLength) { return this.realLineNonText.inlineSizeOptimum(context, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMinimum(int lineLength) { + public int inlineSizeMinimum(final int lineLength) { return this.realLineNonText.inlineSizeMinimum(this.context, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMinimum(FOContext context, int lineLength) { + public int inlineSizeMinimum(final FOContext context, + final int lineLength) { return this.realLineNonText.inlineSizeMinimum(context, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMaximum(int lineLength) { + public int inlineSizeMaximum(final int lineLength) { return this.realLineNonText.inlineSizeMaximum(this.context, lineLength); } /** * {@inheritDoc} */ - public int inlineSizeMaximum(FOContext context, int lineLength) { + public int inlineSizeMaximum(final FOContext context, + final int lineLength) { return this.realLineNonText.inlineSizeMaximum(context, lineLength); } @@ -94,7 +97,8 @@ /** * {@inheritDoc} */ - public org.axsl.foR.FOLineNonText getContextWrapper(FOContext context) { + public org.axsl.foR.FOLineNonText getContextWrapper( + final FOContext context) { /* This *is* the wrapper. */ return this; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineText.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineText.java 2006-07-22 22:07:57 UTC (rev 7811) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineText.java 2006-07-23 00:19:17 UTC (rev 7812) @@ -38,7 +38,8 @@ private org.axsl.foR.FOLineText realLineText; private FOContext context; - public FOLineText(org.axsl.foR.FOLineText realLineText, FOContext context) { + public FOLineText(final org.axsl.foR.FOLineText realLineText, + final FOContext context) { this.realLineText = realLineText; this.context = context; } @@ -53,7 +54,7 @@ /** * {@inheritDoc} */ - public char[] inlineText(FOContext context) { + public char[] inlineText(final FOContext context) { return realLineText.inlineText(context); } @@ -67,21 +68,21 @@ /** * {@inheritDoc} */ - public FontUse inlinePrimaryFont(FOContext context) { + public FontUse inlinePrimaryFont(final FOContext context) { return realLineText.inlinePrimaryFont(context); } /** * {@inheritDoc} */ - public FontUse inlineSecondaryFont(char c) { + public FontUse inlineSecondaryFont(final char c) { return realLineText.inlineSecondaryFont(this.context, c); } /** * {@inheritDoc} */ - public FontUse inlineSecondaryFont(FOContext context, char c) { + public FontUse inlineSecondaryFont(final FOContext context, final char c) { return realLineText.inlineSecondaryFont(context, c); } @@ -95,7 +96,7 @@ /** * {@inheritDoc} */ - public int inlineFontSize(FOContext context) { + public int inlineFontSize(final FOContext context) { return realLineText.inlineFontSize(context); } @@ -109,7 +110,7 @@ /** * {@inheritDoc} */ - public int inlineLetterSpacingOptimum(FOContext context) { + public int inlineLetterSpacingOptimum(final FOContext context) { return realLineText.inlineLetterSpacingOptimum(context); } @@ -123,7 +124,7 @@ /** * {@inheritDoc} */ - public boolean inlineWrapOption(FOContext context) { + public boolean inlineWrapOption(final FOContext context) { return realLineText.inlineWrapOption(context); } @@ -137,7 +138,7 @@ /** * {@inheritDoc} */ - public boolean inlineHyphenate(FOContext context) { + public boolean inlineHyphenate(final FOContext context) { return realLineText.inlineHyphenate(context); } @@ -151,7 +152,7 @@ /** * {@inheritDoc} */ - public String inlineLanguage(FOContext context) { + public String inlineLanguage(final FOContext context) { return realLineText.inlineLanguage(context); } @@ -165,7 +166,7 @@ /** * {@inheritDoc} */ - public String inlineCountry(FOContext context) { + public String inlineCountry(final FOContext context) { return realLineText.inlineCountry(context); } @@ -179,7 +180,7 @@ /** * {@inheritDoc} */ - public int inlineHyphenationRemainCount(FOContext context) { + public int inlineHyphenationRemainCount(final FOContext context) { return realLineText.inlineHyphenationRemainCount(context); } @@ -193,7 +194,7 @@ /** * {@inheritDoc} */ - public int inlineHyphenationPushCount(FOContext context) { + public int inlineHyphenationPushCount(final FOContext context) { return realLineText.inlineHyphenationPushCount(context); } @@ -207,7 +208,7 @@ /** * {@inheritDoc} */ - public char inlineHyphenationCharacter(FOContext context) { + public char inlineHyphenationCharacter(final FOContext context) { return realLineText.inlineHyphenationCharacter(context); } /** @@ -220,7 +221,7 @@ /** * {@inheritDoc} */ - public boolean inlineIsFauxSmallCaps(FOContext context) { + public boolean inlineIsFauxSmallCaps(final FOContext context) { return realLineText.inlineIsFauxSmallCaps(context); } @@ -234,7 +235,7 @@ /** * {@inheritDoc} */ - public int inlineFauxSmallCapsFontSize(FOContext context) { + public int inlineFauxSmallCapsFontSize(final FOContext context) { return realLineText.inlineFauxSmallCapsFontSize(context); } @@ -262,7 +263,7 @@ /** * {@inheritDoc} */ - public org.axsl.foR.FOLineText getContextWrapper(FOContext context) { + public org.axsl.foR.FOLineText getContextWrapper(final FOContext context) { /* This *is* the wrapper. */ return this; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2006-07-22 22:07:57 UTC (rev 7811) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2006-07-23 00:19:17 UTC (rev 7812) @@ -47,7 +47,7 @@ private FONodeResult result; - protected FONode(FObj parent) { + protected FONode(final FObj parent) { super(parent); } @@ -58,26 +58,26 @@ * issues. * @return This node's effective parent. */ - public FObj effectiveParent(FOContext context) { + public FObj effectiveParent(final FOContext context) { /* If either this or its parent is a Marker, we want to return that * Marker's surrogate RetrieveMarker's parent. */ if (this instanceof Marker) { return effectiveMarkerParent(context); } - TreeNode parent = this.getParent(); + final TreeNode parent = this.getParent(); if (parent instanceof Marker) { return effectiveMarkerParent(context); } return realParent(); } - private FObj effectiveMarkerParent(FOContext context) { + private FObj effectiveMarkerParent(final FOContext context) { if (context == null) { /* TODO: Consider throwing an Exception. This should NOT * happen. */ return realParent(); } - RetrieveMarker retrieve = context.getRetrieveMarker(); + final RetrieveMarker retrieve = context.getRetrieveMarker(); if (retrieve == null) { /* TODO: Consider throwing an Exception. This should NOT * happen. */ @@ -109,7 +109,7 @@ /** * {@inheritDoc} */ - public void setProxy(FONodeProxy proxy) { + public void setProxy(final FONodeProxy proxy) { this.proxy = proxy; } @@ -123,7 +123,7 @@ /** * {@inheritDoc} */ - public void setResult(FONodeResult result) { + public void setResult(final FONodeResult result) { this.result = result; } @@ -144,7 +144,7 @@ return; } for (int i = 0; i < this.getChildren().size(); i++) { - FONode node = (FONode) this.getChildren().get(i); + final FONode node = (FONode) this.getChildren().get(i); node.reset(); } } @@ -152,7 +152,7 @@ /** * {@inheritDoc} */ - public org.axsl.foR.FONode getFONodeChildAt(int childIndex) { + public org.axsl.foR.FONode getFONodeChildAt(final int childIndex) { return (FONode) super.getChildAt(childIndex); } @@ -164,7 +164,8 @@ this.getColumn()); } - public String getContextMessage(String systemId, int line, int column) { + public String getContextMessage(final String systemId, final int line, + final int column) { return " Context: " + systemId + "\n" + " (Line " + line + ", Column " + column + ")"; } @@ -173,7 +174,7 @@ * {@inheritDoc} */ public org.axsl.foR.fo.Marker ancestorMarker() { - FObj parent = this.realParent(); + final FObj parent = this.realParent(); if (parent == null) { return null; } @@ -191,13 +192,13 @@ return realParent().getLogger(); } - public void throwException(String message) throws FOTreeException { + public void throwException(final String message) throws FOTreeException { throwException(getContextMessage(), message); } - public void throwException(String contextMessage, String message) - throws FOTreeException{ - FOTreeException exception = new FOTreeException(message); + public void throwException(final String contextMessage, + final String message) throws FOTreeException{ + final FOTreeException exception = new FOTreeException(message); exception.setContextMessage(contextMessage); throw exception; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-07-22 22:07:57 UTC (rev 7811) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-07-23 00:19:17 UTC (rev 7812) @@ -74,7 +74,7 @@ private char[] ca; private byte filterStatus = FILTER_RAW; - public FOText(FObj parent, char[] chars) { + public FOText(final FObj parent, final char[] chars) { super(parent); this.ca = chars; filterContent(); @@ -86,7 +86,7 @@ if (this.getFOTreeBuilder().preserveRawContent()) { return; } - Marker ancestorMarker = this.ancestorMarker(); + final Marker ancestorMarker = this.ancestorMarker(); if (ancestorMarker != null) { /* There is an fo:marker ancestor, so we can't know what the values * are for white-space-treatment, linefeed-treatment, @@ -119,7 +119,7 @@ public boolean isAllWhiteSpace() { for (int i = 0; i < ca.length; i++) { - char ch = ca[i]; + final char ch = ca[i]; if ((ch == ' ') || (ch == '\n') || (ch == '\r') @@ -146,17 +146,17 @@ * * @return The text that should appear in the refined FO tree. */ - public char[] getRefinedText(FOContext context) { + public char[] getRefinedText(final FOContext context) { /* TODO: This needs to come from effectiveParent, with context. */ - FObj effectiveParent = this.realParent(); + final FObj effectiveParent = this.realParent(); if (this.filterStatus >= FILTER_REFINED_FO_TREE) { /* The stored text has already been filtered. Just return it. */ return this.ca; } - char[] charArray = getPreTextTransformText(context); + final char[] charArray = getPreTextTransformText(context); // Now handle text-transform. - short textTransform = effectiveParent.traitTextTransform(context); + final short textTransform = effectiveParent.traitTextTransform(context); if (textTransform != Constants.FOVAL_NONE) { for (int i = 0; i < charArray.length; i++) { charArray[i] = applyTextTransform(context, charArray, i, @@ -189,8 +189,8 @@ * @return The text that should appear in the refined FO tree, except that * text-transform is not applied. */ - private char[] getPreTextTransformText(FOContext context) { - FObj effectiveParent = this.effectiveParent(context); + private char[] getPreTextTransformText(final FOContext context) { + final FObj effectiveParent = this.effectiveParent(context); if (this.filterStatus >= FILTER_PRE_TRANSFORM) { /* The stored text has already been filtered. Just return it. */ return this.ca; @@ -221,9 +221,10 @@ * @param textTransform The value of the text-transform enumerated property. * @return The transformed char. */ - private char applyTextTransform(FOContext context, char[] charArray, - int index, short textTransform) { - char c = charArray[index]; + private char applyTextTransform(final FOContext context, + final char[] charArray, final int index, + final short textTransform) { + final char c = charArray[index]; switch (textTransform) { /* This method not be entered if value is NONE. */ case Constants.FOVAL_UPPERCASE: @@ -271,9 +272,10 @@ * @return True iff the character at this location is the start of a new * word. */ - private boolean isStartOfWord(FOContext context, char[] charArray, - int index) { - char prevChar = getRelativeCharInBlock(context, charArray, index, -1); + private boolean isStartOfWord(final FOContext context, + final char[] charArray, final int index) { + final char prevChar = getRelativeCharInBlock(context, charArray, + index, -1); /* All we are really concerned about here is of what type prevChar is. If inputChar is not part of a word, then the Java conversions will (we hope) simply return inputChar. @@ -288,7 +290,7 @@ * as a possessive or a contraction, or might be a closing quote. */ case IS_WORD_CHAR_MAYBE: - char prevPrevChar = getRelativeCharInBlock(context, charArray, + final char prevPrevChar = getRelativeCharInBlock(context, charArray, index, -2); switch (isWordChar(prevPrevChar)) { case IS_WORD_CHAR_TRUE: @@ -317,7 +319,7 @@ * depending on whether the character should be considered part of a word * or not. */ - public static int isWordChar(char inputChar) { + public static int isWordChar(final char inputChar) { switch (Character.getType(inputChar)) { case Character.COMBINING_SPACING_MARK: return IS_WORD_CHAR_TRUE; @@ -405,10 +407,10 @@ * @return the character in the offset position within the block; 0x0000 if * the offset points to an area outside of the block. */ - private char getRelativeCharInBlock(FOContext context, char[] charArray, - int index, int offset) { + private char getRelativeCharInBlock(final FOContext context, + final char[] charArray, final int index, final int offset) { // The easy case is where the desired character is in the same FOText - int desiredIndex = index + offset; + final int desiredIndex = index + offset; if (desiredIndex >= 0 && desiredIndex < charArray.length) { return ca[desiredIndex]; } @@ -419,7 +421,8 @@ remainingOffset = offset - (charArray.length - 1 - index); FOText nextFOText = this.getNextContiguousTextInBlock(); while (nextFOText != null) { - char[] nextText = nextFOText.getPreTextTransformText(context); + final char[] nextText = + nextFOText.getPreTextTransformText(context); if (nextText.length >= remainingOffset) { return nextText[remainingOffset - 1]; } @@ -432,7 +435,7 @@ remainingOffset = offset + index; FOText prevFOText = this.getPreviousContiguousTextInBlock(); while (prevFOText != null) { - char[] prevText = prevFOText.getPreTextTransformText(context); + final char[] prevText = prevFOText.getPreTextTransformText(context); if (prevText.length >= Math.abs(remainingOffset)) { return prevText[prevText.length + remainingOffset]; } @@ -450,7 +453,7 @@ * non-text leaf between, null is returned. */ private FOText getNextContiguousTextInBlock() { - FONode nextLeaf = (FONode) this.getNextLeaf(); + final FONode nextLeaf = (FONode) this.getNextLeaf(); return getContiguousTextInBlock(nextLeaf); } @@ -462,7 +465,7 @@ * non-text leaf between, null is returned. */ private FOText getPreviousContiguousTextInBlock() { - FONode previousLeaf = (FONode) this.getPreviousLeaf(); + final FONode previousLeaf = (FONode) this.getPreviousLeaf(); return getContiguousTextInBlock(previousLeaf); } @@ -475,9 +478,9 @@ * 3) #leafToTest has the same ancestor Block as this. * If any of these are not true, null is returned. */ - private FOText getContiguousTextInBlock(FONode leafToTest) { - FObj effectiveParent = this.realParent(); - FOContext context = null; + private FOText getContiguousTextInBlock(final FONode leafToTest) { + final FObj effectiveParent = this.realParent(); + final FOContext context = null; if (leafToTest == null) { return null; } @@ -486,15 +489,15 @@ } /* If either is within a Leader, they both need to be in the same one. */ - Leader thisLeader = effectiveParent.getNearestLeader(context); - Leader testLeader = leafToTest.effectiveParent(context) + final Leader thisLeader = effectiveParent.getNearestLeader(context); + final Leader testLeader = leafToTest.effectiveParent(context) .getNearestLeader(context); if (thisLeader != testLeader) { return null; } - Block thisBlock = this.effectiveParent(context).getContainingBlock( - context); - Block testBlock = leafToTest.effectiveParent(context) + final Block thisBlock = + this.effectiveParent(context).getContainingBlock(context); + final Block testBlock = leafToTest.effectiveParent(context) .getContainingBlock(context); if (thisBlock != testBlock) { return null; @@ -512,8 +515,8 @@ * * @return The text that should appear in the area tree. */ - public char[] getAreaTreeText(FOContext context) { - FObj effectiveParent = this.realParent(); + public char[] getAreaTreeText(final FOContext context) { + final FObj effectiveParent = this.realParent(); if (this.filterStatus >= FILTER_AREA_TREE) { /* The stored text has already been filtered. Just return it. */ return this.ca; @@ -522,8 +525,8 @@ // Start with the refined FO Tree text char[] returnArray = getRefinedText(context); // Apply white-space-collapse. - boolean whiteSpaceCollapse = effectiveParent.traitWhiteSpaceCollapse( - context); + final boolean whiteSpaceCollapse = + effectiveParent.traitWhiteSpaceCollapse(context); returnArray = applyWhiteSpaceCollapse(returnArray, whiteSpaceCollapse); /* Set the instance text to the more refined value and update the @@ -537,7 +540,7 @@ return this.inlineText(null); } - public char[] inlineText(FOContext context) { + public char[] inlineText(final FOContext context) { return getAreaTreeText(context); } @@ -545,17 +548,17 @@ return this.inlinePrimaryFont(null); } - public FontUse inlinePrimaryFont(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public FontUse inlinePrimaryFont(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.getPrimaryFont(context); } - public FontUse inlineSecondaryFont(char c) { + public FontUse inlineSecondaryFont(final char c) { return this.inlineSecondaryFont(null, c); } - public FontUse inlineSecondaryFont(FOContext context, char c) { - FObj effectiveParent = effectiveParent(context); + public FontUse inlineSecondaryFont(final FOContext context, final char c) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.getSecondaryFont(context, c); } @@ -563,8 +566,8 @@ return this.inlineFontSize(null); } - public int inlineFontSize(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public int inlineFontSize(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.traitFontSize(context); } @@ -572,8 +575,8 @@ return this.inlineLetterSpacingOptimum(null); } - public int inlineLetterSpacingOptimum(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public int inlineLetterSpacingOptimum(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.traitLetterSpacingOpt(context); } @@ -581,8 +584,8 @@ return this.inlineWrapOption(null); } - public boolean inlineWrapOption(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public boolean inlineWrapOption(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return (effectiveParent.traitWrapOption(context) == Constants.FOVAL_WRAP); } @@ -591,8 +594,8 @@ return this.inlineHyphenate(null); } - public boolean inlineHyphenate(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public boolean inlineHyphenate(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.traitHyphenate(context); } @@ -600,8 +603,8 @@ return this.inlineLanguage(null); } - public String inlineLanguage(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public String inlineLanguage(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.traitLanguage(context); } @@ -609,8 +612,8 @@ return this.inlineCountry(null); } - public String inlineCountry(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public String inlineCountry(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.traitCountry(context); } @@ -618,8 +621,8 @@ return this.inlineHyphenationRemainCount(null); } - public int inlineHyphenationRemainCount(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public int inlineHyphenationRemainCount(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.traitHyphenationRemainCharacterCount(context); } @@ -627,8 +630,8 @@ return this.inlineHyphenationPushCount(null); } - public int inlineHyphenationPushCount(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public int inlineHyphenationPushCount(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.traitHyphenationPushCharacterCount(context); } @@ -636,8 +639,8 @@ return this.inlineHyphenationCharacter(null); } - public char inlineHyphenationCharacter(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public char inlineHyphenationCharacter(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.traitHyphenationCharacter(context); } @@ -645,8 +648,8 @@ return this.inlineIsFauxSmallCaps(null); } - public boolean inlineIsFauxSmallCaps(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public boolean inlineIsFauxSmallCaps(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); if (effectiveParent.traitFontVariant(context) != Constants.FOVAL_SMALL_CAPS) { return false; @@ -665,8 +668,8 @@ return this.inlineFauxSmallCapsFontSize(null); } - public int inlineFauxSmallCapsFontSize(FOContext context) { - FObj effectiveParent = effectiveParent(context); + public int inlineFauxSmallCapsFontSize(final FOContext context) { + final FObj effectiveParent = effectiveParent(context); return effectiveParent.getFauxSmallCapFontSize(context); } @@ -692,9 +695,9 @@ * Note that {@link #DISCARD_CHAR} is not a valid Unicode codepoint, and * should therefore never be in the input. */ - public static char applyWhiteSpaceTreatment(char[] charArray, int index, - short whiteSpaceTreatment) { - char c = charArray[index]; + public static char applyWhiteSpaceTreatment(final char[] charArray, + final int index, final short whiteSpaceTreatment) { + final char c = charArray[index]; if (! XMLCharacter.isXMLWhitespace(c)) { /* If it is not whitespace, it cannot be changed. */ return c; @@ -774,7 +777,7 @@ * white-space-treatment, <code>charArray</code> is returned. * Otherwise, a new char array with the result is returned. */ - public static char[] applyWhiteSpaceTreatment(char[] charArray, + public static char[] applyWhiteSpaceTreatment(final char[] charArray, short whiteSpaceTreatment) { switch (whiteSpaceTreatment) { case Constants.FOVAL_IGNORE: @@ -796,8 +799,8 @@ int discardElements = 0; int changeElements = 0; for (int i = 0; i < charArray.length; i++) { - char c = charArray[i]; - char conversionChar = applyWhiteSpaceTreatment(charArray, i, + final char c = charArray[i]; + final char conversionChar = applyWhiteSpaceTreatment(charArray, i, whiteSpaceTreatment); if (conversionChar == DISCARD_CHAR) { discardElements ++; @@ -812,11 +815,11 @@ /* We now know that changes of some sort must be made. Create a new * array in which to put the results. */ - char[] returnArray = new char[charArray.length - discardElements]; + final char[] returnArray = new char[charArray.length - discardElements]; discardElements = 0; for (int i = 0; i < charArray.length; i++) { - char conversionChar = applyWhiteSpaceTreatment(charArray, + final char conversionChar = applyWhiteSpaceTreatment(charArray, i, whiteSpaceTreatment); if (conversionChar == DISCARD_CHAR) { discardElements ++; @@ -827,7 +830,8 @@ return returnArray; } - public static char applyLinefeedTreatment(char c, short linefeedTreatment) { + public static char applyLinefeedTreatment(final char c, + final short linefeedTreatment) { assert c == 0x000a: "Invalid linefeed-treatment input."; switch (linefeedTreatment) { case Constants.FOVAL_IGNORE: { @@ -859,7 +863,7 @@ * <code>charArray</code> is returned. Otherwise, a new char array with the * result is returned. */ - public static char[] applyLinefeedTreatment(char[] charArray, + public static char[] applyLinefeedTreatment(final char[] charArray, short linefeedTreatment) { switch (linefeedTreatment) { case Constants.FOVAL_PRESERVE: { @@ -881,7 +885,7 @@ int discardElements = 0; int changeElements = 0; for (int i = 0; i < charArray.length; i++) { - char c = charArray[i]; + final char c = charArray[i]; if (c == 0x000a) { if (linefeedTreatment == Constants.FOVAL_IGNORE) { discardElements ++; @@ -897,12 +901,12 @@ /* We now know that changes of some sort must be made. Create a new * array in which to put the results. */ - char[] returnArray = new char[charArray.length - discardElements]; + final char[] returnArray = new char[charArray.length - discardElements]; discardElements = 0; for (int i = 0; i < charArray.length; i++) { - char c = charArray[i]; + final char c = charArray[i]; if (c == 0x000a) { - char conversionChar = applyLinefeedTreatment(c, + final char conversionChar = applyLinefeedTreatment(c, linefeedTreatment); if (conversionChar == DISCARD_CHAR) { discardElements ++; @@ -928,8 +932,9 @@ * if the next character is a line-feed. * If neither of these is true, returns the original character. */ - public static char applyWhiteSpaceCollapse(char[] charArray, int index) { - char c = charArray[index]; + public static char applyWhiteSpaceCollapse(final char[] charArray, + final int index) { + final char c = charArray[index]; if (! XMLCharacter.isXMLWhitespace(c)) { /* If it is not whitespace, nothing should change. */ return c; @@ -961,15 +966,15 @@ * white-space-collapse, <code>charArray</code> is returned. * Otherwise, a new char array with the result is returned. */ - public static char[] applyWhiteSpaceCollapse(char[] charArray, - boolean whiteSpaceCollapse) { + public static char[] applyWhiteSpaceCollapse(final char[] charArray, + final boolean whiteSpaceCollapse) { if (! whiteSpaceCollapse) { return charArray; } int discardElements = 0; for (int i = 0; i < charArray.length; i++) { - char convertChar = applyWhiteSpaceCollapse(charArray, i); + final char convertChar = applyWhiteSpaceCollapse(charArray, i); if (convertChar == DISCARD_CHAR) { discardElements ++; } @@ -981,10 +986,10 @@ /* We now know that changes of some sort must be made. Create a new * array in which to put the results. */ - char[] returnArray = new char[charArray.length - discardElements]; + final char[] returnArray = new char[charArray.length - discardElements]; discardElements = 0; for (int i = 0; i < charArray.length; i++) { - char conversionChar = applyWhiteSpaceCollapse(charArray, i); + final char conversionChar = applyWhiteSpaceCollapse(charArray, i); if (conversionChar == DISCARD_CHAR) { discardElements ++; } else { @@ -1006,12 +1011,12 @@ return this.parentFO().getColumn(); } - public FONodeProxy makeProxy(ProxyFactory factory) { + public FONodeProxy makeProxy(final ProxyFactory factory) { return factory.makeProxy(this); } - public org.axsl.foR.FOLineText getContextWrapper(FOContext context) { - org.axsl.foR.fo.Marker marker = this.ancestorMarker(); + public org.axsl.foR.FOLineText getContextWrapper(final FOContext context) { + final org.axsl.foR.fo.Marker marker = this.ancestorMarker(); if (marker == null) { return this; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2006-07-22 22:07:57 UTC (rev 7811) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2006-07-23 00:19:17 UTC (rev 7812) @@ -90,7 +90,7 @@ URL[] graphicSearchPath; boolean cachingGraphics; - public FOTreeBuilder(FOrayFOTreeServer server, Log logger) { + public FOTreeBuilder(final FOrayFOTreeServer server, final Log logger) { this.server = server; this.logger = logger; } @@ -98,7 +98,7 @@ /** * SAX Handler for characters */ - public void characters(char[] data, int start, int length) + public void characters(final char[] data, final int start, final int length) throws SAXException { if (activeForeignXML != null) { // If inside foreign XML, let the ForeignXML instance handle it. @@ -110,7 +110,7 @@ currentFObj.addCharacters(data, start, length, locator.getSystemId(), locator.getLineNumber(), locator.getColumnNumber()); - } catch (FOTreeException e) { + } catch (final FOTreeException e) { throw new SAXException(e); } } @@ -119,8 +119,8 @@ /** * SAX Handler for the end of an element */ - public void endElement(String uri, String localName, String rawName) - throws SAXException { + public void endElement(final String uri, final String localName, + final String rawName) throws SAXException { if (activeForeignXML != null) { // If inside foreign XML, let the ForeignXML instance handle it. activeForeignXML.endElement(uri, localName, rawName); @@ -131,7 +131,7 @@ } try { currentFObj.end(); - } catch (FOTreeException e) { + } catch (final FOTreeException e) { throw new SAXException(e); } notifyFObjComplete(currentFObj); @@ -157,31 +157,32 @@ notifyDocumentComplete(); } - public void setDocumentLocator(Locator locator) { + public void setDocumentLocator(final Locator locator) { this.locator = locator; } /** * SAX Handler for the start of an element */ - public void startElement(String namespaceURI, String localName, - String rawName, Attributes attlist) throws SAXException { + public void startElement(final String namespaceURI, final String localName, + final String rawName, final Attributes attlist) + throws SAXException { if (activeForeignXML != null) { // If inside foreign XML, let the ForeignXML instance handle it. activeForeignXML.startElement(namespaceURI, localName, rawName, attlist); return; } - Namespace namespace = getTreeServer().getNamespace(namespaceURI); + final Namespace namespace = getTreeServer().getNamespace(namespaceURI); if (namespace == null) { - String message = "Unregistered namespace: " + namespaceURI; + final String message = "Unregistered namespace: " + namespaceURI; getLogger().error(message + ": " + getLine() + ":" + getColumn()); throw new SAXException(message); } /* the formatting object started */ FObj fobj = null; try { - PropertyList list = namespace.createNewPropertyList(localName, + final PropertyList list = namespace.createNewPropertyList(localName, attlist); fobj = namespace.parseElement(localName, currentFObj, list, locator, this); @@ -196,7 +197,7 @@ rootFObj.addId(fobj); // Let Root register an unmatched "ref-id", if any. rootFObj.checkUnmatchedReference(fobj); - } catch (FOTreeException e) { + } catch (final FOTreeException e) { throw new SAXException(e); } currentFObj = fobj; @@ -206,7 +207,7 @@ * @param fobj * @throws SAXException */ - private void checkRoot(FObj fobj) throws SAXException { + private void checkRoot(final FObj fobj) throws SAXException { if (rootFObj != null) { return; } @@ -216,13 +217,13 @@ return; } if (fobj.getName().equals("root")) { - FOTreeException fote = new FOTreeException("Root element is " + final FOTreeException fote = new FOTreeException("Root element is " + "missing the namespace declaration: " + "http://www.w3.org/1999/XSL/Format"); fote.setContextMessage(fobj.getContextMessage()); throw new SAXException(fote); } - FOTreeException fote = new FOTreeException("Root element must be " + final FOTreeException fote = new FOTreeException("Root element must be " + "root, not " + fobj.getName()); fote.setContextMessage(fobj.getContextMessage()); throw new SAXException(new FOTreeException(fote)); @@ -262,7 +263,7 @@ * FOTreeEvent firings. * @param listener the Object which should be notified */ - public void registerListener (FOTreeListener listener) { + public void registerListener (final FOTreeListener listener) { if (listener == null) { return; } @@ -277,7 +278,7 @@ * about FOTreeEvent firings. * @param listener the Object which should no longer be notified */ - public void removeFOTreeListener (FOTreeListener listener) { + public void removeFOTreeListener (final FOTreeListener listener) { if (listener == null) { return; } @@ -292,15 +293,16 @@ * FOTreeEvent has been fired. * @param fobj The FObj instance that was just completed. */ - private void notifyFObjComplete(FObj fobj) { + private void notifyFObjComplete(final FObj fobj) { /* If nobody wants these events, don't waste resources creating * them. */ if (this.qtyFObjListeners < 1) { return; } - FOTreeEvent event = new FOTreeEvent(this, fobj); + final FOTreeEvent event = new FOTreeEvent(this, fobj); for (int i = 0; i < foTreeListeners.size(); i++) { - FOTreeListener listener = (FOTreeListener) foTreeListeners.get(i); + final FOTreeListener listener = + (FOTreeListener) foTreeListeners.get(i); listener.foFObjComplete(event); } } @@ -310,10 +312,11 @@ * FOTreeEvent has been fired. * @param pageSequence The PageSequence instance that was just completed. */ - private void notifyPageSequenceComplete(PageSequence pageSequence) { - FOTreeEvent event = new FOTreeEvent(this, pageSequence); + private void notifyPageSequenceComplete(final PageSequence pageSequence) { + final FOTreeEvent event = new FOTreeEvent(this, pageSequence); for (int i = 0; i < foTreeListeners.size(); i++) { - FOTreeListener listener = (FOTreeListener) foTreeListeners.get(i); + final FOTreeListener listener = + (FOTreeListener) foTreeListeners.get(i); listener.foPageSequenceComplete(event); } } @@ -323,9 +326,10 @@ * FOTreeEvent has been fired. */ private void notifyDocumentComplete() { - FOTreeEvent event = new FOTreeEvent(this); + final FOTreeEvent event = new FOTreeEvent(this); for (int i = 0; i < foTreeListeners.size(); i++) { - FOTreeListener listener = (FOTreeListener) foTreeListeners.get(i); + final FOTreeListener listener = + (FOTreeListener) foTreeListeners.get(i); listener.foDocumentComplete(event); } } @@ -346,7 +350,7 @@ return getTreeServer().getXMLNamespace(); } - public String getPropertyName(short propertyType) { + public String getPropertyName(final short propertyType) { return this.server.getPropertyName(propertyType); } @@ -354,7 +358,7 @@ return this.rootFObj; } - public void activateForeignXML(ForeignXML foreign) { + public void activateForeignXML(final ForeignXML foreign) { this.activeForeignXML = foreign; } @@ -366,7 +370,7 @@ return this.server; } - public void setGraphicServer(GraphicServer graphicServer) { + public void setGraphicServer(final GraphicServer graphicServer) { this.graphicServer = graphicServer; } @@ -374,7 +378,7 @@ return this.graphicServer; } - public void setTextServer(TextServer textServer) { + public void setTextServer(final TextServer textServer) { this.textServer = textServer; } @@ -382,7 +386,7 @@ return this.textServer; } - public void setFontConsumer(FontConsumer consumer) { + public void setFontConsumer(final FontConsumer consumer) { this.fontConsumer = consumer; } @@ -390,7 +394,7 @@ return this.fontConsumer; } - public void setGraphicSearchPath(URL[] graphicSearchPath) { + public void setGraphicSearchPath(final URL[] graphicSearchPath) { this.graphicSearchPath = graphicSearchPath; } @@ -398,7 +402,7 @@ return this.graphicSearchPath; } - public void setCachingGraphics(boolean cachingGraphics) { + public void setCachingGraphics(final boolean cachingGraphics) { this.cachingGraphics = cachingGraphics; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-07-22 22:07:57 UTC (rev 7811) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-07-23 00:19:17 UTC (rev 7812) @@ -59,8 +59,9 @@ protected int line; protected int column; - protected FObj(FObj parent, PropertyList propertyList, String systemId, - int line, int column) throws FOTreeException { + protected FObj(final FObj parent, final PropertyList propertyList, + final String systemId, final int line, final int column) + throws FOTreeException { // Register the parent as the parent of this. super(parent); // Register this as a child of the parent. @@ -114,15 +115,17 @@ * @param column The columns number of the location of the text being * added (used in error messages). */ - protected void addCharacters(char[] data, int start, int length, - String systemId, int line, int column) throws FOTreeException { + protected void addCharacters(final char[] data, final int start, + final int length, final String systemId, final int line, + final int column) throws FOTreeException { if (containsText(data, start, length)) { throwException(getContextMessage(systemId, line, column), "May not contain non-whitespace text."); } } - protected boolean containsText(char[] data, int start, int length) { + protected boolean containsText(final char[] data, final int start, + final int length) { if (data == null || data.length < 1) { return false; } @@ -131,7 +134,7 @@ return false; } for (int i = start; i < start + length; i++) { - char c = data[i]; + final char c = data[i]; if (! XMLCharacter.isXMLWhitespace(c)) { return true; } @@ -191,7 +194,7 @@ * issues. * @return The nearest ancestor FObj that generates reference areas. */ - public org.axsl.foR.FObj ancestorGeneratingRA(FOContext context) { + public org.axsl.foR.FObj ancestorGeneratingRA(final FOContext context) { if (effectiveParent(context).isRAGenerator()) { return effectiveParent(context); } @@ -201,7 +204,7 @@ /** * @return Self or the nearest ancestor FObj that generates reference areas. */ - public org.axsl.foR.FObj nearestGeneratingRA(FOContext context) { + public org.axsl.foR.FObj nearestGeneratingRA(final FOContext context) { if (this.isRAGenerator()) { return this; } @@ -213,7 +216,8 @@ * issues. * @return Self or the nearest ancestor FObj that is a ListItem. */ - public org.axsl.foR.fo.ListItem getNearestListItem(FOContext context) { + public org.axsl.foR.fo.ListItem getNearestListItem( + final FOContext context) { return effectiveParent(context).getNearestListItem(context); } @@ -223,7 +227,7 @@ * @return The nearest ancestor FObj that is a ListBlock. */ public org.axsl.foR.fo.ListBlock getNearestAncestorListBlock( - FOContext context) { + final FOContext context) { if (getParent() == null) { return null; } @@ -245,11 +249,11 @@ * the nearest ancestor that is a Block, or null if there is no ancestor * Block. */ - public org.axsl.foR.fo.Block getContainingBlock(FOContext context) { + public org.axsl.foR.fo.Block getContainingBlock(final FOContext context) { return effectiveParent(context).getContainingBlock(context); } - public org.axsl.foR.fo.Flow getFlow(FOContext context) { + public org.axsl.foR.fo.Flow getFlow(final FOContext context) { if (getParent() == null) { return null; } @@ -259,36 +263,37 @@ /** * {@inheritDoc} */ - public org.axsl.foR.fo.Table getNearestTable(FOContext context) { + public org.axsl.foR.fo.Table getNearestTable(final FOContext context) { return effectiveParent(context).getNearestTable(context); } - public org.axsl.foR.fo.Leader getNearestLeader(FOContext context) { + public org.axsl.foR.fo.Leader getNearestLeader(final FOContext context) { return effectiveParent(context).getNearestLeader(context); } /** * {@inheritDoc} */ - public org.axsl.foR.fo.BasicLink getBasicLink(FOContext context) { + public org.axsl.foR.fo.BasicLink getBasicLink(final FOContext context) { return effectiveParent(context).getBasicLink(context); } /** * {@inheritDoc} */ - public org.axsl.foR.FObj ancestorListRelatedObject(FOContext context) { + public org.axsl.foR.FObj ancestorListRelatedObject( + final FOContext context) { return effectiveParent(context).ancestorListRelatedObject(context); } /** * {@inheritDoc} */ - public String refIdNeeded(FOContext context) { + public String refIdNeeded(final FOContext context) { return null; } - protected void addChild(FONode child) throws FOTreeException { + protected void addChild(final FONode child) throws FOTreeException { children.add(child); } @@ -313,14 +318,14 @@ return true; } - public void checkExceptionLocation(FOTreeException exception) { + public void checkExceptionLocation(final FOTreeException exception) { if (exception.isContextSet()) { return; } exception.setContextMessage(getContextMessage()); } - public void logWarning(String message) { + public void logWarning(final String message) { getLogger().warn(message + "\n" + getContextMessage()); } @@ -342,84 +347,88 @@ */ public abstract Namespace getNamespace() ; - public String getPropertyName(short propertyType) { + public String getPropertyName(final short propertyType) { return getFOTreeBuilder().getPropertyName(propertyType); } /** * {@inheritDoc} */ - public int getMarginLeft(FOContext context, int widthContainingBlock) { + public int getMarginLeft(final FOContext context, + final int widthContainingBlock) { return propertyList.getMarginLeft(context, widthContainingBlock); } /** * {@inheritDoc} */ - public int getMarginRight(FOContext context, int widthContainingBlock) { + public int getMarginRight(final FOContext context, + final int widthContainingBlock) { return propertyList.getMarginRight(context, widthContainingBlock); } /** * {@inheritDoc} */ - public int getMarginTop(FOContext context, int widthContainingBlock) { + public int getMarginTop(final FOContext context, + final int widthContainingBlock) { return propertyList.getMarginTop(context, widthContainingBlock); } /** * {@inheritDoc} */ - public int getMarginBottom(FOContext context, int widthContainingBlock) { + public int getMarginBottom(final FOContext context, + final int widthContainingBlock) { return propertyList.getMarginBottom(context, widthContainingBlock); } /** * {@inheritDoc} */ - public Color traitColor(FOContext context) { + public Color traitColor(final FOContext context) { return propertyList.getColor(context); } /** * {@inheritDoc} */ - public short traitWrapOption(FOContext context) { + public short traitWrapOption(final FOContext context) { return propertyList.getWrapOption(context); } /** * {@inheritDoc} */ - public boolean traitWhiteSpaceCollapse(FOContext context) { + public boolean traitWhiteSpaceCollapse(final FOContext context) { return propertyList.getWhiteSpaceCollapse(context); } /** * {@inheritDoc} */ - public boolean traitUnderlineScore(FOContext context) { + public boolean traitUnderlineScore(final FOContext context) { return propertyList.getUnderlineScore(context); } /** * {@inheritDoc} */ - public boolean traitOverlineScore(FOContext context) { + public boolean traitOverlineScore(final FOContext context) { return propertyList.getOverlineScore(context); } /** * {@inheritDoc} */ - public boolean traitThroughScore(FOContext context) { + public boolean traitThroughScore(final FOContext context) { return propertyList.getThroughScore(context); } /** * {@inheritDoc} */ - public Color traitUnderlineScoreColor(FOContext context) { + public Color traitUnderlineScoreColor(final FOContext context) { /* TODO: This is not right. See Sections 5.5.6 and 7.16.4. Inheritance * is unusual here, and we need to fix it. */ return traitColor(context); @@ -428,7 +437,7 @@ /** * {@inheritDoc} */ - public Color traitOverlineScoreColor(FOContext context) { + public Color traitOverlineScoreColor(final FOContext context) { // Value is the same as for underline. return traitUnderlineScoreColor(context); } @@ -436,7 +445,7 @@ /** * {@inheritDoc} */ - public Color traitThroughScoreColor(FOContext context) { + public Color traitThroughScoreColor(final FOContext context) { // Value is the same as for underline. return traitUnderlineScoreColor(context); } @@ -444,7 +453,7 @@ /** * {@inheritDoc} */ - public boolean traitBlink(FOContext context) { + public boolean traitBlink(final FOContext context) { return propertyList.getBlink(context); } @@ -472,7 +481,8 @@ /** * {@inheritDoc} */ - public int traitStartIndent(FOContext context, int ipdContainingRA) { + public int traitStartIndent(final FOContext context, + final int ipdContainingRA) { return propertyList.getIndent(context, Constants.DIRECTION_START, ipdContainingRA); } @@ -480,7 +490,7 @@ /** * {@inheritDoc} */ - public short traitSpan(FOContext context) { + public short traitSpan(final FOContext context) { /* * Only block-level FOs are affected by column-count, so, for all other * FOs, treat them as if the span trait were "all". @@ -514,7 +524,7 @@ return propertyList.getRetrieveBoundary(); } - public int traitColumnNumber(FOContext context) { + public int traitColumnNumber(final FOContext context) { return propertyList.getColumnNumber(context); } @@ -529,35 +539,35 @@ /** * {@inheritDoc} */ - public short traitBorderCollapse(FOContext context) { + public short traitBorderCollapse(final FOContext context) { return propertyList.getBorderCollapse(context); } /** * {@inheritDoc} */ - public short traitDisplayAlign(FOContext context) { + public short traitDisplayAlign(final FOContext context) { return propertyList.getDisplayAlign(context); } /** * {@inheritDoc} */ - public short traitRelativeAlign(FOContext context) { + public short traitRelativeAlign(final FOContext context) { return propertyList.getRelativeAlign(context); } /** * {@inheritDoc} */ - public int traitBorderSeparationIPD(FOContext context) { + public int traitBorderSeparationIPD(final FOContext context) { return propertyList.getBorderSeparationIPD(context); } /** * {@inheritDoc} */ - public int traitBorderSeparationBPD(FOContext context) { + public int traitBorderSeparationBPD(final FOContext context) { return propertyList.getBorderSeparationBPD(context); } @@ -571,7 +581,7 @@ /** * {@inheritDoc} */ - public int traitColumnWidth(FOContext context, int tableWidth) { + public int traitColumnWidth(final FOContext context, final int tableWidth) { return propertyList.getColumnWidth(context, tableWidth); } @@ -585,70 +595,70 @@ /** * {@inheritDoc} */ - public short traitBreakAfter(FOContext context) { + public short traitBreakAfter(final FOContext context) { return propertyList.getBreakAfter(context); } /** * {@inheritDoc} */ - public int traitKeepTogetherWithinLine(FOContext context) { + public int traitKeepTogetherWithinLine(final FOContext context) { return propertyList.traitKeepTogetherWithinLine(context); } /** * {@inheritDoc} */ - public int traitKeepTogetherWithinColumn(FOContext context) { + public int traitKeepTogetherWithinColumn(final FOContext context) { return propertyList.traitKeepTogetherWithinColumn(context); } /** * {@inheritDoc} */ - public int traitKeepTogetherWithinPage(FOContext context) { + public int traitKeepTogetherWithinPage(final FOContext context) { return propertyList.traitKeepTogetherWithinPage(context); } /** * {@inheritDoc} */ - public int traitKeepWithNextWithinLine(FOContext context) { + public int traitKeepWithNextWithinLine(final FOContext context) { return propertyList.traitKeepWithNextWithinLine(context); } /** * {@inheritDoc} */ - public int traitKeepWithNextWithinColumn(FOContext context) { + public int traitKeepWithNextWithinColumn(final FOContext context) { return propertyList.traitKeepWithNextWithinColumn(context); } /** * {@inheritDoc} */ - public int traitKeepWithNextWithinPage(FOContext context) { + public in... [truncated message content] |
|
From: <vic...@us...> - 2006-07-22 22:08:37
|
Revision: 7811 Author: victormote Date: 2006-07-22 15:07:57 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7811&view=rev Log Message: ----------- Implement standard use of "final" modifier on local variables and parameters. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtAngle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCharacter.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtColor.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCountry.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtFrequency.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtInteger.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtKeep.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLanguage.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLength.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthBPIPDirection.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthConditional.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthRange.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtName.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtNumber.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtPercentage.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtRectangle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtScript.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShadowEffect.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShape.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtSpace.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtString.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtTextDeco.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtTime.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtURI.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtWritingMode.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/Expr.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprAdditiveOper.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprInner.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprMultiplicativeOper.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprUnaryOper.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnAbs.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnBodyStart.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnCeiling.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnFloor.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnFromParent.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnFromTableColumn.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnInheritedProp.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnLabelEnd.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnMax.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnMin.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnNearestSpecProp.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnProportionalColWidth.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnRGB.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnRound.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/Function.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/PropertyCollection.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/PropertyKeyword.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ValueCollection.java trunk/foray/foray-fotree/src/java/org/foray/fotree/xml/NamespaceXML.java trunk/foray/foray-fotree/src/java/org/foray/fotree/xml/PropertyMakerXML.java trunk/foray/foray-fotree/src/java/org/foray/fotree/xml/prop/Lang.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtAngle.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtAngle.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtAngle.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -46,7 +46,8 @@ * @param value The signed angle value. * @param units One of AngleDT.DEGREEES, AngleDT.GRADS, or AngleDT.RADIANS. */ - public DtAngle(float value, byte units) throws PropertyException { + public DtAngle(final float value, final byte units) + throws PropertyException { if (! validUnits(units)) { throw new PropertyException("Illegal angle unit ID: " + units); } @@ -74,7 +75,7 @@ * @param units One of AngleDT.DEGREES, AngleDT.GRADS, or AngleDT.RADIANS. * @return The value, in degrees, of the angle. */ - public static float convertToDegrees(float value, byte units) { + public static float convertToDegrees(final float value, final byte units) { switch (units) { case DEGREES: { return value; @@ -99,7 +100,7 @@ * datatype in the XSL-FO spec, 1.0, Section 5.11. * @return An AngleDT instance if input is valid, otherwise null; */ - public static DtAngle makeAngleDT(String input) { + public static DtAngle makeAngleDT(final String input) { byte unitID = 0; int index = input.indexOf("deg"); if (index > -1) { @@ -120,16 +121,16 @@ if (! validUnits(unitID)) { return null; } - String valuePortion = input.substring(0, index - 1); + final String valuePortion = input.substring(0, index - 1); float value = 0; try { value = Float.parseFloat(valuePortion); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { return null; } try { return new DtAngle(value, unitID); - } catch (PropertyException e1) { + } catch (final PropertyException e1) { /* * The exception thrown by the constructor is to ensure that the * units are valid, which we have already done above. Therefore, @@ -139,7 +140,7 @@ } } - public static boolean validUnits(byte units) { + public static boolean validUnits(final byte units) { if (units < DtAngle.DEGREES) { return false; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCharacter.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCharacter.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCharacter.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -36,7 +36,7 @@ * Constructor. * @param value The char value. */ - public DtCharacter(char value) { + public DtCharacter(final char value) { this.value = value; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtColor.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtColor.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtColor.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -251,7 +251,7 @@ * {@link #makeDtColor(String)}, {@link #makeDtColor(Color)}, or * {@link #makeDtColor(float, float, float, float)}. */ - private DtColor(Color color) { + private DtColor(final Color color) { this.value = color; } @@ -273,36 +273,36 @@ * @return A ColorDT instance, or null if input is not a defined XSL-FO * named color. */ - public static DtColor makeDtColor(String input) { + public static DtColor makeDtColor(final String input) { /* The names colors are static instances anyway, so no need to check * the list of used colors. */ return mapNameToColorRGB(input); } - public static DtColor makeDtColor(Color color) { - DtColor foundColor = DtColor.findColor(color); + public static DtColor makeDtColor(final Color color) { + final DtColor foundColor = DtColor.findColor(color); /* If it has already been created, return the previously-created * instance. */ if (foundColor != null) { return foundColor; } /* Otherwise, create a new instance. */ - DtColor newDtColor = new DtColor(color); + final DtColor newDtColor = new DtColor(color); DtColor.colorsUsed.add(newDtColor); return newDtColor; } - public static DtColor makeDtColor(float red, float green, float blue, - float alpha) { - DtColor foundColor = DtColor.findColor(red, green, blue, alpha); + public static DtColor makeDtColor(final float red, final float green, + final float blue, final float alpha) { + final DtColor foundColor = DtColor.findColor(red, green, blue, alpha); /* If it has already been created, return the previously-created * instance. */ if (foundColor != null) { return foundColor; } /* Otherwise, create a new instance. */ - Color newColor = new Color(red, green, blue, alpha); - DtColor newDtColor = new DtColor(newColor); + final Color newColor = new Color(red, green, blue, alpha); + final DtColor newDtColor = new DtColor(newColor); DtColor.colorsUsed.add(newDtColor); return newDtColor; } @@ -314,9 +314,9 @@ * @return The already-created instance for <code>color</code>, or null * if it has not yet been created. */ - private static DtColor findColor(Color color) { + private static DtColor findColor(final Color color) { for (int i = 0; i < DtColor.getColorsUsed().size(); i++) { - DtColor usedColor = (DtColor) DtColor.getColorsUsed().get(i); + final DtColor usedColor = (DtColor) DtColor.getColorsUsed().get(i); if (usedColor.value.equals(color)) { return usedColor; } @@ -334,12 +334,12 @@ * @return The already-created instance, or null if it has not yet been * created. */ - private static DtColor findColor(float red, float green, float blue, - float alpha) { + private static DtColor findColor(final float red, final float green, + final float blue, final float alpha) { for (int i = 0; i < DtColor.getColorsUsed().size(); i++) { - DtColor usedColor = (DtColor) DtColor.getColorsUsed().get(i); - Color colorValue = usedColor.value; - float[] components = colorValue.getRGBComponents(null); + final DtColor usedColor = (DtColor) DtColor.getColorsUsed().get(i); + final Color colorValue = usedColor.value; + final float[] components = colorValue.getRGBComponents(null); if (components == null || components.length != 4) { continue; @@ -362,9 +362,9 @@ return DtColor.colorsUsed; } - public static DtColor mapNameToColorRGB(String colorName) { + public static DtColor mapNameToColorRGB(final String colorName) { // Do a binary search to find the name in the names list. - int index = Arrays.binarySearch(names, colorName); + final int index = Arrays.binarySearch(names, colorName); if (index < 0 || index >= names.length) { return null; } @@ -409,7 +409,7 @@ throw new PropertyException("Unknown colour format. Must " + "be #RGB or #RRGGBB"); } - } catch (Exception e) { + } catch (final Exception e) { red = 0; green = 0; blue = 0; @@ -417,14 +417,14 @@ + "#RGB or #RRGGBB"); } } else if (value.startsWith("rgb(")) { - int poss = value.indexOf("("); - int pose = value.indexOf(")"); + final int poss = value.indexOf("("); + final int pose = value.indexOf(")"); if (poss != -1 && pose != -1) { value = value.substring(poss + 1, pose); - StringTokenizer st = new StringTokenizer(value, ","); + final StringTokenizer st = new StringTokenizer(value, ","); try { if (st.hasMoreTokens()) { - String str = st.nextToken().trim(); + final String str = st.nextToken().trim(); if (str.endsWith("%")) { red = Integer.parseInt(str.substring(0, str.length() @@ -435,7 +435,7 @@ } } if (st.hasMoreTokens()) { - String str = st.nextToken().trim(); + final String str = st.nextToken().trim(); if (str.endsWith("%")) { green = Integer.parseInt(str.substring(0, str.length() @@ -446,7 +446,7 @@ } } if (st.hasMoreTokens()) { - String str = st.nextToken().trim(); + final String str = st.nextToken().trim(); if (str.endsWith("%")) { blue = Integer.parseInt(str.substring(0, str.length() @@ -456,7 +456,7 @@ blue = Integer.parseInt(str) / 255f; } } - } catch (Exception e) { + } catch (final Exception e) { red = 0; green = 0; blue = 0; @@ -473,7 +473,8 @@ blue = 0; alpha = 1; } else { - DtColor foundColor = mapNameToColorRGB(value.toLowerCase()); + final DtColor foundColor = mapNameToColorRGB( + value.toLowerCase()); if (foundColor == null) { red = 0; green = 0; @@ -484,7 +485,7 @@ return foundColor; } } - DtColor dtColor = DtColor.makeDtColor(red, green, blue, alpha); + final DtColor dtColor = DtColor.makeDtColor(red, green, blue, alpha); return dtColor; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCountry.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCountry.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCountry.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -542,7 +542,7 @@ * Constructor. * @param value The country code. */ - public DtCountry(String value) { + public DtCountry(final String value) { this.value = value.toLowerCase(); } @@ -556,7 +556,7 @@ /** * Set the value. */ - public void setValue(String value) { + public void setValue(final String value) { this.value = value; } @@ -565,8 +565,8 @@ * @param countryCode A 2-letter or 3-letter ISO 3166 code. * @return True if countryCode is found in validCountries, false otherwise. */ - public static boolean validCountry(String countryCode) { - String normalized = countryCode.toLowerCase(); + public static boolean validCountry(final String countryCode) { + final String normalized = countryCode.toLowerCase(); int index = Arrays.binarySearch(validCountries, normalized); if (index >= 0) { return true; @@ -578,7 +578,7 @@ return false; } - public static DtCountry makeCountryDT(String countryCode) { + public static DtCountry makeCountryDT(final String countryCode) { if (! validCountry(countryCode)) { return null; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtFrequency.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtFrequency.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtFrequency.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -40,7 +40,8 @@ /** * Constructor. */ - public DtFrequency(double quantity, byte units) throws PropertyException { + public DtFrequency(final double quantity, final byte units) + throws PropertyException { if (units < 1 || units > 2) { throw new PropertyException("Invalid FrequencyDT unit ID."); } @@ -70,9 +71,9 @@ * @return The FrequencyDT instance constructed, or null if input is not * valid. */ - public static DtFrequency makeFrequencyDT(String input) { + public static DtFrequency makeFrequencyDT(final String input) { // Make a copy of input - String useInput = new String(input); + final String useInput = new String(input); useInput.trim(); byte units = -1; int unitsLength = -1; @@ -86,17 +87,17 @@ if (units < 1) { return null; } - String quantityPart = useInput.substring(0, useInput.length() + final String quantityPart = useInput.substring(0, useInput.length() - unitsLength); double quantity; try { quantity = Double.parseDouble(quantityPart); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { return null; } try { return new DtFrequency(quantity, units); - } catch (PropertyException e1) { + } catch (final PropertyException e1) { /* * This should never happen, because we have already validated the * input. Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtInteger.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtInteger.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtInteger.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -37,7 +37,7 @@ * Constructor. * @param value The signed number value. */ - public DtInteger(int value) { + public DtInteger(final int value) { this.value = value; } @@ -51,7 +51,7 @@ /** * Set the value. */ - public void setValue(int value) { + public void setValue(final int value) { this.value = value; } @@ -59,7 +59,7 @@ return value; } - public void setNumericValue(double value) { + public void setNumericValue(final double value) { this.value = (int) Math.round(value); } @@ -67,13 +67,13 @@ return this; } - public void setMinimumValue(int num) { + public void setMinimumValue(final int num) { if (num > this.value) { this.value = num; } } - public void setMaximumValue(int num) { + public void setMaximumValue(final int num) { if (num < this.value) { this.value = num; } @@ -90,14 +90,14 @@ * created. * @return An IntegerDT instance, or null if input is not valid. */ - public static DtInteger makeIntegerDT(String input) { + public static DtInteger makeIntegerDT(final String input) { // Make a copy of input - String useInput = new String(input); + final String useInput = new String(input); useInput.trim(); int value = 0; try { value = Integer.parseInt(useInput); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { return null; } return new DtInteger(value); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtKeep.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtKeep.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtKeep.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -40,21 +40,22 @@ /** * Constructor. */ - public DtKeep(int withinLine, int withinColumn, int withinPage) { + public DtKeep(final int withinLine, final int withinColumn, + final int withinPage) { this.withinLine = withinLine; this.withinColumn = withinColumn; this.withinPage = withinPage; } - public void setWithinLine(int withinLine) { + public void setWithinLine(final int withinLine) { this.withinLine = withinLine; } - public void setWithinColumn(int withinColumn) { + public void setWithinColumn(final int withinColumn) { this.withinColumn = withinColumn; } - public void setWithinPage(int withinPage) { + public void setWithinPage(final int withinPage) { this.withinPage = withinPage; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLanguage.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLanguage.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLanguage.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -39,7 +39,7 @@ * Constructor. * @param value The language code. */ - public DtLanguage(String value) { + public DtLanguage(final String value) { this.value = value; } @@ -53,11 +53,11 @@ /** * Set the value. */ - public void setValue(String value) { + public void setValue(final String value) { this.value = value; } - public static DtLanguage makeLanguageDT(String languageCode) { + public static DtLanguage makeLanguageDT(final String languageCode) { if (! ISO639.validLanguage(languageCode)) { return null; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLength.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLength.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLength.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -73,7 +73,8 @@ * @param units A byte representation of the unit of measure (points, * inches, etc.) */ - public DtLength(float value, String units) throws PropertyException { + public DtLength(final float value, final String units) + throws PropertyException { this.value = value; this.units = convertUnits(units); if (this.units < 1 || this.units > 8) { @@ -87,7 +88,7 @@ * @param percentBase The base to be used for percentage computations. * @return The value of this length in millipoints. */ - public int getValue(int pointSize, int percentBase) { + public int getValue(final int pointSize, final int percentBase) { switch (this.units) { case UNIT_INCHES: { return Math.round(this.value * 72 * 1000); @@ -120,7 +121,7 @@ } } - public static byte convertUnits(String units) { + public static byte convertUnits(final String units) { // Start at 1, not 0, as 0 is not a valid value. for (byte i = 1; i < unitArray.length; i++) { if (units.equals(unitArray[i])) { @@ -140,7 +141,7 @@ /** * Note that this sets the raw numeric value, without regard to units. */ - public void setNumericValue(double value) { + public void setNumericValue(final double value) { this.value = (int) Math.round(value); } @@ -155,9 +156,9 @@ * created. * @return A LengthDT instance, or null if input is not valid. */ - public static DtLength makeLengthDT(String input) { + public static DtLength makeLengthDT(final String input) { // Make a copy of input - String useInput = new String(input); + final String useInput = new String(input); useInput.trim(); byte unitArrayIndex = -1; for (byte i = 1; i < unitArray.length; i++) { @@ -168,18 +169,18 @@ if (unitArrayIndex < 1) { return null; } - int charsToTruncate = unitArray[unitArrayIndex].length(); - String valuePart = useInput.substring(0, useInput.length() + final int charsToTruncate = unitArray[unitArrayIndex].length(); + final String valuePart = useInput.substring(0, useInput.length() - charsToTruncate); float value = 0; try { value = Float.parseFloat(valuePart); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { return null; } try { return new DtLength(value, unitArray[unitArrayIndex]); - } catch (PropertyException e1) { + } catch (final PropertyException e1) { // This should never happen as we have already validated the input. return null; } @@ -196,7 +197,7 @@ return true; } - public int evalUnitPower1(int pointSize, int percentBase) { + public int evalUnitPower1(final int pointSize, final int percentBase) { return getValue(pointSize, percentBase); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthBPIPDirection.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthBPIPDirection.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthBPIPDirection.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -36,12 +36,13 @@ /** * Constructor. */ - public DtLengthBPIPDirection(DtLength bpdLength, DtLength ipdLength) { + public DtLengthBPIPDirection(final DtLength bpdLength, + final DtLength ipdLength) { this.bpdLength = bpdLength; this.ipdLength = ipdLength; } - public void setBPDLength(DtLength length) { + public void setBPDLength(final DtLength length) { this.bpdLength = length; } @@ -49,7 +50,7 @@ return this.bpdLength; } - public void setIPDLength(DtLength length) { + public void setIPDLength(final DtLength length) { this.ipdLength = length; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthConditional.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthConditional.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthConditional.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -36,16 +36,17 @@ /** * Constructor. */ - public DtLengthConditional(DtLength length, byte conditionality) { + public DtLengthConditional(final DtLength length, + final byte conditionality) { this.length = length; this.conditionality = conditionality; } - public void setLength(DtLength length) { + public void setLength(final DtLength length) { this.length = length; } - public void setConditionality(byte conditionality) { + public void setConditionality(final byte conditionality) { this.conditionality = conditionality; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthRange.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthRange.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthRange.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -37,22 +37,22 @@ /** * Constructor. */ - public DtLengthRange(DtLength lengthMinimum, DtLength lengthOptimum, - DtLength lengthMaximum) { + public DtLengthRange(final DtLength lengthMinimum, + final DtLength lengthOptimum, final DtLength lengthMaximum) { this.lengthMinimum = lengthMinimum; this.lengthOptimum = lengthOptimum; this.lengthMaximum = lengthMaximum; } - public void setLengthMinimum(DtLength lengthMinimum) { + public void setLengthMinimum(final DtLength lengthMinimum) { this.lengthMinimum = lengthMinimum; } - public void setLengthOptimum(DtLength lengthOptimum) { + public void setLengthOptimum(final DtLength lengthOptimum) { this.lengthOptimum = lengthOptimum; } - public void setLengthMaximum(DtLength lengthMaximum) { + public void setLengthMaximum(final DtLength lengthMaximum) { this.lengthMaximum = lengthMaximum; } @@ -75,7 +75,8 @@ * should be set. * @return True if successful, false if the subPropertyName is not valid. */ - public boolean setComponent(String subPropertyName, DtLength length) { + public boolean setComponent(final String subPropertyName, + final DtLength length) { if (subPropertyName.equals("minimum")) { setLengthMinimum(length); return true; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtName.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtName.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtName.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -38,7 +38,7 @@ * Constructor. * @param value The string value of the name. */ - public DtName(String value) { + public DtName(final String value) { this.value = value; } @@ -56,7 +56,7 @@ * @param input String containing the value to be converted to a NameDT. * @return A new NameDT instance, or null if input is not valid. */ - public static DtName makeNameDT(String input) { + public static DtName makeNameDT(final String input) { if (! XMLCharacter.isNCName(input)) { return null; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtNumber.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtNumber.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtNumber.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -37,7 +37,7 @@ * Constructor. * @param value The signed length value. */ - public DtNumber(double value) { + public DtNumber(final double value) { this.value = value; } @@ -52,12 +52,12 @@ return value; } - public void setNumericValue(double value) { + public void setNumericValue(final double value) { this.value = value; } public DtInteger round() { - int integer = (int) Math.round(this.value); + final int integer = (int) Math.round(this.value); return new DtInteger(integer); } @@ -66,11 +66,11 @@ return 0; } - public static DtNumber makeNumberDT(String input) { + public static DtNumber makeNumberDT(final String input) { double aNumber = 0; try { aNumber = Double.parseDouble(input); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { return null; } return new DtNumber(aNumber); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtPercentage.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtPercentage.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtPercentage.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -38,7 +38,7 @@ * @param value The percentage value. 85.6% should be expressed as 85.6, * not .856. */ - public DtPercentage(float value) { + public DtPercentage(final float value) { this.value = value; } @@ -53,7 +53,7 @@ return value; } - public void setNumericValue(double value) { + public void setNumericValue(final double value) { this.value = (float) value; } @@ -67,18 +67,19 @@ * @return The PercentageDT instance constructed, or null if input is not * valid. */ - public static DtPercentage makePercentageDT(String input) { + public static DtPercentage makePercentageDT(final String input) { // Make a copy of input - String useInput = new String(input); + final String useInput = new String(input); useInput.trim(); if (! useInput.endsWith("%")) { return null; } - String quantityPart = useInput.substring(0, useInput.length() - 1); + final String quantityPart = useInput.substring(0, + useInput.length() - 1); float quantity; try { quantity = Float.parseFloat(quantityPart); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { return null; } return new DtPercentage(quantity); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtRectangle.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtRectangle.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtRectangle.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -48,8 +48,9 @@ /** * Constructor. */ - public DtRectangle(PropertyValue topOffset, PropertyValue rightOffset, - PropertyValue bottomOffset, PropertyValue leftOffset) + public DtRectangle(final PropertyValue topOffset, + final PropertyValue rightOffset, + final PropertyValue bottomOffset, final PropertyValue leftOffset) throws PropertyException { if (! validOffset(topOffset) || ! validOffset(rightOffset) || ! validOffset(bottomOffset) || ! validOffset(leftOffset)) { @@ -61,9 +62,9 @@ this.leftOffset = leftOffset; } - private boolean validOffset(PropertyValue pv) { + private boolean validOffset(final PropertyValue pv) { if (pv instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) pv).getValue(); + final short keyword = ((PropertyKeyword) pv).getValue(); if (keyword == Constants.FOVAL_AUTO) { return true; } @@ -75,25 +76,26 @@ return false; } - public int getTopOffset(int pointSize, int percentBase) { + public int getTopOffset(final int pointSize, final int percentBase) { return getOffset(topOffset, pointSize, percentBase); } - public int getRightOffset(int pointSize, int percentBase) { + public int getRightOffset(final int pointSize, final int percentBase) { return getOffset(rightOffset, pointSize, percentBase); } - public int getBottomOffset(int pointSize, int percentBase) { + public int getBottomOffset(final int pointSize, final int percentBase) { return getOffset(bottomOffset, pointSize, percentBase); } - public int getLeftOffset(int pointSize, int percentBase) { + public int getLeftOffset(final int pointSize, final int percentBase) { return getOffset(leftOffset, pointSize, percentBase); } - private int getOffset(PropertyValue pv, int pointSize, int percentBase) { + private int getOffset(final PropertyValue pv, final int pointSize, + final int percentBase) { if (pv instanceof PropertyKeyword) { - short keyword = ((PropertyKeyword) pv).getValue(); + final short keyword = ((PropertyKeyword) pv).getValue(); if (keyword == Constants.FOVAL_AUTO) { return 0; } @@ -110,7 +112,7 @@ * @return The RectangleDT instance constructed, or null if input is not * valid. */ - public static DtRectangle makeRectangleDT(String input) { + public static DtRectangle makeRectangleDT(final String input) { // Make a copy of input String useInput = new String(input); useInput.trim(); @@ -122,19 +124,19 @@ return null; } useInput = useInput.substring(1, useInput.length() - 1); - StringTokenizer st = new StringTokenizer(useInput, " ,"); + final StringTokenizer st = new StringTokenizer(useInput, " ,"); if (st.countTokens() != 4) { return null; } - PropertyValue[] pvArray = new PropertyValue[4]; + final PropertyValue[] pvArray = new PropertyValue[4]; int pvIndex = 0; while (st.hasMoreTokens()) { - String token = st.nextToken(); + final String token = st.nextToken(); if (token.equals("inherit")) { pvArray[pvIndex] = new PropertyKeyword (Constants.FOVAL_INHERIT); } - DtLength length = DtLength.makeLengthDT(token); + final DtLength length = DtLength.makeLengthDT(token); if (length != null) { pvArray[pvIndex] = length; } @@ -146,7 +148,7 @@ try { return new DtRectangle(pvArray[0], pvArray[1], pvArray[2], pvArray[3]); - } catch (PropertyException e) { + } catch (final PropertyException e) { // This should never happen, as we have already validated the input. return null; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtScript.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtScript.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtScript.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -152,7 +152,7 @@ * Constructor. * @param value The 4-character script identifier. */ - public DtScript(String value) { + public DtScript(final String value) { this.value = value; } @@ -166,7 +166,7 @@ /** * Set the String value of this script. */ - public void setValue(String value) { + public void setValue(final String value) { this.value = value; } @@ -175,8 +175,8 @@ * @param scriptCode A 4-character ISO 15924 code. * @return True if scriptCode is found in validScripts, false otherwise. */ - public static boolean validScript(String scriptCode) { - int index = Arrays.binarySearch(validScripts, scriptCode); + public static boolean validScript(final String scriptCode) { + final int index = Arrays.binarySearch(validScripts, scriptCode); if (index >= 0) { return true; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShadowEffect.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShadowEffect.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShadowEffect.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -44,29 +44,30 @@ * Constructor. See Section 7.16.5 in the XSL-FO Standard for the meanings * of the parameters. */ - public DtShadowEffect(DtLength horizontalDistance, - DtLength verticalDistance, DtLength blurRadius, DtColor color) { + public DtShadowEffect(final DtLength horizontalDistance, + final DtLength verticalDistance, final DtLength blurRadius, + final DtColor color) { this.horizontalDistance = horizontalDistance; this.verticalDistance = verticalDistance; this.blurRadius = blurRadius; this.color = color; } - public int getHorizontalDistance(int fontSize) { + public int getHorizontalDistance(final int fontSize) { if (this.horizontalDistance == null) { return 0; } return horizontalDistance.getValue(fontSize, 0); } - public int getVerticalDistance(int fontSize) { + public int getVerticalDistance(final int fontSize) { if (this.verticalDistance == null) { return 0; } return verticalDistance.getValue(fontSize, 0); } - public int getblurRadius(int fontSize) { + public int getblurRadius(final int fontSize) { if (this.blurRadius == null) { return 0; } @@ -87,21 +88,21 @@ * @return The ShadowEffectDT instance constructed, or null if input is not * valid. */ - public static DtShadowEffect makeShadowEffectDT(String input) { + public static DtShadowEffect makeShadowEffectDT(final String input) { // Make a copy of input - String useInput = new String(input); + final String useInput = new String(input); useInput.trim(); DtLength horizontalDistance = null; DtLength verticalDistance = null; DtLength blurRadius = null; DtColor color = null; - StringTokenizer st = new StringTokenizer(input); + final StringTokenizer st = new StringTokenizer(input); if (st.countTokens() < 2 || st.countTokens() > 4) { return null; } for (int i = 0; i < st.countTokens(); i++) { - String token = st.nextToken(); - DtColor aColor = DtColor.makeDtColor(token); + final String token = st.nextToken(); + final DtColor aColor = DtColor.makeDtColor(token); if (aColor != null) { // If it is a color, it must be either the first or last token. if (i == 0 || i == st.countTokens() - 1 @@ -112,7 +113,7 @@ } return null; } - DtLength aLength = DtLength.makeLengthDT(token); + final DtLength aLength = DtLength.makeLengthDT(token); if (aLength == null) { // This can only happen if the input is bad. return null; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShape.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShape.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShape.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -40,8 +40,8 @@ * @return The ShapeDT subclass instance if one is found, or null if one * is not. */ - public static DtShape makeShapeDT(String input) { - DtShape shape = DtRectangle.makeRectangleDT(input); + public static DtShape makeShapeDT(final String input) { + final DtShape shape = DtRectangle.makeRectangleDT(input); if (shape != null) { return shape; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtSpace.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtSpace.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtSpace.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -56,9 +56,9 @@ /** * Constructor. */ - public DtSpace(Expr lengthMinimum, Expr lengthOptimum, - Expr lengthMaximum, short conditionality, int precedence) - throws PropertyException { + public DtSpace(final Expr lengthMinimum, final Expr lengthOptimum, + final Expr lengthMaximum, final short conditionality, + final int precedence) throws PropertyException { if (lengthMinimum.unitPower() != 1 || lengthOptimum.unitPower() != 1 || lengthMaximum.unitPower() != 1) { @@ -71,35 +71,35 @@ this.precedence = precedence; } - public void setLengthMinimum(DtLength lengthMinimum) { + public void setLengthMinimum(final DtLength lengthMinimum) { this.lengthMinimum = lengthMinimum; } - public void setLengthOptimum(DtLength lengthOptimum) { + public void setLengthOptimum(final DtLength lengthOptimum) { this.lengthOptimum = lengthOptimum; } - public void setLengthMaximum(DtLength lengthMaximum) { + public void setLengthMaximum(final DtLength lengthMaximum) { this.lengthMaximum = lengthMaximum; } - public void setConditionality(short conditionality) { + public void setConditionality(final short conditionality) { this.conditionality = conditionality; } - public void setPrecedence(int precedence) { + public void setPrecedence(final int precedence) { this.precedence = precedence; } - public int getLengthMinimum(int pointSize, int percentBase) { + public int getLengthMinimum(final int pointSize, final int percentBase) { return this.lengthMinimum.evalUnitPower1(pointSize, percentBase); } - public int getLengthOptimum(int pointSize, int percentBase) { + public int getLengthOptimum(final int pointSize, final int percentBase) { return this.lengthOptimum.evalUnitPower1(pointSize, percentBase); } - public int getLengthMaximum(int pointSize, int percentBase) { + public int getLengthMaximum(final int pointSize, final int percentBase) { return this.lengthMaximum.evalUnitPower1(pointSize, percentBase); } @@ -120,10 +120,10 @@ * for the subPropertyName given. * @throws PropertyException If the subPropertyName is not valid. */ - public boolean addComponent(String subPropertyName, String value) - throws PropertyException { + public boolean addComponent(final String subPropertyName, + final String value) throws PropertyException { if (subPropertyName.equals("conditionality")) { - short keyword = Property.getKeywordIndex(value, + final short keyword = Property.getKeywordIndex(value, DtSpace.CONDITIONALITY_KEYWORDS); if (keyword > 0) { this.setConditionality(keyword); @@ -132,7 +132,7 @@ return false; } if (subPropertyName.equals("precedence")) { - short keyword = Property.getKeywordIndex(value, + final short keyword = Property.getKeywordIndex(value, DtSpace.PRECEDENCE_KEYWORDS); if (keyword == Constants.FOVAL_FORCE) { this.setPrecedence(DtSpace.PRECEDENCE_FORCE); @@ -141,13 +141,13 @@ int precedence = -1; try { precedence = Integer.parseInt(value); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { return false; } this.setPrecedence(precedence); return true; } - DtLength length = DtLength.makeLengthDT(value); + final DtLength length = DtLength.makeLengthDT(value); if (length != null) { if (subPropertyName.equals("minimum")) { this.setLengthMaximum(length); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtString.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtString.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtString.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -36,7 +36,7 @@ * Constructor. * @param value The string value. */ - public DtString(String value) { + public DtString(final String value) { this.value = value; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtTextDeco.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtTextDeco.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtTextDeco.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -46,8 +46,8 @@ /** * Constructor. */ - public DtTextDeco(boolean isUnderlined, boolean isOverlined, - boolean isLineThrough, boolean isBlink) { + public DtTextDeco(final boolean isUnderlined, final boolean isOverlined, + final boolean isLineThrough, final boolean isBlink) { this.isUnderlined = isUnderlined; this.isOverlined = isOverlined; this.isLineThrough = isLineThrough; @@ -63,7 +63,7 @@ /** * @param isBlink The isBlink to set. */ - public void setBlink(boolean isBlink) { + public void setBlink(final boolean isBlink) { this.isBlink = isBlink; } /** @@ -75,7 +75,7 @@ /** * @param isLineThrough The isLineThrough to set. */ - public void setLineThrough(boolean isLineThrough) { + public void setLineThrough(final boolean isLineThrough) { this.isLineThrough = isLineThrough; } /** @@ -87,7 +87,7 @@ /** * @param isOverlined The isOverlined to set. */ - public void setOverlined(boolean isOverlined) { + public void setOverlined(final boolean isOverlined) { this.isOverlined = isOverlined; } /** @@ -99,7 +99,7 @@ /** * @param isUnderlined The isUnderlined to set. */ - public void setUnderlined(boolean isUnderlined) { + public void setUnderlined(final boolean isUnderlined) { this.isUnderlined = isUnderlined; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtTime.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtTime.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtTime.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -40,7 +40,8 @@ /** * Constructor. */ - public DtTime(double quantity, byte units) throws PropertyException { + public DtTime(final double quantity, final byte units) + throws PropertyException { if (units < 1 || units > 2) { throw new PropertyException("Invalid TimeDT unit ID."); } @@ -70,9 +71,9 @@ * @return The TimeDT instance constructed, or null if input is not * valid. */ - public static DtTime makeTimeDT(String input) { + public static DtTime makeTimeDT(final String input) { // Make a copy of input - String useInput = new String(input); + final String useInput = new String(input); useInput.trim(); byte units = -1; int unitsLength = -1; @@ -86,17 +87,17 @@ if (units < 1) { return null; } - String quantityPart = useInput.substring(0, useInput.length() + final String quantityPart = useInput.substring(0, useInput.length() - unitsLength); double quantity; try { quantity = Double.parseDouble(quantityPart); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { return null; } try { return new DtTime(quantity, units); - } catch (PropertyException e1) { + } catch (final PropertyException e1) { /* * This should never happen, because we have already validated the * input. Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtURI.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtURI.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtURI.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -40,7 +40,7 @@ * Constructor. * @param uriSpecification The String containing the URI specification. */ - public DtURI(String uriSpecification) { + public DtURI(final String uriSpecification) { this.value = uriSpecification; } @@ -56,16 +56,16 @@ * @param input The String containing the URI specification. * @return The created UriDT instance, or null if input is invalid. */ - public static DtURI makeUriDT(String input) { - String useInput = URLUtil.normalizeURISpecification(input); + public static DtURI makeUriDT(final String input) { + final String useInput = URLUtil.normalizeURISpecification(input); if (useInput == null) { return null; } return new DtURI(useInput); } - public static ArrayList tokenizeURIList(String unparsedList) { - ArrayList tokenizedList = new ArrayList(); + public static ArrayList tokenizeURIList(final String unparsedList) { + final ArrayList tokenizedList = new ArrayList(); int startIndex = 0; int endIndex = 0; boolean stillProcessing = true; @@ -76,7 +76,8 @@ break; } assert endIndex > startIndex: "URI list tokenization problem."; - String substring = unparsedList.substring(startIndex, endIndex); + final String substring = unparsedList.substring(startIndex, + endIndex); tokenizedList.add(substring); startIndex = endIndex + 1; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtWritingMode.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtWritingMode.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtWritingMode.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -54,8 +54,8 @@ /** * Constructor. */ - private DtWritingMode(byte ipdOdd, byte ipdEven, byte bpd, byte shiftOdd, - byte shiftEven, boolean paired) { + private DtWritingMode(final byte ipdOdd, final byte ipdEven, final byte bpd, + final byte shiftOdd, final byte shiftEven, final boolean paired) { this.ipdOdd = ipdOdd; this.ipdEven = ipdEven; this.bpd = bpd; @@ -64,7 +64,8 @@ this.paired = paired; } - public static DtWritingMode obtainWritingMode(String writingModeName) { + public static DtWritingMode obtainWritingMode( + final String writingModeName) { // See if it has already been created. DtWritingMode wm = (DtWritingMode) writingModes.get(writingModeName); // If it has already been created, return it. @@ -83,7 +84,8 @@ return null; } - private static DtWritingMode createWritingMode(String writingModeName) { + private static DtWritingMode createWritingMode( + final String writingModeName) { if (writingModeName.equals("lr-tb")) { return new DtWritingMode( Constants.DIRECTION_LEFT_TO_RIGHT, @@ -335,7 +337,7 @@ * @return Either AXIS_HORIZONTAL or AXIS_VERTICAL, or -1 if writing-mode * or input is invalid. */ - public byte getAbsoluteAxis(byte relativeAxis) { + public byte getAbsoluteAxis(final byte relativeAxis) { switch (relativeAxis) { case Constants.AXIS_BP: { return getBPAxis(); @@ -354,7 +356,7 @@ * @return Either AXIS_IP or AXIS_BP, or -1 if writing-mode or input * is invalid. */ - public byte getRelativeAxis(byte absoluteAxis) { + public byte getRelativeAxis(final byte absoluteAxis) { switch (absoluteAxis) { case Constants.AXIS_HORIZONTAL: { return getHorizontalAxis(); @@ -565,7 +567,7 @@ * DIRECTION_RIGHT, DIRECTION_TOP, DIRECTION_BOTTOM, or -1 for invalid * input or writing mode. */ - public byte getAbsoluteDirection(byte relativeDir) { + public byte getAbsoluteDirection(final byte relativeDir) { switch (relativeDir) { case Constants.DIRECTION_START: { return getStart(); @@ -592,7 +594,7 @@ * DIRECTION_LEFT_TO_RIGHT, or DIRECTION_RIGHT_TO_LEFT, or -1 for invalid * input or writing mode. */ - public byte getAbsoluteDirFromRelativeAxis(byte relativeAxis) { + public byte getAbsoluteDirFromRelativeAxis(final byte relativeAxis) { switch (relativeAxis) { case Constants.AXIS_BP: { return this.bpd; @@ -611,7 +613,7 @@ * DIRECTION_END, DIRECTION_BEFORE, DIRECTION_AFTER, or -1 for invalid * input or writing mode. */ - public byte getRelativeDirection(byte absoluteDir) { + public byte getRelativeDirection(final byte absoluteDir) { switch (absoluteDir) { case Constants.DIRECTION_LEFT: { return getLeft(); @@ -638,7 +640,7 @@ * direction. For relative direction input, the corresponding absolute * direction. For an error either in the input or a bad writing mode, -1. */ - public int getCorresponding(int inputDirection) { + public int getCorresponding(final int inputDirection) { switch (inputDirection) { case Constants.DIRECTION_START: { return getStart(); @@ -668,7 +670,7 @@ return -1; } - public static byte getOtherAxis(byte axis) { + public static byte getOtherAxis(final byte axis) { if (axis == Constants.AXIS_HORIZONTAL) { return Constants.AXIS_VERTICAL; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/Expr.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/Expr.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/Expr.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -68,7 +68,7 @@ * length must override this method. * @return The unit power 1 value (length) of this expression. */ - public int evalUnitPower1(int pointSize, int percentBase) { + public int evalUnitPower1(final int pointSize, final int percentBase) { return 0; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprAdditiveOper.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprAdditiveOper.java 2006-07-22 21:39:22 UTC (rev 7810) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprAdditiveOper.java 2006-07-22 22:07:57 UTC (rev 7811) @@ -35,8 +35,9 @@ private ExprMultiplicative operand2; private byte operation; - public ExprAdditiveOper(ExprAdditive operand1, ExprMultiplicative operand2, - byte operation) throws PropertyException { + public ExprAdditiveOper(final ExprAdditive operand1, + final ExprMultiplicative operand2, + final byte operation) throws PropertyException { if (operand1.unitPower() < 0) { throw new PropertyException("AdditiveExpr: Non-numeric operand: " + operand1.toString()); @@ -70,7 +71,7 @@ return false; } - public int evalUnitPower1(int pointSize, int percentBase) { + public int evalUnitPower1(final int pointSize, final int percentBase... [truncated message content] |
|
From: <vic...@us...> - 2006-07-22 21:40:20
|
Revision: 7810 Author: victormote Date: 2006-07-22 14:39:22 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7810&view=rev Log Message: ----------- Implement standard use of "final" modifier on local variables and parameters. Modified Paths: -------------- trunk/foray/foray-font/.project trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java trunk/foray/foray-font/src/java/org/foray/font/FOrayFontUse.java trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java trunk/foray/foray-font/src/java/org/foray/font/FontConfig.java trunk/foray/foray-font/src/java/org/foray/font/FontConfigParser.java trunk/foray/foray-font/src/java/org/foray/font/FontSelector.java trunk/foray/foray-font/src/java/org/foray/font/FontSelectorCBC.java trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java trunk/foray/foray-font/src/java/org/foray/font/RegisteredFontDesc.java trunk/foray/foray-font/src/java/org/foray/font/RegisteredFontFamily.java trunk/foray/foray-font/src/java/org/foray/font/Subset.java trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java trunk/foray/foray-font/src/java/org/foray/font/charset/CharSet.java trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetParser.java trunk/foray/foray-font/src/java/org/foray/font/format/FontFile.java trunk/foray/foray-font/src/java/org/foray/font/format/FontFileReader.java trunk/foray/foray-font/src/java/org/foray/font/format/Kerning.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFile.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFilePFM.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileReader.java trunk/foray/foray-font/src/java/org/foray/font/format/TTCTableHeader.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFFile.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFFileCollection.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFFileSingle.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFReader.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFSubSetFile.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTable.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCFF.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableDirEntry.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableDirectory.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableGLYF.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableHEAD.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableHHEA.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableHMTX.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableKERN.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableLOCA.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableMAXP.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableNAME.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableOS2.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTablePCLT.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTablePOST.java trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFAFile.java trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFBFile.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontOutput.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontOutputFactory.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPDF.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPDFFactory.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPS.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPSFactory.java Modified: trunk/foray/foray-font/.project =================================================================== --- trunk/foray/foray-font/.project 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/.project 2006-07-22 21:39:22 UTC (rev 7810) @@ -8,12 +8,12 @@ </projects> <buildSpec> <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> <arguments> </arguments> </buildCommand> Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java 2006-07-22 21:39:22 UTC (rev 7810) @@ -60,7 +60,8 @@ /** List of all child FontUse instances. */ private ArrayList fontUses = new ArrayList(1); - public FOrayConsumerFont(FOrayFont font, FOrayFontConsumer consumer) { + public FOrayConsumerFont(final FOrayFont font, + final FOrayFontConsumer consumer) { this.font = font; this.consumer = consumer; if (this.font.isSubsettable()) { @@ -116,15 +117,17 @@ return this.fontUses; } - public FOrayFontUse selectFontUse(RegisteredFontDesc rfd, int codePoint) { + public FOrayFontUse selectFontUse(final RegisteredFontDesc rfd, + final int codePoint) { if (rfd == null) { return null; } FOrayFontUse fontUse = null; - SystemFont sf = getSystemFont(); + final SystemFont sf = getSystemFont(); /* Check existing FontUse instances. */ for (int i = 0; i < this.fontUses.size() && fontUse == null; i++) { - FOrayFontUse trialFontUse = (FOrayFontUse) this.fontUses.get(i); + final FOrayFontUse trialFontUse = + (FOrayFontUse) this.fontUses.get(i); if (trialFontUse.getRegisteredFontDesc() != rfd) { continue; } @@ -133,7 +136,8 @@ continue; } } else { - org.axsl.psR.Encoding encoding = trialFontUse.getEncoding(); + final org.axsl.psR.Encoding encoding = + trialFontUse.getEncoding(); if (! encoding.canEncode(codePoint)) { continue; } @@ -148,7 +152,7 @@ /* We don't care about encodings for SystemFonts. */ fontUse = new FOrayFontUse(this, rfd, null); } else { - Encoding encoding = findEncoding(rfd, codePoint); + final Encoding encoding = findEncoding(rfd, codePoint); if (encoding == null) { /* We can't encode this character. * Return null so that the upstream font selection routines can @@ -164,9 +168,10 @@ /** * Returns the described FontUse instance, creating it if necessary. */ - public FOrayFontUse getFontUse(RegisteredFontDesc rfd, Encoding encoding) { + public FOrayFontUse getFontUse(final RegisteredFontDesc rfd, + final Encoding encoding) { for (int i = 0; i < this.fontUses.size(); i++) { - FOrayFontUse fontUse = (FOrayFontUse) this.fontUses.get(i); + final FOrayFontUse fontUse = (FOrayFontUse) this.fontUses.get(i); if (fontUse.getRegisteredFontDesc() != rfd) { continue; } @@ -178,7 +183,8 @@ return new FOrayFontUse(this, rfd, encoding); } - public Encoding findEncoding(RegisteredFontDesc rfd, int codePoint) { + public Encoding findEncoding(final RegisteredFontDesc rfd, + final int codePoint) { switch (this.consumer.getEncodingLatitude()) { case FOrayFontConsumer.ENCODING_SPECIFIED_ONLY: { return rfd.getEncoding(); @@ -193,9 +199,9 @@ return null; } - private Encoding getBestEncoding(int codePoint) { + private Encoding getBestEncoding(final int codePoint) { Encoding trialEncoding = null; - Encoding internalEncoding = this.font.getInternalEncoding(); + final Encoding internalEncoding = this.font.getInternalEncoding(); if (! (internalEncoding instanceof EncodingVector)) { /* CMap encodings should be able to handle any character in the * font's character set. */ Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java 2006-07-22 21:39:22 UTC (rev 7810) @@ -44,7 +44,7 @@ /** Valid values are Font.FONT_SIMPLE and Font.FONT_COMPOSITE */ protected byte fontComplexity = org.axsl.fontR.Font.FONT_COMPLEXITY_UNKNOWN; - protected FOrayFont(RegisteredFont rf) { + protected FOrayFont(final RegisteredFont rf) { this.registeredFont = rf; } @@ -68,11 +68,11 @@ */ public abstract int getXHeight(int fontSize); - private int getEmWidth(int fontSize) { + private int getEmWidth(final int fontSize) { return fontSize; } - private int getEnWidth(int fontSize) { + private int getEnWidth(final int fontSize) { return Math.round(fontSize / 2); } @@ -84,7 +84,7 @@ /** * {@inheritDoc} */ - public int widthEstimate(int c, int fontSize) { + public int widthEstimate(final int c, final int fontSize) { switch (c) { case 0x09: // horizontal tab case 0x0A: // linefeed @@ -127,15 +127,15 @@ /** * {@inheritDoc} */ - public int width(CharSequence word, int fontSize, int letterSpacing, - int wordSpacing) { + public int width(final CharSequence word, final int fontSize, + final int letterSpacing, final int wordSpacing) { if (word == null) { return 0; } int width = 0; for (int i = 0; i < word.length(); i++) { // Add the width of the character itself. - int charWidth = width(word.charAt(i), fontSize); + final int charWidth = width(word.charAt(i), fontSize); if (charWidth == Integer.MIN_VALUE) { width += widthUndefinedGlyph(fontSize); } else { @@ -285,7 +285,7 @@ /** * {@inheritDoc} */ - public float normalLineHeightFactor(int algorithm) { + public float normalLineHeightFactor(final int algorithm) { switch (algorithm) { case LH_ALGORITHM_DEFAULT: default: { @@ -297,8 +297,10 @@ /** * {@inheritDoc} */ - public int baselineOffset(int writingMode, int baselineType, int fontSize) { - int baseline = extractBaseline(writingMode, baselineType, fontSize); + public int baselineOffset(final int writingMode, final int baselineType, + final int fontSize) { + final int baseline = extractBaseline(writingMode, baselineType, + fontSize); if (baseline == Integer.MIN_VALUE) { return estimateBaseline(writingMode, baselineType, fontSize); } @@ -325,8 +327,8 @@ * @param fontSize Same as for {@link #baselineOffset(int, int, int)}. * @return The estimated value of the baseline. */ - public int estimateBaseline(int writingMode, int baselineType, - int fontSize) { + public int estimateBaseline(final int writingMode, final int baselineType, + final int fontSize) { switch (baselineType) { case Constants.BASELINE_ALPHABETIC: { return fontSize + this.getDescender(fontSize); @@ -367,7 +369,7 @@ } } - public int baseline(String script) { + public int baseline(final String script) { /* TODO: Fix this. */ return Constants.BASELINE_ALPHABETIC; } @@ -375,7 +377,7 @@ /** * {@inheritDoc} */ - public int underlineSize(int fontSize) { + public int underlineSize(final int fontSize) { /* TODO: Where possible, replace this heuristic with data from the * font itself. */ /* Until we learn better, make this the same size as the strikeout. */ @@ -385,7 +387,7 @@ /** * {@inheritDoc} */ - public int underlinePosition(int fontSize) { + public int underlinePosition(final int fontSize) { /* TODO: Where possible, replace this heuristic with data from the * font itself. */ return (fontSize / 10) * -1; @@ -394,7 +396,7 @@ /** * {@inheritDoc} */ - public int overlineSize(int fontSize) { + public int overlineSize(final int fontSize) { /* TODO: Where possible, replace this heuristic with data from the * font itself. */ /* Until we learn better, make this the same size as the strikeout. */ @@ -404,7 +406,7 @@ /** * {@inheritDoc} */ - public int overlinePosition(int fontSize) { + public int overlinePosition(final int fontSize) { /* TODO: Where possible, replace this heuristic with data from the * font itself. */ return getAscender(fontSize) + (fontSize / 10); @@ -413,7 +415,7 @@ /** * {@inheritDoc} */ - public int strikeoutSize(int fontSize) { + public int strikeoutSize(final int fontSize) { /* TODO: Where possible, replace this heuristic with data from the * font itself. */ /* This computation comes from the OpenType manual, Section OS/2 @@ -425,7 +427,7 @@ /** * {@inheritDoc} */ - public int strikeoutPosition(int fontSize) { + public int strikeoutPosition(final int fontSize) { /* TODO: Where possible, replace this heuristic with data from the * font itself. */ return getAscender(fontSize) * 3 / 8; Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java 2006-07-22 21:39:22 UTC (rev 7810) @@ -111,14 +111,14 @@ * Constructor. * @param server The FOrayFontServer instance serving this FontConsumer. */ - public FOrayFontConsumer(FOrayFontServer server) { + public FOrayFontConsumer(final FOrayFontServer server) { this.server = server; this.usesFreeStandingFonts = true; this.usesSystemFonts = true; this.prefersFreeStandingFonts = true; } - public void setFontSources(int[] fontSources) { + public void setFontSources(final int[] fontSources) { if (fontSources == null || fontSources.length < 1) { return; @@ -145,7 +145,7 @@ * override the logger used by FOrayFontServer. * @param logger */ - public void setLogger(Log logger) { + public void setLogger(final Log logger) { this.logger = logger; } @@ -178,7 +178,7 @@ return this.server; } - private FontSelector getFontSelector(int strategy) { + private FontSelector getFontSelector(final int strategy) { switch (strategy) { case Font.FONT_SELECTION_CBC: { return this.getFontSelectorCBC(); @@ -195,7 +195,7 @@ return this.fontSelectorAutoType; } - public void setFontSelectorAutoType(String newFontSelectorAutoType) { + public void setFontSelectorAutoType(final String newFontSelectorAutoType) { if (this.fontSelectorAuto == null) { /* Fails silently if the "auto" FontSelector has already been * created. */ @@ -220,14 +220,14 @@ /** * {@inheritDoc} */ - public org.axsl.fontR.FontUse selectFontXSL(int selectionStrategy, - String [] familyList, int style, - int weight, int variant, int stretch, int size, int codePoint) - throws FontException { - FontSelector selector = getFontSelector(selectionStrategy); + public org.axsl.fontR.FontUse selectFontXSL(final int selectionStrategy, + final String [] familyList, final int style, final int weight, + final int variant, final int stretch, final int size, + final int codePoint) throws FontException { + final FontSelector selector = getFontSelector(selectionStrategy); FOrayFont fontSelected = null; - RegisteredFontDesc fontDescSelected = selector.selectFont(familyList, - style, weight, variant, stretch, size, codePoint); + final RegisteredFontDesc fontDescSelected = selector.selectFont( + familyList, style, weight, variant, stretch, size, codePoint); if (fontDescSelected != null) { fontSelected = whichUse(fontDescSelected, codePoint); @@ -235,7 +235,7 @@ if (fontSelected == null) { /* None of the requested font-family items can provide a suitable * font. */ - FOrayFontUse fontUse = getDefaultFontUse(); + final FOrayFontUse fontUse = getDefaultFontUse(); if (fontUse == null) { throw new FontException("Unable to provide even a default " + "font."); @@ -245,10 +245,10 @@ if (fontSelected == null) { return null; } - FOrayConsumerFont consumerFont = registerFontUse(fontSelected); + final FOrayConsumerFont consumerFont = registerFontUse(fontSelected); /* Selection of the actual FontUse is delegated to consumerFont. */ - FOrayFontUse fontUse = consumerFont.selectFontUse(fontDescSelected, - codePoint); + final FOrayFontUse fontUse = consumerFont.selectFontUse( + fontDescSelected, codePoint); return fontUse; } @@ -256,7 +256,7 @@ * Return a default font. We don't care what it can encode. */ protected FOrayFontUse getDefaultFontUse() { - RegisteredFontDesc fontDescSelected = selectDefaultFont(); + final RegisteredFontDesc fontDescSelected = selectDefaultFont(); if (fontDescSelected == null) { return null; } @@ -268,7 +268,7 @@ fontSelected = fontDescSelected.getRegisteredFont() .getSystemFont(); } - FOrayConsumerFont consumerFont = registerFontUse(fontSelected); + final FOrayConsumerFont consumerFont = registerFontUse(fontSelected); return consumerFont.getFontUse(fontDescSelected, fontSelected.getInternalEncoding()); } @@ -290,10 +290,11 @@ * font. * @return The FontUse instance dictated by the parameters of consumer. */ - protected FOrayFont whichUse(RegisteredFontDesc rfd, int codePoint) { - RegisteredFont rf = rfd.getRegisteredFont(); - FreeStandingFont fsf = eligibleFreeStandingFont(rfd, codePoint); - SystemFont sf = eligibleSystemFont(rf, codePoint); + protected FOrayFont whichUse(final RegisteredFontDesc rfd, + final int codePoint) { + final RegisteredFont rf = rfd.getRegisteredFont(); + final FreeStandingFont fsf = eligibleFreeStandingFont(rfd, codePoint); + final SystemFont sf = eligibleSystemFont(rf, codePoint); /* Consumer uses and prefers FreeStandingFont and it is available. */ if (fsf != null && preferFreeStandingFonts()) { @@ -313,17 +314,18 @@ return sf; } - private FreeStandingFont eligibleFreeStandingFont(RegisteredFontDesc rfd, - int codePoint) { + private FreeStandingFont eligibleFreeStandingFont( + final RegisteredFontDesc rfd, final int codePoint) { if (! isUsingFreeStandingFonts()) { return null; } - FreeStandingFont fsf = rfd.getRegisteredFont().getFreeStandingFont(); + final FreeStandingFont fsf = + rfd.getRegisteredFont().getFreeStandingFont(); if (fsf == null) { return null; } - FOrayConsumerFont consumerFont = this.getConsumerFont(fsf); - Encoding encoding = consumerFont.findEncoding(rfd, codePoint); + final FOrayConsumerFont consumerFont = this.getConsumerFont(fsf); + final Encoding encoding = consumerFont.findEncoding(rfd, codePoint); if (encoding == null) { /* Either no known encoding for this font can encode this character * or we have been restricted from using an encoding that can. @@ -333,11 +335,12 @@ return fsf; } - private SystemFont eligibleSystemFont(RegisteredFont rf, int codePoint) { + private SystemFont eligibleSystemFont(final RegisteredFont rf, + final int codePoint) { if (! isUsingSystemFonts()) { return null; } - SystemFont sf = rf.getSystemFont(); + final SystemFont sf = rf.getSystemFont(); if (sf == null) { return null; } @@ -364,8 +367,9 @@ /** * {@inheritDoc} */ - public org.axsl.fontR.FontUse selectFontCSS(String [] familyList, int style, - int weight, int variant, int stretch, int size, int codePoint) + public org.axsl.fontR.FontUse selectFontCSS(final String [] familyList, + final int style, final int weight, final int variant, + final int stretch, final int size, final int codePoint) throws FontException { return selectFontXSL(Font.FONT_SELECTION_CBC, familyList, style, weight, variant, stretch, size, codePoint); @@ -378,11 +382,12 @@ if (this.usedFonts.size() < 1) { return new FOrayFont[0]; } - FOrayFont[] usedFontsToReturn = new FOrayFont[this.usedFonts.size()]; + final FOrayFont[] usedFontsToReturn = + new FOrayFont[this.usedFonts.size()]; int index = 0; - Iterator iterator = usedFonts.keySet().iterator(); + final Iterator iterator = usedFonts.keySet().iterator(); while (iterator.hasNext()) { - FOrayFont realFont = (FOrayFont) iterator.next(); + final FOrayFont realFont = (FOrayFont) iterator.next(); usedFontsToReturn[index] = realFont; index++; } @@ -400,23 +405,23 @@ int count = 0; Iterator iterator = this.usedFonts.entrySet().iterator(); while (iterator.hasNext()) { - FOrayConsumerFont consumerFont = + final FOrayConsumerFont consumerFont = (FOrayConsumerFont) iterator.next(); count += consumerFont.getFontUses().size(); } if (count < 1) { return new FOrayFontUse[0]; } - FOrayFontUse[] toReturn = new FOrayFontUse[count]; + final FOrayFontUse[] toReturn = new FOrayFontUse[count]; count = 0; /* Get a new iterator. */ iterator = this.usedFonts.entrySet().iterator(); while (iterator.hasNext()) { - FOrayConsumerFont consumerFont = + final FOrayConsumerFont consumerFont = (FOrayConsumerFont) iterator.next(); - ArrayList fontUses = consumerFont.getFontUses(); + final ArrayList fontUses = consumerFont.getFontUses(); for (int i = 0; i < fontUses.size(); i++) { - FOrayFontUse fontUse = (FOrayFontUse) fontUses.get(i); + final FOrayFontUse fontUse = (FOrayFontUse) fontUses.get(i); toReturn[count] = fontUse; count ++; } @@ -428,7 +433,7 @@ * Record the fact that this FontConsumer has used this font. * @param font The Font instance that was used. */ - protected FOrayConsumerFont registerFontUse(FOrayFont font) { + protected FOrayConsumerFont registerFontUse(final FOrayFont font) { FOrayConsumerFont consumerFont = (FOrayConsumerFont) usedFonts.get(font); if (consumerFont == null) { @@ -442,10 +447,10 @@ * {@inheritDoc} */ public void optimizeFonts() { - Iterator iter = usedFonts.keySet().iterator(); + final Iterator iter = usedFonts.keySet().iterator(); while (iter.hasNext()) { - Object obj = iter.next(); - FOrayConsumerFont consumerFont = (FOrayConsumerFont) + final Object obj = iter.next(); + final FOrayConsumerFont consumerFont = (FOrayConsumerFont) usedFonts.get(obj); consumerFont.optimize(); } @@ -457,7 +462,7 @@ * related FontUse instance. * @return The related FontUse instance. */ - public FOrayConsumerFont getConsumerFont(FOrayFont font) { + public FOrayConsumerFont getConsumerFont(final FOrayFont font) { FOrayConsumerFont consumerFont = (FOrayConsumerFont) usedFonts.get(font); if (consumerFont != null) { @@ -477,7 +482,7 @@ return encodingLatitude; } - private boolean validEncodingLatitude(int encodingLatitude) { + private boolean validEncodingLatitude(final int encodingLatitude) { for (int i = 0; i < VALID_ENCODING_LATITUDES.length; i++) { if (encodingLatitude == VALID_ENCODING_LATITUDES[i]) { return true; @@ -493,7 +498,8 @@ * {@link #ENCODING_INTERNAL_ONLY}, {@link #ENCODING_SPECIFIED_ONLY}, or * {@link #ENCODING_ANY}. */ - public void setEncodingLatitude(int encodingLatitude) throws FontException { + public void setEncodingLatitude(final int encodingLatitude) + throws FontException { if (! validEncodingLatitude(encodingLatitude)) { throw new FontException("FOrayFontConsumer invalid encoding " + "latitude: " + encodingLatitude); Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java 2006-07-22 21:39:22 UTC (rev 7810) @@ -135,11 +135,11 @@ * messages that are more client-related can be logged to the FontConsumer * logger. */ - public FOrayFontServer(Log logger) { + public FOrayFontServer(final Log logger) { this.logger = logger; try { registerStandardOutputFactories(); - } catch (FontException e) { + } catch (final FontException e) { getLogger().error("Error registering standard Font output " + "factories:\n" + e.getMessage()); e.printStackTrace(); @@ -151,7 +151,7 @@ } protected RegisteredFontFamily getRegisteredFontFamily( - String fontFamilyName) { + final String fontFamilyName) { RegisteredFontFamily rff = (RegisteredFontFamily) this.fontFamilies.get(fontFamilyName); if (rff != null) { @@ -183,19 +183,19 @@ } /* Punt and try to create something that will work. */ try { - RegisteredFont rf = new RegisteredFont(this, null, null, null, null, - null, "serif"); - RegisteredFontFamily rff = this.registerFontFamily2("serif"); + final RegisteredFont rf = new RegisteredFont(this, null, null, null, + null, null, "serif"); + final RegisteredFontFamily rff = this.registerFontFamily2("serif"); rff.registerFontDesc(rf, null, "normal", "normal", "normal", "normal", null, null, null, null); - } catch (FontException e) { + } catch (final FontException e) { getLogger().error("Unable to create default system font."); } this.defaultSystemFont = getDefaultFont(false); return this.defaultSystemFont; } - protected RegisteredFontDesc getDefaultFont(boolean freeStandingFont){ + protected RegisteredFontDesc getDefaultFont(final boolean freeStandingFont){ RegisteredFontDesc defaultFont = null; RegisteredFontFamily rff = getRegisteredFontFamily("any"); if (rff != null) { @@ -222,9 +222,9 @@ if (defaultFont != null) { return defaultFont; } - Iterator iterator = this.fontFamilies.entrySet().iterator(); + final Iterator iterator = this.fontFamilies.entrySet().iterator(); while (iterator.hasNext() && defaultFont == null) { - Map.Entry entry = (Map.Entry) iterator.next(); + final Map.Entry entry = (Map.Entry) iterator.next(); rff = (RegisteredFontFamily) entry.getValue(); defaultFont = rff.findRegisteredFontDesc( FOrayFont.FONT_STYLE_ANY, @@ -241,7 +241,7 @@ * Set the base URL for general resources, unless it has already been set. * @param url The base URL for general resources. */ - public void setBaseURL(URL url) { + public void setBaseURL(final URL url) { /* If not already set, set it */ if (baseURL == null) { baseURL = url; @@ -263,7 +263,7 @@ * Set the base URL for Font locations, unless it has already been set. * @param url The base URL for fonts. */ - public void setBaseFontURL(URL url) { + public void setBaseFontURL(final URL url) { /* If not already set, set it */ if (baseFontURL == null) { baseFontURL = url; @@ -297,7 +297,7 @@ * parsing. * @throws FontException on font configuration error. */ - public void setup(URL fontConfigFile, Map fontConfigOptions) + public void setup(final URL fontConfigFile, final Map fontConfigOptions) throws FontException { if (setupCompleted) { return; @@ -328,13 +328,15 @@ registerBase14Font("Base14-ZapfDingbats", "ZapfDingbats.afm"); } - private void registerBase14Font(String fontName, String fileName) { - String resourceName = "org/foray/font/resources/base-14/" + fileName; - ClassLoader loader = ClassLoader.getSystemClassLoader(); - URL metricURL = loader.getResource(resourceName); + private void registerBase14Font(final String fontName, + final String fileName) { + final String resourceName = "org/foray/font/resources/base-14/" + + fileName; + final ClassLoader loader = ClassLoader.getSystemClassLoader(); + final URL metricURL = loader.getResource(resourceName); try { registerFont(fontName, null, metricURL, null, "none", null); - } catch (FontException e) { + } catch (final FontException e) { this.logger.warn(e); } } @@ -343,18 +345,18 @@ if (! this.usingSystemFonts) { return; } - Font[] fontList = this.getSystemFontList(); + final Font[] fontList = this.getSystemFontList(); if (fontList == null) { return; } for (int i = 0; i < fontList.length; i++) { - Font awtFont = fontList[i]; + final Font awtFont = fontList[i]; RegisteredFontFamily rff = this.getRegisteredFontFamily( awtFont.getFamily()); if (rff == null) { try { rff = registerFontFamily2(awtFont.getFamily()); - } catch (FontException e) { + } catch (final FontException e) { /* This should never happen. We just made sure it doesn't * already exist. */ continue; @@ -364,7 +366,7 @@ try { rf = new RegisteredFont(this, awtFont.getFontName(), null, null, null, "none", awtFont.getFontName()); - } catch (FontException e) { + } catch (final FontException e) { this.logger.error(e.getMessage()); continue; } @@ -376,15 +378,15 @@ if (awtFont.isBold()) { fontWeight = org.axsl.fontR.Font.FONT_WEIGHT_BOLD; } - byte fontVariant = org.axsl.fontR.Font.FONT_VARIANT_NORMAL; - byte fontStretch = org.axsl.fontR.Font.FONT_STRETCH_NORMAL; + final byte fontVariant = org.axsl.fontR.Font.FONT_VARIANT_NORMAL; + final byte fontStretch = org.axsl.fontR.Font.FONT_STRETCH_NORMAL; new RegisteredFontDesc(rf, rff, null, fontStyle, fontWeight, fontVariant, fontStretch); try { rff.registerFontDesc(rf, null, fontStyle, fontWeight, fontVariant, fontStretch, Float.NaN, Float.NaN, Float.NaN, null); - } catch (FontException e) { + } catch (final FontException e) { this.logger.error(e.getMessage()); } } @@ -393,18 +395,18 @@ /** * Reads the font configuration file */ - private void readFontConfig(URL fontConfigURL) throws FontException { + private void readFontConfig(final URL fontConfigURL) throws FontException { if (fontConfigURL == null) { return; } InputStream inputStream; try { inputStream = fontConfigURL.openStream(); - } catch (IOException e) { + } catch (final IOException e) { throw new FontException(e.getMessage()); } - InputSource source = new InputSource(inputStream); - FontConfigParser parser = + final InputSource source = new InputSource(inputStream); + final FontConfigParser parser = new FontConfigParser(this, source); parser.start(); if (hasFatalConfigurationError) { @@ -414,11 +416,11 @@ protected Graphics2D getGraphics2D() { if (this.graphic == null) { - BufferedImage fontImage = + final BufferedImage fontImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); try { this.graphic = fontImage.createGraphics(); - } catch (InternalError e) { + } catch (final InternalError e) { return null; } this.graphic.setRenderingHint (RenderingHints.KEY_FRACTIONALMETRICS, @@ -441,9 +443,9 @@ + "Unable to get System fonts."); return; } - GraphicsEnvironment ge + final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - String[] list = ge.getAvailableFontFamilyNames(); + final String[] list = ge.getAvailableFontFamilyNames(); // Make sure they are sorted for fast searching Arrays.sort(list); this.systemFontFamilyList = list; @@ -453,7 +455,7 @@ * Add a RegisteredFontFamily to the Collection. * @param name the name of the font family (e.g. "Courier") */ - protected RegisteredFontFamily registerFontFamily2(String name) + protected RegisteredFontFamily registerFontFamily2(final String name) throws FontException { /* Make sure it is not already registered. */ RegisteredFontFamily rff = this.getRegisteredFontFamily(name); @@ -472,16 +474,17 @@ * @param realFamily The name of the real font family to which this alias * should be associated (e.g. "Helvetica"). */ - public void registerFontFamilyAlias(String alias, String realFamily) + public void registerFontFamilyAlias(final String alias, + final String realFamily) throws FontException { - RegisteredFontFamily rff + final RegisteredFontFamily rff = (RegisteredFontFamily)fontFamilies.get(realFamily); if (rff == null) { throw new FontException("Font family " + realFamily + " not found. Can't register alias: " + alias); } if (fontFamilyAliases.containsKey(alias)) { - RegisteredFontFamily family = + final RegisteredFontFamily family = ((RegisteredFontFamily)fontFamilyAliases.get(alias)); throw new FontException("Alias " + alias + " already registered to family " + family.getName()); @@ -508,7 +511,7 @@ * have. * @param using When true, FreeStanding fonts will be configured. */ - public void setUsingFreeStandingFonts(boolean using) { + public void setUsingFreeStandingFonts(final boolean using) { if (setupCompleted) { if (using != usingFreeStandingFonts) { getLogger().error("Font setup already completed. " + @@ -526,7 +529,7 @@ * SystemFonts, regardless of what settings that FontConsumer may have. * @param using When true, System fonts will be configured. */ - public void setUsingSystemFonts(boolean using) { + public void setUsingSystemFonts(final boolean using) { if (setupCompleted) { if (using != usingSystemFonts) { getLogger().error("Font setup already completed. " + @@ -537,7 +540,7 @@ usingSystemFonts = using; } - protected void setFatalConfigurationError(boolean hasError) { + protected void setFatalConfigurationError(final boolean hasError) { if (hasError) { hasFatalConfigurationError = true; } @@ -562,7 +565,7 @@ + "Unable to get System fonts."); return null; } - GraphicsEnvironment ge + final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); return ge.getAllFonts(); } @@ -570,27 +573,27 @@ /** * {@inheritDoc} */ - public Encoding getEncoding(String name) { + public Encoding getEncoding(final String name) { return org.foray.ps.encode.EncodingVector.getPredefinedEncoding(name); } /** * {@inheritDoc} */ - public org.axsl.fontR.Font[] getAllFonts(boolean freeStandingFonts, - boolean systemFonts) { - ArrayList fontList = new ArrayList(); - Iterator iterator = this.fontFamilies.entrySet().iterator(); + public org.axsl.fontR.Font[] getAllFonts(final boolean freeStandingFonts, + final boolean systemFonts) { + final ArrayList fontList = new ArrayList(); + final Iterator iterator = this.fontFamilies.entrySet().iterator(); while (iterator.hasNext()) { - Map.Entry entry = (Map.Entry) iterator.next(); - RegisteredFontFamily family = (RegisteredFontFamily) + final Map.Entry entry = (Map.Entry) iterator.next(); + final RegisteredFontFamily family = (RegisteredFontFamily) entry.getValue(); - ArrayList rfdList = family.getFontDescriptions(); + final ArrayList rfdList = family.getFontDescriptions(); if (rfdList != null) { for (int i = 0; i < rfdList.size(); i++) { - RegisteredFontDesc rfd = (RegisteredFontDesc) + final RegisteredFontDesc rfd = (RegisteredFontDesc) rfdList.get(i); - RegisteredFont rf = rfd.getRegisteredFont(); + final RegisteredFont rf = rfd.getRegisteredFont(); if (freeStandingFonts && rf.getFreeStandingFont() != null) { fontList.add(rf.getFreeStandingFont()); @@ -605,11 +608,11 @@ if (fontList.size() < 1) { return null; } - ArrayList returnList = new ArrayList(); + final ArrayList returnList = new ArrayList(); for (int i = 0; i < fontList.size(); i++) { - org.axsl.fontR.FontUse fontUse = + final org.axsl.fontR.FontUse fontUse = (org.axsl.fontR.FontUse) fontList.get(i); - org.axsl.fontR.Font font = fontUse.getFont(); + final org.axsl.fontR.Font font = fontUse.getFont(); boolean duplicateFound = false; for (int j = 0; j < returnList.size() && ! duplicateFound; j++) { if (font == returnList.get(j)) { @@ -621,7 +624,7 @@ returnList.add(font); } } - FOrayFont[] returnArray = new FOrayFont[returnList.size()]; + final FOrayFont[] returnArray = new FOrayFont[returnList.size()]; for (int i = 0; i < returnArray.length; i++) { returnArray[i] = (FOrayFont) returnList.get(i); } @@ -637,20 +640,20 @@ /** * @param entityResolver The entityResolver to set. */ - public void setEntityResolver(EntityResolver entityResolver) { + public void setEntityResolver(final EntityResolver entityResolver) { this.entityResolver = entityResolver; } /** * {@inheritDoc} */ - public void registerFontOutputFactory(FontOutputFactory factory) + public void registerFontOutputFactory(final FontOutputFactory factory) throws FontException { /* */ if (factory == null) { throw new FontException("Cannot register a null FontOutputFactory"); } - String mimeType = factory.getMimeType(); + final String mimeType = factory.getMimeType(); if (mimeType == null || mimeType.equals("")) { throw new FontException("Mime type invalid: " + mimeType); @@ -658,38 +661,38 @@ this.fontOutputFactories.put(mimeType, factory); } - public FontOutputFactory getOutputFactory(String mimeType) { + public FontOutputFactory getOutputFactory(final String mimeType) { return (FontOutputFactory) this.fontOutputFactories.get(mimeType); } /** * {@inheritDoc} */ - public boolean fontOutputFactoryAvailable(String mimeType) { - FontOutputFactory factory = getOutputFactory(mimeType); + public boolean fontOutputFactoryAvailable(final String mimeType) { + final FontOutputFactory factory = getOutputFactory(mimeType); return factory != null; } /** * {@inheritDoc} */ - public void registerFontFamily(String name) throws FontException { + public void registerFontFamily(final String name) throws FontException { registerFontFamily2(name); } /** * {@inheritDoc} */ - public boolean isRegisteredFontFamily(String name) { - RegisteredFontFamily rff = this.getRegisteredFontFamily(name); + public boolean isRegisteredFontFamily(final String name) { + final RegisteredFontFamily rff = this.getRegisteredFontFamily(name); return (rff != null); } /** * {@inheritDoc} */ - public String getFontFamilyForAlias(String alias) { - RegisteredFontFamily family = + public String getFontFamilyForAlias(final String alias) { + final RegisteredFontFamily family = (RegisteredFontFamily)fontFamilyAliases.get(alias); if (family == null) { return null; @@ -700,9 +703,9 @@ /** * {@inheritDoc} */ - public void registerFont(String fontID, URL fontFileURL, - URL metricsFileURL, String collectionID, String embed, - String systemName) throws FontException { + public void registerFont(final String fontID, final URL fontFileURL, + final URL metricsFileURL, final String collectionID, + final String embed, final String systemName) throws FontException { if (! isUsableFont(systemName, fontFileURL, metricsFileURL)) { return; } @@ -710,7 +713,7 @@ if (fontFileURL != null) { try { fontFileReader = new FontFileReader(this.logger, fontFileURL); - } catch (IOException e) { + } catch (final IOException e) { throw new FontException(e); } } @@ -719,7 +722,7 @@ try { metricsFileReader = new MetricsFileReader(this.getLogger(), metricsFileURL); - } catch (IOException e) { + } catch (final IOException e) { throw new FontException(e); } } @@ -727,10 +730,11 @@ collectionID, embed, systemName); } - public void registerFont(String fontID, String fontFileDescription, - byte[] fontFileContents, String metricsFileDescription, - byte[] metricsFileContents, String collectionID, String embed, - String systemName) throws FontException { + public void registerFont(final String fontID, + final String fontFileDescription, final byte[] fontFileContents, + final String metricsFileDescription, + final byte[] metricsFileContents, final String collectionID, + final String embed, final String systemName) throws FontException { if (! isUsableFont(systemName, fontFileContents, metricsFileContents)) { return; } @@ -739,7 +743,7 @@ try { fontFileReader = new FontFileReader(this.logger, fontFileDescription, fontFileContents); - } catch (IOException e) { + } catch (final IOException e) { throw new FontException(e); } } @@ -748,7 +752,7 @@ try { metricsFileReader = new MetricsFileReader(this.getLogger(), metricsFileDescription, metricsFileContents); - } catch (IOException e) { + } catch (final IOException e) { throw new FontException(e); } } @@ -756,8 +760,8 @@ collectionID, embed, systemName); } - private boolean isUsableFont(String systemName, Object fontFile, - Object metricsFile) { + private boolean isUsableFont(final String systemName, final Object fontFile, + final Object metricsFile) { if (! usingFreeStandingFonts) { /* If not using FreeStandingFonts, then this font should not be * registered unless it will be able to generate a SystemFont. */ @@ -777,13 +781,13 @@ return true; } - public RegisteredFont getRegisteredFont(String name) { + public RegisteredFont getRegisteredFont(final String name) { return (RegisteredFont) this.registeredFonts.get(name); } - public void registerFont(String fontID, RegisteredFont rf) + public void registerFont(final String fontID, final RegisteredFont rf) throws FontException { - Object object = this.registeredFonts.get(fontID); + final Object object = this.registeredFonts.get(fontID); if (object != null) { throw new FontException("Font ID already registered: " + fontID); } @@ -793,29 +797,31 @@ /** * {@inheritDoc} */ - public boolean isRegisteredFont(String fontID) { - Object object = this.registeredFonts.get(fontID); + public boolean isRegisteredFont(final String fontID) { + final Object object = this.registeredFonts.get(fontID); return (object != null); } /** * {@inheritDoc} */ - public void registerFontDescription(String fontFamily, String fontID, - Encoding encoding, byte style, short weight, byte variant, - byte stretch, float simulatedSmallCaps, float simulatedOblique, - float simulatedBackslant, float[] simulatedStretch) + public void registerFontDescription(final String fontFamily, + final String fontID, final Encoding encoding, final byte style, + final short weight, final byte variant, final byte stretch, + final float simulatedSmallCaps, final float simulatedOblique, + final float simulatedBackslant, final float[] simulatedStretch) throws FontException { - RegisteredFontFamily rff = this.getRegisteredFontFamily(fontFamily); - RegisteredFont rf = this.getRegisteredFont(fontID); + final RegisteredFontFamily rff = this.getRegisteredFontFamily( + fontFamily); + final RegisteredFont rf = this.getRegisteredFont(fontID); rff.registerFontDesc(rf, encoding, style, weight, variant, stretch, simulatedSmallCaps, simulatedOblique, simulatedBackslant, simulatedStretch); } - public FontSelector makeFontSelector(FOrayFontConsumer consumer) { - String selectorName = consumer.getFontSelectorAutoType(); - FontSelectorFactory factory = (FontSelectorFactory) + public FontSelector makeFontSelector(final FOrayFontConsumer consumer) { + final String selectorName = consumer.getFontSelectorAutoType(); + final FontSelectorFactory factory = (FontSelectorFactory) this.registeredFontSelectorFactories.get(selectorName); if (factory != null) { return factory.makeFontSelector(consumer); @@ -835,8 +841,8 @@ * @throws FontException If either <code>name</code>, or * <code>factory</code> is invalid. */ - public void registerFontSelectorFactory(String name, - FontSelectorFactory factory) throws FontException { + public void registerFontSelectorFactory(final String name, + final FontSelectorFactory factory) throws FontException { if (name == null || factory == null) { throw new FontException("Unable to register null or unnamed " Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFontUse.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontUse.java 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFontUse.java 2006-07-22 21:39:22 UTC (rev 7810) @@ -64,8 +64,8 @@ private HashMap fontOutputs = new HashMap(); - public FOrayFontUse(FOrayConsumerFont consumerFont, RegisteredFontDesc rfd, - Encoding encoding) { + public FOrayFontUse(final FOrayConsumerFont consumerFont, + final RegisteredFontDesc rfd, final Encoding encoding) { this.consumerFont = consumerFont; this.registeredFontDesc = rfd; this.encoding = encoding; @@ -86,7 +86,7 @@ /** * {@inheritDoc} */ - public int encodeCharacter(int codePoint) { + public int encodeCharacter(final int codePoint) { /* First get the font's encoding for the character. */ int fontEncodedChar = codePoint; if (this.encoding != null) { @@ -110,7 +110,8 @@ * {@inheritDoc} */ public short nextBolderWeight() { - RegisteredFontDesc desc = this.registeredFontDesc.nextBolderFont(); + final RegisteredFontDesc desc = + this.registeredFontDesc.nextBolderFont(); if (desc != null) { return desc.getFontWeight(); } @@ -122,7 +123,8 @@ * {@inheritDoc} */ public short nextLighterWeight() { - RegisteredFontDesc desc = this.registeredFontDesc.nextLighterFont(); + final RegisteredFontDesc desc = + this.registeredFontDesc.nextLighterFont(); if (desc != null) { return desc.getFontWeight(); } @@ -134,7 +136,8 @@ * {@inheritDoc} */ public org.axsl.fontR.FontUse nextBolderFont() { - RegisteredFontDesc desc = this.registeredFontDesc.nextBolderFont(); + final RegisteredFontDesc desc = + this.registeredFontDesc.nextBolderFont(); return fontUseForDesc(desc); } @@ -142,26 +145,29 @@ * {@inheritDoc} */ public org.axsl.fontR.FontUse nextLighterFont() { - RegisteredFontDesc desc = this.registeredFontDesc.nextLighterFont(); + final RegisteredFontDesc desc = + this.registeredFontDesc.nextLighterFont(); return fontUseForDesc(desc); } - private org.axsl.fontR.FontUse fontUseForDesc(RegisteredFontDesc desc) { + private org.axsl.fontR.FontUse fontUseForDesc( + final RegisteredFontDesc desc) { if (desc == null) { return null; } - FOrayFontConsumer consumer = this.getFOrayFontConsumer(); - FOrayFont font = consumer.whichUse(desc, ' '); - FOrayConsumerFont consumerFont = consumer.registerFontUse(font); + final FOrayFontConsumer consumer = this.getFOrayFontConsumer(); + final FOrayFont font = consumer.whichUse(desc, ' '); + final FOrayConsumerFont consumerFont = consumer.registerFontUse(font); return consumerFont.selectFontUse(desc, ' '); } /** * {@inheritDoc} */ - public int unavailableChar(CharSequence charSequence, int beginIndex) { + public int unavailableChar(final CharSequence charSequence, + final int beginIndex) { for (int i = 0; i < charSequence.length(); i++) { - char c = charSequence.charAt(i); + final char c = charSequence.charAt(i); if (! glyphAvailable(c)) { return i; } @@ -172,11 +178,12 @@ /** * {@inheritDoc} */ - public int[] unavailableChars(CharSequence charSequence, int beginIndex) { + public int[] unavailableChars(final CharSequence charSequence, + final int beginIndex) { int count = 0; /* Count them first. */ for (int i = 0; i < charSequence.length(); i++) { - char c = charSequence.charAt(i); + final char c = charSequence.charAt(i); if (! glyphAvailable(c)) { count++; } @@ -185,11 +192,11 @@ return null; } /* Create empty array. */ - int[] returnArray = new int[count]; + final int[] returnArray = new int[count]; /* Read through them again, completing the array. */ count = 0; for (int i = 0; i < charSequence.length(); i++) { - char c = charSequence.charAt(i); + final char c = charSequence.charAt(i); if (! glyphAvailable(c)) { returnArray[count] = i; count++; @@ -201,7 +208,7 @@ /** * {@inheritDoc} */ - public boolean glyphAvailable(int codePoint) { + public boolean glyphAvailable(final int codePoint) { /* Does the font have the glyph? */ if (! this.getFOrayFont().glyphAvailable(codePoint)) { return false; @@ -212,14 +219,14 @@ return true; } /* Can my encoding encode it? */ - int encodedChar = this.encoding.encodeCharacter(codePoint); + final int encodedChar = this.encoding.encodeCharacter(codePoint); return (encodedChar != 0); } /** * {@inheritDoc} */ - public int compareTo(Object object) { + public int compareTo(final Object object) { if (object == this) { return 0; } @@ -229,8 +236,8 @@ /** * {@inheritDoc} */ - public int smallCapsSize(int fontSize) { - float percent = this.registeredFontDesc.getSimulateSmallCaps(); + public int smallCapsSize(final int fontSize) { + final float percent = this.registeredFontDesc.getSimulateSmallCaps(); if (percent == Float.NaN) { return fontSize; } @@ -311,7 +318,7 @@ * {@inheritDoc} */ public String getPostscriptName() { - String postScriptName = this.getFont().getPostscriptName(); + final String postScriptName = this.getFont().getPostscriptName(); if (this.encoding == this.getFont().getInternalEncoding()) { return postScriptName; } @@ -332,14 +339,14 @@ /** * {@inheritDoc} */ - public void registerCharUsed(int c) { + public void registerCharUsed(final int c) { this.anyCharsUsed = true; /* If we are not subsetting, there is no need to spend the overhead to * register the use. */ if (this.getSubset() == null) { return; } - int glyphIndex = this.encodeCharacter(c); + final int glyphIndex = this.encodeCharacter(c); /* This just "touches" the subsetting logic. */ this.getSubset().encodeSubsetIndex(glyphIndex); } @@ -347,7 +354,7 @@ /** * {@inheritDoc} */ - public void registerCharsUsed(CharSequence charSequence) { + public void registerCharsUsed(final CharSequence charSequence) { if (charSequence == null) { return; } @@ -358,7 +365,7 @@ return; } for (int i = 0; i < charSequence.length(); i++) { - char c = charSequence.charAt(i); + final char c = charSequence.charAt(i); registerCharUsed(c); } } @@ -385,16 +392,16 @@ /** * {@inheritDoc} */ - public FontOutput getFontOutput(String mimeType) { + public FontOutput getFontOutput(final String mimeType) { FontOutput output = (FontOutput) this.fontOutputs.get(mimeType); if (output != null) { return output; } - FontOutputFactory factory = getFOrayFontServer().getOutputFactory( + final FontOutputFactory factory = getFOrayFontServer().getOutputFactory( mimeType); try { output = factory.createFontOutput(this); - } catch (FontException e) { + } catch (final FontException e) { getLogger().error("Error creating Font output for: " + mimeType + "\n" + e.getMessage()); } Modified: trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java 2006-07-22 21:39:22 UTC (rev 7810) @@ -44,28 +44,29 @@ * Construct an instance. * @param rf The RegisteredFont that should be used to create this font. */ - protected FSTrueTypeFont(RegisteredFont rf) { + protected FSTrueTypeFont(final RegisteredFont rf) { super(rf); parseFont(); } - public byte[] getRawFontFile(FOrayFontUse fontUse) throws IOException { - Subset subset = fontUse.getSubset(); + public byte[] getRawFontFile(final FOrayFontUse fontUse) + throws IOException { + final Subset subset = fontUse.getSubset(); if (subset != null) { - TTFSubSetFile ttfSubset = new TTFSubSetFile(ttf, subset); + final TTFSubSetFile ttfSubset = new TTFSubSetFile(ttf, subset); return ttfSubset.buildEmbeddableSubset(); } - InputStream instream = getFontInputStream(); + final InputStream instream = getFontInputStream(); return IOUtil.toByteArray(instream, 128000); } public void parseFont() { - TTFFile ttfFile = (TTFFile) getRegisteredFont().getFontFileReader() - .cre... [truncated message content] |
|
From: <vic...@us...> - 2006-07-22 19:56:33
|
Revision: 7809 Author: victormote Date: 2006-07-22 12:56:23 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7809&view=rev Log Message: ----------- Implement standard use of "final" modifier on local variables and parameters. Modified Paths: -------------- trunk/foray/foray-core/src/java/org/foray/core/ConfigurationParser.java trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java trunk/foray/foray-core/src/java/org/foray/core/FOraySession.java trunk/foray/foray-core/src/java/org/foray/core/FOrayTarget.java trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java Modified: trunk/foray/foray-core/src/java/org/foray/core/ConfigurationParser.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/ConfigurationParser.java 2006-07-22 19:42:06 UTC (rev 7808) +++ trunk/foray/foray-core/src/java/org/foray/core/ConfigurationParser.java 2006-07-22 19:56:23 UTC (rev 7809) @@ -87,9 +87,9 @@ * @param logger The logger to which errors and other messages * should be sent. */ - public ConfigurationParser(SessionConfig sessionConfig, - Configuration outputConfig, InputSource source, Log logger) - throws FOrayException { + public ConfigurationParser(final SessionConfig sessionConfig, + final Configuration outputConfig, final InputSource source, + final Log logger) throws FOrayException { this.sessionConfig = sessionConfig; this.outputConfig = outputConfig; this.filename = source; @@ -108,16 +108,16 @@ * @throws FOrayException If there are errors parsing the input. */ public void parseDocument() throws FOrayException { - XMLReader parser = createParser(); + final XMLReader parser = createParser(); parser.setContentHandler(this); try { parser.parse(filename); - } catch (SAXException e) { + } catch (final SAXException e) { if (e.getException() instanceof FOrayException) { throw (FOrayException)e.getException(); } throw new FOrayException(e); - } catch (IOException e) { + } catch (final IOException e) { throw new FOrayException(e); } } @@ -129,16 +129,16 @@ */ private XMLReader createParser() throws FOrayException { try { - SAXParserFactory spf = javax.xml.parsers.SAXParserFactory + final SAXParserFactory spf = javax.xml.parsers.SAXParserFactory .newInstance(); spf.setNamespaceAware(true); - XMLReader xmlReader = spf.newSAXParser().getXMLReader(); + final XMLReader xmlReader = spf.newSAXParser().getXMLReader(); logger.info("Config: Using " + xmlReader.getClass().getName() + " as SAX2 Parser."); return xmlReader; - } catch (javax.xml.parsers.ParserConfigurationException e) { + } catch (final javax.xml.parsers.ParserConfigurationException e) { throw new FOrayException(e); - } catch (SAXException e) { + } catch (final SAXException e) { throw new FOrayException(e); } } @@ -150,7 +150,7 @@ * Set the locator which is used to report the position of the element * in the source document. */ - public void setDocumentLocator(Locator locator) { + public void setDocumentLocator(final Locator locator) { this.locator = locator; } @@ -158,8 +158,8 @@ * extracts the element and attribute name and sets the fitting status and * datatype values */ - public void startElement(String uri, String localName, String qName, - Attributes attributes) { + public void startElement(final String uri, final String localName, + final String qName, final Attributes attributes) { if (localName.equals("key")) { status += IN_KEY; return; @@ -183,7 +183,8 @@ * stores subentries or entries into their hashes (map for subentries, * configuration for entry) */ - public void endElement(String uri, String localName, String qName) { + public void endElement(final String uri, final String localName, + final String qName) { if (localName.equals("entry")) { this.store(key, value); status = OUT; @@ -200,10 +201,10 @@ * extracts characters from text nodes and puts them into their respective * variables */ - public void characters(char[] ch, int start, int length) { - char characters[] = new char[length]; + public void characters(final char[] ch, final int start, final int length) { + final char characters[] = new char[length]; System.arraycopy(ch, start, characters, 0, length); - String text = new String(characters); + final String text = new String(characters); switch (status) { case IN_KEY: key = text; @@ -220,7 +221,7 @@ * @param key a string containing the key value for the configuration * @param value a string containing the value for the configuration */ - private void store(String key, String value) { + private void store(final String key, final String value) { // Try the SessionConfig first. if (this.sessionConfig.parseOption(key, value, SessionConfig.PRECEDENCE_CONFIG_FILE)) { Modified: trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java 2006-07-22 19:42:06 UTC (rev 7808) +++ trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java 2006-07-22 19:56:23 UTC (rev 7809) @@ -112,7 +112,7 @@ * Private constructor used only by the other constructors. * @param session The parent FOraySession. */ - private FOrayDocument(FOraySession session) { + private FOrayDocument(final FOraySession session) { this.session = session; session.registerDocument(this); treeBuilder = this.session.getFOTreeServer().makeFOTree(); @@ -127,8 +127,9 @@ * @throws FOrayException If "null" parser is passed and there is an error * creating one. */ - public FOrayDocument(FOraySession session, InputSource inputSource, - XMLReader parser) throws FOrayException { + public FOrayDocument(final FOraySession session, + final InputSource inputSource, XMLReader parser) + throws FOrayException { this(session); this.inputSource = inputSource; if (parser == null) { @@ -143,8 +144,8 @@ * @param session The parent FOraySession. * @param domDocument A DOM Document. */ - public FOrayDocument (FOraySession session, Document domDocument) - throws FOrayException { + public FOrayDocument (final FOraySession session, + final Document domDocument) throws FOrayException { this(session); this.inputSource = new DocumentInputSource(domDocument); this.parser = new DocumentReader(); @@ -156,8 +157,9 @@ * @param session The parent FOraySession. * @param jaxpTransformer A JAXP Transformer. */ - public FOrayDocument (FOraySession session, Transformer jaxpTransformer, - Source jaxpSource) throws FOrayException { + public FOrayDocument (final FOraySession session, + final Transformer jaxpTransformer, final Source jaxpSource) + throws FOrayException { this(session); this.jaxpTransformer = jaxpTransformer; this.jaxpSource = jaxpSource; @@ -169,28 +171,28 @@ * xslt input. * @param session The parent FOraySession. */ - public FOrayDocument (FOraySession session, URL xmlInput, URL xsltInput) - throws FOrayException { + public FOrayDocument (final FOraySession session, final URL xmlInput, + final URL xsltInput) throws FOrayException { this(session); InputStream xmlInputStream = null; try { xmlInputStream = xmlInput.openStream(); - } catch (IOException e) { + } catch (final IOException e) { throw new FOrayException(e); } this.jaxpSource = new StreamSource(xmlInputStream); InputStream xsltInputStream = null; try { xsltInputStream = xsltInput.openStream(); - } catch (IOException e) { + } catch (final IOException e) { throw new FOrayException(e); } - Source xsltSource = new StreamSource(xsltInputStream); - TransformerFactory factory = TransformerFactory.newInstance(); + final Source xsltSource = new StreamSource(xsltInputStream); + final TransformerFactory factory = TransformerFactory.newInstance(); this.jaxpTransformer = null; try { this.jaxpTransformer = factory.newTransformer(xsltSource); - } catch (TransformerConfigurationException e) { + } catch (final TransformerConfigurationException e) { throw new FOrayException(e); } this.jaxpResult = new SAXResult(this.treeBuilder); @@ -200,7 +202,7 @@ * Registers a FOrayTarget instance that this FOrayDocument should process. * @param target The FOrayTarget instance that should be processed. */ - protected void registerTarget(FOrayTarget target) { + protected void registerTarget(final FOrayTarget target) { if (target == null) { return; } @@ -229,7 +231,7 @@ return this.jaxpResult; } - public void setTarget(FOrayTarget target) throws FOrayException { + public void setTarget(final FOrayTarget target) throws FOrayException { if (target.getDocument() != this) { throw new FOrayException("FOrayTarget not a child of this " + "FOrayDocument."); @@ -239,14 +241,14 @@ public synchronized void process() throws FOrayException { // Get the FOrayTarget to process. - FOrayTarget target = (FOrayTarget) targetList.get(0); + final FOrayTarget target = (FOrayTarget) targetList.get(0); processTarget(target); } /** * Build the formatting object tree from the input. */ - public synchronized void processTarget(FOrayTarget target) + public synchronized void processTarget(final FOrayTarget target) throws FOrayException { this.setTarget(target); this.treeBuilder.setFontConsumer(this.getFontConsumer()); @@ -258,34 +260,34 @@ // SAX Events generated by a JAXP Transformer jaxpTransformer.transform(this.jaxpSource, jaxpResult); } - } catch (SAXException e) { + } catch (final SAXException e) { if (e.getException() instanceof FOrayException) { throw (FOrayException)e.getException(); } throw new FOrayException(e); - } catch (TransformerException e) { + } catch (final TransformerException e) { if (e.getException() instanceof FOrayException) { throw (FOrayException)e.getException(); } throw new FOrayException(e); - } catch (IOException e) { + } catch (final IOException e) { throw new FOrayException(e); } finally { cleanup(currentTarget); } } - public void cleanup(FOrayTarget target) { + public void cleanup(final FOrayTarget target) { } /** * Dumps an error */ - public void dumpError(Exception e) { + public void dumpError(final Exception e) { if (! this.getConfiguration().optionVerbosity().equals("debug")) { return; } - Log log = getLogger(); + final Log log = getLogger(); if (e instanceof SAXException) { log.error(e.getMessage()); if (((SAXException)e).getException() != null) { @@ -371,20 +373,21 @@ * @return The newly-created SAX parser. */ XMLReader createParser() throws FOrayException { - SAXParserFactory spf = javax.xml.parsers.SAXParserFactory.newInstance(); + final SAXParserFactory spf = + javax.xml.parsers.SAXParserFactory.newInstance(); spf.setNamespaceAware(true); XMLReader xmlReader = null; try { xmlReader = spf.newSAXParser().getXMLReader(); - } catch (javax.xml.parsers.ParserConfigurationException e) { + } catch (final javax.xml.parsers.ParserConfigurationException e) { throw new FOrayException(e); - } catch (SAXException e) { + } catch (final SAXException e) { throw new FOrayException(e); } try { xmlReader.setFeature( "http://xml.org/sax/features/namespace-prefixes", true); - } catch (SAXException e) { + } catch (final SAXException e) { throw new FOrayException("Error in setting up parser feature " + "namespace-prefixes\n" + "You need a parser which supports SAX version 2", e); Modified: trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java 2006-07-22 19:42:06 UTC (rev 7808) +++ trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java 2006-07-22 19:56:23 UTC (rev 7809) @@ -46,41 +46,42 @@ * * @param message descriptive message */ - public FOrayException(String message) { + public FOrayException(final String message) { super(message); this.contextMessage = null; } - public FOrayException(String message, String contextMessage) { + public FOrayException(final String message, final String contextMessage) { super(message); this.contextMessage = contextMessage; } - public FOrayException(Throwable e) { + public FOrayException(final Throwable e) { super(e.getMessage()); setException(e); this.contextMessage = null; } - public FOrayException(Throwable e, String contextMessage) { + public FOrayException(final Throwable e, final String contextMessage) { super(e.getMessage()); setException(e); this.contextMessage = contextMessage; } - public FOrayException(String message, Throwable e) { + public FOrayException(final String message, final Throwable e) { super(message); setException(e); this.contextMessage = null; } - public FOrayException(String message, Throwable e, String contextMessage) { + public FOrayException(final String message, final Throwable e, + final String contextMessage) { super(message); setException(e); this.contextMessage = contextMessage; } - protected void setException(Throwable t) { + protected void setException(final Throwable t) { _exception = t; } @@ -88,7 +89,7 @@ return _exception; } - public void setContextMessage(String contextMessage) { + public void setContextMessage(final String contextMessage) { this.contextMessage = contextMessage; } @@ -135,7 +136,7 @@ } } - public void printStackTrace(PrintStream stream) { + public void printStackTrace(final PrintStream stream) { synchronized (stream) { super.printStackTrace(stream); if (_exception != null) { @@ -149,7 +150,7 @@ } } - public void printStackTrace(PrintWriter writer) { + public void printStackTrace(final PrintWriter writer) { synchronized (writer) { super.printStackTrace(writer); if (_exception != null) { Modified: trunk/foray/foray-core/src/java/org/foray/core/FOraySession.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/FOraySession.java 2006-07-22 19:42:06 UTC (rev 7808) +++ trunk/foray/foray-core/src/java/org/foray/core/FOraySession.java 2006-07-22 19:56:23 UTC (rev 7809) @@ -110,11 +110,12 @@ * instance will be created by this FOray Session. If an instance is passed, * it needs to be fully configured and ready to be used. */ - public FOraySession(Log logger, SessionConfig configuration, - FontServer fontServer, HyphenationServer hyphenServer, - TextServer textServer, GraphicServer graphicServer, - FOTreeFactory foTreeFactory, AreaTreeFactory areaTreeFactory, - LayoutFactory layoutFactory) throws FOrayException { + public FOraySession(final Log logger, final SessionConfig configuration, + final FontServer fontServer, final HyphenationServer hyphenServer, + final TextServer textServer, final GraphicServer graphicServer, + final FOTreeFactory foTreeFactory, + final AreaTreeFactory areaTreeFactory, + final LayoutFactory layoutFactory) throws FOrayException { /* Validate Logger. */ if (logger == null) { throw new FOrayException("Logger required for FOraySession."); @@ -185,7 +186,7 @@ * Registers a FOrayDocument instance that this FOraySession should process. * @param document The FOrayDocument instance that should be processed. */ - protected void registerDocument(FOrayDocument document) { + protected void registerDocument(final FOrayDocument document) { if (document == null) { return; } @@ -197,14 +198,15 @@ */ private void setupFontServer() { if (log.isDebugEnabled()) { - String[] systemFontFamilies = fontServer.getSystemFontFamilyList(); + final String[] systemFontFamilies = + fontServer.getSystemFontFamilyList(); if (systemFontFamilies != null) { log.debug("Java font family names:"); for (int i = 0; i < systemFontFamilies.length; i++) { log.debug(" " + systemFontFamilies[i]); } } - java.awt.Font[] systemFonts = fontServer.getSystemFontList(); + final java.awt.Font[] systemFonts = fontServer.getSystemFontList(); if (systemFonts != null) { log.debug("Java font names:"); for (int i = 0; i < systemFonts.length; i++) { @@ -242,9 +244,9 @@ * processes each one. */ public void process() throws FOrayException { - Iterator iter = documentList.iterator(); + final Iterator iter = documentList.iterator(); while (iter.hasNext()) { - FOrayDocument document = (FOrayDocument) iter.next(); + final FOrayDocument document = (FOrayDocument) iter.next(); document.process(); } } @@ -257,7 +259,7 @@ * Sets the EntityResolver that should be used to resolve XML entities. * @param entityResolver The EntityResolver that should be set. */ - public void setEntityResolver(EntityResolver entityResolver) { + public void setEntityResolver(final EntityResolver entityResolver) { this.entityResolver = entityResolver; } Modified: trunk/foray/foray-core/src/java/org/foray/core/FOrayTarget.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/FOrayTarget.java 2006-07-22 19:42:06 UTC (rev 7808) +++ trunk/foray/foray-core/src/java/org/foray/core/FOrayTarget.java 2006-07-22 19:56:23 UTC (rev 7809) @@ -110,9 +110,9 @@ private FontConsumer fontConsumer; - public FOrayTarget(FOrayDocument document, OutputTarget outputTarget, - Layout layout, OutputStream outputStream) - throws FOrayException { + public FOrayTarget(final FOrayDocument document, + final OutputTarget outputTarget, final Layout layout, + final OutputStream outputStream) throws FOrayException { // Validate the FOrayDocument. this.document = document; if (this.document == null) { @@ -144,7 +144,7 @@ } /* Obtain a FontConsumer instance. */ - FontServer server = getFontServer(); + final FontServer server = getFontServer(); this.fontConsumer = server.makeFontConsumer(); this.fontConsumer.setFontSources(this.getOutputTarget() .getFontSources()); @@ -177,7 +177,7 @@ startTime = System.currentTimeMillis(); try { outputTarget.startOutput(); - } catch (IOException e) { + } catch (final IOException e) { throw new FOrayException(e); } } @@ -190,10 +190,10 @@ try { processQueue(true); outputTarget.stopOutput(); - } catch (AreaRException e) { + } catch (final AreaRException e) { throw new SAXException(e); } - catch (IOException e) { + catch (final IOException e) { throw new SAXException(e); } @@ -201,8 +201,8 @@ System.gc(); // This takes time but gives better results } - long memoryNow = runtime.totalMemory() - runtime.freeMemory(); - long memoryUsed = (memoryNow - initialMemory) / 1024L; + final long memoryNow = runtime.totalMemory() - runtime.freeMemory(); + final long memoryUsed = (memoryNow - initialMemory) / 1024L; getLogger().debug("Initial heap size: " + (initialMemory/1024L) + "Kb"); getLogger().debug("Current heap size: " + (memoryNow/1024L) + "Kb"); @@ -215,7 +215,7 @@ + "comparatively"); } - long timeUsed = System.currentTimeMillis() - startTime; + final long timeUsed = System.currentTimeMillis() - startTime; getLogger().debug("Total time used: " + timeUsed + "ms"); getLogger().debug("Pages rendered: " + pageCount); @@ -236,28 +236,28 @@ are not all valid. In this case we defer the rendering until they are all valid. */ - public void render(PageSequence pageSequence) throws FOrayException { + public void render(final PageSequence pageSequence) throws FOrayException { pageSequenceCount ++; getLogger().info("Starting layout of page-sequence " + pageSequenceCount + "."); if (this.outputTarget instanceof Renderer) { - Renderer renderer = (Renderer) this.outputTarget; - org.axsl.areaR.AreaTree areaTreeR = getRenderedAreaTree(); + final Renderer renderer = (Renderer) this.outputTarget; + final org.axsl.areaR.AreaTree areaTreeR = getRenderedAreaTree(); renderer.setAreaTree(areaTreeR); - org.axsl.areaW.PageCollection pageCollection = - areaTree.makePageCollection(pageSequence); + final org.axsl.areaW.PageCollection pageCollection = + areaTree.makePageCollection(pageSequence); try { layout.formatPageSequence(pageCollection); - } catch (AreaWException e) { + } catch (final AreaWException e) { throw new FOrayException(e); - } catch (LayoutException e) { + } catch (final LayoutException e) { throw new FOrayException(e); } try { processQueue(false); - } catch (AreaRException e1) { + } catch (final AreaRException e1) { throw new FOrayException(e1); - } catch (IOException e1) { + } catch (final IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } @@ -277,25 +277,26 @@ private org.axsl.areaR.AreaTree getRenderedAreaTree() throws FOrayException { - org.axsl.areaW.AreaTree areaTreeW = getCreatedAreaTree(); + final org.axsl.areaW.AreaTree areaTreeW = getCreatedAreaTree(); if (! (areaTreeW instanceof org.axsl.areaR.AreaTree)) { throw new FOrayException("Area Tree cannot be rendered."); } return (org.axsl.areaR.AreaTree) areaTreeW; } - public void pageComplete(AreaTreeEvent event) { - org.axsl.areaW.PageArea page = event.getPage(); - org.axsl.areaR.PageArea pageToRender = (PageArea) page; + public void pageComplete(final AreaTreeEvent event) { + final org.axsl.areaW.PageArea page = event.getPage(); + final org.axsl.areaR.PageArea pageToRender = (PageArea) page; try { queuePage(pageToRender); - } catch (AreaWException e) { + } catch (final AreaWException e) { /* TODO: Do something better with this. */ e.printStackTrace(); } } - public synchronized void queuePage(PageArea page) throws AreaWException { + public synchronized void queuePage(final PageArea page) + throws AreaWException { /* * We run the pages through a queue because any page page that contains * an unresolved ref-id prevents subsequent pages from being rendered. @@ -321,14 +322,14 @@ If an entry can't be processed, then the queue can't move forward, so return. */ - private synchronized void processQueue(boolean force) + private synchronized void processQueue(final boolean force) throws AreaRException, IOException { if (! (this.outputTarget instanceof Renderer)) { return; } - Renderer renderer = (Renderer) this.outputTarget; + final Renderer renderer = (Renderer) this.outputTarget; while (renderQueue.size() > 0) { - PageArea page = (PageArea) renderQueue.get(0); + final PageArea page = (PageArea) renderQueue.get(0); if (force || page.firstUnresolvedRefId() == null) { renderer.render(page); renderQueue.remove(0); @@ -351,7 +352,7 @@ * do not need to do anything with it, so we ignore it. * @param event The FOTreeEvent that was fired. */ - public void foFObjComplete(FOTreeEvent event) { + public void foFObjComplete(final FOTreeEvent event) { } /** @@ -359,13 +360,13 @@ * FOTreeEvent that is fired when a PageSequence object has been completed. * @param event the FOTreeEvent that was fired */ - public void foPageSequenceComplete(FOTreeEvent event) { + public void foPageSequenceComplete(final FOTreeEvent event) { try { - boolean shouldRender = this.getConfiguration().isModeRender(); + final boolean shouldRender = this.getConfiguration().isModeRender(); if (shouldRender) { render(event.getPageSequence()); } - } catch (FOrayException e) { + } catch (final FOrayException e) { // TODO Auto-generated catch block e.printStackTrace(); } @@ -376,11 +377,11 @@ * is fired when the Document has been completely parsed. * @param event the FOTreeEvent that was fired */ - public void foDocumentComplete(FOTreeEvent event) { + public void foDocumentComplete(final FOTreeEvent event) { getCreatedAreaTree().createDocumentNodes(); try { stopRenderer(); - } catch (SAXException e) { + } catch (final SAXException e) { e.printStackTrace(); } } @@ -431,7 +432,7 @@ if (this.outputStream != null) { try { this.outputStream.close(); - } catch (Exception e) { + } catch (final Exception e) { } } } Modified: trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java 2006-07-22 19:42:06 UTC (rev 7808) +++ trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java 2006-07-22 19:56:23 UTC (rev 7809) @@ -41,7 +41,7 @@ * if any. */ URL baseDocument = null; - public SessionConfig(Log logger) { + public SessionConfig(final Log logger) { super(logger); } @@ -53,7 +53,7 @@ * Sets the default values that should be used unless overridden later. */ protected void setDefaults() { - URL baseDirectory = parseURLDirectory("base-directory", + final URL baseDirectory = parseURLDirectory("base-directory", System.getProperty("user.dir")); put("base-directory", baseDirectory, PRECEDENCE_DEFAULT); @@ -69,12 +69,13 @@ put("mode", "render", PRECEDENCE_DEFAULT); } - public boolean parseOption(String key, String value, int precedenceValue) { + public boolean parseOption(final String key, final String value, + final int precedenceValue) { if (key.equals("cache-graphics") || key.equals("dump-configuration") || key.equals("stroke-svg-text")) { // Boolean value. - Boolean booleanValue = this.parseBoolean(key, value); + final Boolean booleanValue = this.parseBoolean(key, value); put(key, booleanValue, precedenceValue); return true; } @@ -82,13 +83,13 @@ || key.equals("font-base-directory") || key.equals("hyphenation-base-directory")) { // URL for a directory. - URL baseDir = parseURLDirectory(key, value); + final URL baseDir = parseURLDirectory(key, value); put (key, baseDir, precedenceValue); return true; } if (key.equals("font-configuration")) { // URL for a file. - URL baseDir = parseURLFile(key, value); + final URL baseDir = parseURLFile(key, value); put (key, baseDir, precedenceValue); return true; } @@ -127,7 +128,7 @@ return (URL) getValue("base-directory"); } - public void setBaseDirectory(URL newBaseDir, int precedence) { + public void setBaseDirectory(final URL newBaseDir, final int precedence) { put ("base-directory", newBaseDir, precedence); } @@ -142,7 +143,7 @@ } public URL optionFontBaseDirectory() { - URL value = (URL) getValue("font-base-directory"); + final URL value = (URL) getValue("font-base-directory"); return value; } @@ -155,7 +156,7 @@ } public URL optionHyphenationBaseDirectory() { - URL value = (URL) getValue("hyphenation-base-directory"); + final URL value = (URL) getValue("hyphenation-base-directory"); if (value == null) { return optionBaseDirectory(); } @@ -187,7 +188,7 @@ * resources with relative URLs. * @param baseDocument The path to the base document. */ - public void setBaseDocument(URL baseDocument) { + public void setBaseDocument(final URL baseDocument) { this.baseDocument = baseDocument; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-22 19:42:39
|
Revision: 7808 Author: victormote Date: 2006-07-22 12:42:06 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7808&view=rev Log Message: ----------- Implement standard use of "final" modifier on local variables and parameters. Modified Paths: -------------- trunk/foray/foray-common/.project trunk/foray/foray-common/src/java/org/foray/common/ClassService.java trunk/foray/foray-common/src/java/org/foray/common/ColorSpaceCMYK.java trunk/foray/foray-common/src/java/org/foray/common/Configuration.java trunk/foray/foray-common/src/java/org/foray/common/Environment.java trunk/foray/foray-common/src/java/org/foray/common/IOUtil.java trunk/foray/foray-common/src/java/org/foray/common/ISO639.java trunk/foray/foray-common/src/java/org/foray/common/Logging.java trunk/foray/foray-common/src/java/org/foray/common/MUserAgent.java trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java trunk/foray/foray-common/src/java/org/foray/common/RandomReaderRAFile.java trunk/foray/foray-common/src/java/org/foray/common/RandomReaderURL.java trunk/foray/foray-common/src/java/org/foray/common/SVGUserAgent.java trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java trunk/foray/foray-common/src/java/org/foray/common/StringUtilPre5.java trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java trunk/foray/foray-common/src/java/org/foray/common/XMLParser.java trunk/foray/foray-common/src/java/org/foray/common/XMLUtil.java trunk/foray/foray-common/src/java/org/foray/common/sax/DocumentInputSource.java trunk/foray/foray-common/src/java/org/foray/common/sax/DocumentReader.java trunk/foray/foray-common/src/java/org/foray/common/url/AbstractProtocolRegistration.java trunk/foray/foray-common/src/java/org/foray/common/url/FOrayURLStreamHandlerFactory.java trunk/foray/foray-common/src/java/org/foray/common/url/FactoryProtocolRegistration.java trunk/foray/foray-common/src/java/org/foray/common/url/PropertyProtocolRegistration.java trunk/foray/foray-common/src/java/org/foray/common/url/ProtocolRegistrationBroker.java trunk/foray/foray-common/src/java/org/foray/common/url/URLFactory.java trunk/foray/foray-common/src/java/org/foray/common/url/URLUtil.java trunk/foray/foray-common/src/java/org/foray/common/url/UniversalProtocolRegistration.java trunk/foray/foray-common/src/java/org/foray/common/url/classpath/Handler.java Modified: trunk/foray/foray-common/.project =================================================================== --- trunk/foray/foray-common/.project 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/.project 2006-07-22 19:42:06 UTC (rev 7808) @@ -6,12 +6,12 @@ </projects> <buildSpec> <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> <arguments> </arguments> </buildCommand> Modified: trunk/foray/foray-common/src/java/org/foray/common/ClassService.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/ClassService.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/ClassService.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -43,14 +43,14 @@ static HashMap providerMap = new HashMap(); - public static synchronized Enumeration providers(Class cls) { + public static synchronized Enumeration providers(final Class cls) { ClassLoader cl = cls.getClassLoader(); // null if loaded by bootstrap class loader if(cl == null) { cl = ClassLoader.getSystemClassLoader(); } - String serviceFile = "META-INF/services/" + cls.getName(); + final String serviceFile = "META-INF/services/" + cls.getName(); Vector v = (Vector)providerMap.get(serviceFile); if (v != null) { @@ -63,23 +63,23 @@ Enumeration e; try { e = cl.getResources(serviceFile); - } catch (IOException ioe) { + } catch (final IOException ioe) { return v.elements(); } while (e.hasMoreElements()) { try { - URL u = (URL)e.nextElement(); + final URL u = (URL)e.nextElement(); - InputStream is = u.openStream(); - InputStreamReader r = new InputStreamReader(is, "UTF-8"); - BufferedReader br = new BufferedReader(r); + final InputStream is = u.openStream(); + final InputStreamReader r = new InputStreamReader(is, "UTF-8"); + final BufferedReader br = new BufferedReader(r); String line = br.readLine(); while (line != null) { try { // First strip any comment... - int idx = line.indexOf('#'); + final int idx = line.indexOf('#'); if (idx != -1) { line = line.substring(0, idx); } @@ -97,13 +97,13 @@ // Object obj = cl.loadClass(line).newInstance(); // stick it into our vector... v.add(line); - } catch (Exception ex) { + } catch (final Exception ex) { // Just try the next line } line = br.readLine(); } - } catch (Exception ex) { + } catch (final Exception ex) { // Just try the next file... } Modified: trunk/foray/foray-common/src/java/org/foray/common/ColorSpaceCMYK.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/ColorSpaceCMYK.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/ColorSpaceCMYK.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -41,45 +41,45 @@ /** * {@inheritDoc} */ - public float[] toRGB(float[] colorvalue) { + public float[] toRGB(final float[] colorvalue) { if (colorvalue == null) { return null; } if (colorvalue.length < this.getNumComponents()) { throw new ArrayIndexOutOfBoundsException(); } - float cyan = colorvalue[0]; - float magenta = colorvalue[1]; - float yellow = colorvalue[2]; - float black = colorvalue[3]; + final float cyan = colorvalue[0]; + final float magenta = colorvalue[1]; + final float yellow = colorvalue[2]; + final float black = colorvalue[3]; - float red = 1.0f - cyan + (black / BLACK_FACTOR); - float green = 1.0f - magenta + (black / BLACK_FACTOR); - float blue = 1.0f - yellow + (black / BLACK_FACTOR); + final float red = 1.0f - cyan + (black / BLACK_FACTOR); + final float green = 1.0f - magenta + (black / BLACK_FACTOR); + final float blue = 1.0f - yellow + (black / BLACK_FACTOR); return new float[] {red, green, blue}; } /** * {@inheritDoc} */ - public float[] fromRGB(float[] rgbvalue) { + public float[] fromRGB(final float[] rgbvalue) { if (rgbvalue == null) { return null; } if (rgbvalue.length < 3) { throw new ArrayIndexOutOfBoundsException(); } - float red = rgbvalue[0]; - float green = rgbvalue[1]; - float blue = rgbvalue[2]; + final float red = rgbvalue[0]; + final float green = rgbvalue[1]; + final float blue = rgbvalue[2]; - float cyan = 1.0f - red; - float magenta = 1.0f - green; - float yellow = 1.0f - blue; + final float cyan = 1.0f - red; + final float magenta = 1.0f - green; + final float yellow = 1.0f - blue; /* Pick the lowest color. */ - float temp = Math.min(red, Math.min(green, blue)); - float black = temp / BLACK_FACTOR; + final float temp = Math.min(red, Math.min(green, blue)); + final float black = temp / BLACK_FACTOR; return new float[] {cyan, magenta, yellow, black}; } @@ -87,7 +87,7 @@ /** * {@inheritDoc} */ - public float[] toCIEXYZ(float[] colorvalue) { + public float[] toCIEXYZ(final float[] colorvalue) { /* TODO: Implement this. */ return null; } @@ -95,7 +95,7 @@ /** * {@inheritDoc} */ - public float[] fromCIEXYZ(float[] colorvalue) { + public float[] fromCIEXYZ(final float[] colorvalue) { /* TODO: Implement this. */ return null; } @@ -107,9 +107,9 @@ return THE_INSTANCE; } - public static Color makeColor(float cyan, float magenta, float yellow, - float black) { - float[] cmykArray = new float[] {cyan, magenta, yellow, black}; + public static Color makeColor(final float cyan, final float magenta, + final float yellow, final float black) { + final float[] cmykArray = new float[] {cyan, magenta, yellow, black}; return new Color(ColorSpaceCMYK.theInstance(), cmykArray, 0); } Modified: trunk/foray/foray-common/src/java/org/foray/common/Configuration.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/Configuration.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/Configuration.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -73,7 +73,7 @@ */ private Map precedence = new HashMap(30); - protected Configuration(Log logger) { + protected Configuration(final Log logger) { this.logger = logger; setDefaults(); } @@ -95,7 +95,7 @@ * convenience methods, which return the correct form, * null if the key is not defined. */ - protected Object getValue(String key) { + protected Object getValue(final String key) { return options.get(key); } @@ -105,8 +105,8 @@ * @return String a string containing the value, * null if the key is not defined. */ - protected String getStringValue(String key) { - Object obj = getValue(key); + protected String getStringValue(final String key) { + final Object obj = getValue(key); if (obj instanceof String) { return (String)obj; } @@ -119,8 +119,8 @@ * @return int a int containing the value, * -1 if the key is not defined. */ - protected int getIntValue(String key) { - Object obj = getValue(key); + protected int getIntValue(final String key) { + final Object obj = getValue(key); if (obj instanceof String) { return Integer.parseInt((String)obj); } @@ -133,8 +133,8 @@ * @return Boolean true or false as value, * null if the key is not defined. */ - protected Boolean getBooleanValue(String key) { - Object obj = getValue(key); + protected Boolean getBooleanValue(final String key) { + final Object obj = getValue(key); if (obj instanceof String) { return new Boolean((String)obj); } else if (obj instanceof Boolean) { @@ -150,8 +150,8 @@ * @return List a List containing the values, * null if the key is not defined. */ - protected List getListValue(String key) { - Object obj = getValue(key); + protected List getListValue(final String key) { + final Object obj = getValue(key); if (obj instanceof List) { return (List)obj; } @@ -168,8 +168,9 @@ * @param key A string containing the key value for the configuration value. * @param value The object containing the configuration value. */ - protected void put(String key, Object value, int precedenceValue) { - Integer oldPrecedence = (Integer) this.precedence.get(key); + protected void put(final String key, final Object value, + final int precedenceValue) { + final Integer oldPrecedence = (Integer) this.precedence.get(key); if (oldPrecedence == null) { // Key does not already exist. Add it. putInMap(key, value, precedenceValue); @@ -199,18 +200,19 @@ * Adds an item to the configuration without giving the subclass an * opportunity to validate it. */ - protected void addUnvalidatedOption(String key, Object value, - int precedenceValue) { + protected void addUnvalidatedOption(final String key, final Object value, + final int precedenceValue) { put(key, value, precedenceValue); } - private void putInMap(String key, Object value, int precedenceValue) { - Integer newPrecedence = new Integer(precedenceValue); + private void putInMap(final String key, final Object value, + final int precedenceValue) { + final Integer newPrecedence = new Integer(precedenceValue); this.precedence.put(key, newPrecedence); this.options.put(key, value); } - protected Boolean parseBoolean(String key, String value) { + protected Boolean parseBoolean(final String key, final String value) { if (value.equalsIgnoreCase("true")) { return Boolean.TRUE; } @@ -222,49 +224,50 @@ return null; } - protected URL parseURLDirectory(String key, String directory) { + protected URL parseURLDirectory(final String key, final String directory) { URL baseURL = null; try { if (directory == null) { return URLFactory.createURL("."); } - File dir = new File(directory); + final File dir = new File(directory); if (dir.isDirectory()) { return dir.toURL(); } baseURL = URLFactory.createURL(directory); - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { this.getLogger().error("Invalid " + key + ": " + directory + " (" + e.getMessage() + ")"); } return baseURL; } - protected URL parseURLFile(String key, String fileName) { + protected URL parseURLFile(final String key, final String fileName) { URL url = null; if (fileName == null) { return null; } try { - File file = new File(fileName); + final File file = new File(fileName); if (file.isFile()) { url = file.toURL(); } else { this.getLogger().error("Invalid URL (" + key + "): " + fileName); } - } catch (MalformedURLException mfue) { + } catch (final MalformedURLException mfue) { this.getLogger().error("Invalid " + key + ": " + fileName + " (" + mfue.getMessage() + ")"); } return url; } - protected ArrayList parseSpaceDelimitedList(String key, String value) { - ArrayList list = new ArrayList(); - StringTokenizer tokenizer = new StringTokenizer(value); + protected ArrayList parseSpaceDelimitedList(final String key, + final String value) { + final ArrayList list = new ArrayList(); + final StringTokenizer tokenizer = new StringTokenizer(value); while (tokenizer.hasMoreTokens()) { - String item = tokenizer.nextToken(); + final String item = tokenizer.nextToken(); list.add(item); } return list; @@ -276,19 +279,19 @@ */ public void dumpConfiguration() { logger.info("Dumping configuration: " + getName()); - Iterator iterator = options.keySet().iterator(); + final Iterator iterator = options.keySet().iterator(); while (iterator.hasNext()) { - String key = (String)iterator.next(); + final String key = (String)iterator.next(); logger.info("key: " + key); - Object value = options.get(key); + final Object value = options.get(key); if (value instanceof String) { logger.info(" value: " + value); } else if (value instanceof List) { - StringBuffer valueString = new StringBuffer(); - List list = (List) value; + final StringBuffer valueString = new StringBuffer(); + final List list = (List) value; valueString.append(" value: "); for (int i = 0; i < list.size(); i++) { - String item = (String) list.get(i); + final String item = (String) list.get(i); valueString.append(item + " "); } logger.info(valueString.toString()); Modified: trunk/foray/foray-common/src/java/org/foray/common/Environment.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/Environment.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/Environment.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -54,9 +54,9 @@ GraphicsEnvironment ge = null; try { ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - } catch (LinkageError e) { + } catch (final LinkageError e) { return false; - } catch (InternalError e1) { + } catch (final InternalError e1) { return false; } return (ge != null); @@ -75,9 +75,9 @@ /* TODO: Remove this method and replace all dependencies on it with * System.getenv(String name) after Java 1.5 is the lowest supported * runtime. */ - public static String getenv(String name) { + public static String getenv(final String name) { String[] command = null; - String fileSeparator = System.getProperty("file.separator"); + final String fileSeparator = System.getProperty("file.separator"); if (fileSeparator.equals("/")) { command = new String[2]; command[0] = "printenv"; @@ -92,23 +92,23 @@ String value = null; Process process = null; try { - Runtime runtime = Runtime.getRuntime(); + final Runtime runtime = Runtime.getRuntime(); process = runtime.exec(command); if (process == null) { return null; } - InputStream stdout = process.getInputStream(); - InputStreamReader isr = new InputStreamReader(stdout); - BufferedReader br = new BufferedReader(isr); + final InputStream stdout = process.getInputStream(); + final InputStreamReader isr = new InputStreamReader(stdout); + final BufferedReader br = new BufferedReader(isr); value = br.readLine(); - int exitValue = process.waitFor(); + final int exitValue = process.waitFor(); if (exitValue != 0) { return null; } - } catch (IOException e) { + } catch (final IOException e) { // Punt. return null; - } catch (InterruptedException e) { + } catch (final InterruptedException e) { // Punt. return null; } finally { Modified: trunk/foray/foray-common/src/java/org/foray/common/IOUtil.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/IOUtil.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/IOUtil.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -47,7 +47,7 @@ * @param out OutputStream to write to * @throws IOException In case of an I/O problem */ - public static void copyStream(InputStream in, OutputStream out) + public static void copyStream(final InputStream in, final OutputStream out) throws IOException { final int bufferSize = 2048; final byte[] buf = new byte[bufferSize]; @@ -67,9 +67,9 @@ * @return byte[] the array of bytes requested * @throws IOException In case of an I/O problem */ - public static byte[] toByteArray(InputStream in, - int initialTargetBufferSize) throws IOException { - ByteArrayOutputStream baout = + public static byte[] toByteArray(final InputStream in, + final int initialTargetBufferSize) throws IOException { + final ByteArrayOutputStream baout = new ByteArrayOutputStream(initialTargetBufferSize); try { copyStream(in, baout); Modified: trunk/foray/foray-common/src/java/org/foray/common/ISO639.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/ISO639.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/ISO639.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -627,7 +627,7 @@ * @return True iff <code>languageCode</code> is a valid 2- or 3-character * ISO 639 language code. */ - public static boolean validLanguage(String languageCode) { + public static boolean validLanguage(final String languageCode) { int index = Arrays.binarySearch(codes3Letter, languageCode); if (index >= 0) { return true; Modified: trunk/foray/foray-common/src/java/org/foray/common/Logging.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/Logging.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/Logging.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -43,22 +43,22 @@ } public static Log makeDefaultLogger() { - Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO); + final Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO); return new AvalonLogger(logger); } public static Log makeDebugLogger() { - Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_DEBUG); + final Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_DEBUG); return new AvalonLogger(logger); } public static Log makeQuietLogger() { - Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_ERROR); + final Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_ERROR); return new AvalonLogger(logger); } public static Log makeWarningLogger() { - Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_WARN); + final Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_WARN); return new AvalonLogger(logger); } Modified: trunk/foray/foray-common/src/java/org/foray/common/MUserAgent.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/MUserAgent.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/MUserAgent.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -43,14 +43,14 @@ /** * Creates a new SVGUserAgent. */ - public MUserAgent(AffineTransform at) { + public MUserAgent(final AffineTransform at) { super(at); } /** * Opens a link in a new component. */ - public void openLink(SVGAElement elt) { + public void openLink(final SVGAElement elt) { // application.openLink(uri); } @@ -58,7 +58,7 @@ return new Point(0, 0); } - public void setSVGCursor(Cursor cursor) {} + public void setSVGCursor(final Cursor cursor) {} public Dimension2D getViewportSize() { return new Dimension(100, 100); Modified: trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -64,7 +64,7 @@ List children; int nextIndex = 0; - ListEnumeration(List children) { + ListEnumeration(final List children) { this.children = children; nextIndex = 0; } @@ -80,7 +80,7 @@ if (! hasMoreElements()) { throw new NoSuchElementException("No more elements"); } - Object nextElement = children.get(this.nextIndex); + final Object nextElement = children.get(this.nextIndex); this.nextIndex ++; return nextElement; } @@ -88,7 +88,7 @@ private OrderedTreeNode parent; - public OrderedTreeNode(OrderedTreeNode parent) { + public OrderedTreeNode(final OrderedTreeNode parent) { this.parent = parent; } @@ -115,7 +115,7 @@ /** * {@inheritDoc} */ - public TreeNode getChildAt(int childIndex) { + public TreeNode getChildAt(final int childIndex) { if (childIndex < 0) { return null; } @@ -138,7 +138,7 @@ /** * {@inheritDoc} */ - public int getIndex(TreeNode node) { + public int getIndex(final TreeNode node) { if (getChildren() == null) { return -1; } @@ -169,7 +169,7 @@ if (parent == null) { return null; } - List children = parent.getChildren(); + final List children = parent.getChildren(); if (children == null) { return null; } @@ -180,7 +180,7 @@ * {@inheritDoc} */ public int siblingIndex() { - List siblings = getSiblings(); + final List siblings = getSiblings(); if (siblings == null) { return -1; } @@ -191,7 +191,7 @@ * {@inheritDoc} */ public org.axsl.common.OrderedTreeNode getPreviousSibling() { - int mySiblingIndex = siblingIndex(); + final int mySiblingIndex = siblingIndex(); if (mySiblingIndex < 1) { return null; } @@ -202,7 +202,7 @@ * {@inheritDoc} */ public org.axsl.common.OrderedTreeNode getNextSibling() { - int mySiblingIndex = siblingIndex(); + final int mySiblingIndex = siblingIndex(); if (mySiblingIndex < 0) { return null; } @@ -217,7 +217,7 @@ * Changes this nodes parent. * @param newParent The new parent of this node. */ - public void setParent(OrderedTreeNode newParent) { + public void setParent(final OrderedTreeNode newParent) { this.parent = newParent; } @@ -235,7 +235,7 @@ * {@inheritDoc} */ public org.axsl.common.OrderedTreeNode getFirstChild() { - List children = getChildren(); + final List children = getChildren(); if (children == null) { return null; } @@ -249,7 +249,7 @@ * {@inheritDoc} */ public org.axsl.common.OrderedTreeNode getLastChild() { - List children = getChildren(); + final List children = getChildren(); if (children == null) { return null; } @@ -310,7 +310,7 @@ */ public org.axsl.common.OrderedTreeNode getNextLeaf() { org.axsl.common.OrderedTreeNode nextSibling; - OrderedTreeNode myParent = (OrderedTreeNode) getParent(); + final OrderedTreeNode myParent = (OrderedTreeNode) getParent(); if (myParent == null) { return null; } @@ -327,7 +327,7 @@ */ public org.axsl.common.OrderedTreeNode getPreviousLeaf() { org.axsl.common.OrderedTreeNode previousSibling; - OrderedTreeNode myParent = (OrderedTreeNode) getParent(); + final OrderedTreeNode myParent = (OrderedTreeNode) getParent(); if (myParent == null) { return null; } Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomReader.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -73,7 +73,7 @@ * Constructor suitable for a local file. * @param url The URL to the file that will be read. */ - public RandomReader(URL url) throws IOException { + public RandomReader(final URL url) throws IOException { this.realReader = randomInputFactory(url); } @@ -84,15 +84,15 @@ * <code>byteArray</code>. * @param byteArray The byte array that should be read. */ - public RandomReader(String description, byte[] byteArray) { + public RandomReader(final String description, final byte[] byteArray) { this.realReader = randomInputFactory(description, byteArray); } - private RandomInput randomInputFactory(URL url) throws IOException { + private RandomInput randomInputFactory(final URL url) throws IOException { if (url == null) { throw new IOException("URL is null."); } - File file = new File(url.getFile()); + final File file = new File(url.getFile()); if (! file.canRead()) { /* If we can't get a readable file out of it, we need to use the URL * implementation instead. */ @@ -101,8 +101,8 @@ return new RandomReaderRAFile(file); } - private RandomInput randomInputFactory(String description, - byte[] byteArray) { + private RandomInput randomInputFactory(final String description, + final byte[] byteArray) { /* Right now, there is only one available implementation. */ return new RandomReaderArray(description, byteArray); } @@ -110,7 +110,7 @@ /** * {@inheritDoc} */ - public void seek(long pos) throws IOException { + public void seek(final long pos) throws IOException { realReader.seek(pos); } @@ -131,21 +131,22 @@ /** * {@inheritDoc} */ - public void readFully(byte[] b) throws IOException { + public void readFully(final byte[] b) throws IOException { realReader.readFully(b); } /** * {@inheritDoc} */ - public void readFully(byte[] b, int off, int len) throws IOException { + public void readFully(final byte[] b, final int off, final int len) + throws IOException { realReader.readFully(b, off, len); } /** * {@inheritDoc} */ - public int skipBytes(int n) throws IOException { + public int skipBytes(final int n) throws IOException { return realReader.skipBytes(n); } @@ -260,10 +261,10 @@ * @return The unsigned integral. */ public long readUnsignedIntLoHi() throws IOException { - int byte1 = readUnsignedByte(); - int byte2 = readUnsignedByte(); - int byte3 = readUnsignedByte(); - int byte4 = readUnsignedByte(); + final int byte1 = readUnsignedByte(); + final int byte2 = readUnsignedByte(); + final int byte3 = readUnsignedByte(); + final int byte4 = readUnsignedByte(); return ((byte4 << 24) + (byte3 << 16) + (byte2 << 8) + (byte1 << 0)); } @@ -275,8 +276,8 @@ * @return The unsigned integral. */ public int readUnsignedShortLoHi() throws IOException { - int byte1 = readUnsignedByte(); - int byte2 = readUnsignedByte(); + final int byte1 = readUnsignedByte(); + final int byte2 = readUnsignedByte(); return ((byte2 << 8) + (byte1 << 0)); } @@ -287,8 +288,8 @@ * @return The unsigned integral. */ public int readShortLoHi() throws IOException { - int byte1 = readByte(); - int byte2 = readByte(); + final int byte1 = readByte(); + final int byte2 = readByte(); return ((byte2 << 8) + (byte1 << 0)); } @@ -298,14 +299,14 @@ * @param charEncoding The encoding scheme to be used for interpreting the * characters in the string. */ - public String readString(int stringSize, String charEncoding) + public String readString(final int stringSize, String charEncoding) throws IOException { if ((stringSize + getFilePointer()) > length()) { throw new EOFException("Reached EOF, file size=" + length()); } charEncoding = stringEncodingToUse(charEncoding); - byte[] tmp = new byte[stringSize]; + final byte[] tmp = new byte[stringSize]; for (int i = 0; i < stringSize; i++) { tmp[i] = readByte(); } @@ -318,10 +319,10 @@ * * @return The string read. */ - public String readTerminatedString(byte terminatingChar, - String charEncoding) throws IOException { + public String readTerminatedString(final byte terminatingChar, + final String charEncoding) throws IOException { // We're going to read ahead here, so save the location - long saveLocation = getFilePointer(); + final long saveLocation = getFilePointer(); int stringSize = 0; byte inByte = readByte(); while (inByte != terminatingChar) { @@ -347,7 +348,7 @@ * @return charEncoding, if it is valid. Otherwise, the best valid character * encoding scheme found. */ - private String stringEncodingToUse(String charEncoding) { + private String stringEncodingToUse(final String charEncoding) { if (charEncoding == null) { return CHAR_ENCODE_US_ASCII; } @@ -397,11 +398,11 @@ public long searchBytes(final byte[] bytesToFind, final long startRange, final long endRange, final boolean readBackward) throws IOException { - ByteSearcher bSearcher = new ByteSearcher(bytesToFind, startRange, + final ByteSearcher bSearcher = new ByteSearcher(bytesToFind, startRange, endRange, readBackward); try { return bSearcher.searchBytes(); - } catch (IOException e) { + } catch (final IOException e) { return -1; } } @@ -416,8 +417,8 @@ * to be matched in bytesToSearch. * @return True if the contents match, false otherwise. */ - public static final boolean byteArrayCompare(byte[] bytesToSearch, - int bytesToSearchOffset, byte[] bytesToFind) { + public static final boolean byteArrayCompare(final byte[] bytesToSearch, + final int bytesToSearchOffset, final byte[] bytesToFind) { // Make sure we don't go off the end of bytesToSearch if (bytesToSearchOffset + bytesToFind.length > bytesToSearch.length) { return false; @@ -436,11 +437,11 @@ * @param urlArray An array containing a list of URLs to be tested. * @return The first qualifying URL, or null if there are none. */ - public static URL resolveURLInput(URL[] urlArray) { + public static URL resolveURLInput(final URL[] urlArray) { for (int i = 0; i < urlArray.length; i++) { - URL url = urlArray[i]; + final URL url = urlArray[i]; if (url != null) { - File file = new File(url.getFile()); + final File file = new File(url.getFile()); if (file.exists()) { return url; } @@ -604,7 +605,7 @@ } } - private void computeOffsetToContent(int i) { + private void computeOffsetToContent(final int i) { offsetToContent = lastReadStart - lastViewboxTarget + i; } Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -45,7 +45,8 @@ * useful in user messages. * @byteArray The byte array which will be "read" by this reader. */ - protected RandomReaderArray(String description, byte[] byteArray) { + protected RandomReaderArray(final String description, + final byte[] byteArray) { this.description = description; this.byteArray = byteArray; } @@ -53,14 +54,14 @@ /** * {@inheritDoc} */ - public void seek(long offset) throws IOException { + public void seek(final long offset) throws IOException { arrayIndex = (int) offset; } /** * {@inheritDoc} */ - public int skipBytes(int add) throws IOException { + public int skipBytes(final int add) throws IOException { return arrayIndex += add; } @@ -78,7 +79,7 @@ if (arrayIndex >= this.byteArray.length) { throw new EOFException(); } - byte theByte = this.byteArray[arrayIndex]; + final byte theByte = this.byteArray[arrayIndex]; arrayIndex ++; return theByte; } @@ -90,7 +91,7 @@ if (this.arrayIndex >= this.byteArray.length) { throw new EOFException(); } - char c = (char) this.byteArray[this.arrayIndex]; + final char c = (char) this.byteArray[this.arrayIndex]; this.arrayIndex ++; return c; } @@ -99,8 +100,8 @@ * {@inheritDoc} */ public final short readShort() throws IOException { - int byte1 = readUnsignedByte(); - int byte2 = readUnsignedByte(); + final int byte1 = readUnsignedByte(); + final int byte2 = readUnsignedByte(); return (short)((byte1 << 8) + (byte2 << 0)); } @@ -108,8 +109,8 @@ * {@inheritDoc} */ public final int readUnsignedShort() throws IOException { - int byte1 = readUnsignedByte(); - int byte2 = readUnsignedByte(); + final int byte1 = readUnsignedByte(); + final int byte2 = readUnsignedByte(); return (byte1 << 8) + (byte2 << 0); } @@ -124,21 +125,22 @@ * {@inheritDoc} */ public final boolean readBoolean() throws IOException { - int ch = readUnsignedByte(); + final int ch = readUnsignedByte(); return (ch != 0); } /** * {@inheritDoc} */ - public final void readFully(byte[] b) throws IOException { + public final void readFully(final byte[] b) throws IOException { readFully(b, 0, b.length); } /** * {@inheritDoc} */ - public final void readFully(byte[] b, int off, int len) throws IOException { + public final void readFully(final byte[] b, final int off, int len) + throws IOException { boolean eofDetected = false; if (this.arrayIndex + len >= this.byteArray.length) { eofDetected = true; @@ -169,8 +171,8 @@ * {@inheritDoc} */ public final char readChar() throws IOException { - int byte1 = this.readUnsignedByte(); - int byte2 = this.readUnsignedByte(); + final int byte1 = this.readUnsignedByte(); + final int byte2 = this.readUnsignedByte(); return (char)((byte1 << 8) + (byte2 << 0)); } @@ -185,10 +187,10 @@ * {@inheritDoc} */ public final int readInt() throws IOException { - int byte1 = this.readUnsignedByte(); - int byte2 = this.readUnsignedByte(); - int byte3 = this.readUnsignedByte(); - int byte4 = this.readUnsignedByte(); + final int byte1 = this.readUnsignedByte(); + final int byte2 = this.readUnsignedByte(); + final int byte3 = this.readUnsignedByte(); + final int byte4 = this.readUnsignedByte(); return ((byte1 << 24) + (byte2 << 16) + (byte3 << 8) + (byte4 << 0)); } @@ -196,7 +198,7 @@ * {@inheritDoc} */ public final String readLine() throws IOException { - StringBuffer input = new StringBuffer(); + final StringBuffer input = new StringBuffer(); int byteRead = -1; boolean eol = false; @@ -213,7 +215,7 @@ } case '\r': { eol = true; - long cur = getFilePointer(); + final long cur = getFilePointer(); if (this.arrayIndex >= this.length()) { eol = true; break; Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomReaderRAFile.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomReaderRAFile.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomReaderRAFile.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -43,7 +43,7 @@ /** * Constructor. */ - protected RandomReaderRAFile(File file) throws IOException { + protected RandomReaderRAFile(final File file) throws IOException { this.file = file; if (file == null) { return; @@ -52,11 +52,11 @@ seek(0); } - public void seek(long offset) throws IOException { + public void seek(final long offset) throws IOException { raFile.seek(offset); } - public int skipBytes(int add) throws IOException { + public int skipBytes(final int add) throws IOException { return raFile.skipBytes(add); } @@ -88,11 +88,12 @@ return raFile.readBoolean(); } - public final void readFully(byte[] b) throws IOException { + public final void readFully(final byte[] b) throws IOException { raFile.readFully(b); } - public final void readFully(byte[] b, int off, int len) throws IOException { + public final void readFully(final byte[] b, final int off, final int len) + throws IOException { raFile.readFully(b, off, len); } Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomReaderURL.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/RandomReaderURL.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/RandomReaderURL.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -46,7 +46,7 @@ * Constructor. * @param url The URL which contains the stream to be used. */ - protected RandomReaderURL(URL url) { + protected RandomReaderURL(final URL url) { this.url = url; } @@ -54,15 +54,15 @@ if (this.array != null) { return; } - InputStream input = this.getInputStream(); - byte[] theBytes = IOUtil.toByteArray(input, 20000); + final InputStream input = this.getInputStream(); + final byte[] theBytes = IOUtil.toByteArray(input, 20000); this.array = new RandomReaderArray(this.url.toExternalForm(), theBytes); } /** * {@inheritDoc} */ - public void seek(long offset) throws IOException { + public void seek(final long offset) throws IOException { checkArray(); this.array.seek(offset); } @@ -70,7 +70,7 @@ /** * {@inheritDoc} */ - public int skipBytes(int add) throws IOException { + public int skipBytes(final int add) throws IOException { checkArray(); return this.array.skipBytes(add); } @@ -134,7 +134,7 @@ /** * {@inheritDoc} */ - public final void readFully(byte[] b) throws IOException { + public final void readFully(final byte[] b) throws IOException { checkArray(); this.array.readFully(b); } @@ -142,7 +142,8 @@ /** * {@inheritDoc} */ - public final void readFully(byte[] b, int off, int len) throws IOException { + public final void readFully(final byte[] b, final int off, final int len) + throws IOException { checkArray(); this.array.readFully(b, off, len); } @@ -209,7 +210,7 @@ public String getDescription() { try { checkArray(); - } catch (IOException e) { + } catch (final IOException e) { return this.url.toExternalForm(); } return this.array.getDescription(); @@ -228,7 +229,7 @@ public void reset() { try { checkArray(); - } catch (IOException e) { + } catch (final IOException e) { /* Nothing to do here. */ } this.array = null; Modified: trunk/foray/foray-common/src/java/org/foray/common/SVGUserAgent.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/SVGUserAgent.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/SVGUserAgent.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -41,25 +41,25 @@ /** * Creates a new SVGUserAgent. */ - public SVGUserAgent(AffineTransform at) { + public SVGUserAgent(final AffineTransform at) { currentTransform = at; } - public void setLogger(Log logger) { + public void setLogger(final Log logger) { log = logger; } /** * Displays an error message. */ - public void displayError(String message) { + public void displayError(final String message) { log.error(message); } /** * Displays an error resulting from the specified Exception. */ - public void displayError(Exception ex) { + public void displayError(final Exception ex) { log.error("SVG Error" + ex.getMessage()); log.error(ex.getMessage()); } @@ -68,7 +68,7 @@ * Displays a message in the User Agent interface. * The given message is typically displayed in a status bar. */ - public void displayMessage(String message) { + public void displayMessage(final String message) { log.info(message); } Modified: trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -41,7 +41,7 @@ * @param input The character to be tested. * @return True iff the character is a valid hexadecimal character. */ - public static boolean isASCIIHex(char input) { + public static boolean isASCIIHex(final char input) { // "0" thru "9" if (input >= 0x30 && input <= 0x39) { return true; @@ -60,7 +60,7 @@ /** * Same as {@link #isASCIIHex(byte)}, except with a char as input. */ - public static boolean isASCIIHex(byte input) { + public static boolean isASCIIHex(final byte input) { // Make sure the byte is not negative before casting as char. if (input < 0x00) { return false; @@ -78,7 +78,7 @@ * @return The byte containing the hex value of the 2 input bytes, or -1 if * the input is valid. */ - public static byte asciiHexBytesToHex(byte byte1, byte byte2) { + public static byte asciiHexBytesToHex(final byte byte1, final byte byte2) { if (! isASCIIHex(byte1)) { return -1; } @@ -86,9 +86,9 @@ return -1; } // Convert the high-order byte and shift it into the high position. - byte convert1 = (byte) (asciiHexByteToHex(byte1) << 4); + final byte convert1 = (byte) (asciiHexByteToHex(byte1) << 4); // Convert the low-order byte. - byte convert2 = asciiHexByteToHex(byte2); + final byte convert2 = asciiHexByteToHex(byte2); // "Or" the two half-bytes together and return it. return (byte) (convert1 | convert2); } @@ -99,7 +99,7 @@ * @param inputByte The ASCII Hex byte to convert. * @return The hex equivalent of inputByte. */ - public static byte asciiHexByteToHex(byte inputByte) { + public static byte asciiHexByteToHex(final byte inputByte) { if (inputByte >= 0x30 && inputByte <= 0x39) { // numerals return (byte) (inputByte - 0x30); } @@ -125,8 +125,8 @@ * @return The index (0 through stringArray.length - 1) of the matching * element, or -1 if no match is found. */ - public static int indexOfSortedCharArray(char[] charArray, - char inputChar, int startIndex, int endIndex) { + public static int indexOfSortedCharArray(final char[] charArray, + final char inputChar, final int startIndex, final int endIndex) { if (charArray == null) { return -1; } @@ -136,8 +136,8 @@ int bottom = startIndex; int top = endIndex; while (top >= bottom) { - int mid = (bottom + top) / 2; - char testChar = charArray[mid]; + final int mid = (bottom + top) / 2; + final char testChar = charArray[mid]; if (inputChar == testChar) { // This is the item we are looking for. Return it. return mid; @@ -166,8 +166,8 @@ * ensure this size. * @return The String representing c's hex value. */ - public static String charToHexString(char c, boolean upperCase, - int minimumSize) { + public static String charToHexString(final char c, final boolean upperCase, + final int minimumSize) { String returnString = Integer.toHexString(c); if (upperCase) { returnString.toUpperCase(); @@ -190,7 +190,8 @@ * ensure this size. * @return The String representing c's octal value. */ - public static String charToOctalString(char c, int minimumSize) { + public static String charToOctalString(final char c, + final int minimumSize) { String returnString = Integer.toOctalString(c); int bytesToPad = minimumSize - returnString.length(); while (bytesToPad > 0) { @@ -208,12 +209,12 @@ * spaces to the end of eol. * @param length The maximum length that a line should contain. */ - public static void lineBreakStringBuffer(StringBuffer buffer, String eol, - int length) { + public static void lineBreakStringBuffer(final StringBuffer buffer, + final String eol, final int length) { int currentLineStarts = 0; int lastOpportunity = -1; for (int i = 0; i < buffer.length(); i++) { - int currentLineLength = i - currentLineStarts; + final int currentLineLength = i - currentLineStarts; if (currentLineLength > length && lastOpportunity > 0) { buffer.replace(lastOpportunity, lastOpportunity + 1, eol); @@ -221,7 +222,7 @@ lastOpportunity = -1; i =+ eol.length() - 1; } - char c = buffer.charAt(i); + final char c = buffer.charAt(i); if (c == ' ') { lastOpportunity = i; } @@ -233,13 +234,14 @@ * @param input The CharSequence to be converted. * @return An array of Unicode code points. */ - public static int[] toCodePoints(CharSequence input) { + public static int[] toCodePoints(final CharSequence input) { if (input == null || input.length() < 1) { return new int[0]; } - int length = StringUtilPre5.codePointCount(input, 0, input.length()); - int[] output = new int[length]; + final int length = StringUtilPre5.codePointCount(input, 0, + input.length()); + final int[] output = new int[length]; int outputIndex = 0; for (int i = 0; i < input.length(); i++) { output[outputIndex] = StringUtilPre5.codePointAt(input, i); @@ -256,13 +258,14 @@ * @param input The char[] to be converted. * @return An array of Unicode code points. */ - public static int[] toCodePoints(char[] input) { + public static int[] toCodePoints(final char[] input) { if (input == null || input.length < 1) { return new int[0]; } - int length = StringUtilPre5.codePointCount(input, 0, input.length); - int[] output = new int[length]; + final int length = StringUtilPre5.codePointCount(input, 0, + input.length); + final int[] output = new int[length]; int outputIndex = 0; for (int i = 0; i < input.length; i++) { output[outputIndex] = StringUtilPre5.codePointAt(input, i); @@ -282,12 +285,13 @@ * @return The index to the first character in the Strings that is * different. If the Strings are identical, returns -1. */ - public static int firstDifferent(String string1, String string2) { + public static int firstDifferent(final String string1, + final String string2) { if (string2.equals(string1)) { return -1; } - char[] chars1 = string1.toCharArray(); - char[] chars2 = string2.toCharArray(); + final char[] chars1 = string1.toCharArray(); + final char[] chars2 = string2.toCharArray(); for (int i = 0; i < chars1.length; i++) { if (i >= chars2.length) { return i; @@ -309,13 +313,13 @@ * @param newString The substring that should replace oldString. * @return The number of replacements that were made. */ - public static int replace(StringBuffer buffer, String oldString, - String newString) { + public static int replace(final StringBuffer buffer, final String oldString, + final String newString) { int numChanges = 0; boolean anyChanges = true; while (anyChanges) { anyChanges = false; - int index = buffer.indexOf(oldString); + final int index = buffer.indexOf(oldString); if (index > -1) { buffer.replace(index, index + oldString.length(), newString); anyChanges = true; Modified: trunk/foray/foray-common/src/java/org/foray/common/StringUtilPre5.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/StringUtilPre5.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/StringUtilPre5.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -42,65 +42,67 @@ /** * Mimics Java 5.0: Character.charCount(int). */ - public static int charCount(int codePoint) { + public static int charCount(final int codePoint) { return UCharacter.charCount(codePoint); } /** * Mimics Java 5.0: Character.codePointAt(char[], int). */ - public static int codePointAt(char[] chars, int index) { + public static int codePointAt(final char[] chars, final int index) { return UCharacter.codePointAt(chars, index); } /** * Mimics Java 5.0: Character.codePointAt(CharSequence, int). */ - public static int codePointAt(CharSequence chars, int index) { + public static int codePointAt(final CharSequence chars, final int index) { return UCharacter.codePointAt(chars, index); } /** * Mimics Java 5.0: Character.codePointCount(char[], int, int). */ - public static int codePointCount(char[] input, int offset, int count) { + public static int codePointCount(final char[] input, final int offset, + final int count) { return UTF16.countCodePoint(input, offset, count); } /** * Mimics Java 5.0: Character.codePointCount(char[], int, int). */ - public static int codePointCount(CharSequence input, int beginIndex, - int endIndex) { - char[] array = input.toString().toCharArray(); + public static int codePointCount(final CharSequence input, + final int beginIndex, final int endIndex) { + final char[] array = input.toString().toCharArray(); return codePointCount(array, beginIndex, endIndex); } /** * Mimics Java 5.0: Character.isHighSurrogate(char). */ - public static boolean isHighSurrogate(char ch) { + public static boolean isHighSurrogate(final char ch) { return UCharacter.isHighSurrogate(ch); } /** * Mimics Java 5.0: Character.isLetter(int). */ - public static boolean isLetter(int codePoint) { + public static boolean isLetter(final int codePoint) { return UCharacter.isLetter(codePoint); } /** * Mimics Java 5.0: Character.isSupplementaryCodePoint(int). */ - public static boolean isSupplementaryCodePoint(int codePoint) { + public static boolean isSupplementaryCodePoint(final int codePoint) { return UCharacter.isSupplementaryCodePoint(codePoint); } /** * Mimics Java 5.0: String(int[], int, int). */ - public static String newString(int[] codePoints, int offset, int count) { + public static String newString(final int[] codePoints, final int offset, + final int count) { return UTF16.newString(codePoints, offset, count); } Modified: trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java 2006-07-22 19:16:29 UTC (rev 7807) +++ trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java 2006-07-22 19:42:06 UTC (rev 7808) @@ -382,7 +382,7 @@ */ private XMLCharacter() { } - private static boolean isInClass(char[] charArray, char c) { + private static boolean isInClass(final char[] charArray, final char c) { for (int i = 0; i < charArray.length; i += 2) { if (c >= charArray[i] && c <= charArray[i + 1]) { return true; @@ -391,27 +391,27 @@ return false; } - public static boolean isBaseChar(char c) { + public static boolean isBaseChar(final char c) { return isInClass(BASE_CHAR, c); } - public static boolean isIdeographic(char c) { + public static boolean isIdeographic(final char c) { return isInClass(IDEOGRAPHIC, c); } - public static boolean isCombiningChar(char c) { + public static boolean isCombiningChar(final char c) { return isInClass(COMBINING_CHAR, c); } - public static boolean isDigit(char c) { + public static boolean isDigit(final char c) { return isInClass(DIGIT, c); } - public static boolean isExtender(char c) { + public static boolean isExtender(final char c) { return isInClass(EXTENDER, c); } - public static boolean isLetter(char c) { + public static boolean isLetter(final char c) { if (isBaseChar(c)) { return true; } @@ -427,7 +427,7 @@ * http://www.w3.org/TR/REC-xml-names/#NT-NCName * @param c The character to check */ - private static boolean isNameStartChar(char c) { + private static boolean isNameStartChar(final char c) { if (isLetter(c)) { return true; } @@ -443,7 +443,7 @@ * http://www.w3.org/TR/REC-xml-names/#NT-NCNameChar * @param c The character to check */ - private static boolean isNameChar(char c) { + private static boolean isNameChar(final char c) { if (isLetter(c)) { return true; } @@ -475,7 +475,7 @@ * @pa... [truncated message content] |
|
From: <vic...@us...> - 2006-07-22 19:17:15
|
Revision: 7807 Author: victormote Date: 2006-07-22 12:16:29 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7807&view=rev Log Message: ----------- Implement standard use of "final" modifier on local variables and parameters. Modified Paths: -------------- trunk/foray/foray-areatree/src/java/org/foray/area/AbstractInlineArea.java trunk/foray/foray-areatree/src/java/org/foray/area/AbstractNormalBlockArea.java trunk/foray/foray-areatree/src/java/org/foray/area/AbstractPlaceholder.java trunk/foray/foray-areatree/src/java/org/foray/area/AbstractTableContainer.java trunk/foray/foray-areatree/src/java/org/foray/area/Area.java trunk/foray/foray-areatree/src/java/org/foray/area/AreaFixed.java trunk/foray/foray-areatree/src/java/org/foray/area/AreaFlexible.java trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java trunk/foray/foray-areatree/src/java/org/foray/area/BasicLinkArea.java trunk/foray/foray-areatree/src/java/org/foray/area/BeforeFloatRA.java trunk/foray/foray-areatree/src/java/org/foray/area/BlockArea.java trunk/foray/foray-areatree/src/java/org/foray/area/BlockContainerRA.java trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkArea.java trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTitleArea.java trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTreeArea.java trunk/foray/foray-areatree/src/java/org/foray/area/ContainerRA.java trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java trunk/foray/foray-areatree/src/java/org/foray/area/FOLinkage.java trunk/foray/foray-areatree/src/java/org/foray/area/FOLinkageMarker.java trunk/foray/foray-areatree/src/java/org/foray/area/FOLinkageNormal.java trunk/foray/foray-areatree/src/java/org/foray/area/FOrayAreaTreeFactory.java trunk/foray/foray-areatree/src/java/org/foray/area/FootnoteRA.java trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java trunk/foray/foray-areatree/src/java/org/foray/area/GenericContainer.java trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java trunk/foray/foray-areatree/src/java/org/foray/area/ListBlockArea.java trunk/foray/foray-areatree/src/java/org/foray/area/ListItemArea.java trunk/foray/foray-areatree/src/java/org/foray/area/MainRA.java trunk/foray/foray-areatree/src/java/org/foray/area/MarkerContentArea.java trunk/foray/foray-areatree/src/java/org/foray/area/NonArea.java trunk/foray/foray-areatree/src/java/org/foray/area/NormalBlockArea.java trunk/foray/foray-areatree/src/java/org/foray/area/NormalFlowRA.java trunk/foray/foray-areatree/src/java/org/foray/area/PageCollection.java trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberArea.java trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationArea.java trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java trunk/foray/foray-areatree/src/java/org/foray/area/RegionRA.java trunk/foray/foray-areatree/src/java/org/foray/area/RegionRABody.java trunk/foray/foray-areatree/src/java/org/foray/area/SVGArea.java trunk/foray/foray-areatree/src/java/org/foray/area/SpanRA.java trunk/foray/foray-areatree/src/java/org/foray/area/TableBodyContainer.java trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java trunk/foray/foray-areatree/src/java/org/foray/area/TableFooterContainer.java trunk/foray/foray-areatree/src/java/org/foray/area/TableHeaderContainer.java trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java trunk/foray/foray-areatree/src/java/org/foray/area/TableRowContainer.java trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AbstractInlineArea.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/AbstractInlineArea.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/AbstractInlineArea.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -44,8 +44,8 @@ * @param parentArea * @param retrieveMarker */ - public AbstractInlineArea(FONode generatedBy, LineArea parentArea, - RetrieveMarker retrieveMarker) { + public AbstractInlineArea(final FONode generatedBy, + final LineArea parentArea, final RetrieveMarker retrieveMarker) { super(generatedBy, parentArea, retrieveMarker); } @@ -55,8 +55,9 @@ * @param parentArea * @param retrieveMarker */ - public AbstractInlineArea(FONode generatedBy, AbstractInlineArea parentArea, - RetrieveMarker retrieveMarker) { + public AbstractInlineArea(final FONode generatedBy, + final AbstractInlineArea parentArea, + final RetrieveMarker retrieveMarker) { super(generatedBy, parentArea, retrieveMarker); } @@ -75,7 +76,8 @@ return Constants.AXIS_IP; } - public Area getOverflowArea(Area childRequesting) throws AreaWException { + public Area getOverflowArea(final Area childRequesting) + throws AreaWException { return getParentArea().getOverflowArea(this); } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AbstractNormalBlockArea.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/AbstractNormalBlockArea.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/AbstractNormalBlockArea.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -36,8 +36,8 @@ implements org.axsl.areaR.Area, org.axsl.areaW.AbstractNormalBlockArea { - public AbstractNormalBlockArea(FObj parentFObj, Area parentArea, - RetrieveMarker retrieveMarker) { + public AbstractNormalBlockArea(final FObj parentFObj, final Area parentArea, + final RetrieveMarker retrieveMarker) { super(parentFObj, parentArea, retrieveMarker); } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AbstractPlaceholder.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/AbstractPlaceholder.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/AbstractPlaceholder.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -34,8 +34,8 @@ */ public abstract class AbstractPlaceholder extends Area { - public AbstractPlaceholder(FObj generatedBy, Area parentArea, - RetrieveMarker retrieveMarker) { + public AbstractPlaceholder(final FObj generatedBy, final Area parentArea, + final RetrieveMarker retrieveMarker) { super(generatedBy, parentArea, retrieveMarker); } @@ -77,7 +77,8 @@ /** * {@inheritDoc} */ - public Area getOverflowArea(Area childRequesting) throws AreaWException { + public Area getOverflowArea(final Area childRequesting) + throws AreaWException { return this.getParentArea().getOverflowArea(childRequesting); } @@ -98,21 +99,21 @@ /** * {@inheritDoc} */ - public void setProgressionDimension(int progressionDimension) { + public void setProgressionDimension(final int progressionDimension) { return; } /** * {@inheritDoc} */ - public void setMinimumProgressionDimension(int minimumPD) { + public void setMinimumProgressionDimension(final int minimumPD) { return; } /** * {@inheritDoc} */ - public void incrementProgressionDimension(int incrementAmount) { + public void incrementProgressionDimension(final int incrementAmount) { return; } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AbstractTableContainer.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/AbstractTableContainer.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/AbstractTableContainer.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -35,13 +35,13 @@ implements BackgroundArea, org.axsl.areaW.AbstractTableContainer { - public AbstractTableContainer(FObj generatedBy, Area parentArea, - RetrieveMarker retrieveMarker) { + public AbstractTableContainer(final FObj generatedBy, final Area parentArea, + final RetrieveMarker retrieveMarker) { super(generatedBy, parentArea, retrieveMarker); } - public TableRowContainer makeTableRowContainer(TableRow node, - RetrieveMarker retrieveMarker) { + public TableRowContainer makeTableRowContainer(final TableRow node, + final RetrieveMarker retrieveMarker) { return new org.foray.area.TableRowContainer(node, this, retrieveMarker); } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/Area.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -55,8 +55,8 @@ * @param generatedBy * @param parentArea */ - public Area(FONode generatedBy, AreaNode parentArea, - RetrieveMarker retrieveMarker) { + public Area(final FONode generatedBy, final AreaNode parentArea, + final RetrieveMarker retrieveMarker) { super(generatedBy, parentArea, retrieveMarker); } @@ -155,12 +155,12 @@ } public int traitEndIndent() { - int percentBase = this.getContainingReferenceArea().crIPD(); + final int percentBase = this.getContainingReferenceArea().crIPD(); return traitGeneratedBy().traitEndIndent(this, percentBase); } public int traitStartIndent() { - int percentBase = this.getContainingReferenceArea().crIPD(); + final int percentBase = this.getContainingReferenceArea().crIPD(); return traitGeneratedBy().traitStartIndent(this, percentBase); } @@ -175,7 +175,7 @@ return traitGeneratedBy().getPrimaryFont(this); } - public FontUse getSecondaryFont(int codePoint) { + public FontUse getSecondaryFont(final int codePoint) { return traitGeneratedBy().getSecondaryFont(this, codePoint); } @@ -223,7 +223,7 @@ if (getParent() == null) { return true; } - List siblings = getAreaNodeParent().getChildren(); + final List siblings = getAreaNodeParent().getChildren(); if (siblings == null) { return true; } @@ -237,7 +237,7 @@ if (getParent() == null) { return true; } - List siblings = getAreaNodeParent().getChildren(); + final List siblings = getAreaNodeParent().getChildren(); if (siblings == null) { return true; } @@ -256,17 +256,17 @@ return false; } - public int getWordWidth(String word) { - FontUse fontUse = getPrimaryFont(); - Font font = fontUse.getFont(); + public int getWordWidth(final String word) { + final FontUse fontUse = getPrimaryFont(); + final Font font = fontUse.getFont(); fontUse.registerCharsUsed(word); return font.width(word, traitFontSize(), traitLetterSpacingOpt(), traitWordSpacingOpt()); } - public int getCharWidth(char c) { - FontUse fontUse = getPrimaryFont(); - Font font = getPrimaryFont().getFont(); + public int getCharWidth(final char c) { + final FontUse fontUse = getPrimaryFont(); + final Font font = getPrimaryFont().getFont(); fontUse.registerCharUsed(c); return font.width(c, traitFontSize()) + traitLetterSpacingOpt(); } @@ -369,7 +369,7 @@ // Start at the padding-rectangle origin. int x = prOriginX(); if (this.getBPAxis() == Constants.AXIS_VERTICAL) { - boolean goingRight = (this.traitIPDirection() + final boolean goingRight = (this.traitIPDirection() == Constants.DIRECTION_LEFT_TO_RIGHT); if (goingRight) { x -= this.traitBorderStartWidth(); @@ -378,7 +378,7 @@ } } else { // Our BP Axis is horizontal - boolean goingRight = (this.traitBPDirection() + final boolean goingRight = (this.traitBPDirection() == Constants.DIRECTION_LEFT_TO_RIGHT); if (goingRight) { x -= this.traitBorderBeforeWidth(); @@ -398,7 +398,7 @@ // Start at the padding-rectangle origin. int y = prOriginY(); if (this.getBPAxis() == Constants.AXIS_VERTICAL) { - boolean goingDown = (this.traitBPDirection() + final boolean goingDown = (this.traitBPDirection() == Constants.DIRECTION_TOP_TO_BOTTOM); if (goingDown) { y += this.traitBorderBeforeWidth(); @@ -407,7 +407,7 @@ } } else { // Our BP Axis is horizontal - boolean goingUp = (this.traitIPDirection() + final boolean goingUp = (this.traitIPDirection() == Constants.DIRECTION_BOTTOM_TO_TOP); if (goingUp) { y -= this.traitBorderStartWidth(); @@ -467,7 +467,7 @@ // Start at the content-rectangle origin. int x = crOriginX(); if (this.getBPAxis() == Constants.AXIS_VERTICAL) { - boolean goingRight = (this.traitIPDirection() + final boolean goingRight = (this.traitIPDirection() == Constants.DIRECTION_LEFT_TO_RIGHT); if (goingRight) { x -= this.traitPaddingStart(); @@ -476,7 +476,7 @@ } } else { // Our BP Axis is horizontal - boolean goingRight = (this.traitBPDirection() + final boolean goingRight = (this.traitBPDirection() == Constants.DIRECTION_LEFT_TO_RIGHT); if (goingRight) { x -= this.traitPaddingBefore(); @@ -496,7 +496,7 @@ // Start at the content-rectangle origin. int y = crOriginY(); if (this.getBPAxis() == Constants.AXIS_VERTICAL) { - boolean goingDown = (this.traitBPDirection() + final boolean goingDown = (this.traitBPDirection() == Constants.DIRECTION_TOP_TO_BOTTOM); if (goingDown) { y += this.traitPaddingBefore(); @@ -505,7 +505,7 @@ } } else { // Our BP Axis is horizontal - boolean goingRight = (this.traitBPDirection() + final boolean goingRight = (this.traitBPDirection() == Constants.DIRECTION_LEFT_TO_RIGHT); if (goingRight) { y -= this.traitPaddingBefore(); @@ -797,13 +797,13 @@ } public int traitSpaceStartOptimum() { - Area ancestor = this.ancestorBlockAreaNotALineArea(); + final Area ancestor = this.ancestorBlockAreaNotALineArea(); return traitGeneratedBy().traitSpaceStartOptimum(this, ancestor.crIPD()); } public int traitSpaceEndOptimum() { - Area ancestor = this.ancestorBlockAreaNotALineArea(); + final Area ancestor = this.ancestorBlockAreaNotALineArea(); return traitGeneratedBy().traitSpaceEndOptimum(this, ancestor.crIPD()); } @@ -817,7 +817,7 @@ private int nearestBaseBPD() { int nearestBPD = -1; - Area nearest = this.ancestorGeneratedByBlockLevelFO(); + final Area nearest = this.ancestorGeneratedByBlockLevelFO(); if (nearest != null) { nearestBPD = nearest.crBPD(); } @@ -850,7 +850,7 @@ private int nearestBaseIPD() { int nearestIPD = -1; - Area nearest = this.ancestorGeneratedByBlockLevelFO(); + final Area nearest = this.ancestorGeneratedByBlockLevelFO(); if (nearest != null) { nearestIPD = nearest.crIPD(); } @@ -934,7 +934,7 @@ * the writing-mode. */ public byte contentStackingDirectionAbsolute() { - byte relative = contentStackingAxisRelative(); + final byte relative = contentStackingAxisRelative(); return getWritingMode().getAbsoluteDirFromRelativeAxis(relative); } @@ -1000,7 +1000,7 @@ } public short referenceOrientationCumulative() { - Area containingRA = this.getContainingReferenceArea(); + final Area containingRA = this.getContainingReferenceArea(); short cumulative = containingRA.traitReferenceOrientation(); /* * The FObj method from which the following line is derived returns @@ -1072,7 +1072,7 @@ * if there is none. */ public String destinationName() { - String id = traitId(); + final String id = traitId(); if (id == null || id.equals("")) { return null; } @@ -1096,7 +1096,7 @@ * of a link, returns {@link Constants#BASIC_LINK_INVALID}. */ public byte linkType() { - BasicLink link = this.traitGeneratedBy().getBasicLink(this); + final BasicLink link = this.traitGeneratedBy().getBasicLink(this); if (link == null) { return Constants.BASIC_LINK_INVALID; } @@ -1110,7 +1110,7 @@ * external-destination. */ public String linkDestination() { - BasicLink link = this.traitGeneratedBy().getBasicLink(this); + final BasicLink link = this.traitGeneratedBy().getBasicLink(this); if (link == null) { return null; } @@ -1118,7 +1118,7 @@ } public int getHyphenWidth() { - char hyphenChar = traitHyphenationCharacter(); + final char hyphenChar = traitHyphenationCharacter(); return getCharWidth(hyphenChar); } @@ -1160,46 +1160,47 @@ return true; } - public TableArea makeTableArea(Table table, - RetrieveMarker retrieveMarker) { + public TableArea makeTableArea(final Table table, + final RetrieveMarker retrieveMarker) { return new org.foray.area.TableRA(table, this, retrieveMarker); } - public NormalBlockArea makeNormalBlockArea(Block block, - RetrieveMarker retrieveMarker) { + public NormalBlockArea makeNormalBlockArea(final Block block, + final RetrieveMarker retrieveMarker) { return new org.foray.area.NormalBlockArea(block, this, retrieveMarker); } public BlockContainerRA makeBlockContainerArea( - BlockContainer blockContainer, RetrieveMarker retrieveMarker) { + final BlockContainer blockContainer, + final RetrieveMarker retrieveMarker) { return new org.foray.area.BlockContainerRA(blockContainer, this, retrieveMarker); } - public ListBlockArea makeListBlockArea(ListBlock listBlock, - RetrieveMarker retrieveMarker) { + public ListBlockArea makeListBlockArea(final ListBlock listBlock, + final RetrieveMarker retrieveMarker) { return new org.foray.area.ListBlockArea(listBlock, this, retrieveMarker); } public int traitTop() { - Area ancestor = this.ancestorBlockAreaNotALineArea(); + final Area ancestor = this.ancestorBlockAreaNotALineArea(); return traitGeneratedBy().traitTop(this, ancestor.crBPD()); } public int traitBottom() { - Area ancestor = this.ancestorBlockAreaNotALineArea(); + final Area ancestor = this.ancestorBlockAreaNotALineArea(); return traitGeneratedBy().traitBottom(this, ancestor.crBPD()); } public int traitLeft() { - Area ancestor = this.ancestorBlockAreaNotALineArea(); + final Area ancestor = this.ancestorBlockAreaNotALineArea(); return traitGeneratedBy().traitLeft(this, ancestor.crIPD()); } public int traitRight() { - Area ancestor = this.ancestorBlockAreaNotALineArea(); + final Area ancestor = this.ancestorBlockAreaNotALineArea(); return traitGeneratedBy().traitRight(this, ancestor.crIPD()); } @@ -1234,7 +1235,7 @@ if (! this.isInNormalFlow()) { return false; } - Area parent = getParentArea(); + final Area parent = getParentArea(); if (parent instanceof LineArea) { /* LineArea children grow in the IPD, LineArea grows in the BPD. */ return false; @@ -1248,7 +1249,7 @@ } public org.axsl.areaW.MarkerContentArea makeMarkerContentArea( - RetrieveMarker retrieve, Marker marker) { + final RetrieveMarker retrieve, final Marker marker) { return new MarkerContentArea(retrieve, this, marker); } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaFixed.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/AreaFixed.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaFixed.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -38,8 +38,8 @@ */ public abstract class AreaFixed extends Area { - public AreaFixed(FObj generatedBy, AreaNode parentArea, - RetrieveMarker retrieveMarker) { + public AreaFixed(final FObj generatedBy, final AreaNode parentArea, + final RetrieveMarker retrieveMarker) { super(generatedBy, parentArea, retrieveMarker); } @@ -48,10 +48,10 @@ */ public int progressionDimensionAvailable() { int dimension = brBPD(); - List children = getChildren(); + final List children = getChildren(); for (int i = 0; i < children.size(); i++) { if (children.get(i) instanceof AreaFlexible) { - AreaFlexible child = (AreaFlexible) children.get(i); + final AreaFlexible child = (AreaFlexible) children.get(i); dimension -= child.usedProgressionDimensionNormalFlow(); } } @@ -66,17 +66,17 @@ return 0; } - public void setProgressionDimension(int progressionDimension) { + public void setProgressionDimension(final int progressionDimension) { // No-op. Exists here to minimize casts. return; } - public void setMinimumProgressionDimension(int minPD) { + public void setMinimumProgressionDimension(final int minPD) { // No-op. Exists here to minimize casts. return; } - public void incrementProgressionDimension(int incrementAmount) { + public void incrementProgressionDimension(final int incrementAmount) { // No-op. Exists here to minimize casts. return; } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaFlexible.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/AreaFlexible.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaFlexible.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -51,8 +51,8 @@ */ private int anteriorSpace; - public AreaFlexible(FONode generatedBy, AreaNode parentArea, - RetrieveMarker retrieveMarker) { + public AreaFlexible(final FONode generatedBy, final AreaNode parentArea, + final RetrieveMarker retrieveMarker) { super(generatedBy, parentArea, retrieveMarker); initializeProgressionDimension(); initializeAnteriorSpace(); @@ -93,14 +93,14 @@ * See {@link #getAnteriorSpace()} for a description of "anterior space". * @param anteriorSpace The anteriorSpace to set. */ - public void setAnteriorSpace(int anteriorSpace) { - Area parent = getParentArea(); + public void setAnteriorSpace(final int anteriorSpace) { + final Area parent = getParentArea(); if (parent instanceof AreaFlexible) { /* * A change to anteriorSpace does not affect the anteriorSpace * of the parent, but it does affects its progressionDimension. */ - AreaFlexible afParent = (AreaFlexible) parent; + final AreaFlexible afParent = (AreaFlexible) parent; int value = afParent.getProgressionDimension(); // Subtract the old value value -= this.getAnteriorSpace(); @@ -117,14 +117,14 @@ * See {@link #getAnteriorSpace()} for a description of "anterior space". * @param incrementAmount The amount to adjust the anteriorSpace. */ - public void incrementAnteriorSpace(int incrementAmount) { - Area parent = getParentArea(); + public void incrementAnteriorSpace(final int incrementAmount) { + final Area parent = getParentArea(); if (parent instanceof AreaFlexible) { /* * A change to anteriorSpace does not affect the anteriorSpace * of the parent, but it does affects its progressionDimension. */ - AreaFlexible afParent = (AreaFlexible) parent; + final AreaFlexible afParent = (AreaFlexible) parent; afParent.incrementProgressionDimension(incrementAmount); } this.anteriorSpace += incrementAmount; @@ -135,9 +135,9 @@ * "progression dimension". * @param progressionDimension The progressionDimension to set. */ - public void setProgressionDimension(int progressionDimension) { + public void setProgressionDimension(final int progressionDimension) { if (shouldAdjustParentPD()) { - Area parent = getParentArea(); + final Area parent = getParentArea(); /* The new value. */ int incrementAmount = progressionDimension; /* Subtract the old value. */ @@ -153,9 +153,9 @@ * "progression dimension". * @param incrementAmount The amount to adjust the progressionDimension. */ - public void incrementProgressionDimension(int incrementAmount) { + public void incrementProgressionDimension(final int incrementAmount) { if (shouldAdjustParentPD()) { - Area parent = getParentArea(); + final Area parent = getParentArea(); parent.incrementProgressionDimension(incrementAmount); } this.progressionDimension += incrementAmount; @@ -166,7 +166,7 @@ * progression dimension. * @param minPD */ - public void setMinimumProgressionDimension(int minPD) { + public void setMinimumProgressionDimension(final int minPD) { if (minPD <= this.progressionDimension) { return; } @@ -199,7 +199,7 @@ */ protected int crIPDBlockArea() { int actual = 0; - int computed = this.traitIPDimensionOpt(); + final int computed = this.traitIPDimensionOpt(); if (computed < 0) { actual = getParentArea().crIPD() - traitBorderStartWidth() @@ -217,7 +217,7 @@ */ protected int crBPDInline() { int actual = 0; - int computed = this.traitBPDimensionOpt(); + final int computed = this.traitBPDimensionOpt(); if (computed < 0) { actual = getParentArea().crBPD() - traitBorderBeforeWidth() @@ -234,7 +234,7 @@ * Computes the initial value of anteriorSpace for this Area. */ public void initializeAnteriorSpace() { - Area previous = getPreviousSiblingArea(); + final Area previous = getPreviousSiblingArea(); if (previous != null) { if (isBlockArea()) { this.setAnteriorSpace(previous.traitSpaceAfterOptimum()); @@ -257,15 +257,15 @@ /** * @param previous The previous sibling Area to this. */ - private void checkHalfLeading(Area previous) { + private void checkHalfLeading(final Area previous) { // This test different than isBlockArea() if (! (previous instanceof NormalBlockArea)) { return; } - NormalBlockArea ba = (NormalBlockArea) previous; - AreaNode lastChild = ba.getLastAreaNodeChild(); + final NormalBlockArea ba = (NormalBlockArea) previous; + final AreaNode lastChild = ba.getLastAreaNodeChild(); if (lastChild instanceof LineArea) { - LineArea lastLineArea = (LineArea) lastChild; + final LineArea lastLineArea = (LineArea) lastChild; this.incrementAnteriorSpace(lastLineArea.traitHalfLeadingOpt()); } } @@ -293,9 +293,9 @@ return getParentArea().progressionDimensionAvailable(); } - public void removeChild(AreaNode areaNode) { + public void removeChild(final AreaNode areaNode) { if (areaNode instanceof AreaFlexible) { - AreaFlexible af = (AreaFlexible) areaNode; + final AreaFlexible af = (AreaFlexible) areaNode; this.incrementProgressionDimension(- af.getProgressionDimension()); } super.removeChild(areaNode); @@ -303,11 +303,11 @@ public int pdUsedBySiblings() { int pdUsedBySiblings = 0; - int siblingIndex = siblingIndex(); - List siblings = getSiblings(); + final int siblingIndex = siblingIndex(); + final List siblings = getSiblings(); for (int i = 0; i < siblingIndex; i++) { if (siblings.get(i) instanceof AreaFlexible) { - AreaFlexible af = (AreaFlexible) siblings.get(i); + final AreaFlexible af = (AreaFlexible) siblings.get(i); if (af.isInNormalFlow()) { /* If the Area is not part of the normal flow, then its * progression dimension should not be included in the Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -60,15 +60,15 @@ * parent in the AreaTree. * @param retrieveMarker TODO */ - public AreaNode(FONode generatedBy, AreaNode parentArea, - RetrieveMarker retrieveMarker) { + public AreaNode(final FONode generatedBy, final AreaNode parentArea, + final RetrieveMarker retrieveMarker) { super(parentArea); if (! (this instanceof AreaTree)) { // AreaTree has no parent with which to register getAreaNodeParent().getChildren().add(this); // Root can't do this because the AreaTreeControl isn't registered. this.generatedBy = linkage(generatedBy, retrieveMarker); - FOLinkageNormal normalLinkage = this.getNormalLinkage( + final FOLinkageNormal normalLinkage = this.getNormalLinkage( retrieveMarker); normalLinkage.registerGeneratedArea(this); } @@ -92,12 +92,12 @@ this.getNormalLinkage().unregisterGeneratedArea(this); } - public void removeChild(org.axsl.areaW.AreaNode areaNode) { + public void removeChild(final org.axsl.areaW.AreaNode areaNode) { this.children.remove(areaNode); } - public static FOLinkage linkage(FONode foNode, - RetrieveMarker retrieveMarker) { + public static FOLinkage linkage(final FONode foNode, + final RetrieveMarker retrieveMarker) { if (foNode == null) { return null; } @@ -109,10 +109,11 @@ linkage = new FOLinkageNormal(foNode); } else { try { - FOLinkageMarker markerLinkage = new FOLinkageMarker(foNode); + final FOLinkageMarker markerLinkage = new FOLinkageMarker( + foNode); markerLinkage.getNormalLinkage(retrieveMarker); linkage = markerLinkage; - } catch (AreaWException e) { + } catch (final AreaWException e) { /* Ignore this. It should never happen as we have already tested * for the condition that causes the exception, i.e. that foNode * has no ancestor marker. */ @@ -127,8 +128,9 @@ return (FOLinkageNormal) this.generatedBy; } if (this.generatedBy instanceof FOLinkageMarker) { - FOLinkageMarker linkageMarker = (FOLinkageMarker) this.generatedBy; - RetrieveMarker retrieveMarker = this.getRetrieveMarker(); + final FOLinkageMarker linkageMarker = (FOLinkageMarker) + this.generatedBy; + final RetrieveMarker retrieveMarker = this.getRetrieveMarker(); return linkageMarker.getNormalLinkage(retrieveMarker); } /* TODO: Consider throwing an Exception. This shouldn't happen. */ @@ -138,12 +140,14 @@ /* Use this overloaded version when we haven't yet gottent the * RetrieveMarker instance stashed in the FOLinkageMarker, especially * during AreaNode construction. */ - public FOLinkageNormal getNormalLinkage(RetrieveMarker retrieveMarker) { + public FOLinkageNormal getNormalLinkage( + final RetrieveMarker retrieveMarker) { if (this.generatedBy instanceof FOLinkageNormal) { return (FOLinkageNormal) this.generatedBy; } if (this.generatedBy instanceof FOLinkageMarker) { - FOLinkageMarker linkageMarker = (FOLinkageMarker) this.generatedBy; + final FOLinkageMarker linkageMarker = (FOLinkageMarker) + this.generatedBy; return linkageMarker.getNormalLinkage(retrieveMarker); } /* TODO: Consider throwing an Exception. This shouldn't happen. */ @@ -182,7 +186,7 @@ } public Area getParentArea() { - AreaNode parent = getAreaNodeParent(); + final AreaNode parent = getAreaNodeParent(); if (parent == null) { return null; } @@ -193,7 +197,7 @@ } public Area getPreviousSiblingArea() { - AreaNode previousSibling = (AreaNode) getPreviousSibling(); + final AreaNode previousSibling = (AreaNode) getPreviousSibling(); if (previousSibling == null) { return null; } @@ -204,12 +208,12 @@ } public Area ancestorBlockAreaNotALineArea() { - AreaNode parent = getAreaNodeParent(); + final AreaNode parent = getAreaNodeParent(); if (parent == null) { return null; } if (parent instanceof Area) { - Area parentArea = (Area) parent; + final Area parentArea = (Area) parent; if (parentArea.isBlockArea() && ! (parentArea instanceof LineArea)) { return parentArea; @@ -219,7 +223,7 @@ } public NormalBlockArea ancestorNormalBlockArea() { - AreaNode parent = getAreaNodeParent(); + final AreaNode parent = getAreaNodeParent(); if (parent == null) { return null; } @@ -234,7 +238,7 @@ } public Area getContainingReferenceArea() { - Area parent = getParentArea(); + final Area parent = getParentArea(); if (parent.traitIsReferenceArea()) { return parent; } @@ -280,7 +284,7 @@ * if there is none. */ public Area ancestorGeneratedByBlockLevelFO() { - Area parent = getParentArea(); + final Area parent = getParentArea(); if (parent == null) { return null; } @@ -342,7 +346,7 @@ return null; } for (int i = 0; i < children.size(); i++) { - Object child = children.get(i); + final Object child = children.get(i); if (child instanceof Area) { return (Area) child; } @@ -358,7 +362,7 @@ return null; } for (int i = children.size() - 1; i >= 0; i--) { - Object child = children.get(i); + final Object child = children.get(i); if (child instanceof Area) { return (Area) child; } @@ -370,7 +374,7 @@ * @return The ancestor SpanRA, or null if there is none. */ public SpanRA ancestorSpanRA() { - AreaNode parent = getAreaNodeParent(); + final AreaNode parent = getAreaNodeParent(); if (parent == null) { return null; } @@ -381,7 +385,7 @@ * @return The ancestor LineArea, or null if there is none. */ public LineArea ancestorLineArea() { - AreaNode parent = getAreaNodeParent(); + final AreaNode parent = getAreaNodeParent(); if (parent == null) { return null; } @@ -397,7 +401,7 @@ * implementation instead of the interface (for internal AreaTree use). */ public TableRA ancestorTableRA() { - AreaNode parent = getAreaNodeParent(); + final AreaNode parent = getAreaNodeParent(); if (parent == null) { return null; } @@ -412,22 +416,22 @@ } public PageCollection ancestorPageCollection() { - AreaNode parent = getAreaNodeParent(); + final AreaNode parent = getAreaNodeParent(); if (parent == null) { return null; } return parent.ancestorPageCollection(); } - public void moveChildBackward(AreaNode child, AreaNode oldParent, - AreaNode newParent) { + public void moveChildBackward(final AreaNode child, + final AreaNode oldParent, final AreaNode newParent) { oldParent.removeChild(child); newParent.getChildren().add(child); child.setParent(newParent); } - public void moveChildForward(AreaNode child, AreaNode oldParent, - AreaNode newParent) { + public void moveChildForward(final AreaNode child, final AreaNode oldParent, + final AreaNode newParent) { oldParent.removeChild(child); newParent.getChildren().add(0, child); child.setParent(newParent); @@ -459,7 +463,7 @@ * {@inheritDoc} */ public int crBPDNearestGeneratedByBlockLevelFO() { - org.axsl.areaW.Area nearest = nearestGeneratedByBlockLevelFO(); + final org.axsl.areaW.Area nearest = nearestGeneratedByBlockLevelFO(); if (nearest == null) { return Constants.DIMENSION_AUTO; } @@ -470,7 +474,7 @@ * {@inheritDoc} */ public int crIPDNearestGeneratedByBlockLevelFO() { - org.axsl.areaW.Area nearest = nearestGeneratedByBlockLevelFO(); + final org.axsl.areaW.Area nearest = nearestGeneratedByBlockLevelFO(); if (nearest == null) { return Constants.DIMENSION_AUTO; } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -69,8 +69,8 @@ */ private ArrayList areaTreeListeners = new ArrayList(); - public AreaTree(Root root, FontConsumer fontConsumer, TextServer textServer, - Log logger) { + public AreaTree(final Root root, final FontConsumer fontConsumer, + final TextServer textServer, final Log logger) { super(root, null); this.fontConsumer = fontConsumer; this.textServer = textServer; @@ -84,8 +84,9 @@ } public org.axsl.areaW.PageCollection makePageCollection( - PageSequence pageSequence) { - PageCollection pageCollection = new PageCollection(pageSequence, this); + final PageSequence pageSequence) { + final PageCollection pageCollection = new PageCollection(pageSequence, + this); pageCollectionsProcessed.add(pageCollection); return pageCollection; } @@ -114,28 +115,30 @@ } public Root getRoot() { - FOLinkageNormal linkage = this.getNormalLinkage(); + final FOLinkageNormal linkage = this.getNormalLinkage(); /* Cast verified at construction. */ return (Root) linkage.getFONode(); } - private void layoutBookmarkTree(Root rootFObj) { - BookmarkTree bookmarkTree = rootFObj.getBookmarkTree(); + private void layoutBookmarkTree(final Root rootFObj) { + final BookmarkTree bookmarkTree = rootFObj.getBookmarkTree(); if (bookmarkTree == null) { return; } - BookmarkTreeArea bmtArea = new BookmarkTreeArea(bookmarkTree, this); + final BookmarkTreeArea bmtArea = new BookmarkTreeArea(bookmarkTree, + this); for (int i = 0; i < bookmarkTree.getChildren().size(); i++) { - Bookmark bookmark = (Bookmark) bookmarkTree.getChildren().get(i); + final Bookmark bookmark = (Bookmark) + bookmarkTree.getChildren().get(i); layoutBookmark(bookmark, bmtArea); } } - public void layoutBookmark(Bookmark bookmark, AreaNode area) { - BookmarkArea bookmarkArea = new BookmarkArea(bookmark, area); - List children = bookmark.getChildren(); + public void layoutBookmark(final Bookmark bookmark, final AreaNode area) { + final BookmarkArea bookmarkArea = new BookmarkArea(bookmark, area); + final List children = bookmark.getChildren(); for (int i = 0; i < children.size(); i++) { - FObj child = (FObj) children.get(i); + final FObj child = (FObj) children.get(i); if (child instanceof Bookmark) { layoutBookmark((Bookmark) child, bookmarkArea); } else if (child instanceof BookmarkTitle) { @@ -144,8 +147,8 @@ } } - private void layoutBookmarkTitle(BookmarkTitle bookmarkTitle, - BookmarkArea bookmarkArea) { + private void layoutBookmarkTitle(final BookmarkTitle bookmarkTitle, + final BookmarkArea bookmarkArea) { new BookmarkTitleArea(bookmarkTitle, bookmarkArea); } @@ -161,9 +164,9 @@ * @param id The id whose FObj instance is sought. * @return The FObj instance that is associated with id. */ - public FObj retrieveId(String id) { + public FObj retrieveId(final String id) { // Cast verified at construction. - Root root = (Root) traitGeneratedBy(); + final Root root = (Root) traitGeneratedBy(); return root.retrieveId(id); } @@ -174,11 +177,11 @@ * @return The first normal area returned by the FObj instance whose "id" * trait matches the "id" parameter, or null if none is found. */ - public Area firstNormalAreaReturned(String id) { - FObj fobj = retrieveId(id); - FOLinkage linkage = linkage(fobj, null); + public Area firstNormalAreaReturned(final String id) { + final FObj fobj = retrieveId(id); + final FOLinkage linkage = linkage(fobj, null); if (linkage instanceof FOLinkageNormal) { - FOLinkageNormal normalLinkage = (FOLinkageNormal) linkage; + final FOLinkageNormal normalLinkage = (FOLinkageNormal) linkage; return normalLinkage.firstNormalAreaReturned(); } /* Hopefully we can't reference ids in static content, right? */ @@ -188,7 +191,7 @@ /** * {@inheritDoc} */ - public void registerListener (AreaTreeListener listener) { + public void registerListener (final AreaTreeListener listener) { if (listener == null) { return; } @@ -200,7 +203,7 @@ * {@link AreaTreeEvent} firings. * @param listener The listener to be unregistered. */ - public void unRegisterListener (AreaTreeListener listener) { + public void unRegisterListener (final AreaTreeListener listener) { if (listener == null) { return; } @@ -211,15 +214,15 @@ * Notify all listeners that a "Page Complete" event has been fired. * @param page The PageArea instance that was just completed. */ - protected void notifyPageComplete(PageArea page) { + protected void notifyPageComplete(final PageArea page) { /* If nobody wants these events, don't waste resources creating * them. */ if (areaTreeListeners.size() < 1) { return; } - AreaTreeEvent event = new AreaTreeEvent(this, page); + final AreaTreeEvent event = new AreaTreeEvent(this, page); for (int i = 0; i < this.areaTreeListeners.size(); i++) { - AreaTreeListener listener = (AreaTreeListener) + final AreaTreeListener listener = (AreaTreeListener) this.areaTreeListeners.get(i); listener.pageComplete(event); } @@ -232,7 +235,7 @@ return "area-tree"; } - public void render(RenderVisitor visitor) { + public void render(final RenderVisitor visitor) { visitor.render(this); } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BasicLinkArea.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/BasicLinkArea.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/BasicLinkArea.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -35,17 +35,17 @@ implements org.axsl.areaR.BasicLinkArea, org.axsl.areaW.BasicLinkArea { - public BasicLinkArea(BasicLink generatedBy, LineArea parentArea, - RetrieveMarker retrieveMarker) { + public BasicLinkArea(final BasicLink generatedBy, final LineArea parentArea, + final RetrieveMarker retrieveMarker) { super(generatedBy, parentArea, retrieveMarker); } public int crIPD() { int ipd = 0; for (int i = 0; i < getChildren().size(); i++) { - Object object = getChildren().get(i); + final Object object = getChildren().get(i); if (object instanceof Area) { - Area child = (Area) object; + final Area child = (Area) object; ipd += child.brIPD(); } } @@ -59,7 +59,7 @@ return "basic-link"; } - public void render(RenderVisitor visitor) { + public void render(final RenderVisitor visitor) { visitor.render(this); } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BeforeFloatRA.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/BeforeFloatRA.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/BeforeFloatRA.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -36,7 +36,8 @@ implements org.axsl.areaR.BeforeFloatArea, org.axsl.areaW.BeforeFloatRA { - public BeforeFloatRA(FObj generatedBy, RegionRABody parentArea) { + public BeforeFloatRA(final FObj generatedBy, + final RegionRABody parentArea) { super(generatedBy, parentArea, null); } @@ -65,7 +66,8 @@ return 0; } - public Area getOverflowArea(Area childRequesting) throws AreaWException { + public Area getOverflowArea(final Area childRequesting) + throws AreaWException { return getParentArea().getOverflowArea(this); } @@ -81,15 +83,15 @@ return (RegionRABody) getParentArea(); } - public void setProgressionDimension(int progressionDimension) { + public void setProgressionDimension(final int progressionDimension) { this.getRegionBodyArea().setBeforeFloatDimension(progressionDimension); } - public void incrementProgressionDimension(int incrementAmount) { + public void incrementProgressionDimension(final int incrementAmount) { this.getRegionBodyArea().incrementBeforeFloatDimension(incrementAmount); } - public void render(RenderVisitor visitor) { + public void render(final RenderVisitor visitor) { visitor.render(this); } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BlockArea.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/BlockArea.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/BlockArea.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -33,8 +33,8 @@ */ public abstract class BlockArea extends AreaFlexible { - public BlockArea(FObj parentFObj, Area parentArea, - RetrieveMarker retrieveMarker) { + public BlockArea(final FObj parentFObj, final Area parentArea, + final RetrieveMarker retrieveMarker) { super(parentFObj, parentArea, retrieveMarker); } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BlockContainerRA.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/BlockContainerRA.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/BlockContainerRA.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -37,8 +37,8 @@ public class BlockContainerRA extends ContainerRA implements BlockContainerArea, org.axsl.areaW.BlockContainerRA { - public BlockContainerRA(FObj generatedBy, Area parentArea, - RetrieveMarker retrieveMarker) { + public BlockContainerRA(final FObj generatedBy, final Area parentArea, + final RetrieveMarker retrieveMarker) { super(generatedBy, parentArea, retrieveMarker); } @@ -54,15 +54,15 @@ */ public int crOriginBPDOffset() { if (this.traitAbsolutePosition() == Constants.FOVAL_ABSOLUTE) { - int top = this.traitTop(); + final int top = this.traitTop(); if (top != Constants.ABSOLUTE_POSITION_AUTO) { /* If "top" is specified, that is the offset needed. */ return top; } - int bottom = this.traitBottom(); + final int bottom = this.traitBottom(); if (bottom != Constants.ABSOLUTE_POSITION_AUTO) { /* If "bottom" is specified, */ - Area parentArea = this.getAreaParent(); + final Area parentArea = this.getAreaParent(); return parentArea.crBPD() - bottom - this.getProgressionDimension(); } @@ -79,7 +79,7 @@ return "block-container"; } - public void render(RenderVisitor visitor) { + public void render(final RenderVisitor visitor) { visitor.render(this); } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkArea.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkArea.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkArea.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -34,7 +34,7 @@ public class BookmarkArea extends NonArea implements org.axsl.areaR.BookmarkArea { - public BookmarkArea(Bookmark generatedBy, AreaNode parent) { + public BookmarkArea(final Bookmark generatedBy, final AreaNode parent) { super(generatedBy, parent); } @@ -53,7 +53,7 @@ return "bookmark"; } - public void render(RenderVisitor visitor) { + public void render(final RenderVisitor visitor) { visitor.render(this); } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTitleArea.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTitleArea.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTitleArea.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -33,13 +33,14 @@ public class BookmarkTitleArea extends NonArea implements org.axsl.areaR.BookmarkTitleArea { - public BookmarkTitleArea(BookmarkTitle generatedBy, BookmarkArea parent) { + public BookmarkTitleArea(final BookmarkTitle generatedBy, + final BookmarkArea parent) { super(generatedBy, parent); } public String getTitleText() { // Cast verified at construction. - BookmarkTitle generatedBy = (BookmarkTitle) traitGeneratedBy(); + final BookmarkTitle generatedBy = (BookmarkTitle) traitGeneratedBy(); return new String(generatedBy.getContent()); } @@ -50,7 +51,7 @@ return "bookmark-title"; } - public void render(RenderVisitor visitor) { + public void render(final RenderVisitor visitor) { visitor.render(this); } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTreeArea.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTreeArea.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTreeArea.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -33,7 +33,8 @@ public class BookmarkTreeArea extends NonArea implements org.axsl.areaR.BookmarkTreeArea { - public BookmarkTreeArea(BookmarkTree generatedBy, AreaNode parent) { + public BookmarkTreeArea(final BookmarkTree generatedBy, + final AreaNode parent) { super(generatedBy, parent); } @@ -44,7 +45,7 @@ return "bookmark-tree"; } - public void render(RenderVisitor visitor) { + public void render(final RenderVisitor visitor) { visitor.render(this); } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ContainerRA.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/ContainerRA.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/ContainerRA.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -37,12 +37,13 @@ public abstract class ContainerRA extends AreaFlexible implements org.axsl.areaW.ContainerRA { - public ContainerRA(FObj generatedBy, Area parentArea, - RetrieveMarker retrieveMarker) { + public ContainerRA(final FObj generatedBy, final Area parentArea, + final RetrieveMarker retrieveMarker) { super(generatedBy, parentArea, retrieveMarker); } - public Area getOverflowArea(Area childRequesting) throws AreaWException { + public Area getOverflowArea(final Area childRequesting) + throws AreaWException { return getParentArea().getOverflowArea(this); } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -34,15 +34,16 @@ implements org.axsl.areaR.ExternalGraphicArea, org.axsl.areaW.ExternalGraphicArea { - public ExternalGraphicArea(ExternalGraphic generatedBy, LineArea parentArea, - RetrieveMarker retrieveMarker, int width) { + public ExternalGraphicArea(final ExternalGraphic generatedBy, + final LineArea parentArea, final RetrieveMarker retrieveMarker, + final int width) { super(generatedBy, parentArea, retrieveMarker); init(parentArea, width); } - public ExternalGraphicArea(ExternalGraphic generatedBy, - AbstractInlineArea parentArea, RetrieveMarker retrieveMarker, - int width) { + public ExternalGraphicArea(final ExternalGraphic generatedBy, + final AbstractInlineArea parentArea, + final RetrieveMarker retrieveMarker, final int width) { super(generatedBy, parentArea, retrieveMarker); init(parentArea, width); } @@ -51,7 +52,7 @@ * @param parentArea * @param width */ - private void init(Area parentArea, int width) { + private void init(final Area parentArea, final int width) { setProgressionDimension(width); // Adjust the bpd of the parent line-area. parentArea.setMinimumProgressionDimension(viewportBPD()); @@ -68,14 +69,14 @@ } public int viewportBPD() { - ExternalGraphic eg = (ExternalGraphic) this.traitGeneratedBy(); - Area parentForDimensions = this.ancestorGeneratedByBlockLevelFO(); + final ExternalGraphic eg = (ExternalGraphic) this.traitGeneratedBy(); + final Area parentForDimensions = this.ancestorGeneratedByBlockLevelFO(); return eg.viewportBPD(this, parentForDimensions.crBPD()); } public int viewportIPD() { - ExternalGraphic eg = (ExternalGraphic) this.traitGeneratedBy(); - Area parentForDimensions = this.ancestorGeneratedByBlockLevelFO(); + final ExternalGraphic eg = (ExternalGraphic) this.traitGeneratedBy(); + final Area parentForDimensions = this.ancestorGeneratedByBlockLevelFO(); return eg.viewportIPD(this, parentForDimensions.crIPD()); } @@ -86,7 +87,7 @@ return "external-graphic"; } - public void render(RenderVisitor visitor) { + public void render(final RenderVisitor visitor) { visitor.render(this); } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/FOLinkage.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/FOLinkage.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/FOLinkage.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -37,7 +37,7 @@ /** The FONode for which this linkage tracks Area generation. */ private FONode foGenerator; - public FOLinkage(FONode foGenerator) { + public FOLinkage(final FONode foGenerator) { this.foGenerator = foGenerator; } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/FOLinkageMarker.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/FOLinkageMarker.java 2006-07-22 18:11:33 UTC (rev 7806) +++ trunk/foray/foray-areatree/src/java/org/foray/area/FOLinkageMarker.java 2006-07-22 19:16:29 UTC (rev 7807) @@ -75,9 +75,9 @@ * with an initial value of 1. */ private HashMap map = new HashMap(); - public FOLinkageMarker(FONode foGenerator) throws AreaWException { + public FOLinkageMarker(final FONode foGenerator) throws AreaWException { super(foGenerator); - Marker marker = foGenerator.ancestorMarker(); + final Marker marker = foGenerator.ancestorMarker(); if (marker == null) { throw new AreaWException("(FOray) FOLinkageMarker construction " + "attempted for object\n" @@ -86,24 +86,26 @@ } } - public FOLinkageNormal getNormalLinkage(RetrieveMarker retrieveMarker) { + public FOLinkageNormal getNormalLinkage( + final RetrieveMarker retrieveMarker) { if (retrieveMarker == null) { return null; } - Object object = this.map.get(retrieveMarker); + final Object object = this.map.get(retrieveMarker); if (object != null) { return (FOLinkageNormal) object; } - FOLinkageNormal newLinkage = new FOLinkageNormal(this.getFONode()); + final FOLinkageNormal newLinkage = new FOLinkageNormal( + this.getFONode()); this.map.put(retrieveMarker, n... [truncated message content] |
|
From: <vic...@us...> - 2006-07-22 18:12:04
|
Revision: 7806 Author: victormote Date: 2006-07-22 11:11:33 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7806&view=rev Log Message: ----------- Implement standard use of "final" modifier on local variables and parameters. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java trunk/foray/foray-app/src/java/org/foray/app/FOray.java trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java trunk/foray/foray-app/src/java/org/foray/app/Options.java trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java trunk/foray/foray-app/src/java/org/foray/app/PrintStarter.java trunk/foray/foray-app/src/java/org/foray/app/Starter.java trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTask.java trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java trunk/foray/foray-app/src/java/org/foray/app/ant/RunTest.java trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2XML.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2FO.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/embed/model/ProjectMember.java trunk/foray/foray-app/src/java/org/foray/demo/embed/model/ProjectTeam.java trunk/foray/foray-app/src/java/org/foray/demo/embed/model/ProjectTeamInputSource.java trunk/foray/foray-app/src/java/org/foray/demo/embed/model/ProjectTeamXMLReader.java trunk/foray/foray-app/src/java/org/foray/demo/embed/tools/AbstractObjectReader.java trunk/foray/foray-app/src/java/org/foray/demo/embed/tools/EasyContentHandlerProxy.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoPrintServlet.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java Modified: trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java 2006-07-22 16:15:41 UTC (rev 7805) +++ trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java 2006-07-22 18:11:33 UTC (rev 7806) @@ -68,9 +68,9 @@ private Translator resource; private UserMessage userMessage; - public AWTStarter(Log logger, SessionConfig sessionConfig, - OutputConfig renderConfig, CommandLineOptions commandLineOptions) - throws FOrayException { + public AWTStarter(final Log logger, final SessionConfig sessionConfig, + final OutputConfig renderConfig, + final CommandLineOptions commandLineOptions) throws FOrayException { super(logger, sessionConfig, renderConfig, commandLineOptions); init(); } @@ -80,7 +80,7 @@ try { UIManager.setLookAndFeel( new javax.swing.plaf.metal.MetalLookAndFeel()); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } @@ -88,7 +88,7 @@ if (language == null) { try { language = System.getProperty("user.language"); - } catch(SecurityException se) { + } catch(final SecurityException se) { // if this is running in a secure place } } @@ -98,12 +98,14 @@ + "messages." + language)); resource.setMissingEmphasized(false); - SessionConfig configuration = this.options.getSessionConfig(); - FOraySession session = FOraySpecific.makeFOraySession(configuration); + final SessionConfig configuration = this.options.getSessionConfig(); + final FOraySession session = FOraySpecific.makeFOraySession( + configuration); this.document = new FOrayDocument(session, inputSource, null); - OutputConfig renderOptions = commandLineOptions.getRendererOptions(); + final OutputConfig renderOptions = + commandLineOptions.getRendererOptions(); this.renderer = new AWTRenderer(this.getLogger(), renderOptions); frame = createPreviewDialog(renderer, resource); renderer.setProgressListener(frame); @@ -116,7 +118,7 @@ frame.progress(resource.getString("Build FO tree") + " ..."); try { document.process(); - } catch (Exception e) { + } catch (final Exception e) { frame.reportException(e); if (e instanceof FOrayException) { throw (FOrayException)e; @@ -127,19 +129,21 @@ frame.showPage(); } - protected PreviewDialog createPreviewDialog(AWTRenderer renderer, - Translator res) { - PreviewDialog frame = new PreviewDialog(renderer, res, getLogger()); + protected PreviewDialog createPreviewDialog(final AWTRenderer renderer, + final Translator res) { + final PreviewDialog frame = new PreviewDialog(renderer, res, + getLogger()); frame.validate(); frame.addWindowListener(new WindowAdapter() { - public void windowClosed(WindowEvent we) { - System.exit(0); - } - }); + public void windowClosed(final WindowEvent we) { + System.exit(0); + } + }); // center window - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - Dimension frameSize = frame.getSize(); + final Dimension screenSize = Toolkit.getDefaultToolkit() + .getScreenSize(); + final Dimension frameSize = frame.getSize(); if (frameSize.height > screenSize.height) { frameSize.height = screenSize.height; } @@ -171,7 +175,7 @@ } in = url.openStream(); - } catch (Exception ex) { + } catch (final Exception ex) { getLogger().error("Can't find URL to: <" + path + "> " + ex.getMessage()); getLogger().error(ex.getMessage()); Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java 2006-07-22 16:15:41 UTC (rev 7805) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java 2006-07-22 18:11:33 UTC (rev 7806) @@ -87,7 +87,7 @@ /** State variable indicating current index into args[]. */ private transient int currentArgument = 0; - public CommandLineOptions(String[] args, Log logger) + public CommandLineOptions(final String[] args, final Log logger) throws FOrayException, FileNotFoundException { this.log = logger; @@ -101,17 +101,17 @@ checkSettings(); debug(); } - } catch (FOrayException e) { + } catch (final FOrayException e) { printUsage(log); throw e; - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { printUsage(log); throw e; } } private void adjustLogger() { - String verbosity = this.sessionConfig.optionVerbosity(); + final String verbosity = this.sessionConfig.optionVerbosity(); if (verbosity.equals("debug")) { setLogger(Logging.makeDebugLogger()); } else if (verbosity.equals("quiet")) { @@ -126,10 +126,10 @@ * @exception FOrayException if there was an error in the format of the * options. */ - private boolean parseOptions(String args[]) throws FOrayException { + private boolean parseOptions(final String args[]) throws FOrayException { this.currentArgument = 0; while (currentArgument < args.length) { - boolean optionParsedSuccessfully = parseOneOption(args); + final boolean optionParsedSuccessfully = parseOneOption(args); if (! optionParsedSuccessfully) { printUsage(log); return false; @@ -144,7 +144,7 @@ * @return True if the option was successfully parsed, false otherwise. * @throws FOrayException */ - private boolean parseOneOption(String[] args) throws FOrayException { + private boolean parseOneOption(final String[] args) throws FOrayException { if (args[currentArgument].equals("-c")) { if ((currentArgument + 1 == args.length) || (args[currentArgument + 1].charAt(0) == '-')) { @@ -154,14 +154,14 @@ try { this.userConfig = URLFactory.createURL( args[currentArgument + 1]); - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { throw new FOrayException(e); } currentArgument++; return true; } if (args[currentArgument].equals("-so")) { - boolean success = parseConfigurationOption(args); + final boolean success = parseConfigurationOption(args); if (success) { currentArgument += 2; } @@ -174,10 +174,10 @@ throw new FOrayException("you must specify the fo file " + "for the '-fo' option"); } - String foString = args[currentArgument + 1]; + final String foString = args[currentArgument + 1]; try { this.foInput = URLFactory.createURL(foString); - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { throw new FOrayException("Malformed URL: " + foString); } this.sessionConfig.setBaseDocument(this.foInput); @@ -191,10 +191,10 @@ throw new FOrayException("you must specify the stylesheet " + "file for the '-xsl' option"); } - String xsltString = args[currentArgument + 1]; + final String xsltString = args[currentArgument + 1]; try { xsltInput = URLFactory.createURL(xsltString); - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { throw new FOrayException("Malformed URL: " + xsltString); } currentArgument++; @@ -207,10 +207,10 @@ throw new FOrayException("you must specify the input file " + "for the '-xml' option"); } - String xmlString = args[currentArgument + 1]; + final String xmlString = args[currentArgument + 1]; try { this.xmlInput = URLFactory.createURL(xmlString); - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { throw new FOrayException("Malformed URL: " + xmlString); } this.sessionConfig.setBaseDocument(xmlInput); @@ -303,7 +303,7 @@ inputmode = INPUT_FO; try { foInput = URLFactory.createURL(args[currentArgument]); - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { throw new FOrayException(e); } } else if (outputmode == INPUT_NOT_SET) { @@ -333,7 +333,7 @@ /** * @param args */ - private boolean parseConfigurationOption(String[] args) + private boolean parseConfigurationOption(final String[] args) throws FOrayException { /* * Configuration options are always in key-value pairs, so there are @@ -344,8 +344,8 @@ throw new FOrayException("Argument " + currentArgument + " must be followed by key and value."); } - String key = args[currentArgument + 1]; - String value = args[currentArgument + 2]; + final String key = args[currentArgument + 1]; + final String value = args[currentArgument + 2]; if (this.sessionConfig.parseOption(key, value, SessionConfig.PRECEDENCE_COMMAND_LINE)) { return true; @@ -354,7 +354,7 @@ OutputConfig.PRECEDENCE_COMMAND_LINE)); } - private void setOutputMode(int mode) throws FOrayException { + private void setOutputMode(final int mode) throws FOrayException { if (outputmode == INPUT_NOT_SET) { outputmode = mode; } else { @@ -417,7 +417,7 @@ } } // end checkSettings - private void setLogger(Log newLogger) { + private void setLogger(final Log newLogger) { this.log = newLogger; } @@ -437,7 +437,7 @@ if (inputmode == INPUT_FO) { try { return new InputSource(foInput.openStream()); - } catch (IOException e) { + } catch (final IOException e) { throw new FOrayException(e); } } @@ -459,7 +459,7 @@ try { starter = new AWTStarter(log, getSessionConfig(), getRendererOptions(), this); - } catch (Exception e) { + } catch (final Exception e) { if (e instanceof FOrayException) { throw (FOrayException)e; } @@ -470,7 +470,7 @@ try { starter = new PrintStarter(log, getSessionConfig(), getRendererOptions(), this); - } catch (Exception e) { + } catch (final Exception e) { if (e instanceof FOrayException) { throw (FOrayException)e; } @@ -535,7 +535,7 @@ * shows the commandline syntax including a summary of all available * options and some examples */ - public static void printUsage(Log logger) { + public static void printUsage(final Log logger) { logger.error("\nUSAGE\nFOray [options] [-fo|-xml] infile " + "[-xsl file] [-awt|-pdf|-mif|-pcl|-ps|-txt|-at|-print] " + "<outfile>\n" @@ -601,7 +601,7 @@ * If in debug mode, logs all commandline settings. */ private void debug() { - String verbosity = this.sessionConfig.optionVerbosity(); + final String verbosity = this.sessionConfig.optionVerbosity(); if (! verbosity.equals("debug")) { return; } Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-07-22 16:15:41 UTC (rev 7805) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-07-22 18:11:33 UTC (rev 7806) @@ -48,8 +48,9 @@ CommandLineOptions commandLineOptions; - public CommandLineStarter(Log logger, SessionConfig sessionConfig, - OutputConfig outputConfig, CommandLineOptions commandLineOptions) + public CommandLineStarter(final Log logger, + final SessionConfig sessionConfig, final OutputConfig outputConfig, + final CommandLineOptions commandLineOptions) throws FOrayException { super(logger, sessionConfig, outputConfig); this.commandLineOptions = commandLineOptions; @@ -69,8 +70,9 @@ */ /* Instantiate the FOraySession. */ - SessionConfig sessionConfig = this.options.getSessionConfig(); - FOraySession session = FOraySpecific.makeFOraySession(sessionConfig); + final SessionConfig sessionConfig = this.options.getSessionConfig(); + final FOraySession session = FOraySpecific.makeFOraySession( + sessionConfig); /* * Instantiate and configure the FOrayDocument(s). The constructor @@ -95,9 +97,9 @@ * OutputTargets, but you can create and use a non-standard OutputTarget * as well. */ - int outputType = commandLineOptions.getOutputType(); - OutputConfig outputOptions = this.outputConfig; - OutputTarget outputTarget = OutputTargetFactory.makeOutputTarget( + final int outputType = commandLineOptions.getOutputType(); + final OutputConfig outputOptions = this.outputConfig; + final OutputTarget outputTarget = OutputTargetFactory.makeOutputTarget( outputType, outputOptions, session.getLogger()); /* @@ -109,10 +111,10 @@ * Targets that do not need an OutputStream should set that parameter * to null. */ - LayoutStrategy layout = new PioneerLS(session.getLogger()); - FileOutputStream outputFileStream = getFileOutputStream(); - FOrayTarget target = new FOrayTarget(document, outputTarget, layout, - outputFileStream); + final LayoutStrategy layout = new PioneerLS(session.getLogger()); + final FileOutputStream outputFileStream = getFileOutputStream(); + final FOrayTarget target = new FOrayTarget(document, outputTarget, + layout, outputFileStream); /* * Everything is now ready to go. There are two different processing @@ -181,10 +183,10 @@ } private FileOutputStream getFileOutputStream() throws FOrayException { - File outputFile = commandLineOptions.getOutputFile(); + final File outputFile = commandLineOptions.getOutputFile(); try { return new FileOutputStream(outputFile); - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { throw new FOrayException(e); } } Modified: trunk/foray/foray-app/src/java/org/foray/app/FOray.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOray.java 2006-07-22 16:15:41 UTC (rev 7805) +++ trunk/foray/foray-app/src/java/org/foray/app/FOray.java 2006-07-22 18:11:33 UTC (rev 7806) @@ -33,18 +33,18 @@ import java.io.FileNotFoundException; public class FOray { - public static void main(String[] args) { + public static void main(final String[] args) { CommandLineOptions options = null; - Log logger = Logging.makeDefaultLogger(); + final Log logger = Logging.makeDefaultLogger(); try { options = new CommandLineOptions(args, logger); - Starter starter = options.getStarter(); + final Starter starter = options.getStarter(); starter.run(); - } catch (FOrayException e) { + } catch (final FOrayException e) { logger.error("" + e.getMessage()); if (options != null) { - SessionConfig sessionConfig = options.getSessionConfig(); + final SessionConfig sessionConfig = options.getSessionConfig(); if (sessionConfig.optionVerbosity().equals("debug")) { e.printStackTrace(); } @@ -53,10 +53,10 @@ } } System.exit(2); - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { logger.error("" + e.getMessage()); if (options != null) { - SessionConfig sessionConfig = options.getSessionConfig(); + final SessionConfig sessionConfig = options.getSessionConfig(); if (sessionConfig.optionVerbosity().equals("debug")) { e.printStackTrace(); } Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-07-22 16:15:41 UTC (rev 7805) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-07-22 18:11:33 UTC (rev 7806) @@ -74,28 +74,30 @@ * @throws FOrayException For errors in creating the server and factories, * or in instantiating the FOraySession. */ - public static FOraySession makeFOraySession(SessionConfig sessionConfig) - throws FOrayException { - Log logger = FOraySpecific.makeLogger(sessionConfig); - FontServer fontServer = FOraySpecific.makeFontServer(logger, + public static FOraySession makeFOraySession( + final SessionConfig sessionConfig) throws FOrayException { + final Log logger = FOraySpecific.makeLogger(sessionConfig); + final FontServer fontServer = FOraySpecific.makeFontServer(logger, sessionConfig); - HyphenationServer hyphenServer = FOraySpecific.makeHyphenationServer( - logger, sessionConfig); - TextServer textServer = FOraySpecific.makeTextServer(logger, + final HyphenationServer hyphenServer = + FOraySpecific.makeHyphenationServer(logger, sessionConfig); + final TextServer textServer = FOraySpecific.makeTextServer(logger, hyphenServer); - GraphicServer graphicServer = FOraySpecific.makeGraphicServer(logger); - FOTreeFactory foTreeServer = FOraySpecific.makeFOTreeFactory(logger, - sessionConfig, graphicServer, textServer); - AreaTreeFactory areaTreeFactory = FOraySpecific.makeAreaTreeFactory( - logger, textServer); - LayoutFactory layoutFactory = FOraySpecific.makeLayoutFactory(logger); - FOraySession session = new FOraySession(logger, sessionConfig, + final GraphicServer graphicServer = FOraySpecific.makeGraphicServer( + logger); + final FOTreeFactory foTreeServer = FOraySpecific.makeFOTreeFactory( + logger, sessionConfig, graphicServer, textServer); + final AreaTreeFactory areaTreeFactory = + FOraySpecific.makeAreaTreeFactory(logger, textServer); + final LayoutFactory layoutFactory = FOraySpecific.makeLayoutFactory( + logger); + final FOraySession session = new FOraySession(logger, sessionConfig, fontServer, hyphenServer, textServer, graphicServer, foTreeServer, areaTreeFactory, layoutFactory); return session; } - public static Log makeLogger(SessionConfig configuration) { + public static Log makeLogger(final SessionConfig configuration) { if (configuration.optionVerbosity().equals("debug")) { return Logging.makeDebugLogger(); } else { @@ -103,10 +105,10 @@ } } - public static FontServer makeFontServer(Log logger, - SessionConfig configuration) throws FOrayException { - EntityResolver entityResolver = makeEntityResolver(configuration); - FOrayFontServer forayFontServer = new FOrayFontServer(logger); + public static FontServer makeFontServer(final Log logger, + final SessionConfig configuration) throws FOrayException { + final EntityResolver entityResolver = makeEntityResolver(configuration); + final FOrayFontServer forayFontServer = new FOrayFontServer(logger); forayFontServer.setBaseFontURL( configuration.optionFontBaseDirectory()); forayFontServer.setBaseURL(configuration.optionBaseDirectory()); @@ -114,67 +116,69 @@ try { forayFontServer.setup(configuration.optionFontConfiguration(), null); - } catch (FontException e) { + } catch (final FontException e) { throw new FOrayException(e); } return forayFontServer; } - public static TextServer makeTextServer(Log logger, - HyphenationServer hyphenServer) throws FOrayException { + public static TextServer makeTextServer(final Log logger, + final HyphenationServer hyphenServer) throws FOrayException { return new org.foray.text.TextServer(logger, hyphenServer); } - public static HyphenationServer makeHyphenationServer(Log logger, - SessionConfig configuration) { - URL hyphenationDir = configuration.optionHyphenationBaseDirectory(); + public static HyphenationServer makeHyphenationServer(final Log logger, + final SessionConfig configuration) { + final URL hyphenationDir = + configuration.optionHyphenationBaseDirectory(); return new org.foray.hyphenR.HyphenationServer(logger, hyphenationDir); } - public static GraphicServer makeGraphicServer(Log logger) + public static GraphicServer makeGraphicServer(final Log logger) throws FOrayException { return new FOrayGraphicServer(logger, XMLParser.getParserClassName()); } - public static FOTreeFactory makeFOTreeFactory(Log logger, - SessionConfig configuration, GraphicServer graphicServer, - TextServer textServer) + public static FOTreeFactory makeFOTreeFactory(final Log logger, + final SessionConfig configuration, + final GraphicServer graphicServer, final TextServer textServer) throws FOrayException { - URL[] graphicSearchPath = buildGraphicSearchPath(configuration); + final URL[] graphicSearchPath = buildGraphicSearchPath(configuration); return new FOrayFOTreeServer(logger, graphicServer, textServer, graphicSearchPath, configuration.optionCacheGraphics()); } - private static URL[] buildGraphicSearchPath(SessionConfig configuration) { - URL[] urls = new URL[3]; + private static URL[] buildGraphicSearchPath( + final SessionConfig configuration) { + final URL[] urls = new URL[3]; urls[0] = configuration.getBaseDocument(); urls[1] = configuration.optionBaseDirectory(); try { urls[2] = URLFactory.createURL(System.getProperty("user.dir")); - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { // Ignore this -- just leave the null value in the array } return urls; } - public static AreaTreeFactory makeAreaTreeFactory(Log logger, - TextServer textServer) throws FOrayException { + public static AreaTreeFactory makeAreaTreeFactory(final Log logger, + final TextServer textServer) throws FOrayException { return new FOrayAreaTreeFactory(logger, textServer); } - public static LayoutFactory makeLayoutFactory(Log logger) + public static LayoutFactory makeLayoutFactory(final Log logger) throws FOrayException { return new PioneerFactory(logger); } public static EntityResolver makeEntityResolver( - SessionConfig configuration) { - String catalog = configuration.optionXMLCatalog(); + final SessionConfig configuration) { + final String catalog = configuration.optionXMLCatalog(); 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; Modified: trunk/foray/foray-app/src/java/org/foray/app/Options.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/Options.java 2006-07-22 16:15:41 UTC (rev 7805) +++ trunk/foray/foray-app/src/java/org/foray/app/Options.java 2006-07-22 18:11:33 UTC (rev 7806) @@ -48,15 +48,15 @@ /** The logger that should be used. */ private Log logger; - public Options(Log logger, SessionConfig sessionConfig, - OutputConfig renderConfig) throws FOrayException { + public Options(final Log logger, final SessionConfig sessionConfig, + final OutputConfig renderConfig) throws FOrayException { this.logger = logger; this.sessionConfig = sessionConfig; this.renderConfig = renderConfig; } - public Options(Log logger, SessionConfig sessionConfig, - OutputConfig renderConfig, URL userConfigFile) + public Options(final Log logger, final SessionConfig sessionConfig, + final OutputConfig renderConfig, final URL userConfigFile) throws FOrayException { this(logger, sessionConfig, renderConfig); this.loadUserconfiguration(userConfigFile); @@ -72,10 +72,10 @@ } // setting clOptions - void setCommandLineOptions(CommandLineOptions clOptions) + void setCommandLineOptions(final CommandLineOptions clOptions) throws FOrayException { // load user configuration file,if there is one - URL userConfigFile = clOptions.getUserConfigFile(); + final URL userConfigFile = clOptions.getUserConfigFile(); if (userConfigFile != null) { this.loadUserconfiguration(userConfigFile); } @@ -87,29 +87,29 @@ } } - public void loadUserconfiguration(URL userConfigFile) + public void loadUserconfiguration(final URL userConfigFile) throws FOrayException { if (userConfigFile == null) { return; } try { - InputSource inputSource = new InputSource( + final InputSource inputSource = new InputSource( userConfigFile.openStream()); loadUserconfiguration(inputSource); - } catch (IOException e) { + } catch (final IOException e) { throw new FOrayException(e); } } - public void loadUserconfiguration(InputSource userConfigSource) + public void loadUserconfiguration(final InputSource userConfigSource) throws FOrayException { // read user configuration - ConfigurationParser reader = + final ConfigurationParser reader = new ConfigurationParser(this.sessionConfig, this.renderConfig, userConfigSource, this.logger); try { reader.parseDocument(); - } catch (FOrayException error) { + } catch (final FOrayException error) { logger.error("Could not load user configuration:\n" + " " + userConfigSource.getSystemId() + "\n" + " Error: " + error.getMessage() +"\n" @@ -121,7 +121,7 @@ /** * Dumps an error */ - public void dumpError(Exception e) { + public void dumpError(final Exception e) { if (! getSessionConfig().optionVerbosity().equals("debug")) { return; } Modified: trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java 2006-07-22 16:15:41 UTC (rev 7805) +++ trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java 2006-07-22 18:11:33 UTC (rev 7806) @@ -97,8 +97,9 @@ * @param outputOptions Map containing the options to be used with the * Renderer. */ - public static OutputTarget makeOutputTarget(int rendererType, - OutputConfig outputOptions, Log logger) throws FOrayException { + public static OutputTarget makeOutputTarget(final int rendererType, + final OutputConfig outputOptions, final Log logger) + throws FOrayException { OutputTarget renderer = null; switch (rendererType) { case RENDER_AWT: { @@ -134,7 +135,8 @@ break; } default: { - PDFDocument document = new org.foray.pdf.object.PDFDocument(logger); + final PDFDocument document = new org.foray.pdf.object.PDFDocument( + logger); renderer = new PDFRenderer(logger, outputOptions, document); break; } @@ -155,7 +157,7 @@ * {@link #RENDER_PCL}, {@link #RENDER_PS}, {@link #RENDER_TXT}, * {@link #RENDER_SVG}, or -1 if the input is not valid. */ - public static int getRendererType(String format) { + public static int getRendererType(final String format) { if ((format == null) || format.equalsIgnoreCase("application/pdf") || format.equalsIgnoreCase("pdf")) { @@ -185,7 +187,7 @@ return -1; } - public static String getMimeExtension(int rendererType) { + public static String getMimeExtension(final int rendererType) { switch (rendererType) { case RENDER_PDF: { return ".pdf"; Modified: trunk/foray/foray-app/src/java/org/foray/app/PrintStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/PrintStarter.java 2006-07-22 16:15:41 UTC (rev 7805) +++ trunk/foray/foray-app/src/java/org/foray/app/PrintStarter.java 2006-07-22 18:11:33 UTC (rev 7806) @@ -48,30 +48,30 @@ */ public class PrintStarter extends CommandLineStarter { - public PrintStarter(Log logger, SessionConfig sessionConfig, - OutputConfig renderConfig, CommandLineOptions options) + public PrintStarter(final Log logger, final SessionConfig sessionConfig, + final OutputConfig renderConfig, final CommandLineOptions options) throws FOrayException { super(logger, sessionConfig, renderConfig, options); } public void run() throws FOrayException { - SessionConfig configuration = this.options.getSessionConfig(); - FOraySession session = FOraySpecific.makeFOraySession( + final SessionConfig configuration = this.options.getSessionConfig(); + final FOraySession session = FOraySpecific.makeFOraySession( configuration); - PrinterJob pj = PrinterJob.getPrinterJob(); + final PrinterJob pj = PrinterJob.getPrinterJob(); if(System.getProperty("dialog") != null) { if (! pj.printDialog()) { throw new FOrayException("Printing cancelled by operator"); } } - int copies = getIntProperty("copies", 1); + final int copies = getIntProperty("copies", 1); pj.setCopies(copies); pj.setJobName("FOray Document"); try { session.process(); - } catch (Exception e) { + } catch (final Exception e) { if (e instanceof FOrayException) { throw (FOrayException)e; } @@ -80,12 +80,12 @@ System.exit(0); } - 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-app/src/java/org/foray/app/Starter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/Starter.java 2006-07-22 16:15:41 UTC (rev 7805) +++ trunk/foray/foray-app/src/java/org/foray/app/Starter.java 2006-07-22 18:11:33 UTC (rev 7806) @@ -45,15 +45,15 @@ protected SessionConfig sessionConfig; protected OutputConfig outputConfig; - public Starter(Log logger, SessionConfig sessionConfig, - OutputConfig renderConfig) throws FOrayException { + public Starter(final Log logger, final SessionConfig sessionConfig, + final OutputConfig renderConfig) throws FOrayException { this.logger = logger; this.sessionConfig = sessionConfig; this.outputConfig = renderConfig; options = new Options(logger, sessionConfig, renderConfig); } - public void setInputSource(InputSource inputSource) { + public void setInputSource(final InputSource inputSource) { this.inputSource = inputSource; } Modified: trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTask.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTask.java 2006-07-22 16:15:41 UTC (rev 7805) +++ trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTask.java 2006-07-22 18:11:33 UTC (rev 7806) @@ -74,7 +74,7 @@ * Sets the user configuration file. * @param userConfig File containing the user configuration. */ - public void setUserconfig (URL userConfig) { + public void setUserconfig (final URL userConfig) { this.userConfig = userConfig; } @@ -82,7 +82,7 @@ * Sets the input file. * @param foFile The FO input file. */ - public void setFofile(File foFile) { + public void setFofile(final File foFile) { this.foFile = foFile; } @@ -96,7 +96,7 @@ /** * Adds a set of fo files (nested fileset attribute). */ - public void addFileset(FileSet set) { + public void addFileset(final FileSet set) { filesets.add(set); } @@ -106,7 +106,7 @@ * * @param force true if always generate. */ - public void setForce(boolean force) { + public void setForce(final boolean force) { this.force = force; } @@ -122,7 +122,7 @@ * Sets the output file * @param outFile The File to which the output should be written. */ - public void setOutfile(File outFile) { + public void setOutfile(final File outFile) { this.outFile = outFile; } @@ -137,7 +137,7 @@ * Sets the output directory * @param outDir Directory to which the output should be written. */ - public void setOutdir(File outDir) { + public void setOutdir(final File outDir) { this.outDir = outDir; } @@ -151,7 +151,7 @@ /** * Sets output format (MIME type) */ - public void setFormat(String format) { + public void setFormat(final String format) { this.format = format; } @@ -166,7 +166,7 @@ * Sets the message level to be used while processing. * @param messageLevel String containing (info | verbose | debug). */ - public void setMessagelevel(String messageLevel) { + public void setMessagelevel(final String messageLevel) { if (messageLevel.equalsIgnoreCase("info")) { messageType = Project.MSG_INFO; } else if (messageLevel.equalsIgnoreCase("verbose")) { @@ -198,7 +198,7 @@ * Sets the base directory. Currently ignored. * @param baseDir File to use as a working directory. */ - public void setBasedir(File baseDir) { + public void setBasedir(final File baseDir) { this.baseDir = baseDir; } @@ -213,7 +213,7 @@ * Controls whether the filenames of the files that are processed are logged * or not. */ - public void setLogFiles(boolean aBoolean) { + public void setLogFiles(final boolean aBoolean) { logFiles = aBoolean; } @@ -250,9 +250,9 @@ } } try { - Starter starter = new FOrayAntTaskStarter(this, log); + final Starter starter = new FOrayAntTaskStarter(this, log); starter.run(); - } catch (FOrayException ex) { + } catch (final FOrayException ex) { throw new BuildException(ex); } } @@ -266,8 +266,9 @@ } protected String getFileExtension() { - int rendererType = getRendererType(); - String extension = OutputTargetFactory.getMimeExtension(rendererType); + final int rendererType = getRendererType(); + final String extension = OutputTargetFactory.getMimeExtension( + rendererType); return extension; } Modified: trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-07-22 16:15:41 UTC (rev 7805) +++ trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-07-22 18:11:33 UTC (rev 7806) @@ -74,13 +74,14 @@ * @param logger * @throws FOrayException */ - FOrayAntTaskStarter(FOrayAntTask task, Log logger) throws FOrayException { + FOrayAntTaskStarter(final FOrayAntTask task, final Log logger) + throws FOrayException { super(logger, null, null); this.task = task; } - private File replaceExtension(File file, String expectedExt, - String newExt) { + private File replaceExtension(final File file, final String expectedExt, + final String newExt) { String name = file.getName(); if (name.toLowerCase().endsWith(expectedExt)) { name = name.substring(0, name.length() - expectedExt.length()); @@ -154,28 +155,29 @@ */ private void processFileSet() throws FOrayException { - String newExtension = this.task.getFileExtension(); + final String newExtension = this.task.getFileExtension(); if (newExtension == null) { - String err = "Unknown renderer: "+ this.task.getRendererType(); + final String err = "Unknown renderer: " + + this.task.getRendererType(); throw new BuildException(err); } - GlobPatternMapper mapper = new GlobPatternMapper(); + final GlobPatternMapper mapper = new GlobPatternMapper(); mapper.setFrom("*.fo"); mapper.setTo("*" + newExtension); // deal with the filesets for (int i = 0; i < task.filesets.size(); i++) { - FileSet fs = (FileSet) task.filesets.get(i); - DirectoryScanner ds = fs.getDirectoryScanner(task.getProject()); - String[] files = ds.getIncludedFiles(); + final FileSet fs = (FileSet) task.filesets.get(i); + final DirectoryScanner ds = fs.getDirectoryScanner( + task.getProject()); + final String[] files = ds.getIncludedFiles(); - for (int j = 0; j < files.length; j++) { - File f = new File(fs.getDir(task.getProject()), files[j]); + final File f = new File(fs.getDir(task.getProject()), files[j]); File outf = null; if (task.getOutdir() != null && files[j].endsWith(".fo")) { - String[] sa = mapper.mapFileName(files[j]); - outf = new File(task.getOutdir(), sa[0]); + final String[] sa = mapper.mapFileName(files[j]); + outf = new File(task.getOutdir(), sa[0]); } else { outf = replaceExtension(f, ".fo", newExtension); if (task.getOutdir() != null) { @@ -196,7 +198,7 @@ task.log("Using base directory: " + sessionConfig.optionBaseDirectory(), Project.MSG_DEBUG); - } catch (Exception e) { + } catch (final Exception e) { task.log("Error setting base directory: " + e, Project.MSG_ERR); } @@ -234,7 +236,7 @@ URL url = null; try { url = newBaseDirectory.toURL(); - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { task.log("FOrayAntTask base directory is invalid:\n" + e, Project.MSG_ERR); } @@ -244,23 +246,23 @@ Project.MSG_DEBUG); } - private void render(File foFile, File outFile) + private void render(final File foFile, final File outFile) throws FOrayException { InputSource inputSource; try { inputSource = new InputSource(foFile.toURL().openStream()); - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { throw new FOrayException(e); - } catch (IOException e) { + } catch (final IOException e) { throw new FOrayException(e); } OutputStream out = null; try { - File dir = outFile.getParentFile(); + final File dir = outFile.getParentFile(); dir.mkdirs(); out = new FileOutputStream(outFile); - } catch (Exception ex) { + } catch (final Exception ex) { throw new BuildException(ex); } @@ -269,23 +271,24 @@ } try { - FOraySession session = FOraySpecific.makeFOraySession( + final FOraySession session = FOraySpecific.makeFOraySession( sessionConfig); - FOrayDocument document = new FOrayDocument(session, inputSource, - null); + final FOrayDocument document = new FOrayDocument(session, + inputSource, null); if (this.task.getRendererType() == OutputTargetFactory.RENDER_XML) { this.outputConfig.parseOption("fineDetail", "true", SessionConfig.PRECEDENCE_DEFAULT); } - OutputTarget outputTarget = OutputTargetFactory.makeOutputTarget( + final OutputTarget outputTarget = + OutputTargetFactory.makeOutputTarget( this.task.getRendererType(), this.outputConfig, session.getLogger()); new FOrayTarget(document, outputTarget, null, out); session.process(); out.close(); - } catch (Exception ex) { + } catch (final Exception ex) { throw new BuildException(ex); } } Modified: trunk/foray/foray-app/src/java/org/foray/app/ant/RunTest.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/ant/RunTest.java 2006-07-22 16:15:41 UTC (rev 7805) +++ trunk/foray/foray-app/src/java/org/foray/app/ant/RunTest.java 2006-07-22 18:11:33 UTC (rev 7806) @@ -54,19 +54,19 @@ public RunTest() {} - public void setTestSuite(String str) { + public void setTestSuite(final String str) { testsuite = str; } - public void setBasedir(String str) { + public void setBasedir(final String str) { basedir = str; } - public void setReference(String str) { + public void setReference(final String str) { referenceJar = str; } - public void setRefVersion(String str) { + public void setRefVersion(final String str) { refVersion = str; } @@ -87,21 +87,21 @@ * The output is then compared with the reference output. */ protected void testNewBuild() { - Log logger = Logging.makeDefaultLogger(); + final Log logger = Logging.makeDefaultLogger(); try { - ClassLoader loader = new URLClassLoader(new URL[] { + final ClassLoader loader = new URLClassLoader(new URL[] { URLFactory.createURL("file:build/fop.jar") }); - HashMap diff = runConverter(loader, "areatree", + final HashMap diff = runConverter(loader, "areatree", "reference/output/"); if (diff != null &&!diff.isEmpty()) { logger.info("===================================="); logger.info("The following files differ:"); boolean broke = false; - for (Iterator keys = diff.keySet().iterator(); + for (final Iterator keys = diff.keySet().iterator(); keys.hasNext(); ) { - Object fname = keys.next(); - Boolean pass = (Boolean)diff.get(fname); + final Object fname = keys.next(); + final Boolean pass = (Boolean)diff.get(fname); logger.info("file: " + fname + " - reference success: " + pass); if (pass.booleanValue()) { @@ -113,7 +113,7 @@ "Working tests have been changed."); } } - } catch (MalformedURLException mue) { + } catch (final MalformedURLException mue) { mue.printStackTrace(); } } @@ -127,13 +127,13 @@ */ protected void runReference() throws BuildException { // check not already done - File f = new File(basedir + "/reference/output/"); + final File f = new File(basedir + "/reference/output/"); // if(f.exists()) { // need to check that files have actually been created. // return; // } else { try { - ClassLoader loader = new URLClassLoader(new URL[] { + final ClassLoader loader = new URLClassLoader(new URL[] { URLFactory.createURL("file:" + referenceJar) }); boolean failed = false; @@ -143,20 +143,20 @@ true, loader); cla = Class.forName("org.apache.fop.apps.Version", true, loader); - Method get = cla.getMethod("getVersion", new Class[]{}); + final Method get = cla.getMethod("getVersion", new Class[]{}); if (!get.invoke(null, new Object[]{}).equals(refVersion)) { throw new BuildException("Reference jar is not correct " + "version it must be: " + refVersion); } - } catch (IllegalAccessException iae) { + } catch (final IllegalAccessException iae) { failed = true; - } catch (IllegalArgumentException are) { + } catch (final IllegalArgumentException are) { failed = true; - } catch (InvocationTargetException are) { + } catch (final InvocationTargetException are) { failed = true; - } catch (ClassNotFoundException are) { + } catch (final ClassNotFoundException are) { failed = true; - } catch (NoSuchMethodException are) { + } catch (final NoSuchMethodException are) { failed = true; } if (failed) { @@ -165,7 +165,7 @@ } f.mkdirs(); runConverter(loader, "reference/output/", null); - } catch (MalformedURLException mue) { + } catch (final MalformedURLException mue) { mue.printStackTrace(); } // } @@ -179,14 +179,14 @@ * file in the base directory. * @param loader the class loader to use to run the tests with */ - protected HashMap runConverter(ClassLoader loader, String dest, - String compDir) { - String converter = "org.apache.fop.tools.TestConverter"; + protected HashMap runConverter(final ClassLoader loader, final String dest, + final String compDir) { + final String converter = "org.apache.fop.tools.TestConverter"; HashMap diff = null; try { - Class cla = Class.forName(converter, true, loader); - Object tc = cla.newInstance(); + final Class cla = Class.forName(converter, true, loader); + final Object tc = cla.newInstance(); Method meth; meth = cla.getMethod("setBaseDir", new Class[] { @@ -202,7 +202,7 @@ diff = (HashMap)meth.invoke(tc, new Object[] { testsuite, dest, compDir }); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } return diff; Modified: trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-07-22 16:15:41 UTC (rev 7805) +++ trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-07-22 18:11:33 UTC (rev 7806) @@ -85,15 +85,15 @@ * test results * -pdf to output the result as pdf */ - public static void main(String[] args) { - Log log = Logging.makeDefaultLogger(); + public static void main(final String[] args) { + final Log log = Logging.makeDefaultLogger(); - TestConverter tc = new TestConverter(); + final TestConverter tc = new TestConverter(); String testFile = null; String output = null; for (int count = 0; count < args.length; count++) { - String argument = args[count]; + final String argument = args[count]; if (argument.equals("-failOnly")) { tc.setFailOnly(true); } else if (argument.equals("-pdf")) { @@ -131,15 +131,15 @@ log = Logging.makeQuietLogger(); } - public void setOutputPDF(boolean pdf) { + public void setOutputPDF(final boolean pdf) { outputPDF = pdf; } - public void setFailOnly(boolean fail) { + public void setFailOnly(final boolean fail) { failOnly = fail; } - public void setBaseDir(String str) { + public void setBaseDir(final String str) { baseDir = str; } @@ -148,7 +148,8 @@ * This runs the tests specified in the xml file fname. * The document is read as a dom and each testcase is covered. */ - public HashMap runTests(String fname, String dest, String compDir) { + public HashMap runTests(final String fname, final String dest, + final String compDir) { log.debug("running tests in file:" + fname); try { if (compDir != null) { @@ -156,13 +157,13 @@ } destdir = new File(baseDir + "/" + dest); destdir.mkdirs(); - File f = new File(baseDir + "/" + fname); - DocumentBuilderFactory factory = + final File f = new File(baseDir + "/" + fname); + final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = factory.newDocumentBuilder(); - Document doc = db.parse(f); + final DocumentBuilder db = factory.newDocumentBuilder(); + final Document doc = db.parse(f); - NodeList suitelist = doc.getChildNodes(); + final NodeList suitelist = doc.getChildNodes(); if (suitelist.getLength() == 0) { return differ; } @@ -171,19 +172,19 @@ testsuite = doc.getDocumentElement(); if (testsuite.hasAttributes()) { - String profile = testsuite.getAttributes().getNamedItem( + final String profile = testsuite.getAttributes().getNamedItem( "profile").getNodeValue(); log.debug("testing test suite:" + profile); } - NodeList testcases = testsuite.getChildNodes(); + final NodeList testcases = testsuite.getChildNodes(); for (int count = 0; count < testcases.getLength(); count++) { - Node testcase = testcases.item(count); + final Node testcase = testcases.item(count); if (testcase.getNodeName().equals("testcases")) { runTestCase(testcase); } } - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } return differ; @@ -195,17 +196,17 @@ * A testcase can contain a test, a result or more test cases. * A test case is handled recursively otherwise the test is run. */ - protected void runTestCase(Node tcase) { + protected void runTestCase(final Node tcase) { if (tcase.hasAttributes()) { - String profile = + final String profile = tcase.getAttributes().getNamedItem("profile").getNodeValue(); log.debug("testing profile:" + profile); } - NodeList cases = tcase.getChildNodes(); + final NodeList cases = tcase.getChildNodes(); for (int count = 0; count < cases.getLength(); count++) { - Node node = cases.item(count); - String nodename = node.getNodeName(); + final Node node = cases.item(count); + final String nodename = node.getNodeName(); if (nodename.equals("testcases")) { runTestCase(node); } else if (nodename.equals("test")) { @@ -223,12 +224,13 @@ * This creates an XSLTInputHandler to provide the input * for FOray and writes the data out to an XML area tree. */ - protected void runTest(Node testcase, Node test) { - String id = test.getAttributes().getNamedItem("id").getNodeValue(); - Node result = locateResult(testcase, id); + protected void runTest(final Node testcase, final Node test) { + final String id = test.getAttributes().getNamedItem("id") + .getNodeValue(); + final Node result = locateResult(testcase, id); boolean pass = false; if (result != null) { - String agreement = + final String agreement = result.getAttributes().getNamedItem("agreement").getNodeValue(); pass = agreement.equals("full"); } @@ -237,8 +239,9 @@ return; } - String xml = test.getAttributes().getNamedItem("xml").getNodeValue(); - Node xslNode = test.getAttributes().getNamedItem("xsl"); + final String xml = test.getAttributes().getNamedItem("xml") + .getNodeValue(); + final Node xslNode = test.getAttributes().getNamedItem("xsl"); String xsl = null; if (xslNode != null) { xsl = xslNode.getNodeValue(); @@ -247,18 +250,18 @@ xsl + " to area tree"); try { - File xmlFile = new File(baseDir + "/" + xml); - SessionConfig configuration = new SessionConfig(log); + final File xmlFile = new File(baseDir + "/" + xml); + final SessionConfig configuration = new SessionConfig(log); try { configuration.parseOption("base-directory", xmlFile.getParentFile().toURL().toExternalForm(), SessionConfig.PRECEDENCE_DEFAULT); - } catch (Exception e) { + } catch (final Exception e) { log.error("Error setting base directory"); } - FOraySession session = FOraySpecific.makeFOraySession( + final FOraySession session = FOraySpecific.makeFOraySession( configuration); FOrayDocument document = null; @@ -276,7 +279,7 @@ if (outname.endsWith(".xml")) { outname = outname.substring(0, outname.length() - 4); } - BufferedOutputStream bos = new BufferedOutputStream( + final BufferedOutputStream bos = new BufferedOutputStream( new FileOutputStream(new File(destdir, outname + (outputPDF ? ".pdf" : ".at.xml")))); int rendererType = -1; @@ -286,12 +289,12 @@ rendererType = OutputTargetFactory.RENDER_XML; } - OutputConfig renderOptions = new OutputConfig(log); + final OutputConfig renderOptions = new OutputConfig(log); renderOptions.parseOption("fineDeta... [truncated message content] |
|
From: <vic...@us...> - 2006-07-22 16:17:14
|
Revision: 7805 Author: victormote Date: 2006-07-22 09:15:41 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7805&view=rev Log Message: ----------- Consolidate unexpected value reporting a bit. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteDimension.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentAdjust.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentBaseline.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AudioDial.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Azimuth.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Background.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundImage.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundPosition.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BaselineShift.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Boolean.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Border.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSeparation.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSpacing.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderStyle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderWidth.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/CaseTitle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Character.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Clip.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Color.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnCount.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnGap.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnNumber.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnWidth.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ContentDimension.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ContentType.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Country.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Cue.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DestinationPlacementOffset.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DisplayAlign.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DominantBaseline.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Elevation.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Enumerated.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Extent.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ExternalDestination.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Font.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSize.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSizeAdjust.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStretch.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStyle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontVariant.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontWeight.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ForcePageCount.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Format.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GlyphOrientation.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GroupingSize.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphLadderCount.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphPushCharCount.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphRemainCharCount.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Id.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Indent.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InitialPageNumber.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InternalDestination.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Keep.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Language.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LastLineEndIndent.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LeaderLength.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LeaderPatternWidth.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LetterSpacing.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LineHeight.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Margin.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/MaximumRepeats.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Name.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/NumberColumnsRepeated.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/NumberColumnsSpanned.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/NumberRowsSpanned.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Orphans.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Padding.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/PageDimension.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Pause.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Pitch.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/PlayDuring.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ProvDistanceBetween.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ProvLabelSeparation.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RefId.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RegionName.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeDimension.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeSpace.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Role.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RuleThickness.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Script.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Size.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/SourceDocument.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/SpeechRate.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Src.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/SwitchTo.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TableLayout.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TargetPresentationContext.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TargetProcessingContext.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TargetStylesheet.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextAlign.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextAlignLast.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextAltitude.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextDecoration.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextDepth.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextIndent.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextShadow.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TreatAsWordSpace.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/VerticalAlign.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Volume.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Widows.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/WordSpacing.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/WritingMode.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ZIndex.java trunk/foray/foray-fotree/src/java/org/foray/fotree/xml/prop/Lang.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -95,6 +95,17 @@ return propertyType; } + protected PropertyException unexpectedValue(String value, + PropertyList propertyList) { + return unexpectedValue(value, propertyList, null); + } + + protected PropertyException unexpectedValue(String value, + PropertyList propertyList, String reason) { + return new PropertyException(unexpectedValueMessage(reason, value, + propertyList)); + } + /** * Creates an "Unexpected value" message suitable for user messages or * exception reporting. @@ -103,7 +114,7 @@ * @return A formatted, ready-to-present message describing the error. * @see #unexpectedValueMessage(String, String, PropertyList) */ - public String unexpectedValueMessage(String value, + private String unexpectedValueMessage(String value, PropertyList propertyList) { return unexpectedValueMessage(null, value, propertyList); } @@ -118,7 +129,7 @@ * @return A formatted, ready-to-present message describing the error. * @see #unexpectedValueMessage(String, PropertyList) */ - public String unexpectedValueMessage(String reason, String value, + private String unexpectedValueMessage(String reason, String value, PropertyList propertyList) { StringBuffer buffer = new StringBuffer(); FObj fobj = propertyList.getFObj(); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteDimension.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteDimension.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteDimension.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -76,8 +76,7 @@ if (pv instanceof DtPercentage) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public int getValue(FOContext context, byte relativeAxis, Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -68,8 +68,7 @@ if (pv instanceof DtPercentage) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public int getValue(FOContext context, byte direction, Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentAdjust.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentAdjust.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentAdjust.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -77,8 +77,7 @@ if (pv instanceof DtPercentage) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public short traitValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentBaseline.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentBaseline.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentBaseline.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -65,8 +65,7 @@ if (pv != null) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public short traitValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AudioDial.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AudioDial.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AudioDial.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -68,8 +68,7 @@ return pv; } } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public double getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Azimuth.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Azimuth.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Azimuth.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -79,8 +79,7 @@ } } if (! isBehind) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } } PropertyValue pv = checkKeywords(remainingValue); @@ -91,23 +90,20 @@ case Constants.FOVAL_RIGHTWARDS: case Constants.FOVAL_INHERIT: { if (this.isBehind) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } } } return pv; } if (this.isBehind) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } pv = DtAngle.makeAngleDT(value); if (pv != null) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public float getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Background.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Background.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Background.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -75,8 +75,7 @@ // Tokenize the input & put the tokens into an ArrayList StringTokenizer st = new StringTokenizer(value); if (st.countTokens() < 1 || st.countTokens() > MAX_TOKENS) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } ArrayList tokenList = new ArrayList(st.countTokens()); while (st.hasMoreTokens()) { @@ -87,8 +86,7 @@ for (int i = 0; i < tokenList.size(); i++) { short contentType = getContentType((String) tokenList.get(i)); if (contentType < 0) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } positionArray[i] = contentType; } @@ -101,8 +99,7 @@ switch (positionArray[i]) { case Constants.FOPROP_BACKGROUND_COLOR: { if (colorFound) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } collection.addItem(new BackgroundColor(propertyList, positionArray[i], propertyFullName, @@ -111,8 +108,7 @@ } case Constants.FOPROP_BACKGROUND_IMAGE: { if (imageFound) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } collection.addItem(new BackgroundImage(propertyList, positionArray[i], propertyFullName, @@ -121,8 +117,7 @@ } case Constants.FOPROP_BACKGROUND_REPEAT: { if (repeatFound) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } collection.addItem(new Enumerated(propertyList, positionArray[i], propertyFullName, @@ -131,8 +126,7 @@ } case Constants.FOPROP_BACKGROUND_ATTACHMENT: { if (attachmentFound) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } collection.addItem(new Enumerated(propertyList, positionArray[i], propertyFullName, @@ -141,8 +135,7 @@ } case Constants.FOPROP_BACKGROUND_POSITION: { if (positionFound) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } String propertyInput = (String) tokenList.get(i); if (i < positionArray.length && positionArray[i + 1] Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundImage.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundImage.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundImage.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -69,8 +69,7 @@ if (pv != null) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public Graphic getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundPosition.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundPosition.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundPosition.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -90,8 +90,7 @@ if (pv != null) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } private PropertyValue createShorthandValue(PropertyList propertyList, @@ -106,8 +105,7 @@ } StringTokenizer st = new StringTokenizer(value); if (st.countTokens() < 1 || st.countTokens() > 2) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } while (st.hasMoreTokens()) { String token = st.nextToken(); @@ -132,8 +130,7 @@ (propertyList, propertyType, pv); collection.addItem(property); } else { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } } if (collection.getCount() == 1) { @@ -149,16 +146,14 @@ if (pv2 instanceof DtPercentage || pv2 instanceof DtLength) { return collection; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } /* * If the first item is a keyword, the other needs to be also. */ if (pv instanceof PropertyKeyword) { if (! (pv2 instanceof PropertyKeyword)) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } } // The two keywords need to be from each of the two sets. Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BaselineShift.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BaselineShift.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BaselineShift.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -67,8 +67,7 @@ if (pv instanceof DtPercentage) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public int traitValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Boolean.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Boolean.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Boolean.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -61,8 +61,7 @@ if (pv != null) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public boolean getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Border.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Border.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Border.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -79,8 +79,7 @@ while (st.hasMoreTokens()) { Property property = parseToken(propertyList, st.nextToken()); if (property == null) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } if (collection == null) { collection = new PropertyCollection(); @@ -90,8 +89,7 @@ if (collection != null) { return collection; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public Property parseToken(PropertyList propertyList, String token) Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -77,8 +77,7 @@ if (pv instanceof ExprColor) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } private PropertyValue createShorthandValue(PropertyList propertyList, Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -68,8 +68,7 @@ if (pv instanceof DtInteger) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public int getValue(FOContext context, FObj fobj, byte direction) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSeparation.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSeparation.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSeparation.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -76,8 +76,7 @@ return new DtLengthBPIPDirection(null, ((DtLength) pv)); } } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public int getValue(FOContext context, byte axis, FObj fobj) { @@ -152,8 +151,7 @@ if (pv instanceof DtLength) { length = (DtLength) pv; } else { - throw new PropertyException(unexpectedValueMessage(attributeValue, - propertyList)); + throw unexpectedValue(attributeValue, propertyList); } String subPropertyName = Property.getSubPropertyName(propertyFullName); if (subPropertyName.equals("block-progression-direction")) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSpacing.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSpacing.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSpacing.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -83,8 +83,7 @@ return new DtLengthBPIPDirection(length2, length1); } } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } /** Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderStyle.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderStyle.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderStyle.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -93,8 +93,7 @@ if (kw != null) { return kw; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } private PropertyValue createShorthandValue(PropertyList propertyList, Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderWidth.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderWidth.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderWidth.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -93,8 +93,7 @@ if (pv instanceof DtLengthConditional) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } private PropertyValue createShorthandValue(PropertyList propertyList, Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/CaseTitle.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/CaseTitle.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/CaseTitle.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -45,8 +45,7 @@ if (value.length() != 0) { return new DtString(value); } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public String getValue() { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Character.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Character.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Character.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -68,8 +68,7 @@ if (value.length() == 1) { return new DtCharacter(value.charAt(0)); } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } /* For "hyphenation-character", which can be inherited. */ Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Clip.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Clip.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Clip.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -60,8 +60,7 @@ if (pv != null) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public Shape getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Color.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Color.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Color.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -72,8 +72,7 @@ if (pv instanceof ExprColor) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public java.awt.Color getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnCount.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnCount.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnCount.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -60,8 +60,7 @@ ((DtInteger) pv).setMinimumValue(1); return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public int getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnGap.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnGap.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnGap.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -64,8 +64,7 @@ if (pv instanceof DtPercentage) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public int getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnNumber.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnNumber.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnNumber.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -54,8 +54,7 @@ integer.setMinimumValue(1); return integer; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } private boolean validateFObj(PropertyList propertyList) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnWidth.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnWidth.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnWidth.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -58,8 +58,7 @@ // Used to store proportional column width return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public int getValue(FOContext context, FObj fobj, int tableWidth) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ContentDimension.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ContentDimension.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ContentDimension.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -65,8 +65,7 @@ if (pv instanceof DtPercentage) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } /** Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ContentType.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ContentType.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ContentType.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -56,8 +56,7 @@ if (value.length() != 0) { return new DtString(value); } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public String getValue(FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Country.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Country.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Country.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -64,8 +64,7 @@ if (DtCountry.validCountry(value)) { return new DtCountry(value); } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public String getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Cue.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Cue.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Cue.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -75,16 +75,14 @@ if (pv != null) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } private PropertyValue createShorthandValue(PropertyList propertyList, String value) throws PropertyException { StringTokenizer st = new StringTokenizer(value); if (st.countTokens() != 1 && st.countTokens() != 2) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } PropertyCollection collection = new PropertyCollection(); while (st.hasMoreTokens()) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DestinationPlacementOffset.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DestinationPlacementOffset.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DestinationPlacementOffset.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -51,8 +51,7 @@ if (pv instanceof DtLength) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public int getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DisplayAlign.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DisplayAlign.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DisplayAlign.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -58,8 +58,7 @@ if (pv != null) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public short traitValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DominantBaseline.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DominantBaseline.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DominantBaseline.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -66,8 +66,7 @@ if (pv != null) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public short traitValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Elevation.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Elevation.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Elevation.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -64,8 +64,7 @@ if (pv != null) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public float getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Enumerated.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Enumerated.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Enumerated.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -59,8 +59,7 @@ if (pv != null) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public short getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Extent.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Extent.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Extent.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -68,8 +68,7 @@ if (pv instanceof DtPercentage) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public int getValue(FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ExternalDestination.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ExternalDestination.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ExternalDestination.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -46,8 +46,7 @@ if (pv != null) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public String getValue() { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Font.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Font.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Font.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -110,16 +110,14 @@ tokenList.add(token); } if (tokenList.size() < 1 || tokenList.size() > MAX_TOKENS) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } // Create an array indicating which property is in each position short[] positionArray = new short[tokenList.size()]; for (int i = 0; i < tokenList.size(); i++) { short contentType = getContentType((String) tokenList.get(i)); if (contentType < 0) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } positionArray[i] = contentType; } @@ -133,8 +131,7 @@ switch (positionArray[i]) { case Constants.FOPROP_FONT_STYLE: { if (styleFound || sizeFound || lineHeightFound || familyFound) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } collection.addItem(new FontStyle(propertyList, positionArray[i], propertyFullName, @@ -144,8 +141,7 @@ case Constants.FOPROP_FONT_VARIANT: { if (variantFound || sizeFound || lineHeightFound || familyFound) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } collection.addItem(new FontVariant(propertyList, positionArray[i], propertyFullName, @@ -155,8 +151,7 @@ case Constants.FOPROP_FONT_WEIGHT: { if (weightFound || sizeFound || lineHeightFound || familyFound) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } collection.addItem(new FontWeight(propertyList, positionArray[i], propertyFullName, @@ -165,8 +160,7 @@ } case Constants.FOPROP_FONT_SIZE: { if (sizeFound || lineHeightFound || familyFound) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } collection.addItem(new FontSize(propertyList, positionArray[i], propertyFullName, @@ -175,8 +169,7 @@ } case Constants.FOPROP_LINE_HEIGHT: { if (lineHeightFound || familyFound || ! sizeFound) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } // Strip the leading "/" character. String adjustedToken @@ -188,8 +181,7 @@ } case Constants.FOPROP_FONT_FAMILY: { if (familyFound || ! sizeFound) { - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } collection.addItem(new FontFamily(propertyList, positionArray[i], propertyFullName, Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSize.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSize.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSize.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -97,8 +97,7 @@ return pv; } } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public int getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSizeAdjust.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSizeAdjust.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSizeAdjust.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -65,8 +65,7 @@ if (pv != null) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public double getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStretch.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStretch.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStretch.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -70,8 +70,7 @@ if (pv != null) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public short getValue(FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStyle.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStyle.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStyle.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -63,8 +63,7 @@ if (pv != null) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public short getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontVariant.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontVariant.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontVariant.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -61,8 +61,7 @@ if (pv != null) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public short getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontWeight.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontWeight.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontWeight.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -83,8 +83,7 @@ } return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public short getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ForcePageCount.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ForcePageCount.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ForcePageCount.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -60,8 +60,7 @@ if (pv != null) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public short getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Format.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Format.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Format.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -45,8 +45,7 @@ if (value.length() != 0) { return new DtString(value); } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public String getValue() { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GlyphOrientation.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GlyphOrientation.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GlyphOrientation.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -67,8 +67,7 @@ if (pv != null) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public short getValue(FOContext context, FObj fobj, byte axis) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GroupingSize.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GroupingSize.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GroupingSize.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -50,8 +50,7 @@ if (pv instanceof DtInteger) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public int getValue() { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphLadderCount.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphLadderCount.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphLadderCount.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -62,8 +62,7 @@ if (pv instanceof DtInteger) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public int getValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphPushCharCount.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphPushCharCount.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphPushCharCount.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -59,8 +59,7 @@ ((DtInteger) pv).setMinimumValue(1); return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public int traitValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphRemainCharCount.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphRemainCharCount.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphRemainCharCount.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -60,8 +60,7 @@ ((DtInteger) pv).setMinimumValue(1); return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public int traitValue(FOContext context, FObj fobj) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Id.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Id.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Id.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -46,8 +46,7 @@ if (pv instanceof DtName) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public String getValue() { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Indent.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Indent.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Indent.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -81,8 +81,7 @@ return pv; } } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public int getValue(FOContext context, FObj fobj, byte direction, Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InitialPageNumber.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InitialPageNumber.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InitialPageNumber.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -62,8 +62,7 @@ if (pv instanceof DtInteger) { return pv; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public int getValue(FOContext context, FObj fobj, int lastPageNumberUsed) { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InternalDestination.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InternalDestination.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InternalDestination.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -44,8 +44,7 @@ String value) throws PropertyException { DtName pv = DtName.makeNameDT(value); if (pv == null) { - throw new PropertyException(unexpectedValueMessage("Invalid NCName", - value, propertyList)); + throw unexpectedValue(value, propertyList, "Invalid NCName"); } return pv; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Keep.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Keep.java 2006-07-19 02:15:55 UTC (rev 7804) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Keep.java 2006-07-22 16:15:41 UTC (rev 7805) @@ -84,8 +84,7 @@ int integer = ((DtInteger) pv).getValue(); return new DtKeep(integer, integer, integer); } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } private PropertyValue createPropertyValueSpace(PropertyList propertyList, @@ -96,8 +95,7 @@ if (keepDT != null) { return keepDT; } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + throw unexpectedValue(value, propertyList); } public int getValue(FOContext context, int subProperty, FObj fobj) { @@ -246,8 +244,7 @@ return keepDT; } default: {... [truncated message content] |
|
From: <vic...@us...> - 2006-07-19 02:15:58
|
Revision: 7804 Author: victormote Date: 2006-07-18 19:15:55 -0700 (Tue, 18 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7804&view=rev Log Message: ----------- Remove the InputHandler classes entirely as they are now merely useless wrappers around an InputSource. Removed Paths: ------------- trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java Deleted: trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java 2006-07-19 02:15:39 UTC (rev 7803) +++ trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java 2006-07-19 02:15:55 UTC (rev 7804) @@ -1,53 +0,0 @@ -/* - * Copyright 2004 The FOray Project. - * http://www.foray.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This work is in part derived from the following work(s), used with the - * permission of the licensor: - * Apache FOP, licensed by the Apache Software Foundation - * - */ - -/* $Id$ */ - -package org.foray.core; - - - -import org.apache.commons.logging.Log; - -import org.xml.sax.InputSource; - -import java.io.IOException; -import java.net.URL; - -/** - * Manages input if it is an xsl:fo file - */ -public class FOInputHandler extends InputHandler { - - URL foURL = null; - - public FOInputHandler (Log logger, URL url) { - super(logger); - this.foURL = url; - } - - public InputSource getInputSource () throws IOException { - InputSource inputSource = new InputSource(foURL.openStream()); - return inputSource; - } - -} Deleted: trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java 2006-07-19 02:15:39 UTC (rev 7803) +++ trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java 2006-07-19 02:15:55 UTC (rev 7804) @@ -1,50 +0,0 @@ -/* - * Copyright 2004 The FOray Project. - * http://www.foray.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This work is in part derived from the following work(s), used with the - * permission of the licensor: - * Apache FOP, licensed by the Apache Software Foundation - * - */ - -/* $Id$ */ - -package org.foray.core; - - - -import org.apache.commons.logging.Log; - -import org.xml.sax.InputSource; - -import java.io.IOException; - -public abstract class InputHandler { - - Log logger; - - public InputHandler(Log logger) { - this.logger = logger; - } - - /** - * Provides the SAX InputSource. - * @return The SAX InputSource for this handler. - * @throws IOException - */ - public abstract InputSource getInputSource() throws IOException ; - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-19 02:15:52
|
Revision: 7803 Author: victormote Date: 2006-07-18 19:15:39 -0700 (Tue, 18 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7803&view=rev Log Message: ----------- Remove the InputHandler classes entirely as they are now merely useless wrappers around an InputSource. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java trunk/foray/foray-app/src/java/org/foray/app/Starter.java trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoPrintServlet.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java Modified: trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java 2006-07-19 01:53:59 UTC (rev 7802) +++ trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java 2006-07-19 02:15:39 UTC (rev 7803) @@ -48,7 +48,6 @@ import java.awt.Toolkit; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import java.io.IOException; import java.io.InputStream; import java.net.URL; @@ -102,12 +101,7 @@ SessionConfig configuration = this.options.getSessionConfig(); FOraySession session = FOraySpecific.makeFOraySession(configuration); - try { - this.document = new FOrayDocument(session, - inputHandler.getInputSource(), null); - } catch (IOException e) { - throw new FOrayException(e); - } + this.document = new FOrayDocument(session, inputSource, null); OutputConfig renderOptions = commandLineOptions.getRendererOptions(); this.renderer = new AWTRenderer(this.getLogger(), renderOptions); Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java 2006-07-19 01:53:59 UTC (rev 7802) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java 2006-07-19 02:15:39 UTC (rev 7803) @@ -27,16 +27,17 @@ import org.foray.common.Logging; import org.foray.common.url.URLFactory; import org.foray.common.url.URLUtil; -import org.foray.core.FOInputHandler; import org.foray.core.FOrayException; -import org.foray.core.InputHandler; import org.foray.core.SessionConfig; import org.foray.output.OutputConfig; import org.apache.commons.logging.Log; +import org.xml.sax.InputSource; + import java.io.File; import java.io.FileNotFoundException; +import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; @@ -432,9 +433,13 @@ /** * */ - public InputHandler getInputHandler() throws FOrayException { + public InputSource getInputSource() throws FOrayException { if (inputmode == INPUT_FO) { - return new FOInputHandler(log, foInput); + try { + return new InputSource(foInput.openStream()); + } catch (IOException e) { + throw new FOrayException(e); + } } return null; } Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-07-19 01:53:59 UTC (rev 7802) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-07-19 02:15:39 UTC (rev 7803) @@ -37,12 +37,9 @@ import org.apache.commons.logging.Log; -import org.xml.sax.InputSource; - import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; -import java.io.IOException; /** * Superclass for all classes which start FOray from the commandline. @@ -57,7 +54,7 @@ super(logger, sessionConfig, outputConfig); this.commandLineOptions = commandLineOptions; options.setCommandLineOptions(commandLineOptions); - super.setInputHandler(commandLineOptions.getInputHandler()); + super.setInputSource(commandLineOptions.getInputSource()); } /** @@ -85,13 +82,7 @@ */ FOrayDocument document = null; if (this.commandLineOptions.inputmode == CommandLineOptions.INPUT_FO) { - InputSource saxInputSource; - try { - saxInputSource = inputHandler.getInputSource(); - } catch (IOException e) { - throw new FOrayException(e); - } - document = new FOrayDocument(session, saxInputSource, null); + document = new FOrayDocument(session, inputSource, null); } else { document = new FOrayDocument(session, commandLineOptions.getXMLFile(), Modified: trunk/foray/foray-app/src/java/org/foray/app/Starter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/Starter.java 2006-07-19 01:53:59 UTC (rev 7802) +++ trunk/foray/foray-app/src/java/org/foray/app/Starter.java 2006-07-19 02:15:39 UTC (rev 7803) @@ -25,12 +25,13 @@ package org.foray.app; import org.foray.core.FOrayException; -import org.foray.core.InputHandler; import org.foray.core.SessionConfig; import org.foray.output.OutputConfig; import org.apache.commons.logging.Log; +import org.xml.sax.InputSource; + /** * abstract super class * Creates a SAX Parser (defaulting to Xerces). @@ -39,7 +40,7 @@ public abstract class Starter { Options options; - InputHandler inputHandler; + InputSource inputSource; private Log logger; protected SessionConfig sessionConfig; protected OutputConfig outputConfig; @@ -52,8 +53,8 @@ options = new Options(logger, sessionConfig, renderConfig); } - public void setInputHandler(InputHandler inputHandler) { - this.inputHandler = inputHandler; + public void setInputSource(InputSource inputSource) { + this.inputSource = inputSource; } public abstract void run() throws FOrayException; Modified: trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-07-19 01:53:59 UTC (rev 7802) +++ trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-07-19 02:15:39 UTC (rev 7803) @@ -28,12 +28,10 @@ import org.foray.app.Options; import org.foray.app.OutputTargetFactory; import org.foray.app.Starter; -import org.foray.core.FOInputHandler; import org.foray.core.FOrayDocument; import org.foray.core.FOrayException; import org.foray.core.FOraySession; import org.foray.core.FOrayTarget; -import org.foray.core.InputHandler; import org.foray.core.SessionConfig; import org.foray.output.OutputConfig; @@ -46,8 +44,11 @@ import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.util.GlobPatternMapper; +import org.xml.sax.InputSource; + import java.io.File; import java.io.FileOutputStream; +import java.io.IOException; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; @@ -245,12 +246,13 @@ private void render(File foFile, File outFile) throws FOrayException { - InputHandler inputHandler; + InputSource inputSource; try { - inputHandler = new FOInputHandler(getLogger(), - foFile.toURL()); + inputSource = new InputSource(foFile.toURL().openStream()); } catch (MalformedURLException e) { throw new FOrayException(e); + } catch (IOException e) { + throw new FOrayException(e); } OutputStream out = null; @@ -269,8 +271,8 @@ try { FOraySession session = FOraySpecific.makeFOraySession( sessionConfig); - FOrayDocument document = new FOrayDocument(session, - inputHandler.getInputSource(), null); + FOrayDocument document = new FOrayDocument(session, inputSource, + null); if (this.task.getRendererType() == OutputTargetFactory.RENDER_XML) { this.outputConfig.parseOption("fineDetail", "true", Modified: trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-07-19 01:53:59 UTC (rev 7802) +++ trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-07-19 02:15:39 UTC (rev 7803) @@ -28,11 +28,9 @@ import org.foray.app.OutputTargetFactory; import org.foray.common.Logging; import org.foray.common.url.URLFactory; -import org.foray.core.FOInputHandler; import org.foray.core.FOrayDocument; import org.foray.core.FOraySession; import org.foray.core.FOrayTarget; -import org.foray.core.InputHandler; import org.foray.core.SessionConfig; import org.foray.output.OutputConfig; @@ -43,6 +41,7 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -264,10 +263,9 @@ FOrayDocument document = null; if (xsl == null) { - InputHandler inputHandler = null; - inputHandler = new FOInputHandler(log, xmlFile.toURL()); - document = new FOrayDocument(session, - inputHandler.getInputSource(), null); + InputSource inputSource = null; + inputSource = new InputSource(xmlFile.toURL().openStream()); + document = new FOrayDocument(session, inputSource, null); } else { document = new FOrayDocument(session, xmlFile.toURL(), URLFactory.createURL(baseDir + "/" + xsl)); Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java 2006-07-19 01:53:59 UTC (rev 7802) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java 2006-07-19 02:15:39 UTC (rev 7803) @@ -24,30 +24,30 @@ package org.foray.demo.embed; -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.File; -import java.io.IOException; -import java.net.URL; - -import javax.xml.transform.TransformerException; - import org.foray.app.FOraySpecific; import org.foray.core.Application; -import org.foray.core.FOInputHandler; import org.foray.core.FOrayDocument; import org.foray.core.FOrayException; import org.foray.core.FOraySession; import org.foray.core.FOrayTarget; -import org.foray.core.InputHandler; import org.foray.render.awt.AWTRenderer; import org.foray.render.awt.viewer.PreviewDialog; import org.foray.render.awt.viewer.SecureResourceBundle; import org.foray.render.awt.viewer.Translator; import org.foray.render.awt.viewer.UserMessage; +import org.xml.sax.InputSource; + +import java.awt.Dimension; +import java.awt.Toolkit; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.File; +import java.io.IOException; +import java.net.URL; + +import javax.xml.transform.TransformerException; + /** * This class demonstrates the use of the AWT Viewer. */ @@ -114,9 +114,8 @@ FOraySession session = FOraySpecific.makeFOraySession(null); //Setup FOrayDocument - InputHandler inputHandler = new FOInputHandler(getLogger(), fo); - FOrayDocument document = new FOrayDocument(session, - inputHandler.getInputSource(), null); + InputSource inputSource = new InputSource(fo.openStream()); + FOrayDocument document = new FOrayDocument(session, inputSource, null); //Setup renderer AWTRenderer renderer = new AWTRenderer(this.logger, null); Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2006-07-19 01:53:59 UTC (rev 7802) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2006-07-19 02:15:39 UTC (rev 7803) @@ -27,15 +27,15 @@ import org.foray.app.FOraySpecific; import org.foray.app.OutputTargetFactory; import org.foray.core.Application; -import org.foray.core.FOInputHandler; import org.foray.core.FOrayDocument; import org.foray.core.FOrayException; import org.foray.core.FOraySession; import org.foray.core.FOrayTarget; -import org.foray.core.InputHandler; import org.axsl.output.OutputTarget; +import org.xml.sax.InputSource; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -54,9 +54,8 @@ FOraySession session = FOraySpecific.makeFOraySession(null); // Setup FOrayDocument - InputHandler inputHandler = new FOInputHandler(getLogger(), fo); - FOrayDocument document = new FOrayDocument(session, - inputHandler.getInputSource(), null); + InputSource inputSource = new InputSource(fo.openStream()); + FOrayDocument document = new FOrayDocument(session, inputSource, null); //Setup Renderer OutputTarget renderer = OutputTargetFactory.makeOutputTarget( Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2006-07-19 01:53:59 UTC (rev 7802) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2006-07-19 02:15:39 UTC (rev 7803) @@ -28,20 +28,19 @@ import org.foray.app.OutputTargetFactory; import org.foray.common.Logging; import org.foray.common.url.URLFactory; -import org.foray.core.FOInputHandler; import org.foray.core.FOrayDocument; import org.foray.core.FOrayException; import org.foray.core.FOraySession; import org.foray.core.FOrayTarget; -import org.foray.core.InputHandler; import org.axsl.output.OutputTarget; import org.apache.commons.logging.Log; +import org.xml.sax.InputSource; + import java.io.ByteArrayOutputStream; import java.io.File; -import java.io.IOException; import java.io.PrintWriter; import java.net.URL; @@ -78,8 +77,7 @@ if (foParam != null) { URL fofile = URLFactory.createURL(foParam); - FOInputHandler inputHandler = new FOInputHandler(this.logger, - fofile); + InputSource inputHandler = new InputSource(fofile.openStream()); renderFO(inputHandler, response); } else if ((xmlParam != null) && (xslParam != null)) { File xmlFile = new File(xmlParam); @@ -117,22 +115,14 @@ } /** - * @param inputHandler + * @param inputSource * @param session * @return A FOrayDocument to be used in processing. * @throws FOrayException */ protected FOrayDocument setupSAXDocument(FOraySession session, - InputHandler inputHandler) throws FOrayException { - // Setup FOrayDocument - FOrayDocument document; - try { - document = new FOrayDocument(session, - inputHandler.getInputSource(), null); - } catch (IOException e) { - throw new FOrayException(e); - } - return document; + InputSource inputSource) throws FOrayException { + return new FOrayDocument(session, inputSource, null); } /** @@ -161,7 +151,7 @@ * Renders an FO inputsource into a PDF file which is written * directly to the response object's OutputStream */ - public void renderFO(InputHandler inputHandler, + public void renderFO(InputSource inputHandler, HttpServletResponse response) throws ServletException { try { FOraySession session = setupSession(response); Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoPrintServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoPrintServlet.java 2006-07-19 01:53:59 UTC (rev 7802) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoPrintServlet.java 2006-07-19 02:15:39 UTC (rev 7803) @@ -29,9 +29,10 @@ import org.foray.core.FOrayException; import org.foray.core.FOraySession; import org.foray.core.FOrayTarget; -import org.foray.core.InputHandler; import org.foray.render.awt.AWTPrintRenderer; +import org.xml.sax.InputSource; + import java.awt.print.PrinterJob; import java.io.File; import java.io.PrintWriter; @@ -79,11 +80,11 @@ /** * Renders an FO inputsource to the default printer. */ - public void renderFO(InputHandler inputHandler, + public void renderFO(InputSource inputSource, HttpServletResponse response) throws ServletException { try { FOraySession session = setupSession(response); - FOrayDocument document = setupSAXDocument(session, inputHandler); + FOrayDocument document = setupSAXDocument(session, inputSource); setupTarget(document); session.process(); reportOK (response); Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java 2006-07-19 01:53:59 UTC (rev 7802) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java 2006-07-19 02:15:39 UTC (rev 7803) @@ -29,10 +29,11 @@ import org.foray.core.FOrayException; import org.foray.core.FOraySession; import org.foray.core.FOrayTarget; -import org.foray.core.InputHandler; import org.axsl.output.OutputTarget; +import org.xml.sax.InputSource; + import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; @@ -80,11 +81,11 @@ * Renders an FO inputsource into a PDF file which is written * directly to the response object's OutputStream */ - public void renderFO(InputHandler inputHandler, + public void renderFO(InputSource inputSource, HttpServletResponse response) throws ServletException { try { FOraySession session = setupSession(response); - FOrayDocument document = setupSAXDocument(session, inputHandler); + FOrayDocument document = setupSAXDocument(session, inputSource); FOrayTarget target = setupTarget(document); session.process(); sendContentToResponse(response, target); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-19 01:54:04
|
Revision: 7802 Author: victormote Date: 2006-07-18 18:53:59 -0700 (Tue, 18 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7802&view=rev Log Message: ----------- Put the default parser creation inside FOrayDocument. Modified Paths: -------------- trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java Modified: trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java 2006-07-19 01:53:48 UTC (rev 7801) +++ trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java 2006-07-19 01:53:59 UTC (rev 7802) @@ -29,7 +29,6 @@ import org.apache.commons.logging.Log; import org.xml.sax.InputSource; -import org.xml.sax.XMLReader; import java.io.IOException; import java.net.URL; @@ -51,8 +50,4 @@ return inputSource; } - public XMLReader getParser() throws FOrayException { - return super.createParser(); - } - } Modified: trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java 2006-07-19 01:53:48 UTC (rev 7801) +++ trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java 2006-07-19 01:53:59 UTC (rev 7802) @@ -48,6 +48,7 @@ import java.net.URL; import java.util.ArrayList; +import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; @@ -121,12 +122,18 @@ * Standard constructor. Accepts a SAX InputSource as input. * @param session The parent FOraySession. * @param inputSource A SAX InputSource. - * @param parser A SAX parser. + * @param parser A SAX parser. If null is passed, a default parser will be + * provided. + * @throws FOrayException If "null" parser is passed and there is an error + * creating one. */ public FOrayDocument(FOraySession session, InputSource inputSource, - XMLReader parser) { + XMLReader parser) throws FOrayException { this(session); this.inputSource = inputSource; + if (parser == null) { + parser = this.createParser(); + } this.parser = parser; this.parser.setContentHandler(treeBuilder); } @@ -359,4 +366,34 @@ return this.session.getLayoutFactory(); } + /** + * Creates a SAX parser. + * @return The newly-created SAX parser. + */ + XMLReader createParser() throws FOrayException { + SAXParserFactory spf = javax.xml.parsers.SAXParserFactory.newInstance(); + spf.setNamespaceAware(true); + XMLReader xmlReader = null; + try { + xmlReader = spf.newSAXParser().getXMLReader(); + } catch (javax.xml.parsers.ParserConfigurationException e) { + throw new FOrayException(e); + } catch (SAXException e) { + throw new FOrayException(e); + } + try { + xmlReader.setFeature( + "http://xml.org/sax/features/namespace-prefixes", true); + } catch (SAXException e) { + throw new FOrayException("Error in setting up parser feature " + + "namespace-prefixes\n" + + "You need a parser which supports SAX version 2", e); + } + if (this.getLogger().isDebugEnabled()) { + this.getLogger().debug("FO Parsing: Using " + + xmlReader.getClass().getName() + " as SAX2 Parser."); + } + return xmlReader; + } + } Modified: trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java 2006-07-19 01:53:48 UTC (rev 7801) +++ trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java 2006-07-19 01:53:59 UTC (rev 7802) @@ -29,13 +29,9 @@ import org.apache.commons.logging.Log; import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; import java.io.IOException; -import javax.xml.parsers.SAXParserFactory; - public abstract class InputHandler { Log logger; @@ -45,38 +41,10 @@ } /** - * Creates a SAX parser. - * @return The newly-created SAX parser. - */ - protected XMLReader createParser() throws FOrayException { - SAXParserFactory spf = javax.xml.parsers.SAXParserFactory.newInstance(); - spf.setNamespaceAware(true); - XMLReader xmlReader = null; - try { - xmlReader = spf.newSAXParser().getXMLReader(); - } catch (javax.xml.parsers.ParserConfigurationException e) { - throw new FOrayException(e); - } catch (SAXException e) { - throw new FOrayException(e); - } - if (this.logger.isDebugEnabled()) { - this.logger.debug("FO Parsing: Using " - + xmlReader.getClass().getName() + " as SAX2 Parser."); - } - return xmlReader; - } - - /** * Provides the SAX InputSource. * @return The SAX InputSource for this handler. * @throws IOException */ public abstract InputSource getInputSource() throws IOException ; - /** - * Provides the SAX parser for the SAX InputSource. - * @return The SAX parser for the SAX InputSource. - */ - public abstract XMLReader getParser() throws FOrayException; - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-19 01:53:58
|
Revision: 7801 Author: victormote Date: 2006-07-18 18:53:48 -0700 (Tue, 18 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7801&view=rev Log Message: ----------- Put the default parser creation inside FOrayDocument. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java Modified: trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java 2006-07-19 01:35:02 UTC (rev 7800) +++ trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java 2006-07-19 01:53:48 UTC (rev 7801) @@ -44,8 +44,6 @@ import org.apache.commons.logging.Log; -import org.xml.sax.XMLReader; - import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.WindowAdapter; @@ -65,7 +63,6 @@ AWTRenderer renderer; protected FOraySession session; protected FOrayDocument document; - protected XMLReader parser; public static final String TRANSLATION_PATH = "/org/foray/render/awt/viewer/resources/"; @@ -105,14 +102,9 @@ SessionConfig configuration = this.options.getSessionConfig(); FOraySession session = FOraySpecific.makeFOraySession(configuration); - // init parser - parser = inputHandler.getParser(); - if (parser == null) { - throw new FOrayException("Unable to create SAX parser"); - } try { this.document = new FOrayDocument(session, - inputHandler.getInputSource(), parser); + inputHandler.getInputSource(), null); } catch (IOException e) { throw new FOrayException(e); } Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-07-19 01:35:02 UTC (rev 7800) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-07-19 01:53:48 UTC (rev 7801) @@ -38,7 +38,6 @@ import org.apache.commons.logging.Log; import org.xml.sax.InputSource; -import org.xml.sax.XMLReader; import java.io.File; import java.io.FileNotFoundException; @@ -92,9 +91,7 @@ } catch (IOException e) { throw new FOrayException(e); } - XMLReader parser = inputHandler.getParser(); - document = new FOrayDocument(session, saxInputSource, - parser); + document = new FOrayDocument(session, saxInputSource, null); } else { document = new FOrayDocument(session, commandLineOptions.getXMLFile(), Modified: trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-07-19 01:35:02 UTC (rev 7800) +++ trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-07-19 01:53:48 UTC (rev 7801) @@ -46,8 +46,6 @@ import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.util.GlobPatternMapper; -import org.xml.sax.XMLReader; - import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; @@ -254,7 +252,6 @@ } catch (MalformedURLException e) { throw new FOrayException(e); } - XMLReader parser = inputHandler.getParser(); OutputStream out = null; try { @@ -273,7 +270,7 @@ FOraySession session = FOraySpecific.makeFOraySession( sessionConfig); FOrayDocument document = new FOrayDocument(session, - inputHandler.getInputSource(), parser); + inputHandler.getInputSource(), null); if (this.task.getRendererType() == OutputTargetFactory.RENDER_XML) { this.outputConfig.parseOption("fineDetail", "true", Modified: trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-07-19 01:35:02 UTC (rev 7800) +++ trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-07-19 01:53:48 UTC (rev 7801) @@ -30,7 +30,6 @@ import org.foray.common.url.URLFactory; import org.foray.core.FOInputHandler; import org.foray.core.FOrayDocument; -import org.foray.core.FOrayException; import org.foray.core.FOraySession; import org.foray.core.FOrayTarget; import org.foray.core.InputHandler; @@ -44,8 +43,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -269,10 +266,8 @@ if (xsl == null) { InputHandler inputHandler = null; inputHandler = new FOInputHandler(log, xmlFile.toURL()); - XMLReader parser = inputHandler.getParser(); - setParserFeatures(parser); document = new FOrayDocument(session, - inputHandler.getInputSource(), parser); + inputHandler.getInputSource(), null); } else { document = new FOrayDocument(session, xmlFile.toURL(), URLFactory.createURL(baseDir + "/" + xsl)); @@ -346,17 +341,6 @@ return false; } - public void setParserFeatures(XMLReader parser) throws FOrayException { - try { - parser.setFeature("http://xml.org/sax/features/namespace-prefixes", - true); - } catch (SAXException e) { - throw new FOrayException("Error in setting up parser feature " - + "namespace-prefixes\n" - + "You need a parser which supports SAX version 2", e); - } - } - protected Node locateResult(Node testcase, String id) { NodeList cases = testcase.getChildNodes(); for (int count = 0; count < cases.getLength(); count++) { Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java 2006-07-19 01:35:02 UTC (rev 7800) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java 2006-07-19 01:53:48 UTC (rev 7801) @@ -116,7 +116,7 @@ //Setup FOrayDocument InputHandler inputHandler = new FOInputHandler(getLogger(), fo); FOrayDocument document = new FOrayDocument(session, - inputHandler.getInputSource(), inputHandler.getParser()); + inputHandler.getInputSource(), null); //Setup renderer AWTRenderer renderer = new AWTRenderer(this.logger, null); Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2006-07-19 01:35:02 UTC (rev 7800) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2006-07-19 01:53:48 UTC (rev 7801) @@ -56,7 +56,7 @@ // Setup FOrayDocument InputHandler inputHandler = new FOInputHandler(getLogger(), fo); FOrayDocument document = new FOrayDocument(session, - inputHandler.getInputSource(), inputHandler.getParser()); + inputHandler.getInputSource(), null); //Setup Renderer OutputTarget renderer = OutputTargetFactory.makeOutputTarget( Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2006-07-19 01:35:02 UTC (rev 7800) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2006-07-19 01:53:48 UTC (rev 7801) @@ -128,7 +128,7 @@ FOrayDocument document; try { document = new FOrayDocument(session, - inputHandler.getInputSource(), inputHandler.getParser()); + inputHandler.getInputSource(), null); } catch (IOException e) { throw new FOrayException(e); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-19 01:35:07
|
Revision: 7800 Author: victormote Date: 2006-07-18 18:35:02 -0700 (Tue, 18 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7800&view=rev Log Message: ----------- Cleanup unused InputHandler logic. Modified Paths: -------------- trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java Modified: trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java 2006-07-19 01:32:44 UTC (rev 7799) +++ trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java 2006-07-19 01:35:02 UTC (rev 7800) @@ -31,7 +31,6 @@ import org.xml.sax.InputSource; import org.xml.sax.XMLReader; -import java.io.File; import java.io.IOException; import java.net.URL; @@ -40,7 +39,6 @@ */ public class FOInputHandler extends InputHandler { - File fofile = null; URL foURL = null; public FOInputHandler (Log logger, URL url) { @@ -49,9 +47,6 @@ } public InputSource getInputSource () throws IOException { - if (fofile != null) { - return super.fileInputSource(fofile); - } InputSource inputSource = new InputSource(foURL.openStream()); return inputSource; } Modified: trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java 2006-07-19 01:32:44 UTC (rev 7799) +++ trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java 2006-07-19 01:35:02 UTC (rev 7800) @@ -26,17 +26,13 @@ -import org.foray.common.url.URLFactory; - import org.apache.commons.logging.Log; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; -import java.io.File; import java.io.IOException; -import java.net.MalformedURLException; import javax.xml.parsers.SAXParserFactory; @@ -49,30 +45,6 @@ } /** - * create an InputSource from a File - * - * @param file the File - * @return the InputSource created - */ - public static InputSource fileInputSource(File file) { - /* this code adapted from James Clark's in XT */ - String path = file.getAbsolutePath(); - String fSep = System.getProperty("file.separator"); - if (fSep != null && fSep.length() == 1) { - path = path.replace(fSep.charAt(0), '/'); - } - if (path.length() > 0 && path.charAt(0) != '/') { - path = '/' + path; - } - try { - return new InputSource(URLFactory.createURL("file", null, - path).toString()); - } catch (MalformedURLException e) { - throw new Error("unexpected MalformedURLException"); - } - } - - /** * Creates a SAX parser. * @return The newly-created SAX parser. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-19 01:32:49
|
Revision: 7799 Author: victormote Date: 2006-07-18 18:32:44 -0700 (Tue, 18 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7799&view=rev Log Message: ----------- Remove the File version of the InputHandler constructor. Modified Paths: -------------- trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java Modified: trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java 2006-07-19 01:32:33 UTC (rev 7798) +++ trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java 2006-07-19 01:32:44 UTC (rev 7799) @@ -43,11 +43,6 @@ File fofile = null; URL foURL = null; - public FOInputHandler (Log logger, File fofile) { - super(logger); - this.fofile = fofile; - } - public FOInputHandler (Log logger, URL url) { super(logger); this.foURL = url; Modified: trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java 2006-07-19 01:32:33 UTC (rev 7798) +++ trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java 2006-07-19 01:32:44 UTC (rev 7799) @@ -48,10 +48,6 @@ this.logger = logger; } -// public static InputSource urlInputSource(URL url) throws IOException { -// return new InputSource(url.openStream()); -// } - /** * create an InputSource from a File * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-19 01:32:42
|
Revision: 7798 Author: victormote Date: 2006-07-18 18:32:33 -0700 (Tue, 18 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7798&view=rev Log Message: ----------- Remove the File version of the InputHandler constructor. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java Modified: trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-07-19 01:19:40 UTC (rev 7797) +++ trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-07-19 01:32:33 UTC (rev 7798) @@ -247,7 +247,13 @@ private void render(File foFile, File outFile) throws FOrayException { - InputHandler inputHandler = new FOInputHandler(getLogger(), foFile); + InputHandler inputHandler; + try { + inputHandler = new FOInputHandler(getLogger(), + foFile.toURL()); + } catch (MalformedURLException e) { + throw new FOrayException(e); + } XMLReader parser = inputHandler.getParser(); OutputStream out = null; Modified: trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-07-19 01:19:40 UTC (rev 7797) +++ trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-07-19 01:32:33 UTC (rev 7798) @@ -268,7 +268,7 @@ FOrayDocument document = null; if (xsl == null) { InputHandler inputHandler = null; - inputHandler = new FOInputHandler(log, xmlFile); + inputHandler = new FOInputHandler(log, xmlFile.toURL()); XMLReader parser = inputHandler.getParser(); setParserFeatures(parser); document = new FOrayDocument(session, Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java 2006-07-19 01:19:40 UTC (rev 7797) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java 2006-07-19 01:32:33 UTC (rev 7798) @@ -98,7 +98,7 @@ return new SecureResourceBundle(url.openStream(), getLogger()); } - public void viewFO(File fo) throws IOException, FOrayException, + public void viewFO(URL fo) throws IOException, FOrayException, TransformerException { //Setup l18n String language = System.getProperty("user.language"); @@ -166,7 +166,7 @@ app.getLogger().info("Starting AWT Viewer..."); try { - app.viewFO(fofile); + app.viewFO(fofile.toURL()); app.getLogger().info("Success!"); } catch (Exception e) { app.getLogger().error("Demo AWT Viewer Error", e); Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2006-07-19 01:19:40 UTC (rev 7797) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2006-07-19 01:32:33 UTC (rev 7798) @@ -40,13 +40,14 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.net.URL; /** * This class demonstrates the conversion of an FO file to PDF using FOray. */ public class DemoFO2PDF extends EmbedDemo { - public void convertFO2PDF(File fo, File pdf) throws IOException, + public void convertFO2PDF(URL fo, File pdf) throws IOException, FOrayException { // Setup FOraySession @@ -91,7 +92,7 @@ app.getLogger().info("Transforming..."); try { - app.convertFO2PDF(fofile, pdffile); + app.convertFO2PDF(fofile.toURL(), pdffile); } catch (Exception e) { app.getLogger().error("Demo FO to PDF Error", e); Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2006-07-19 01:19:40 UTC (rev 7797) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2006-07-19 01:32:33 UTC (rev 7798) @@ -27,6 +27,7 @@ import org.foray.app.FOraySpecific; import org.foray.app.OutputTargetFactory; import org.foray.common.Logging; +import org.foray.common.url.URLFactory; import org.foray.core.FOInputHandler; import org.foray.core.FOrayDocument; import org.foray.core.FOrayException; @@ -42,6 +43,7 @@ import java.io.File; import java.io.IOException; import java.io.PrintWriter; +import java.net.URL; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; @@ -75,7 +77,7 @@ String xslParam = request.getParameter(XSL_REQUEST_PARAM); if (foParam != null) { - File fofile = new File(foParam); + URL fofile = URLFactory.createURL(foParam); FOInputHandler inputHandler = new FOInputHandler(this.logger, fofile); renderFO(inputHandler, response); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-19 01:19:44
|
Revision: 7797 Author: victormote Date: 2006-07-18 18:19:40 -0700 (Tue, 18 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7797&view=rev Log Message: ----------- Move two classes to Common. Modified Paths: -------------- trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java Removed Paths: ------------- trunk/foray/foray-core/src/java/org/foray/core/DocumentInputSource.java trunk/foray/foray-core/src/java/org/foray/core/DocumentReader.java Deleted: trunk/foray/foray-core/src/java/org/foray/core/DocumentInputSource.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/DocumentInputSource.java 2006-07-19 01:19:31 UTC (rev 7796) +++ trunk/foray/foray-core/src/java/org/foray/core/DocumentInputSource.java 2006-07-19 01:19:40 UTC (rev 7797) @@ -1,59 +0,0 @@ -/* - * Copyright 2004 The FOray Project. - * http://www.foray.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This work is in part derived from the following work(s), used with the - * permission of the licensor: - * Apache FOP, licensed by the Apache Software Foundation - * - */ - -/* $Id$ */ - -package org.foray.core; - -import org.w3c.dom.Document; -import org.xml.sax.InputSource; - -/** - * This is an InputSource to be used with DocumentReader. - * - * @author Kelly A Campbell - * - */ - -public class DocumentInputSource extends InputSource { - private Document _document; - - public DocumentInputSource() { - super(); - } - - public DocumentInputSource(Document document) { - this(); - _document = document; - } - - public Document getDocument() { - return _document; - } - - public void setDocument(Document document) { - _document = document; - } - -} - - Deleted: trunk/foray/foray-core/src/java/org/foray/core/DocumentReader.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/DocumentReader.java 2006-07-19 01:19:31 UTC (rev 7796) +++ trunk/foray/foray-core/src/java/org/foray/core/DocumentReader.java 2006-07-19 01:19:40 UTC (rev 7797) @@ -1,515 +0,0 @@ -/* - * Copyright 2004 The FOray Project. - * http://www.foray.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This work is in part derived from the following work(s), used with the - * permission of the licensor: - * Apache FOP, licensed by the Apache Software Foundation - * - */ - -/* $Id$ */ - -package org.foray.core; - - -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.xml.sax.ContentHandler; -import org.xml.sax.DTDHandler; -import org.xml.sax.EntityResolver; -import org.xml.sax.ErrorHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXNotRecognizedException; -import org.xml.sax.SAXNotSupportedException; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.AttributesImpl; - -import java.io.IOException; - -/** - * This presents a DOM as an XMLReader to make it easy to use a Document - * with a SAX-based implementation. - * - * @author Kelly A Campbell - * - */ - -public class DocumentReader implements XMLReader { - - // ////////////////////////////////////////////////////////////////// - // Configuration. - // ////////////////////////////////////////////////////////////////// - private boolean _namespaces = true; - private boolean _namespace_prefixes = true; - - - /** - * Look up the value of a feature. - * - * <p>The feature name is any fully-qualified URI. It is - * possible for an XMLReader to recognize a feature name but - * to be unable to return its value; this is especially true - * in the case of an adapter for a SAX1 Parser, which has - * no way of knowing whether the underlying parser is - * performing validation or expanding external entities.</p> - * - * <p>All XMLReaders are required to recognize the - * http://xml.org/sax/features/namespaces and the - * http://xml.org/sax/features/namespace-prefixes feature names.</p> - * - * <p>Some feature values may be available only in specific - * contexts, such as before, during, or after a parse.</p> - * - * <p>Typical usage is something like this:</p> - * - * <pre> - * XMLReader r = new MySAXDriver(); - * - * // try to activate validation - * try { - * r.setFeature("http://xml.org/sax/features/validation", true); - * } catch (SAXException e) { - * getLogger().error("Cannot activate validation."); - * } - * - * // register event handlers - * r.setContentHandler(new MyContentHandler()); - * r.setErrorHandler(new MyErrorHandler()); - * - * // parse the first document - * try { - * r.parse("http://www.foo.com/mydoc.xml"); - * } catch (IOException e) { - * getLogger().error("I/O exception reading XML document"); - * } catch (SAXException e) { - * getLogger().error("XML exception reading document."); - * } - * </pre> - * - * <p>Implementors are free (and encouraged) to invent their own features, - * using names built on their own URIs.</p> - * - * @param name The feature name, which is a fully-qualified URI. - * @return The current state of the feature (true or false). - * @exception SAXNotRecognizedException When the - * XMLReader does not recognize the feature name. - * @exception SAXNotSupportedException When the - * XMLReader recognizes the feature name but - * cannot determine its value at this time. - * @see #setFeature - */ - public boolean getFeature(String name) - throws SAXNotRecognizedException, SAXNotSupportedException { - if ("http://xml.org/sax/features/namespaces".equals(name)) { - return _namespaces; - } else if ( - "http://xml.org/sax/features/namespace-prefixes".equals(name)) { - return _namespace_prefixes; - } else { - throw new SAXNotRecognizedException("Feature '" + name - + "' not recognized or supported by Document2SAXAdapter"); - } - - } - - /** - * Set the state of a feature. - * - * <p>The feature name is any fully-qualified URI. It is - * possible for an XMLReader to recognize a feature name but - * to be unable to set its value; this is especially true - * in the case of an adapter for a SAX1 Parser, - * which has no way of affecting whether the underlying parser is - * validating, for example.</p> - * - * <p>All XMLReaders are required to support setting - * http://xml.org/sax/features/namespaces to true and - * http://xml.org/sax/features/namespace-prefixes to false.</p> - * - * <p>Some feature values may be immutable or mutable only - * in specific contexts, such as before, during, or after - * a parse.</p> - * - * @param name The feature name, which is a fully-qualified URI. - * @param value The requested state of the feature (true or false). - * @exception SAXNotRecognizedException When the - * XMLReader does not recognize the feature name. - * @exception SAXNotSupportedException When the - * XMLReader recognizes the feature name but - * cannot set the requested value. - * @see #getFeature - */ - public void setFeature(String name, boolean value) - throws SAXNotRecognizedException, SAXNotSupportedException { - if ("http://xml.org/sax/features/namespaces".equals(name)) { - _namespaces = value; - } else if ( - "http://xml.org/sax/features/namespace-prefixes".equals(name)) { - _namespace_prefixes = value; - } else { - throw new SAXNotRecognizedException("Feature '" + name - + "' not recognized or supported by Document2SAXAdapter"); - } - - } - - - - /** - * Look up the value of a property. - * - * <p>The property name is any fully-qualified URI. It is - * possible for an XMLReader to recognize a property name but - * to be unable to return its state; this is especially true - * in the case of an adapter for a SAX1 Parser.</p> - * - * <p>XMLReaders are not required to recognize any specific - * property names, though an initial core set is documented for - * SAX2.</p> - * - * <p>Some property values may be available only in specific - * contexts, such as before, during, or after a parse.</p> - * - * <p>Implementors are free (and encouraged) to invent their own properties, - * using names built on their own URIs.</p> - * - * @param name The property name, which is a fully-qualified URI. - * @return The current value of the property. - * @exception SAXNotRecognizedException When the - * XMLReader does not recognize the property name. - * @exception SAXNotSupportedException When the - * XMLReader recognizes the property name but - * cannot determine its value at this time. - * @see #setProperty - */ - public Object getProperty(String name) - throws SAXNotRecognizedException, SAXNotSupportedException { - throw new SAXNotRecognizedException("Property '" + name - + "' not recognized or supported by Document2SAXAdapter"); - } - - /** - * Set the value of a property. - * - * <p>The property name is any fully-qualified URI. It is - * possible for an XMLReader to recognize a property name but - * to be unable to set its value; this is especially true - * in the case of an adapter for a SAX1 Parser.</p> - * - * <p>XMLReaders are not required to recognize setting - * any specific property names, though a core set is provided with - * SAX2.</p> - * - * <p>Some property values may be immutable or mutable only - * in specific contexts, such as before, during, or after - * a parse.</p> - * - * <p>This method is also the standard mechanism for setting - * extended handlers.</p> - * - * @param name The property name, which is a fully-qualified URI. - * @param value The requested value for the property. - * @exception SAXNotRecognizedException When the - * XMLReader does not recognize the property name. - * @exception SAXNotSupportedException When the - * XMLReader recognizes the property name but - * cannot set the requested value. - */ - public void setProperty(String name, Object value) - throws SAXNotRecognizedException, SAXNotSupportedException { - throw new SAXNotRecognizedException("Property '" + name - + "' not recognized or supported by Document2SAXAdapter"); - } - - - - // ////////////////////////////////////////////////////////////////// - // Event handlers. - // ////////////////////////////////////////////////////////////////// - private EntityResolver _entityResolver = null; - private DTDHandler _dtdHandler = null; - private ContentHandler _contentHandler = null; - private ErrorHandler _errorHandler = null; - - - /** - * Allow an application to register an entity resolver. - * - * <p>If the application does not register an entity resolver, - * the XMLReader will perform its own default resolution.</p> - * - * <p>Applications may register a new or different resolver in the - * middle of a parse, and the SAX parser must begin using the new - * resolver immediately.</p> - * - * @param resolver The entity resolver. - * @see #getEntityResolver - */ - public void setEntityResolver(EntityResolver resolver) { - _entityResolver = resolver; - } - - - - /** - * Return the current entity resolver. - * - * @return The current entity resolver, or null if none - * has been registered. - * @see #setEntityResolver - */ - public EntityResolver getEntityResolver() { - return _entityResolver; - } - - - - /** - * Allow an application to register a DTD event handler. - * - * <p>If the application does not register a DTD handler, all DTD - * events reported by the SAX parser will be silently ignored.</p> - * - * <p>Applications may register a new or different handler in the - * middle of a parse, and the SAX parser must begin using the new - * handler immediately.</p> - * - * @param handler The DTD handler. - * @see #getDTDHandler - */ - public void setDTDHandler(DTDHandler handler) { - _dtdHandler = handler; - } - - - - /** - * Return the current DTD handler. - * - * @return The current DTD handler, or null if none - * has been registered. - * @see #setDTDHandler - */ - public DTDHandler getDTDHandler() { - return _dtdHandler; - } - - - - /** - * Allow an application to register a content event handler. - * - * <p>If the application does not register a content handler, all - * content events reported by the SAX parser will be silently - * ignored.</p> - * - * <p>Applications may register a new or different handler in the - * middle of a parse, and the SAX parser must begin using the new - * handler immediately.</p> - * - * @param handler The content handler. - * @see #getContentHandler - */ - public void setContentHandler(ContentHandler handler) { - _contentHandler = handler; - } - - /** - * Return the current content handler. - * - * @return The current content handler, or null if none - * has been registered. - * @see #setContentHandler - */ - public ContentHandler getContentHandler() { - return _contentHandler; - } - - - - /** - * Allow an application to register an error event handler. - * - * <p>If the application does not register an error handler, all - * error events reported by the SAX parser will be silently - * ignored; however, normal processing may not continue. It is - * highly recommended that all SAX applications implement an - * error handler to avoid unexpected bugs.</p> - * - * <p>Applications may register a new or different handler in the - * middle of a parse, and the SAX parser must begin using the new - * handler immediately.</p> - * - * @param handler The error handler. - * @see #getErrorHandler - */ - public void setErrorHandler(ErrorHandler handler) { - _errorHandler = handler; - } - - /** - * Return the current error handler. - * - * @return The current error handler, or null if none - * has been registered. - * @see #setErrorHandler - */ - public ErrorHandler getErrorHandler() { - return _errorHandler; - } - - - - // ////////////////////////////////////////////////////////////////// - // Parsing. - // ////////////////////////////////////////////////////////////////// - - /** - * Parse an XML DOM document. - * @param input The input source for the top-level of the XML document. - * @exception SAXException Any SAX exception, possibly - * wrapping another exception. - * @exception IOException An IO exception from the parser, - * possibly from a byte stream or character stream - * supplied by the application. - * @see org.xml.sax.InputSource - * @see #parse(String) - * @see #setEntityResolver - * @see #setDTDHandler - * @see #setContentHandler - * @see #setErrorHandler - */ - public void parse(InputSource input) throws IOException, SAXException { - if (input instanceof DocumentInputSource) { - Document document = ((DocumentInputSource)input).getDocument(); - if (_contentHandler == null) { - throw new SAXException("ContentHandler is null. Please use " - + "setContentHandler()"); - } - - /* most of this code is modified from John Cowan's */ - - Node currentNode; - AttributesImpl currentAtts; - - /* temporary array for making Strings into character arrays */ - char[] array = null; - - currentAtts = new AttributesImpl(); - - /* start at the document element */ - currentNode = document; - while (currentNode != null) { - switch (currentNode.getNodeType()) { - case Node.DOCUMENT_NODE: - _contentHandler.startDocument(); - break; - case Node.CDATA_SECTION_NODE: - case Node.TEXT_NODE: - String data = currentNode.getNodeValue(); - int datalen = data.length(); - if (array == null || array.length < datalen) { - /* - * if the array isn't big enough, make a new - * one - */ - array = new char[datalen]; - } - data.getChars(0, datalen, array, 0); - _contentHandler.characters(array, 0, datalen); - break; - case Node.PROCESSING_INSTRUCTION_NODE: - _contentHandler.processingInstruction( - currentNode.getNodeName(), - currentNode.getNodeValue()); - break; - case Node.ELEMENT_NODE: - NamedNodeMap map = currentNode.getAttributes(); - currentAtts.clear(); - for (int i = map.getLength() - 1; i >= 0; i--) { - Attr att = (Attr)map.item(i); - currentAtts.addAttribute(att.getNamespaceURI(), - att.getLocalName(), - att.getName(), "CDATA", - att.getValue()); - } - _contentHandler.startElement(currentNode.getNamespaceURI(), - currentNode.getLocalName(), - currentNode.getNodeName(), - currentAtts); - break; - } - - Node nextNode = currentNode.getFirstChild(); - if (nextNode != null) { - currentNode = nextNode; - continue; - } - - while (currentNode != null) { - switch (currentNode.getNodeType()) { - case Node.DOCUMENT_NODE: - _contentHandler.endDocument(); - break; - case Node.ELEMENT_NODE: - _contentHandler.endElement( - currentNode.getNamespaceURI(), - currentNode.getLocalName(), - currentNode.getNodeName()); - break; - } - - nextNode = currentNode.getNextSibling(); - if (nextNode != null) { - currentNode = nextNode; - break; - } - - currentNode = currentNode.getParentNode(); - } - } - - } else { - throw new SAXException("DocumentReader only supports parsing of a " - + "DocumentInputSource"); - } - - } - - - - /** - * DocumentReader requires a DocumentInputSource, so this is not implements - * and simply throws a SAXException. - * Use parse(DocumentInputSource) instead - * - * @param systemId The system identifier (URI). - * @exception SAXException Any SAX exception, possibly - * wrapping another exception. - * @exception IOException An IO exception from the parser, - * possibly from a byte stream or character stream - * supplied by the application. - * @see #parse(InputSource) - */ - public void parse(String systemId) throws IOException, SAXException { - throw new SAXException("DocumentReader only supports parsing of a " - + "DocumentInputSource"); - } - -} Modified: trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java 2006-07-19 01:19:31 UTC (rev 7796) +++ trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java 2006-07-19 01:19:40 UTC (rev 7797) @@ -25,6 +25,8 @@ package org.foray.core; import org.foray.common.XMLParser; +import org.foray.common.sax.DocumentInputSource; +import org.foray.common.sax.DocumentReader; import org.axsl.areaW.AreaTreeFactory; import org.axsl.fontR.FontConsumer; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-19 01:19:39
|
Revision: 7796 Author: victormote Date: 2006-07-18 18:19:31 -0700 (Tue, 18 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7796&view=rev Log Message: ----------- Move two classes to Common. Added Paths: ----------- trunk/foray/foray-common/src/java/org/foray/common/sax/ trunk/foray/foray-common/src/java/org/foray/common/sax/DocumentInputSource.java trunk/foray/foray-common/src/java/org/foray/common/sax/DocumentReader.java Copied: trunk/foray/foray-common/src/java/org/foray/common/sax/DocumentInputSource.java (from rev 7685, trunk/foray/foray-core/src/java/org/foray/core/DocumentInputSource.java) =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/sax/DocumentInputSource.java (rev 0) +++ trunk/foray/foray-common/src/java/org/foray/common/sax/DocumentInputSource.java 2006-07-19 01:19:31 UTC (rev 7796) @@ -0,0 +1,59 @@ +/* + * Copyright 2004 The FOray Project. + * http://www.foray.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * This work is in part derived from the following work(s), used with the + * permission of the licensor: + * Apache FOP, licensed by the Apache Software Foundation + * + */ + +/* $Id$ */ + +package org.foray.common.sax; + +import org.w3c.dom.Document; +import org.xml.sax.InputSource; + +/** + * This is an InputSource to be used with DocumentReader. + * + * @author Kelly A Campbell + * + */ + +public class DocumentInputSource extends InputSource { + private Document _document; + + public DocumentInputSource() { + super(); + } + + public DocumentInputSource(Document document) { + this(); + _document = document; + } + + public Document getDocument() { + return _document; + } + + public void setDocument(Document document) { + _document = document; + } + +} + + Copied: trunk/foray/foray-common/src/java/org/foray/common/sax/DocumentReader.java (from rev 7685, trunk/foray/foray-core/src/java/org/foray/core/DocumentReader.java) =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/sax/DocumentReader.java (rev 0) +++ trunk/foray/foray-common/src/java/org/foray/common/sax/DocumentReader.java 2006-07-19 01:19:31 UTC (rev 7796) @@ -0,0 +1,517 @@ +/* + * Copyright 2004 The FOray Project. + * http://www.foray.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * This work is in part derived from the following work(s), used with the + * permission of the licensor: + * Apache FOP, licensed by the Apache Software Foundation + * + */ + +/* $Id$ */ + +package org.foray.common.sax; + + +import org.foray.common.sax.DocumentInputSource; + +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.AttributesImpl; + +import java.io.IOException; + +/** + * This presents a DOM as an XMLReader to make it easy to use a Document + * with a SAX-based implementation. + * + * @author Kelly A Campbell + * + */ + +public class DocumentReader implements XMLReader { + + // ////////////////////////////////////////////////////////////////// + // Configuration. + // ////////////////////////////////////////////////////////////////// + private boolean _namespaces = true; + private boolean _namespace_prefixes = true; + + + /** + * Look up the value of a feature. + * + * <p>The feature name is any fully-qualified URI. It is + * possible for an XMLReader to recognize a feature name but + * to be unable to return its value; this is especially true + * in the case of an adapter for a SAX1 Parser, which has + * no way of knowing whether the underlying parser is + * performing validation or expanding external entities.</p> + * + * <p>All XMLReaders are required to recognize the + * http://xml.org/sax/features/namespaces and the + * http://xml.org/sax/features/namespace-prefixes feature names.</p> + * + * <p>Some feature values may be available only in specific + * contexts, such as before, during, or after a parse.</p> + * + * <p>Typical usage is something like this:</p> + * + * <pre> + * XMLReader r = new MySAXDriver(); + * + * // try to activate validation + * try { + * r.setFeature("http://xml.org/sax/features/validation", true); + * } catch (SAXException e) { + * getLogger().error("Cannot activate validation."); + * } + * + * // register event handlers + * r.setContentHandler(new MyContentHandler()); + * r.setErrorHandler(new MyErrorHandler()); + * + * // parse the first document + * try { + * r.parse("http://www.foo.com/mydoc.xml"); + * } catch (IOException e) { + * getLogger().error("I/O exception reading XML document"); + * } catch (SAXException e) { + * getLogger().error("XML exception reading document."); + * } + * </pre> + * + * <p>Implementors are free (and encouraged) to invent their own features, + * using names built on their own URIs.</p> + * + * @param name The feature name, which is a fully-qualified URI. + * @return The current state of the feature (true or false). + * @exception SAXNotRecognizedException When the + * XMLReader does not recognize the feature name. + * @exception SAXNotSupportedException When the + * XMLReader recognizes the feature name but + * cannot determine its value at this time. + * @see #setFeature + */ + public boolean getFeature(String name) + throws SAXNotRecognizedException, SAXNotSupportedException { + if ("http://xml.org/sax/features/namespaces".equals(name)) { + return _namespaces; + } else if ( + "http://xml.org/sax/features/namespace-prefixes".equals(name)) { + return _namespace_prefixes; + } else { + throw new SAXNotRecognizedException("Feature '" + name + + "' not recognized or supported by Document2SAXAdapter"); + } + + } + + /** + * Set the state of a feature. + * + * <p>The feature name is any fully-qualified URI. It is + * possible for an XMLReader to recognize a feature name but + * to be unable to set its value; this is especially true + * in the case of an adapter for a SAX1 Parser, + * which has no way of affecting whether the underlying parser is + * validating, for example.</p> + * + * <p>All XMLReaders are required to support setting + * http://xml.org/sax/features/namespaces to true and + * http://xml.org/sax/features/namespace-prefixes to false.</p> + * + * <p>Some feature values may be immutable or mutable only + * in specific contexts, such as before, during, or after + * a parse.</p> + * + * @param name The feature name, which is a fully-qualified URI. + * @param value The requested state of the feature (true or false). + * @exception SAXNotRecognizedException When the + * XMLReader does not recognize the feature name. + * @exception SAXNotSupportedException When the + * XMLReader recognizes the feature name but + * cannot set the requested value. + * @see #getFeature + */ + public void setFeature(String name, boolean value) + throws SAXNotRecognizedException, SAXNotSupportedException { + if ("http://xml.org/sax/features/namespaces".equals(name)) { + _namespaces = value; + } else if ( + "http://xml.org/sax/features/namespace-prefixes".equals(name)) { + _namespace_prefixes = value; + } else { + throw new SAXNotRecognizedException("Feature '" + name + + "' not recognized or supported by Document2SAXAdapter"); + } + + } + + + + /** + * Look up the value of a property. + * + * <p>The property name is any fully-qualified URI. It is + * possible for an XMLReader to recognize a property name but + * to be unable to return its state; this is especially true + * in the case of an adapter for a SAX1 Parser.</p> + * + * <p>XMLReaders are not required to recognize any specific + * property names, though an initial core set is documented for + * SAX2.</p> + * + * <p>Some property values may be available only in specific + * contexts, such as before, during, or after a parse.</p> + * + * <p>Implementors are free (and encouraged) to invent their own properties, + * using names built on their own URIs.</p> + * + * @param name The property name, which is a fully-qualified URI. + * @return The current value of the property. + * @exception SAXNotRecognizedException When the + * XMLReader does not recognize the property name. + * @exception SAXNotSupportedException When the + * XMLReader recognizes the property name but + * cannot determine its value at this time. + * @see #setProperty + */ + public Object getProperty(String name) + throws SAXNotRecognizedException, SAXNotSupportedException { + throw new SAXNotRecognizedException("Property '" + name + + "' not recognized or supported by Document2SAXAdapter"); + } + + /** + * Set the value of a property. + * + * <p>The property name is any fully-qualified URI. It is + * possible for an XMLReader to recognize a property name but + * to be unable to set its value; this is especially true + * in the case of an adapter for a SAX1 Parser.</p> + * + * <p>XMLReaders are not required to recognize setting + * any specific property names, though a core set is provided with + * SAX2.</p> + * + * <p>Some property values may be immutable or mutable only + * in specific contexts, such as before, during, or after + * a parse.</p> + * + * <p>This method is also the standard mechanism for setting + * extended handlers.</p> + * + * @param name The property name, which is a fully-qualified URI. + * @param value The requested value for the property. + * @exception SAXNotRecognizedException When the + * XMLReader does not recognize the property name. + * @exception SAXNotSupportedException When the + * XMLReader recognizes the property name but + * cannot set the requested value. + */ + public void setProperty(String name, Object value) + throws SAXNotRecognizedException, SAXNotSupportedException { + throw new SAXNotRecognizedException("Property '" + name + + "' not recognized or supported by Document2SAXAdapter"); + } + + + + // ////////////////////////////////////////////////////////////////// + // Event handlers. + // ////////////////////////////////////////////////////////////////// + private EntityResolver _entityResolver = null; + private DTDHandler _dtdHandler = null; + private ContentHandler _contentHandler = null; + private ErrorHandler _errorHandler = null; + + + /** + * Allow an application to register an entity resolver. + * + * <p>If the application does not register an entity resolver, + * the XMLReader will perform its own default resolution.</p> + * + * <p>Applications may register a new or different resolver in the + * middle of a parse, and the SAX parser must begin using the new + * resolver immediately.</p> + * + * @param resolver The entity resolver. + * @see #getEntityResolver + */ + public void setEntityResolver(EntityResolver resolver) { + _entityResolver = resolver; + } + + + + /** + * Return the current entity resolver. + * + * @return The current entity resolver, or null if none + * has been registered. + * @see #setEntityResolver + */ + public EntityResolver getEntityResolver() { + return _entityResolver; + } + + + + /** + * Allow an application to register a DTD event handler. + * + * <p>If the application does not register a DTD handler, all DTD + * events reported by the SAX parser will be silently ignored.</p> + * + * <p>Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately.</p> + * + * @param handler The DTD handler. + * @see #getDTDHandler + */ + public void setDTDHandler(DTDHandler handler) { + _dtdHandler = handler; + } + + + + /** + * Return the current DTD handler. + * + * @return The current DTD handler, or null if none + * has been registered. + * @see #setDTDHandler + */ + public DTDHandler getDTDHandler() { + return _dtdHandler; + } + + + + /** + * Allow an application to register a content event handler. + * + * <p>If the application does not register a content handler, all + * content events reported by the SAX parser will be silently + * ignored.</p> + * + * <p>Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately.</p> + * + * @param handler The content handler. + * @see #getContentHandler + */ + public void setContentHandler(ContentHandler handler) { + _contentHandler = handler; + } + + /** + * Return the current content handler. + * + * @return The current content handler, or null if none + * has been registered. + * @see #setContentHandler + */ + public ContentHandler getContentHandler() { + return _contentHandler; + } + + + + /** + * Allow an application to register an error event handler. + * + * <p>If the application does not register an error handler, all + * error events reported by the SAX parser will be silently + * ignored; however, normal processing may not continue. It is + * highly recommended that all SAX applications implement an + * error handler to avoid unexpected bugs.</p> + * + * <p>Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately.</p> + * + * @param handler The error handler. + * @see #getErrorHandler + */ + public void setErrorHandler(ErrorHandler handler) { + _errorHandler = handler; + } + + /** + * Return the current error handler. + * + * @return The current error handler, or null if none + * has been registered. + * @see #setErrorHandler + */ + public ErrorHandler getErrorHandler() { + return _errorHandler; + } + + + + // ////////////////////////////////////////////////////////////////// + // Parsing. + // ////////////////////////////////////////////////////////////////// + + /** + * Parse an XML DOM document. + * @param input The input source for the top-level of the XML document. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception IOException An IO exception from the parser, + * possibly from a byte stream or character stream + * supplied by the application. + * @see org.xml.sax.InputSource + * @see #parse(String) + * @see #setEntityResolver + * @see #setDTDHandler + * @see #setContentHandler + * @see #setErrorHandler + */ + public void parse(InputSource input) throws IOException, SAXException { + if (input instanceof DocumentInputSource) { + Document document = ((DocumentInputSource)input).getDocument(); + if (_contentHandler == null) { + throw new SAXException("ContentHandler is null. Please use " + + "setContentHandler()"); + } + + /* most of this code is modified from John Cowan's */ + + Node currentNode; + AttributesImpl currentAtts; + + /* temporary array for making Strings into character arrays */ + char[] array = null; + + currentAtts = new AttributesImpl(); + + /* start at the document element */ + currentNode = document; + while (currentNode != null) { + switch (currentNode.getNodeType()) { + case Node.DOCUMENT_NODE: + _contentHandler.startDocument(); + break; + case Node.CDATA_SECTION_NODE: + case Node.TEXT_NODE: + String data = currentNode.getNodeValue(); + int datalen = data.length(); + if (array == null || array.length < datalen) { + /* + * if the array isn't big enough, make a new + * one + */ + array = new char[datalen]; + } + data.getChars(0, datalen, array, 0); + _contentHandler.characters(array, 0, datalen); + break; + case Node.PROCESSING_INSTRUCTION_NODE: + _contentHandler.processingInstruction( + currentNode.getNodeName(), + currentNode.getNodeValue()); + break; + case Node.ELEMENT_NODE: + NamedNodeMap map = currentNode.getAttributes(); + currentAtts.clear(); + for (int i = map.getLength() - 1; i >= 0; i--) { + Attr att = (Attr)map.item(i); + currentAtts.addAttribute(att.getNamespaceURI(), + att.getLocalName(), + att.getName(), "CDATA", + att.getValue()); + } + _contentHandler.startElement(currentNode.getNamespaceURI(), + currentNode.getLocalName(), + currentNode.getNodeName(), + currentAtts); + break; + } + + Node nextNode = currentNode.getFirstChild(); + if (nextNode != null) { + currentNode = nextNode; + continue; + } + + while (currentNode != null) { + switch (currentNode.getNodeType()) { + case Node.DOCUMENT_NODE: + _contentHandler.endDocument(); + break; + case Node.ELEMENT_NODE: + _contentHandler.endElement( + currentNode.getNamespaceURI(), + currentNode.getLocalName(), + currentNode.getNodeName()); + break; + } + + nextNode = currentNode.getNextSibling(); + if (nextNode != null) { + currentNode = nextNode; + break; + } + + currentNode = currentNode.getParentNode(); + } + } + + } else { + throw new SAXException("DocumentReader only supports parsing of a " + + "DocumentInputSource"); + } + + } + + + + /** + * DocumentReader requires a DocumentInputSource, so this is not implements + * and simply throws a SAXException. + * Use parse(DocumentInputSource) instead + * + * @param systemId The system identifier (URI). + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception IOException An IO exception from the parser, + * possibly from a byte stream or character stream + * supplied by the application. + * @see #parse(InputSource) + */ + public void parse(String systemId) throws IOException, SAXException { + throw new SAXException("DocumentReader only supports parsing of a " + + "DocumentInputSource"); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-18 16:26:31
|
Revision: 7795 Author: victormote Date: 2006-07-18 09:26:21 -0700 (Tue, 18 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7795&view=rev Log Message: ----------- Remove no-longer-needed class. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java Removed Paths: ------------- trunk/foray/foray-core/src/java/org/foray/core/TraxInputHandler.java Modified: trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-07-18 16:22:37 UTC (rev 7794) +++ trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-07-18 16:26:21 UTC (rev 7795) @@ -35,7 +35,6 @@ import org.foray.core.FOrayTarget; import org.foray.core.InputHandler; import org.foray.core.SessionConfig; -import org.foray.core.TraxInputHandler; import org.foray.output.OutputConfig; import org.axsl.output.OutputTarget; @@ -263,22 +262,23 @@ log.error("Error setting base directory"); } - InputHandler inputHandler = null; + FOraySession session = FOraySpecific.makeFOraySession( + configuration); + + FOrayDocument document = null; if (xsl == null) { + InputHandler inputHandler = null; inputHandler = new FOInputHandler(log, xmlFile); + XMLReader parser = inputHandler.getParser(); + setParserFeatures(parser); + document = new FOrayDocument(session, + inputHandler.getInputSource(), parser); } else { - inputHandler = new TraxInputHandler(log, xmlFile.toURL(), + document = new FOrayDocument(session, xmlFile.toURL(), URLFactory.createURL(baseDir + "/" + xsl)); } - FOraySession session = FOraySpecific.makeFOraySession( - configuration); - XMLReader parser = inputHandler.getParser(); - setParserFeatures(parser); - FOrayDocument document = new FOrayDocument(session, - inputHandler.getInputSource(), parser); - String outname = xmlFile.getName(); if (outname.endsWith(".xml")) { outname = outname.substring(0, outname.length() - 4); Deleted: trunk/foray/foray-core/src/java/org/foray/core/TraxInputHandler.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/TraxInputHandler.java 2006-07-18 16:22:37 UTC (rev 7794) +++ trunk/foray/foray-core/src/java/org/foray/core/TraxInputHandler.java 2006-07-18 16:26:21 UTC (rev 7795) @@ -1,184 +0,0 @@ -/* - * Copyright 2004 The FOray Project. - * http://www.foray.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This work is in part derived from the following work(s), used with the - * permission of the licensor: - * Apache FOP, licensed by the Apache Software Foundation - * - */ - -/* $Id$ */ - -package org.foray.core; - - - - -import org.apache.commons.logging.Log; - -import org.xml.sax.InputSource; -import org.xml.sax.XMLFilter; -import org.xml.sax.XMLReader; - -import java.io.File; -import java.io.IOException; -import java.net.URL; - -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.sax.SAXResult; -import javax.xml.transform.sax.SAXSource; -import javax.xml.transform.sax.SAXTransformerFactory; -import javax.xml.transform.stream.StreamSource; - -/** - * XSLTInputHandler basically takes an xml source and transforms it with - * an xslt source and the resulting xsl:fo document is input for FOray. - */ -public class TraxInputHandler extends InputHandler { - private Transformer transformer; - private StreamSource xmlSource; - private Source xsltSource; - - public TraxInputHandler(Log logger, URL xmlfile, URL xsltfile) - throws FOrayException { - super(logger); - try { - xmlSource = new StreamSource(xmlfile.openStream()); - xsltSource = new StreamSource(xsltfile.openStream()); - } catch (IOException e) { - throw new FOrayException(e); - } - initTransformer(); - } - - public TraxInputHandler(Log logger, String xmlURL, String xsltURL) - throws FOrayException { - super(logger); - this.xmlSource = new StreamSource(xmlURL); - this.xsltSource = new StreamSource(xsltURL); - initTransformer(); - } - - public TraxInputHandler(Log logger, InputSource xmlSource, - InputSource xsltSource) throws FOrayException { - super(logger); - this.xmlSource = new StreamSource(xmlSource.getByteStream(), - xmlSource.getSystemId()); - this.xsltSource = new StreamSource(xsltSource.getByteStream(), - xsltSource.getSystemId()); - initTransformer(); - } - - private void initTransformer() throws FOrayException { - try { - transformer = TransformerFactory.newInstance().newTransformer( - xsltSource); - } - catch(Exception ex) { - throw new FOrayException(ex); - } - } - - /** - * Overwrites the method of the super class to return the xmlfile. - * Use run(Driver driver) instead. - * @deprecated - */ - public InputSource getInputSource() { - InputSource is = new InputSource(); - is.setByteStream(xmlSource.getInputStream()); - is.setSystemId(xmlSource.getSystemId()); - return is; - } - - /** - * Overwrites this method of the super class and returns an - * XMLFilter instead of a simple XMLReader which allows chaining - * of transformations. - * Use run(Driver driver) instead. - * @deprecated - * - */ - public XMLReader getParser() throws FOrayException { - return getXMLFilter(xsltSource); - } - - /** - * Creates from the transformer an instance of an XMLFilter which - * then can be used in a chain with the XMLReader passed to Driver. This way - * during the conversion of the xml file + xslt stylesheet the resulting - * data is fed into FOary. This should help to avoid memory problems - * @param xsltSource An xslt stylesheet. - * @return An XMLFilter which can be chained together with other XMLReaders - * or XMLFilters. - */ - private XMLFilter getXMLFilter(Source xsltSource) - throws FOrayException { - try { - // Instantiate a TransformerFactory. - TransformerFactory tFactory = TransformerFactory.newInstance(); - // Determine whether the TransformerFactory supports the - // use of SAXSource and SAXResult - if (tFactory.getFeature(SAXSource.FEATURE) - && tFactory.getFeature(SAXResult.FEATURE)) { - // Cast the TransformerFactory to SAXTransformerFactory. - SAXTransformerFactory saxTFactory = - ((SAXTransformerFactory)tFactory); - // Create an XMLFilter for each stylesheet. - XMLFilter xmlfilter = - saxTFactory.newXMLFilter(xsltSource); - - // Create an XMLReader. - XMLReader parser = createParser(); - if (parser == null) { - throw new FOrayException("Unable to create SAX parser"); - } - - // xmlFilter uses the XMLReader as its reader. - xmlfilter.setParent(parser); - return xmlfilter; - } - throw new FOrayException("Your parser doesn't support the " - + "features SAXSource and SAXResult.\n" - + "Use an XSL parser which supports TrAX"); - } catch (Exception ex) { - throw new FOrayException(ex); - } - } - - - /** - * Creates from the transformer an instance of an XMLFilter which - * then can be used in a chain with the XMLReader passed to Driver. This way - * during the conversion of the xml file + xslt stylesheet the resulting - * data is fed into FOray. This should help to avoid memory problems - * @param xmlfile The xmlfile containing the text data - * @param xsltfile An xslt stylesheet - * @return XMLFilter an XMLFilter which can be chained together with other - * XMLReaders or XMLFilters - */ - public XMLFilter getXMLFilter(File xmlfile, File xsltfile) - throws FOrayException { - return getXMLFilter(new StreamSource(xsltfile)); - } - - public void setParameter(String name, Object value) { - transformer.setParameter(name, value); - } - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-18 16:22:45
|
Revision: 7794 Author: victormote Date: 2006-07-18 09:22:37 -0700 (Tue, 18 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7794&view=rev Log Message: ----------- Add constructor that takes URLs for transformation. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-07-18 16:07:41 UTC (rev 7793) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-07-18 16:22:37 UTC (rev 7794) @@ -44,14 +44,7 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.stream.StreamSource; - /** * Superclass for all classes which start FOray from the commandline. */ @@ -103,30 +96,9 @@ document = new FOrayDocument(session, saxInputSource, parser); } else { - InputStream xmlInputStream = null; - try { - xmlInputStream = commandLineOptions.getXMLFile() - .openStream(); - } catch (IOException e) { - throw new FOrayException(e); - } - Source xmlSource = new StreamSource(xmlInputStream); - InputStream xsltInputStream = null; - try { - xsltInputStream = commandLineOptions.getXSLFile() - .openStream(); - } catch (IOException e) { - throw new FOrayException(e); - } - Source xsltSource = new StreamSource(xsltInputStream); - TransformerFactory factory = TransformerFactory.newInstance(); - Transformer transformer = null; - try { - transformer = factory.newTransformer(xsltSource); - } catch (TransformerConfigurationException e) { - throw new FOrayException(e); - } - document = new FOrayDocument(session, transformer, xmlSource); + document = new FOrayDocument(session, + commandLineOptions.getXMLFile(), + commandLineOptions.getXSLFile()); } /* Modified: trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java 2006-07-18 16:07:41 UTC (rev 7793) +++ trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java 2006-07-18 16:22:37 UTC (rev 7794) @@ -42,13 +42,17 @@ import org.xml.sax.XMLReader; import java.io.IOException; +import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import javax.xml.transform.Source; import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamSource; /** * This class manages the process of parsing an input FO document and creating @@ -152,6 +156,38 @@ } /** + * Constructor for JAXP processing, using supplied URLs to the xml and + * xslt input. + * @param session The parent FOraySession. + */ + public FOrayDocument (FOraySession session, URL xmlInput, URL xsltInput) + throws FOrayException { + this(session); + InputStream xmlInputStream = null; + try { + xmlInputStream = xmlInput.openStream(); + } catch (IOException e) { + throw new FOrayException(e); + } + this.jaxpSource = new StreamSource(xmlInputStream); + InputStream xsltInputStream = null; + try { + xsltInputStream = xsltInput.openStream(); + } catch (IOException e) { + throw new FOrayException(e); + } + Source xsltSource = new StreamSource(xsltInputStream); + TransformerFactory factory = TransformerFactory.newInstance(); + this.jaxpTransformer = null; + try { + this.jaxpTransformer = factory.newTransformer(xsltSource); + } catch (TransformerConfigurationException e) { + throw new FOrayException(e); + } + this.jaxpResult = new SAXResult(this.treeBuilder); + } + + /** * Registers a FOrayTarget instance that this FOrayDocument should process. * @param target The FOrayTarget instance that should be processed. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-18 16:08:01
|
Revision: 7793 Author: victormote Date: 2006-07-18 09:07:41 -0700 (Tue, 18 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7793&view=rev Log Message: ----------- Move the ISO-639 logic to a new Common class, and bring it up to date. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Language.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLanguage.java Added Paths: ----------- trunk/foray/foray-common/src/java/org/foray/common/ISO639.java Added: trunk/foray/foray-common/src/java/org/foray/common/ISO639.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/ISO639.java (rev 0) +++ trunk/foray/foray-common/src/java/org/foray/common/ISO639.java 2006-07-18 16:07:41 UTC (rev 7793) @@ -0,0 +1,642 @@ +/* + * Copyright 2006 The FOray Project. + * http://www.foray.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * This work is in part derived from the following work(s), used with the + * permission of the licensor: + * Apache FOP, licensed by the Apache Software Foundation + * + */ + +/* $Id$ */ + +package org.foray.common; + +import java.util.Arrays; + +/** + * Utility class for validating ISO language codes using the ISO-639 standard. + * + */ +public class ISO639 { + + /** + * This list is derived from + * http://www.loc.gov/standards/iso639-2/langcodes.html. + * Element 0 is the 3-letter code, element 1 is the 2-letter code (if any), + * element 2 is the English language name, and element 3 is the French + * language name. + */ + private static String[][] rawCodes = { + {"aar", "aa", "Afar", "afar"}, + {"abk", "ab", "Abkhazian", "abkhaze"}, + {"ace", null, "Achinese", "aceh"}, + {"ach", null, "Acoli", "acoli"}, + {"ada", null, "Adangme", "adangme"}, + {"ady", null, "Adyghe; Adygei", "adygh\xE9"}, + {"afa", null, "Afro-Asiatic (Other)", + "afro-asiatiques, autres langues"}, + {"afh", null, "Afrihili", "afrihili"}, + {"afr", "af", "Afrikaans", "afrikaans"}, + {"ain", null, "Ainu", "a\xEFnou"}, + {"aka", "ak", "Akan", "akan"}, + {"akk", null, "Akkadian", "akkadien"}, + {"alb", "sq", "Albanian", "albanais"}, + {"ale", null, "Aleut", "al\xE9oute"}, + {"alg", null, "Algonquian languages", "algonquines, langues"}, + {"alt", null, "Southern Altai", "alta\xEF du Sud"}, + {"amh", "am", "Amharic", "amharique"}, + {"ang", null, "English, Old (ca.450-1100)", + "anglo-saxon (ca.450-1100)"}, + {"anp", null, "Angika", "angika"}, + {"apa", null, "Apache languages", "apache"}, + {"ara", "ar", "Arabic", "arabe"}, + {"arc", null, "Aramaic", "aram\xE9en"}, + {"arg", "an", "Aragonese", "aragonais"}, + {"arm", "hy", "Armenian", "arm\xE9nien"}, + {"arn", null, "Araucanian", "araucan"}, + {"arp", null, "Arapaho", "rapaho"}, + {"art", null, "Artificial (Other)", + "artificielles, autres langues"}, + {"arw", null, "Arawak", "arawak"}, + {"asm", "as", "Assamese", "assamais"}, + {"ast", null, "Asturian; Bable", " asturien; bable"}, + {"ath", null, "Athapascan languages", "athapascanes, langues"}, + {"aus", null, "Australian languages", "australiennes, langues"}, + {"ava", "av", "Avaric", "avar"}, + {"ave", "ae", "Avestan", "avestique"}, + {"awa", null, "Awadhi", "awadhi"}, + {"aym", "ay", "Aymara", "aymara"}, + {"aze", "az", "Azerbaijani", "az\xE9ri"}, + {"bad", null, "Banda", " banda"}, + {"bai", null, "Bamileke languages", "bamil\xE9k\xE9s, langues"}, + {"bak", "ba", "Bashkir", "bachkir"}, + {"bal", null, "Baluchi", "baloutchi"}, + {"bam", "bm", "Bambara", "bambara"}, + {"ban", null, "Balinese", "balinais"}, + {"baq", "eu", "Basque", "basque"}, + {"bas", null, "Basa", "basa"}, + {"bat", null, "Baltic (Other)", "baltiques, autres langues"}, + {"bej", null, "Beja", "bedja"}, + {"bel", "be", "Belarusian", "bi\xE9lorusse"}, + {"bem", null, "Bemba", "bemba"}, + {"ben", "bn", "Bengali", "bengali"}, + {"ber", null, "Berber (Other)", "berb\xE8res, autres langues"}, + {"bho", null, "Bhojpuri", "bhojpuri"}, + {"bih", "bh", "Bihari", "bihari"}, + {"bik", null, "Bikol", "bikol"}, + {"bin", null, "Bini", "bini"}, + {"bis", "bi", "Bislama", "bichlamar"}, + {"bla", null, "Siksika", "blackfoot"}, + {"bnt", null, "Bantu (Other)", "bantoues, autres langues"}, + {"tib", "bo", "Tibetan", "tib\xE9tain"}, + {"bos", "bs", "Bosnian", "bosniaque"}, + {"bra", null, "Braj", "braj"}, + {"bre", "br", "Breton", "breton"}, + {"btk", null, "Batak (Indonesia)", "batak (Indon\xE9sie)"}, + {"bua", null, "Buriat", "bouriate"}, + {"bug", null, "Buginese", "bugi"}, + {"bul", "bg", "Bulgarian", "bulgare"}, + {"bur", "my", "Burmese", "birman"}, + {"byn", null, "Blin; Bilin", "blin; bilen"}, + {"cad", null, "Caddo", "caddo"}, + {"cai", null, "Central American Indian (Other)", + "indiennes d'Am\xE9rique centrale, autres langues"}, + {"car", null, "Carib", "caribe"}, + {"cat", "ca", "Catalan; Valencian", "catalan; valencien"}, + {"cau", null, "Caucasian (Other)", "caucasiennes, autres langues"}, + {"ceb", null, "Cebuano", "cebuano"}, + {"cel", null, "Celtic (Other)", "celtiques, autres langues"}, + {"cze", "cs", "Czech", "tch\xE8que"}, + {"cha", "ch", "Chamorro", "chamorro"}, + {"chb", null, "Chibcha", " chibcha"}, + {"che", "ce", "Chechen", "tch\xE9tch\xE8ne"}, + {"chg", null, "Chagatai", "djaghata\xEF"}, + {"chi", "zh", "Chinese", "chinois"}, + {"chk", null, "Chuukese", "chuuk"}, + {"chm", null, "Mari", "mari"}, + {"chn", null, "Chinook jargon", "chinook, jargon"}, + {"cho", null, "Choctaw", "choctaw"}, + {"chp", null, "Chipewyan", "chipewyan"}, + {"chr", null, "Cherokee", "cherokee"}, + {"chu", "cu", "Church Slavic; Old Slavonic; Church Slavonic; " + + "Old Bulgarian; Old Church Slavonic", + "slavon d'\xE9glise; vieux slave; slavon liturgique; vieux " + + "bulgare"}, + {"chv", "cv", "Chuvash", "tchouvache"}, + {"chy", null, "Cheyenne", "cheyenne"}, + {"cmc", null, "Chamic languages", "chames, langues"}, + {"cop", null, "Coptic", "copte"}, + {"cor", "kw", "Cornish", "cornique"}, + {"cos", "co", "Corsican", "corse"}, + {"cpe", null, "Creoles and pidgins, English based (Other)", + "cr\xE9oles et pidgins anglais, autres"}, + {"cpf", null, "Creoles and pidgins, French-based (Other)", + "cr\xE9oles et pidgins fran\xE7ais, autres"}, + {"cpp", null, "Creoles and pidgins, Portuguese-based (Other)", + "cr\xE9oles et pidgins portugais, autres"}, + {"cre", "cr", "Cree", "cree"}, + {"crh", null, "Crimean Tatar; Crimean Turkish", "tatar de Crim\xE9"}, + {"crp", null, "Creoles and pidgins (Other)", + "cr\xE9oles et pidgins divers"}, + {"csb", null, "Kashubian", "kachoube"}, + {"cus", null, "Cushitic (Other)", "couchitiques, autres langues"}, + {"wel", "cy", "Welsh", "gallois"}, + {"cze", "cs", "Czech", "tch\xE8que"}, + {"dak", null, "Dakota", "dakota"}, + {"dan", "da", "Danish", "danois"}, + {"dar", null, "Dargwa", "dargwa"}, + {"day", null, "Dayak", "dayak"}, + {"del", null, "Delaware", "delaware"}, + {"den", null, "Slave (Athapascan)", "esclave (athapascan)"}, + {"ger", "de", "German", "allemand"}, + {"dgr", null, "Dogrib", "dogrib"}, + {"din", null, "Dinka", "dinka"}, + {"div", "dv", "Divehi; Dhivehi; Maldivian", " maldivien"}, + {"doi", null, "Dogri", "dogri"}, + {"dra", null, "Dravidian (Other)", "dravidiennes, autres langues"}, + {"dsb", null, "Lower Sorbian", "bas-sorabe"}, + {"dua", null, "Duala", "douala"}, + {"dum", null, "Dutch, Middle (ca.1050-1350)", + "n\xE9erlandais moyen (ca. 1050-1350)"}, + {"dut", "nl", "Dutch; Flemish", "n\xE9erlandais; flamand"}, + {"dyu", null, "Dyula", "dioula"}, + {"dzo", "dz", "Dzongkha", "dzongkha"}, + {"efi", null, "Efik", "efik"}, + {"egy", null, "Egyptian (Ancient)", "\xE9gyptien"}, + {"eka", null, "Ekajuk", "ekajuk"}, + {"gre", "el", "Greek, Modern (1453-)", "grec moderne (apr\xE8s 1453)"}, + {"elx", null, "Elamite", "\xE9lamite"}, + {"eng", "en", "English", "anglais"}, + {"enm", null, "English, Middle (1100-1500)", + "anglais moyen (1100-1500)"}, + {"epo", "eo", "Esperanto", "esp\xE9ranto"}, + {"est", "et", "Estonian", "estonien"}, + {"baq", "eu", "Basque", "basque"}, + {"ewe", "ee", "Ewe", "\xE9w\xE9"}, + {"ewo", null, "Ewondo", "\xE9wondo"}, + {"fan", null, "Fang", "fang"}, + {"fao", "fo", "Faroese", "f\xE9ro\xEFen"}, + {"per", "fa", "Persian", "persan"}, + {"fat", null, "Fanti", "fanti"}, + {"fij", "fj", "Fijian", "fidjien"}, + {"fil", null, "Filipino; Pilipino", "filipino; pilipino"}, + {"fin", "fi", "Finnish", "finnois"}, + {"fiu", null, "Finno-Ugrian (Other)", + "finno-ougriennes, autres langues"}, + {"fon", null, "Fon", "fon"}, + {"fre", "fr", "French", "fran\xE7ais"}, + {"frm", null, "French, Middle (ca.1400-1600)", + "fran\xE7ais moyen (1400-1600)"}, + {"fro", null, "French, Old (842-ca.1400)", + "fran\xE7ais ancien (842-ca.1400)"}, + {"frr", null, "Northern Frisian", "frison septentrional"}, + {"frs", null, "Eastern Frisian", "frison oriental"}, + {"fry", "fy", "Western Frisian", "frison occidental"}, + {"ful", "ff", "Fulah", "peul"}, + {"fur", null, "Friulian", "frioulan"}, + {"gaa", null, "Ga", "ga"}, + {"gay", null, "Gayo", " gayo"}, + {"gba", null, "Gbaya", "gbaya"}, + {"gem", null, "Germanic (Other)", "germaniques, autres langues"}, + {"geo", "ka", "Georgian", "g\xE9orgien"}, + {"ger", "de", "German", "allemand"}, + {"gez", null, "Geez", "gu\xE8ze"}, + {"gil", null, "Gilbertese", "kiribati"}, + {"gla", "gd", "Gaelic; Scottish Gaelic", + "ga\xE9lique; ga\xE9lique \xE9cossais"}, + {"gle", "ga", "Irish", "irlandais"}, + {"glg", "gl", "Galician galicien"}, + {"glv", "gv", "Manx", "manx; mannois"}, + {"gmh", null, "German, Middle High (ca.1050-1500)", + "allemand, moyen haut (ca. 1050-1500)"}, + {"goh", null, "German, Old High (ca.750-1050)", + "allemand, vieux haut (ca. 750-1050)"}, + {"gon", null, "Gondi", "gond"}, + + {"gor", null, "Gorontalo", "gorontalo"}, + {"got", null, "Gothic", "gothique"}, + {"grb", null, "Grebo", "grebo"}, + {"grc", null, "Greek, Ancient (to 1453)", + "grec ancien (jusqu'\xE0 1453)"}, + {"gre", "el", "Greek, Modern (1453-)", "grec moderne (apr\xE8s 1453)"}, + {"grn", "gn", "Guarani", "guarani"}, + {"gsw", null, "Alemanic; Swiss German", " al\xE9manique"}, + {"guj", "gu", "Gujarati", "goudjrati"}, + {"gwi", null, "Gwich\xB4in", "gwich\xB4in"}, + {"hai", null, "Haida", "haida"}, + {"hat", "ht", "Haitian; Haitian Creole", "ha\xEFtien; cr\xE9ole ha\xEFtien"}, + {"hau", "ha", "Hausa", "haoussa"}, + {"haw", null, "Hawaiian", "hawa\xEFen"}, + {"heb", "he", "Hebrew", "h\xE9breu"}, + {"her", "hz", "Herero", " herero"}, + {"hil", null, "Hiligaynon", "hiligaynon"}, + {"him", null, "Himachali", "himachali"}, + {"hin", "hi", "Hindi", "hindi"}, + {"hit", null, "Hittite", "hittite"}, + {"hmn", null, "Hmong", "hmong"}, + {"hmo", "ho", "Hiri Motu", "hiri motu"}, + {"scr", "hr", "Croatian", "croate"}, + {"hsb", null, "Upper Sorbian", "haut-sorabe"}, + {"hun", "hu", "Hungarian", "hongrois"}, + {"hup", null, "Hupa", "hupa"}, + {"arm", "hy", "Armenian", "arm\xE9nien"}, + {"iba", null, "Iban", "iban"}, + {"ibo", "ig", "Igbo", "igbo"}, + {"ice", "is", "Icelandic", "islandais"}, + {"ido", "io", "Ido", "ido"}, + {"iii", "ii", "Sichuan Yi", "yi de Sichuan"}, + {"ijo", null, "Ijo", "ijo"}, + {"iku", "iu", "Inuktitut", "inuktitut"}, + {"ile", "ie", "Interlingue", "interlingue"}, + {"ilo", null, "Iloko", "ilocano"}, + {"ina", "ia", "Interlingua (International Auxiliary Language " + + "Association)", + "interlingua (langue auxiliaire internationale)"}, + {"inc", null, "Indic (Other)", "indo-aryennes, autres langues"}, + {"ind", "id", "Indonesian", "indon\xE9sien"}, + {"ine", null, "Indo-European (Other)", + "indo-europ\xE9ennes, autres langues"}, + {"inh", null, "Ingush", "ingouche"}, + {"ipk", "ik", "Inupiaq", "inupiaq"}, + {"ira", null, "Iranian (Other)", "iraniennes, autres langues"}, + {"iro", null, "Iroquoian languages", + "iroquoises, langues (famille)"}, + {"ice", "is", "Icelandic", "islandais"}, + {"ita", "it", "Italian", "italien"}, + {"jav", "jv", "Javanese", "javanais"}, + {"jbo", null, "Lojban", "lojban"}, + {"jpn", "ja", "Japanese", "japonais"}, + {"jpr", null, "Judeo-Persian", "jud\xE9o-persan"}, + {"jrb", null, "Judeo-Arabic", "jud\xE9o-arabe"}, + {"kaa", null, "Kara-Kalpak", "karakalpak"}, + {"kab", null, "Kabyle", "kabyle"}, + {"kac", null, "Kachin", "kachin"}, + {"kal", "kl", "Kalaallisut; Greenlandic", "groenlandais"}, + {"kam", null, "Kamba", "kamba"}, + {"kan", "kn", "Kannada", "kannada"}, + {"kar", null, "Karen", "karen"}, + {"kas", "ks", "Kashmiri", "kashmiri"}, + {"geo", "ka", "Georgian", "g\xE9orgien"}, + {"kau", "kr", "Kanuri", "kanouri"}, + {"kaw", null, "Kawi", "kawi"}, + {"kaz", "kk", "Kazakh", "kazakh"}, + {"kbd", null, "Kabardian", "kabardien"}, + {"kha", null, "Khasi", "khasi"}, + {"khi", null, "Khoisan (Other)", "khoisan, autres langues"}, + {"khm", "km", "Khmer", "khmer"}, + {"kho", null, "Khotanese", "khotanais"}, + {"kik", "ki", "Kikuyu; Gikuyu", "kikuyu"}, + {"kin", "rw", "Kinyarwanda", "rwanda"}, + {"kir", "ky", "Kirghiz", "kirghize"}, + {"kmb", null, "Kimbundu", "kimbundu"}, + {"kok", null, "Konkani", "konkani"}, + {"kom", "kv", "Komi", "kom"}, + {"kon", "kg", "Kongo", "kongo"}, + {"kor", "ko", "Korean", "cor\xE9en"}, + {"kos", null, "Kosraean", "kosrae"}, + {"kpe", null, "Kpelle", "kpell\xE9"}, + {"krc", null, "Karachay-Balkar", "karatcha\xEF balkar"}, + {"krl", null, "Karelian", "car\xE9lien"}, + {"kro", null, "Kru", "krou"}, + {"kru", null, "Kurukh", "kurukh"}, + {"kua", "kj", "Kuanyama; Kwanyama", "kuanyama; kwanyama"}, + {"kum", null, "Kumyk", "koumyk"}, + {"kur", "ku", "Kurdish", "kurde"}, + {"kut", null, "Kutenai", "kutenai"}, + {"lad", null, "Ladino", "jud\xE9o-espagnol"}, + {"lah", null, "Lahnda", "lahnda"}, + {"lam", null, "Lamba", "lamba"}, + {"lao", "lo", "Lao", "lao"}, + {"lat", "la", "Latin", "latin"}, + {"lav", "lv", "Latvian", "letton"}, + {"lez", null, "Lezghian", "lezghien"}, + {"lim", "li", "Limburgan; Limburger;", "Limburgish limbourgeois"}, + {"lin", "ln", "Lingala", "lingala"}, + {"lit", "lt", "Lithuanian", "lituanien"}, + {"lol", null, "Mongo", "mongo"}, + {"loz", null, "Lozi", "lozi"}, + {"ltz", "lb", "Luxembourgish; Letzeburgesch", "luxembourgeois"}, + {"lua", null, "Luba-Lulua", "luba-lulua"}, + {"lub", "lu", "Luba-Katanga", "luba-katanga"}, + {"lug", "lg", "Ganda", "ganda"}, + {"lui", null, "Luiseno", "luiseno"}, + {"lun", null, "Lunda", "lunda"}, + {"luo", null, "Luo (Kenya and Tanzania)", + "luo (Kenya et Tanzanie)"}, + {"lus", null, "lushai", "Lushai"}, + {"mac", "mk", "Macedonian", "mac\xE9donien"}, + {"mad", null, "Madurese", "madourais"}, + {"mag", null, "Magahi", "magahi"}, + {"mah", "mh", "Marshallese", "marshall"}, + {"mai", null, "Maithili", "maithili"}, + {"mak", null, "Makasar", "makassar"}, + {"mal", "ml", "Malayalam", "malayalam"}, + {"man", null, "Mandingo", "mandingue"}, + {"mao", "mi", "Maori", "maori"}, + {"map", null, "Austronesian (Other)", + "malayo-polyn\xE9siennes, autres langues"}, + {"mar", "mr", "Marathi", "marathe"}, + {"mas", null, "Masai", "massa\xEF"}, + {"may", "ms", "Malay", "malais"}, + {"mdf", null, "Moksha", "moksa"}, + {"mdr", null, "Mandar", "mandar"}, + {"men", null, "Mende", "mend\xE9"}, + {"mga", null, "Irish, Middle (900-1200)", + "irlandais moyen (900-1200)"}, + {"mic", null, "Mi'kmaq; Micmac", "mi'kmaq; micmac"}, + {"min", null, "Minangkabau", "minangkabau"}, + {"mis", null, "Miscellaneous languages", "diverses, langues"}, + {"mac", "mk", "Macedonian", "mac\xE9donien"}, + {"mkh", null, "Mon-Khmer (Other)", "m\xF4n-khmer, autres langues"}, + {"mlg", "mg", "Malagasy", "malgache"}, + {"mlt", "mt", "Maltese", "maltais"}, + {"mnc", null, "Manchu", "mandchou"}, + {"mni", null, "Manipuri", "manipuri"}, + {"mno", null, "Manobo languages", " manobo, langues"}, + {"moh", null, "Mohawk", "mohawk"}, + {"mol", "mo", "Moldavian", "moldave"}, + {"mon", "mn", "Mongolian", "mongol"}, + {"mos", null, "Mossi", "mor\xE9"}, + {"mao", "mi", "Maori", "maori"}, + {"may", "ms", "Malay", "malais"}, + {"mul", null, "Multiple languages", "multilingue"}, + {"mun", null, "Munda languages", "mounda, langues"}, + {"mus", null, "Creek", "muskogee"}, + {"mwl", null, "Mirandese", "mirandais"}, + {"mwr", null, "Marwari", "marvari"}, + {"bur", "my", "Burmese", "birman"}, + {"myn", null, "Mayan languages", "maya, langues"}, + {"myv", null, "Erzya", "erza"}, + {"nah", null, "Nahuatl", "nahuatl"}, + {"nai", null, "North American Indian", + "indiennes d'Am\xE9rique du Nord, autres langues"}, + {"nap", null, "Neapolitan", "napolitain"}, + {"nau", "na", "Nauru", "nauruan"}, + {"nav", "nv", "Navajo; Navaho", "navaho"}, + {"nbl", "nr", "Ndebele, South; South Ndebele", "nd\xE9b\xE9l\xE9 du Sud"}, + {"nde", "nd", "Ndebele, North; North Ndebele", "nd\xE9b\xE9l\xE9 du Nord"}, + {"ndo", "ng", "Ndonga", "ndonga"}, + {"nds", null, "Low German; Low Saxon; German, Low; Saxon, Low", + "bas allemand; bas saxon; allemand, bas; saxon, bas"}, + {"nep", "ne", "Nepali", "n\xE9palais"}, + {"new", null, "Newari; Nepal Bhasa", "newari; nepal bhasa"}, + {"nia", null, "Nias", "nias"}, + {"nic", null, "Niger-Kordofanian (Other)", + "nig\xE9ro-congolaises, autres langues"}, + {"niu", null, "Niuean", "niu\xE9"}, + {"dut", "nl", "Dutch; Flemish", "n\xE9erlandais; flamand"}, + {"nno", "nn", "Norwegian Nynorsk; Nynorsk, Norwegian", + "norv\xE9gien nynorsk; nynorsk, norv\xE9gien"}, + {"nob", "nb", "Norwegian Bokm\xE5l; Bokm\xE5l, Norwegian", + "norv\xE9gien bokm\xE5l; bokm\xE5l, norv\xE9gien"}, + {"nog", null, "Nogai", "noga\xEF; nogay"}, + {"non", null, "Norse, Old", "norrois, vieux"}, + {"nor", "no", "Norwegian", "norv\xE9gien"}, + {"nqo", null, "N'ko", "n'ko"}, + {"nso", null, "Northern Sotho, Pedi; Sepedi", + "sotho du Nord; pedi; sepedi"}, + {"nub", null, "Nubian languages", "nubiennes, langues"}, + {"nwc", null, "Classical Newari; Old Newari; Classical Nepal", + "Bhasa newari classique"}, + {"nya", "ny", "Chichewa; Chewa; Nyanja", "chichewa; chewa; nyanja"}, + {"nym", null, "Nyamwezi", "nyamwezi"}, + {"nyn", null, "Nyankole", "nyankol\xE9"}, + {"nyo", null, "Nyoro", "nyoro"}, + {"nzi", null, "Nzima", "nzema"}, + {"oci", "oc", "Occitan (post 1500); Proven\xE7al", + "occitan (apr\xE8s 1500); proven\xE7al"}, + {"oji", "oj", "Ojibwa", "ojibwa"}, + {"ori", "or", "Oriya", "oriya"}, + {"orm", "om", "Oromo", "galla"}, + {"osa", null, "Osage", "osage"}, + {"oss", "os", "Ossetian; Ossetic", "oss\xE8te"}, + {"ota", null, "Turkish, Ottoman (1500-1928)", + "turc ottoman (1500-1928)"}, + {"oto", null, "Otomian languages", "otomangue, langues"}, + {"paa", null, "Papuan (Other)", "papoues, autres langues"}, + {"pag", null, "Pangasinan", "pangasinan"}, + {"pal", null, "Pahlavi", "pahlavi"}, + {"pam", null, "Pampanga", "pampangan"}, + {"pan", "pa", "Panjabi; Punjabi", "pendjabi"}, + {"pap", null, "Papiamento", "papiamento"}, + {"pau", null, "Palauan", "palau"}, + {"peo", null, "Persian, Old (ca.600-400 B.C.)", + "perse, vieux (ca. 600-400 av. J.-C.)"}, + {"per", "fa", "Persian", "persan"}, + {"phi", null, "Philippine (Other)", "philippines, autres langues"}, + {"phn", null, "Phoenician", "ph\xE9nicien"}, + {"pli", "pi", "Pali", "pali"}, + {"pol", "pl", "Polish", "polonais"}, + {"pon", null, "Pohnpeian", "pohnpei"}, + {"por", "pt", "Portuguese", "portugais"}, + {"pra", null, "Prakrit languages", "pr\xE2krit"}, + {"pro", null, "Proven\xE7al, Old (to 1500)", + "proven\xE7al ancien (jusqu'\xE0 1500)"}, + {"pus", "ps", "Pushto", "pachto"}, + {"que", "qu", "Quechua", "quechua"}, + {"raj", null, "Rajasthani", "rajasthani"}, + {"rap", null, "Rapanui", "rapanui"}, + {"rar", null, "Rarotongan", "rarotonga"}, + {"roa", null, "Romance (Other)", "romanes, autres langues"}, + {"roh", "rm", "Raeto-Romance", "rh\xE9to-roman"}, + {"rom", null, "Romany", "tsigane"}, + {"rum", "ro", "Romanian", "roumain"}, + {"run", "rn", "Rundi", "rundi"}, + {"rup", null, "Aromanian; Arumanian; Macedo-Romanian", + "aroumain; mac\xE9do-roumain"}, + {"rus", "ru", "Russian", "russe"}, + {"sad", null, "Sandawe", "sandawe"}, + {"sag", "sg", "Sango", "sango"}, + {"sah", null, "Yakut", "iakoute"}, + {"sai", null, "South American Indian (Other)", + "indiennes d'Am\xE9rique du Sud autres langues"}, + {"sal", null, "Salishan languages", "salish, langues"}, + {"sam", null, "Samaritan Aramaic", "samaritain"}, + {"san", "sa", "Sanskrit", "sanskrit"}, + {"sas", null, "Sasak", "sasak"}, + {"sat", null, "Santali", "santal"}, + {"scc", "sr", "Serbian", "serbe"}, + {"scn", null, "Sicilian", "sicilien"}, + {"sco", null, "Scots", "\xE9cossais"}, + {"scr", "hr", "Croatian", "croate"}, + {"sel", null, "Selkup", "selkoupe"}, + {"sem", null, "Semitic (Other)", "s\xE9mitiques, autres langues"}, + {"sga", null, "Irish, Old (to 900)", + "irlandais ancien (jusqu'\xE0 900)"}, + {"sgn", null, "Sign Languages", "langues des signes"}, + {"shn", null, "Shan", "chan"}, + {"sid", null, "Sidamo", "sidamo"}, + {"sin", "si", "Sinhala; Sinhalese", "singhalais"}, + {"sio", null, "Siouan languages", "sioux, langues"}, + {"sit", null, "Sino-Tibetan (Other)", + "sino-tib\xE9taines, autres langues"}, + {"sla", null, "Slavic (Other)", "slaves, autres langues"}, + {"slo", "sk", "Slovak", "slovaque"}, + {"slv", "sl", "Slovenian", "slov\xE8ne"}, + {"sma", null, "Southern Sami", "sami du Sud"}, + {"sme", "se", "Northern Sami", "sami du Nord"}, + {"smi", null, "Sami languages (Other)", "sami, autres langues"}, + {"smj", null, "Lule Sami", "sami de Lule"}, + {"smn", null, "Inari Sami", "sami d'Inari"}, + {"smo", "sm", "Samoan", "samoan"}, + {"sms", null, "Skolt Sami", "sami skolt"}, + {"sna", "sn", "Shona", "shona"}, + {"snd", "sd", "Sindhi", "sindhi"}, + {"snk", null, "Soninke", "sonink\xE9"}, + {"sog", null, "Sogdian", "sogdien"}, + {"som", "so", "Somali", "somali"}, + {"son", null, "Songhai", "songhai"}, + {"sot", "st", "Sotho, Southern", "sotho du Sud"}, + {"spa", "es", "Spanish; Castilian", "espagnol; castillan"}, + {"alb", "sq", "Albanian", "albanais"}, + {"srd", "sc", "Sardinian", "sarde"}, + {"srn", null, "Sranan Togo", "sranan togo"}, + {"scc", "sr", "Serbian", "serbe"}, + {"srr", null, "Serer", "s\xE9r\xE8re"}, + {"ssa", null, "Nilo-Saharan (Other)", + "nilo-sahariennes, autres langues"}, + {"ssw", "ss", "Swati", "swati"}, + {"suk", null, "Sukuma", "sukuma"}, + {"sun", "su", "Sundanese", "soundanais"}, + {"sus", null, "Susu", "soussou"}, + {"sux", null, "Sumerian", "sum\xE9rien"}, + {"swa", "sw", "Swahili", "swahili"}, + {"swe", "sv", "Swedish", "su\xE9dois"}, + {"syr", null, "Syriac", "syriaque"}, + {"tah", "ty", "Tahitian", "tahitien"}, + {"tai", null, "Tai (Other)", "tha\xEFes, autres langues"}, + {"tam", "ta", "Tamil", "tamoul"}, + {"tat", "tt", "Tatar", "tatar"}, + {"tel", "te", "Telugu", "t\xE9lougou"}, + {"tem", null, "Timne", "temne"}, + {"ter", null, "Tereno", "tereno"}, + {"tet", null, "Tetum", "tetum"}, + {"tgk", "tg", "Tajik", "tadjik"}, + {"tgl", "tl", "Tagalog", "tagalog"}, + {"tha", "th", "Thai", "tha\xEF"}, + {"tib", "bo", "Tibetan", "tib\xE9tain"}, + {"tig", null, "Tigre", "tigr\xE9"}, + {"tir", "ti", "Tigrinya", "tigrigna"}, + {"tiv", null, "Tiv", "tiv"}, + {"tkl", null, "Tokelau", "tokelau"}, + {"tlh", null, "Klingon; tlhIngan-Hol", "klingon"}, + {"tli", null, "Tlingit", "tlingit"}, + {"tmh", null, "Tamashek", "tamacheq"}, + {"tog", null, "Tonga (Nyasa)", "tonga (Nyasa)"}, + {"ton", "to", "Tonga (Tonga Islands)", "tongan (\xCEles Tonga)"}, + {"tpi", null, "Tok Pisin", "tok pisin"}, + {"tsi", null, "Tsimshian", "tsimshian"}, + {"tsn", "tn", "Tswana", "tswana"}, + {"tso", "ts", "Tsonga", "tsonga"}, + {"tuk", "tk", "Turkmen", "turkm\xE8ne"}, + {"tum", null, "Tumbuka", "tumbuka"}, + {"tup", null, "Tupi languages", "tupi, langues"}, + {"tur", "tr", "Turkish", "turc"}, + {"tut", null, "Altaic (Other)", "alta\xEFques, autres langues"}, + {"tvl", null, "Tuvalu", "tuvalu"}, + {"twi", "tw", "Twi", "twi"}, + {"tyv", null, "Tuvinian", "touva"}, + {"udm", null, "Udmurt", "oudmourte"}, + {"uga", null, "Ugaritic", "ougaritique"}, + {"uig", "ug", "Uighur; Uyghur", "ou\xEFgour"}, + {"ukr", "uk", "Ukrainian", "ukrainien"}, + {"umb", null, "Umbundu", "umbundu"}, + {"und", null, "Undetermined", "ind\xE9termin\xE9e"}, + {"urd", "ur", "Urdu", "ourdou"}, + {"uzb", "uz", "Uzbek", "ouszbek"}, + {"vai", null, "Vai", "va\xEF"}, + {"ven", "ve", "Venda", "venda"}, + {"vie", "vi", "Vietnamese", "vietnamien"}, + {"vol", "vo", "Volap\xFCk", "volap\xFCk"}, + {"vot", null, "Votic", "vote"}, + {"wak", null, "Wakashan languages", "wakashennes, langues"}, + {"wal", null, "Walamo", "walamo"}, + {"war", null, "Waray", "waray"}, + {"was", null, "Washo", "washo"}, + {"wel", "cy", "Welsh", "gallois"}, + {"wen", null, "Sorbian languages", "sorabes, langues"}, + {"wln", "wa", "Walloon", "wallon"}, + {"wol", "wo", "Wolof", "wolof"}, + {"xal", null, "Kalmyk; Oirat", "kalmouk; o\xEFrat"}, + {"xho", "xh", "Xhosa", "xhosa"}, + {"yao", null, "Yao", "yao"}, + {"yap", null, "Yapese", "yapois"}, + {"yid", "yi", "Yiddish", "yiddish"}, + {"yor", "yo", "Yoruba", "yoruba"}, + {"ypk", null, "Yupik languages yupik,", "langues"}, + {"zap", null, "Zapotec", "zapot\xE8que"}, + {"zen", null, "Zenaga", "zenaga"}, + {"zha", "za", "Zhuang; Chuang", "zhuang; chuang"}, + {"chi", "zh", "Chinese", "chinois"}, + {"znd", null, "Zande", "zand\xE9"}, + {"zul", "zu", "Zulu", "zoulou"}, + {"zun", null, "Zuni", "zuni"}, + {"zxx", null, "No linguistic content", + "pas de contenu linguistique"}, + }; + + private static String[] codes3Letter; + private static String[] codes2Letter; + + static { + /* Build the 3-letter codes array.*/ + int count2LetterCodes = 0; + codes3Letter = new String[rawCodes.length]; + for (int i = 0; i < rawCodes.length; i++) { + codes3Letter[i] = rawCodes[i][0]; + if (rawCodes[i][1] != null) { + count2LetterCodes ++; + } + } + Arrays.sort(codes3Letter); + + /* Build the 2-letter codes array. */ + codes2Letter = new String[count2LetterCodes]; + count2LetterCodes = 0; + for (int i = 0; i < rawCodes.length; i++) { + if (rawCodes[i][1] != null) { + codes2Letter[count2LetterCodes] = rawCodes[i][1]; + count2LetterCodes ++; + } + } + Arrays.sort(codes2Letter); + } + + /** + * Private constructor (should not be instantiated). + */ + private ISO639() {} + + /** + * Determines whether a given language code is a valid 2-character or + * 3-character language code as defined in ISO 639 + * @param languageCode A 2-letter or 3-letter ISO 639 code + * @return True iff <code>languageCode</code> is a valid 2- or 3-character + * ISO 639 language code. + */ + public static boolean validLanguage(String languageCode) { + int index = Arrays.binarySearch(codes3Letter, languageCode); + if (index >= 0) { + return true; + } + index = Arrays.binarySearch(codes2Letter, languageCode); + if (index >= 0) { + return true; + } + return false; + } + +} Property changes on: trunk/foray/foray-common/src/java/org/foray/common/ISO639.java ___________________________________________________________________ Name: svn:keywords + "Author Id Rev Date URL" Name: svn:eol-style + native Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Language.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Language.java 2006-07-18 02:19:08 UTC (rev 7792) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Language.java 2006-07-18 16:07:41 UTC (rev 7793) @@ -24,6 +24,7 @@ package org.foray.fotree.fo.prop; +import org.foray.common.ISO639; import org.foray.fotree.FObj; import org.foray.fotree.Property; import org.foray.fotree.PropertyException; @@ -61,7 +62,7 @@ if (pv != null) { return pv; } - if (DtLanguage.validLanguage(value)) { + if (ISO639.validLanguage(value)) { return new DtLanguage(value); } throw new PropertyException(unexpectedValueMessage(value, Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLanguage.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLanguage.java 2006-07-18 02:19:08 UTC (rev 7792) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLanguage.java 2006-07-18 16:07:41 UTC (rev 7793) @@ -24,7 +24,7 @@ package org.foray.fotree.value; -import java.util.Arrays; +import org.foray.common.ISO639; /** * A "language" datatype in XSL-FO. Languages must conform to the 3-letter ISO @@ -32,587 +32,6 @@ */ public class DtLanguage extends Datatype { - /** - * This list is derived from http://www.w3.org/WAI/ER/IG/ert/iso639.htm, - * which also contains the mappings to language names. This list should - * be maintained in alphabetical order so that a binary search can be - * used. - */ - public static final String[] validLanguages = { - "aar", - "abk", - "ace", - "ach", - "ada", - "afa", - "afh", - "afr", - "aka", - "akk", - "alb", - "ale", - "alg", - "amh", - "ang", - "apa", - "ara", - "arc", - "arm", - "arn", - "arp", - "art", - "arw", - "asm", - "ath", - "ava", - "ave", - "awa", - "aym", - "aze", - "bad", - "bai", - "bak", - "bal", - "bam", - "ban", - "baq", - "bas", - "bat", - "bej", - "bel", - "bem", - "ben", - "ber", - "bho", - "bih", - "bik", - "bin", - "bis", - "bla", - "bnt", - "bod", - "bra", - "bre", - "bua", - "bug", - "bul", - "bur", - "cad", - "cai", - "car", - "cat", - "cau", - "ceb", - "cel", - "ces", - "cha", - "chb", - "che", - "chg", - "chi", - "chm", - "chn", - "cho", - "chr", - "chu", - "chv", - "chy", - "cop", - "cor", - "cos", - "cpe", - "cpf", - "cpp", - "cre", - "crp", - "cus", - "cym", - "cze", - "dak", - "dan", - "del", - "deu", - "din", - "div", - "doi", - "dra", - "dua", - "dum", - "dut", - "dyu", - "dzo", - "efi", - "egy", - "eka", - "ell", - "elx", - "eng", - "enm", - "epo", - "esk", - "esl", - "est", - "eus", - "ewe", - "ewo", - "fan", - "fao", - "fas", - "fat", - "fij", - "fin", - "fiu", - "fon", - "fra", - "fre", - "frm", - "fro", - "fry", - "ful", - "gaa", - "gae", - "gai", - "gay", - "gdh", - "gem", - "geo", - "ger", - "gez", - "gil", - "glg", - "gmh", - "goh", - "gon", - "got", - "grb", - "grc", - "gre", - "grn", - "guj", - "hai", - "hau", - "haw", - "heb", - "her", - "hil", - "him", - "hin", - "hmo", - "hun", - "hup", - "hye", - "iba", - "ibo", - "ice", - "ijo", - "iku", - "ilo", - "ina", - "inc", - "ind", - "ine", - "ine", - "ipk", - "ira", - "iri", - "iro", - "isl", - "ita", - "jav", - "jaw", - "jpn", - "jpr", - "jrb", - "kaa", - "kab", - "kac", - "kal", - "kam", - "kan", - "kar", - "kas", - "kat", - "kau", - "kaw", - "kaz", - "kha", - "khi", - "khm", - "kho", - "kik", - "kin", - "kir", - "kok", - "kom", - "kon", - "kor", - "kpe", - "kro", - "kru", - "kua", - "kum", - "kur", - "kus", - "kut", - "lad", - "lah", - "lam", - "lao", - "lat", - "lav", - "lez", - "lin", - "lit", - "lol", - "loz", - "ltz", - "lub", - "lug", - "lui", - "lun", - "luo", - "mac", - "mad", - "mag", - "mah", - "mai", - "mak", - "mak", - "mal", - "man", - "mao", - "map", - "mar", - "mas", - "max", - "may", - "men", - "mga", - "mic", - "min", - "mis", - "mkh", - "mlg", - "mlt", - "mni", - "mno", - "moh", - "mol", - "mon", - "mos", - "mri", - "msa", - "mul", - "mun", - "mus", - "mwr", - "mya", - "myn", - "nah", - "nai", - "nau", - "nav", - "nbl", - "nde", - "ndo", - "nep", - "new", - "nic", - "niu", - "nla", - "nno", - "non", - "nor", - "nso", - "nub", - "nya", - "nym", - "nyn", - "nyo", - "nzi", - "oci", - "oji", - "ori", - "orm", - "osa", - "oss", - "ota", - "oto", - "paa", - "pag", - "pal", - "pam", - "pan", - "pap", - "pau", - "peo", - "per", - "phn", - "pli", - "pol", - "pon", - "por", - "pra", - "pro", - "pus", - "que", - "raj", - "rar", - "roa", - "roh", - "rom", - "ron", - "rum", - "run", - "rus", - "sad", - "sag", - "sah", - "sai", - "sal", - "sam", - "san", - "sco", - "scr", - "sel", - "sem", - "sga", - "shn", - "sid", - "sin", - "sio", - "sit", - "sla", - "slk", - "slo", - "slv", - "smi", - "smo", - "sna", - "snd", - "sog", - "som", - "son", - "sot", - "spa", - "sqi", - "srd", - "srr", - "ssa", - "ssw", - "ssw", - "suk", - "sun", - "sus", - "sux", - "sve", - "swa", - "swe", - "syr", - "tah", - "tam", - "tat", - "tel", - "tem", - "ter", - "tgk", - "tgl", - "tha", - "tib", - "tig", - "tir", - "tiv", - "tli", - "tmh", - "tog", - "ton", - "tru", - "tsi", - "tsn", - "tso", - "tuk", - "tum", - "tur", - "tut", - "twi", - "tyv", - "uga", - "uig", - "ukr", - "umb", - "und", - "urd", - "uzb", - "vai", - "ven", - "vie", - "vol", - "vot", - "wak", - "wal", - "war", - "was", - "wel", - "wen", - "wol", - "xho", - "yao", - "yap", - "yid", - "yor", - "zap", - "zen", - "zha", - "zho", - "zul", - "zun", - }; - - /** - * This list is derived from http://www.w3.org/WAI/ER/IG/ert/iso639.htm, - * which also contains the mappings to language names. This list should - * be maintained in alphabetical order so that a binary search can be - * used. - */ - public static final String[] validLanguages2char = { - "aa", - "ab", - "af", - "am", - "ar", - "as", - "ay", - "az", - "ba", - "be", - "bg", - "bh", - "bi", - "bn", - "bo", - "br", - "ca", - "co", - "cs", - "cy", - "da", - "de", - "dz", - "el", - "en", - "eo", - "es", - "et", - "eu", - "fa", - "fi", - "fj", - "fo", - "fr", - "fy", - "ga", - "gd", - "gl", - "gn", - "gu", - "ha", - "hi", - "hr", - "hu", - "hy", - "ia", - "ie", - "ik", - "in", - "is", - "it", - "iw", - "ja", - "ji", - "jw", - "ka", - "kk", - "kl", - "km", - "kn", - "ko", - "ks", - "ku", - "ky", - "la", - "ln", - "lo", - "lt", - "lv", - "mg", - "mi", - "mk", - "ml", - "mn", - "mo", - "mr", - "ms", - "mt", - "my", - "na", - "ne", - "nl", - "no", - "oc", - "om", - "or", - "pa", - "pl", - "ps", - "pt", - "qu", - "rm", - "rn", - "ro", - "ru", - "rw", - "sa", - "sd", - "sg", - "sh", - "si", - "sk", - "sl", - "sm", - "sn", - "so", - "sq", - "sr", - "ss", - "st", - "su", - "sv", - "sw", - "ta", - "te", - "tg", - "th", - "ti", - "tk", - "tl", - "tn", - "to", - "tr", - "ts", - "tt", - "tw", - "uk", - "ur", - "uz", - "vi", - "vo", - "wo", - "xh", - "yo", - "zh", - "zu", - }; - /** The 2-letter or 3-letter ISO 639 code. */ private String value = null; @@ -638,27 +57,8 @@ this.value = value; } - /** - * Determines whether a given language code is found in validLanguages - * or validLanguages2char. - * @param languageCode A 2-letter or 3-letter ISO 639 code - * @return True if languageCode is found in validLanguages or - * validLanguages2char, false otherwise. - */ - public static boolean validLanguage(String languageCode) { - int index = Arrays.binarySearch(validLanguages, languageCode); - if (index >= 0) { - return true; - } - index = Arrays.binarySearch(validLanguages2char, languageCode); - if (index >= 0) { - return true; - } - return false; - } - public static DtLanguage makeLanguageDT(String languageCode) { - if (! validLanguage(languageCode)) { + if (! ISO639.validLanguage(languageCode)) { return null; } return new DtLanguage(languageCode); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-18 02:19:13
|
Revision: 7792 Author: victormote Date: 2006-07-17 19:19:08 -0700 (Mon, 17 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7792&view=rev Log Message: ----------- Allow expressions in margin computations. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Margin.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Margin.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Margin.java 2006-07-18 02:14:11 UTC (rev 7791) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Margin.java 2006-07-18 02:19:08 UTC (rev 7792) @@ -31,6 +31,7 @@ import org.foray.fotree.fo.obj.SimplePageMaster; import org.foray.fotree.value.DtLength; import org.foray.fotree.value.DtPercentage; +import org.foray.fotree.value.Expr; import org.foray.fotree.value.PropertyCollection; import org.foray.fotree.value.PropertyKeyword; import org.foray.fotree.value.PropertyValue; @@ -74,6 +75,12 @@ return pv; } pv = standardParse(propertyList, value, false, false); + if (pv instanceof Expr) { + Expr expression = (Expr) pv; + if (expression.canEvalUnitPower1()) { + return pv; + } + } if (pv instanceof DtLength) { return pv; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-07-18 02:14:14
|
Revision: 7791 Author: victormote Date: 2006-07-17 19:14:11 -0700 (Mon, 17 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7791&view=rev Log Message: ----------- Fix unit power computation. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprUnaryOper.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprUnaryOper.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprUnaryOper.java 2006-07-18 02:13:25 UTC (rev 7790) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprUnaryOper.java 2006-07-18 02:14:11 UTC (rev 7791) @@ -72,7 +72,7 @@ * {@inheritDoc} */ public byte unitPower() { - return -1; + return this.operand1.unitPower(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |