foray-commit Mailing List for FOray (Page 54)
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
(3) |
Dec
|
|
From: <vic...@us...> - 2022-02-03 19:59:03
|
Revision: 12551
http://sourceforge.net/p/foray/code/12551
Author: victormote
Date: 2022-02-03 19:59:00 +0000 (Thu, 03 Feb 2022)
Log Message:
-----------
Conform to aXSL change: Remove obsolete interface.
Modified Paths:
--------------
trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/LineBreaker.java
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/LineBreaker.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/LineBreaker.java 2022-02-03 19:25:24 UTC (rev 12550)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/LineBreaker.java 2022-02-03 19:59:00 UTC (rev 12551)
@@ -41,7 +41,7 @@
/**
* Abstract superclass for all line breakers.
*/
-public abstract class LineBreaker implements org.axsl.text.line.LineBreaker {
+public abstract class LineBreaker {
/** The "parent" TextServer. */
private TextServer4a server;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-03 19:25:27
|
Revision: 12550
http://sourceforge.net/p/foray/code/12550
Author: victormote
Date: 2022-02-03 19:25:24 +0000 (Thu, 03 Feb 2022)
Log Message:
-----------
For layout, remove requirement for external logger.
Modified Paths:
--------------
trunk/foray/foray-app/src/main/java/org/foray/app/CommandLineStarter.java
trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java
trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/ExternalGraphicPnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoNodePnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerFactory.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/StaticContentPnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/TablePnr.java
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/CommandLineStarter.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/CommandLineStarter.java 2022-02-03 19:13:00 UTC (rev 12549)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/CommandLineStarter.java 2022-02-03 19:25:24 UTC (rev 12550)
@@ -127,7 +127,7 @@
*/
final TextServer textServer = session.getTextServer();
final LineBreakerFactory lbFactory = session.getLineBreakerFactory();
- final LayoutStrategy layout = new PioneerLayoutStrategy(session.getLogger(), lbFactory);
+ final LayoutStrategy layout = new PioneerLayoutStrategy(lbFactory);
final ForayTarget target =
new ForayTarget(document, textServer, layout, outputTarget.getFontSelectionConstraints());
target.addOutputTarget(outputTarget, outputStream);
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2022-02-03 19:13:00 UTC (rev 12549)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2022-02-03 19:25:24 UTC (rev 12550)
@@ -105,7 +105,7 @@
logger, sessionConfig, fontServer, graphicServer, textServer, hyphenServer);
final AreaTreeFactory areaTreeFactory = ForaySpecific.makeAreaTreeFactory();
final LineBreakerFactory lbFactory = ForaySpecific.makeLineBreakerFactory();
- final LayoutFactory layoutFactory = ForaySpecific.makeLayoutFactory(logger, lbFactory);
+ final LayoutFactory layoutFactory = ForaySpecific.makeLayoutFactory(lbFactory);
final SpeechServer speechServer = ForaySpecific.makeSpeechServer();
final ForaySession session = new ForaySession(logger, sessionConfig,
fontServer, hyphenServer, textServer, graphicServer,
@@ -260,14 +260,13 @@
/**
* Make a standard LayoutFactory instance for use in FOray.
- * @param logger The logger.
* @param lbFactory Factory that creates instances of {@link LineBreaker}.
* @return The newly-created LayoutFactory instance.
* @throws ForayException For errors creating the server.
*/
- public static PioneerFactory makeLayoutFactory(final Logger logger, final LineBreakerFactory lbFactory)
+ public static PioneerFactory makeLayoutFactory(final LineBreakerFactory lbFactory)
throws ForayException {
- return new PioneerFactory(logger, lbFactory);
+ return new PioneerFactory(lbFactory);
}
/**
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java 2022-02-03 19:13:00 UTC (rev 12549)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java 2022-02-03 19:25:24 UTC (rev 12550)
@@ -35,7 +35,6 @@
import org.foray.area.PageCollection4a;
import org.foray.core.ForayException;
import org.foray.fotree.FoTree4a;
-import org.foray.fotree.FoTreeServer4a;
import org.foray.fotree.fo.obj.PageSequence4a;
import org.foray.fotree.fo.obj.Root4a;
import org.foray.pioneer.PioneerFactory;
@@ -69,11 +68,10 @@
* objects.
*/
private AreaTreeCreator() throws IOException, ForayException {
- final FoTreeServer4a treeServer = FoDocumentReader.getInstance().getTreeServer();
final AreaTreeFactory4a areaTreeFactory = ForaySpecific.makeAreaTreeFactory();
this.areaTreeFactory = areaTreeFactory;
final LineBreakerFactory lbFactory = ForaySpecific.makeLineBreakerFactory();
- final PioneerFactory layoutFactory = ForaySpecific.makeLayoutFactory(treeServer.getLogger(), lbFactory);
+ final PioneerFactory layoutFactory = ForaySpecific.makeLayoutFactory(lbFactory);
this.layoutFactory = layoutFactory;
}
Modified: trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java
===================================================================
--- trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java 2022-02-03 19:13:00 UTC (rev 12549)
+++ trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java 2022-02-03 19:25:24 UTC (rev 12550)
@@ -53,8 +53,6 @@
import org.axsl.text.line.LineNonText;
import org.axsl.text.line.LineText;
-import org.slf4j.Logger;
-
import java.util.Stack;
/**
@@ -62,28 +60,15 @@
*/
public abstract class LayoutStrategy implements LineBreakHandler, Layout {
- /** The logger. */
- private Logger logger;
-
/** The AreaTree instance that this layout system is processing. */
private AreaTree areaTree;
/** The stack of AreaNodes into which line content is being written.
- * If empty, line content should be written directly to the line that is
- * being processed.
- * If not empty, there are inline AreaNodes inside the line, and the top
- * item on the stack is what the line content should be written to. */
- private Stack<LineContentFactory> areaStack =
- new Stack<LineContentFactory>();
+ * If empty, line content should be written directly to the line that is being processed.
+ * If not empty, there are inline AreaNodes inside the line, and the top item on the stack is what the line content
+ * should be written to. */
+ private Stack<LineContentFactory> areaStack = new Stack<LineContentFactory>();
- /**
- * Constructor.
- * @param logger The logger.
- */
- public LayoutStrategy(final Logger logger) {
- this.logger = logger;
- }
-
@Override
public void formatPageSequence(final PageCollection pageCollection)
throws AreaTreeException {
@@ -205,14 +190,6 @@
}
/**
- * Returns the logger.
- * @return The logger.
- */
- public Logger getLogger() {
- return this.logger;
- }
-
- /**
* Formats the static content of the current page.
* @param pageArea The page area whose static content should be laid out.
* @throws AreaTreeException For errors during layout.
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/ExternalGraphicPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/ExternalGraphicPnr.java 2022-02-03 19:13:00 UTC (rev 12549)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/ExternalGraphicPnr.java 2022-02-03 19:25:24 UTC (rev 12550)
@@ -33,6 +33,8 @@
import org.axsl.area.LineArea;
import org.axsl.fotree.fo.ExternalGraphic;
+import org.slf4j.LoggerFactory;
+
/**
* Pioneer Layout for {@link ExternalGraphic}.
*/
@@ -59,7 +61,7 @@
}
if (this.realFONode.getGraphic(areaNode) == null) {
- this.getLogger().warn("Null graphic cannot be laid out."
+ LoggerFactory.getLogger(this.getClass()).warn("Null graphic cannot be laid out."
+ this.realFONode.getContextMessage());
return Status.OK;
}
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoNodePnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoNodePnr.java 2022-02-03 19:13:00 UTC (rev 12549)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoNodePnr.java 2022-02-03 19:25:24 UTC (rev 12550)
@@ -45,7 +45,7 @@
import org.axsl.text.TextServer;
import org.axsl.text.line.EagerLineBreaker;
-import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.List;
@@ -178,14 +178,6 @@
}
/**
- * Returns the logger.
- * @return The logger.
- */
- public Logger getLogger() {
- return this.layout.getLogger();
- }
-
- /**
* Adds a text item to the line.
* @param lineArea The line into which the text should be added.
* @param lineText The text input which should be added to the line.
@@ -292,7 +284,7 @@
if (addNonTextItemToLine(lineArea, nonText, foContext) == 1) {
return Status.OK;
}
- getLogger().error(node.getName() + " does not fit on line:\n"
+ LoggerFactory.getLogger(this.getClass()).error(node.getName() + " does not fit on line:\n"
+ node.getContextMessage());
return Status.OK;
}
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerFactory.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerFactory.java 2022-02-03 19:13:00 UTC (rev 12549)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerFactory.java 2022-02-03 19:25:24 UTC (rev 12550)
@@ -32,32 +32,25 @@
import org.axsl.linebreak.LineBreaker;
import org.axsl.linebreak.LineBreakerFactory;
-import org.slf4j.Logger;
-
/**
* Creates instances of {@link PioneerLayoutStrategy}.
*/
public class PioneerFactory implements LayoutFactory {
- /** The logger used by this factory. */
- private Logger logger;
-
/** Factory that creates instances of {@link LineBreaker}. */
private LineBreakerFactory lbFactory;
/**
* Constructor.
- * @param logger The logger to be used by this factory.
* @param lbFactory Factory that creates instances of {@link LineBreaker}.
*/
- public PioneerFactory(final Logger logger, final LineBreakerFactory lbFactory) {
- this.logger = logger;
+ public PioneerFactory(final LineBreakerFactory lbFactory) {
this.lbFactory = lbFactory;
}
@Override
public PioneerLayoutStrategy makeLayout() {
- return new PioneerLayoutStrategy(this.logger, lbFactory);
+ return new PioneerLayoutStrategy(lbFactory);
}
}
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java 2022-02-03 19:13:00 UTC (rev 12549)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java 2022-02-03 19:25:24 UTC (rev 12550)
@@ -103,8 +103,6 @@
import org.axsl.linebreak.LineBreakerFactory;
import org.axsl.text.line.EagerLineBreaker;
-import org.slf4j.Logger;
-
import java.util.ArrayList;
import java.util.List;
@@ -154,11 +152,9 @@
/**
* Constructor.
- * @param logger The logger to be used by this layout system.
* @param lbFactory The factory to be used to create {@link LineBreaker} instances.
*/
- public PioneerLayoutStrategy(final Logger logger, final LineBreakerFactory lbFactory) {
- super(logger);
+ public PioneerLayoutStrategy(final LineBreakerFactory lbFactory) {
this.lbFactory = lbFactory;
}
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/StaticContentPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/StaticContentPnr.java 2022-02-03 19:13:00 UTC (rev 12549)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/StaticContentPnr.java 2022-02-03 19:25:24 UTC (rev 12550)
@@ -33,6 +33,8 @@
import org.axsl.fotree.Fo;
import org.axsl.fotree.fo.StaticContent;
+import org.slf4j.LoggerFactory;
+
/**
* Pioneer Layout for {@link StaticContent}.
*/
@@ -62,8 +64,7 @@
if (status.isIncomplete()) {
/* in fact all should be laid out and clip, error etc depending
* on 'overflow' */
- getLayout().getLogger().warn("Some static content could not "
- + "fit in the area.");
+ LoggerFactory.getLogger(this.getClass()).warn("Some static content could not fit in the area.");
setProgress(i);
if ((i != 0) && (status == Status.AREA_FULL_NONE)) {
status = Status.AREA_FULL_SOME;
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/TablePnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/TablePnr.java 2022-02-03 19:13:00 UTC (rev 12549)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/TablePnr.java 2022-02-03 19:25:24 UTC (rev 12550)
@@ -43,6 +43,8 @@
import org.axsl.fotree.fo.TableHeader;
import org.axsl.value.Break;
+import org.slf4j.LoggerFactory;
+
/**
* Pioneer Layout for {@link Table}.
*/
@@ -112,7 +114,7 @@
/* For now, we bail out if the columns widths are not specified. */
if (this.table.numberOfColumns() == 0) {
- getLayout().getLogger().warn("Current implementation of tables "
+ LoggerFactory.getLogger(this.getClass()).warn("Current implementation of tables "
+ "requires a table-column for each column, "
+ "indicating column-width: "
+ this.table.getContextMessage());
@@ -172,7 +174,7 @@
// from the last table body and place it on the
// next page so that it can have a footer at
// the end of the table.
- getLayout().getLogger().warn("footer could not fit on page, "
+ LoggerFactory.getLogger(this.getClass()).warn("footer could not fit on page, "
+ "moving last body row to next page");
final TableFooterPnr tableFooterPL
= (TableFooterPnr) this.getLayoutProxy(tf);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-03 19:13:03
|
Revision: 12549
http://sourceforge.net/p/foray/code/12549
Author: victormote
Date: 2022-02-03 19:13:00 +0000 (Thu, 03 Feb 2022)
Log Message:
-----------
Conform to aXSL change: Move management of the LineBreakerFactory from the AreaTree to Layout.
Modified Paths:
--------------
trunk/foray/foray-app/src/main/java/org/foray/app/CommandLineStarter.java
trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
trunk/foray/foray-app/src/main/java/org/foray/app/ant/ForayAntTaskStarter.java
trunk/foray/foray-app/src/main/java/org/foray/app/test/TestConverter.java
trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoAwtViewer.java
trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoFo2Pdf.java
trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoObj2Pdf.java
trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoXml2Pdf.java
trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/AbstractDemoServlet.java
trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoPrintServlet.java
trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoServlet.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTreeFactory4a.java
trunk/foray/foray-core/src/main/java/org/foray/core/ForayTarget.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoNodePnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerFactory.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/CommandLineStarter.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/CommandLineStarter.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/CommandLineStarter.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -127,9 +127,9 @@
*/
final TextServer textServer = session.getTextServer();
final LineBreakerFactory lbFactory = session.getLineBreakerFactory();
- final LayoutStrategy layout = new PioneerLayoutStrategy(session.getLogger());
+ final LayoutStrategy layout = new PioneerLayoutStrategy(session.getLogger(), lbFactory);
final ForayTarget target =
- new ForayTarget(document, textServer, lbFactory, layout, outputTarget.getFontSelectionConstraints());
+ new ForayTarget(document, textServer, layout, outputTarget.getFontSelectionConstraints());
target.addOutputTarget(outputTarget, outputStream);
/*
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -49,6 +49,7 @@
import org.axsl.fotree.text.FoOrthographyServer;
import org.axsl.graphic.GraphicServer;
import org.axsl.layout.LayoutFactory;
+import org.axsl.linebreak.LineBreaker;
import org.axsl.linebreak.LineBreakerFactory;
import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.OrthographyServer;
@@ -104,7 +105,7 @@
logger, sessionConfig, fontServer, graphicServer, textServer, hyphenServer);
final AreaTreeFactory areaTreeFactory = ForaySpecific.makeAreaTreeFactory();
final LineBreakerFactory lbFactory = ForaySpecific.makeLineBreakerFactory();
- final LayoutFactory layoutFactory = ForaySpecific.makeLayoutFactory(logger);
+ final LayoutFactory layoutFactory = ForaySpecific.makeLayoutFactory(logger, lbFactory);
final SpeechServer speechServer = ForaySpecific.makeSpeechServer();
final ForaySession session = new ForaySession(logger, sessionConfig,
fontServer, hyphenServer, textServer, graphicServer,
@@ -260,12 +261,13 @@
/**
* Make a standard LayoutFactory instance for use in FOray.
* @param logger The logger.
+ * @param lbFactory Factory that creates instances of {@link LineBreaker}.
* @return The newly-created LayoutFactory instance.
* @throws ForayException For errors creating the server.
*/
- public static PioneerFactory makeLayoutFactory(final Logger logger)
+ public static PioneerFactory makeLayoutFactory(final Logger logger, final LineBreakerFactory lbFactory)
throws ForayException {
- return new PioneerFactory(logger);
+ return new PioneerFactory(logger, lbFactory);
}
/**
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/ant/ForayAntTaskStarter.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/ant/ForayAntTaskStarter.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/ant/ForayAntTaskStarter.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -318,8 +318,8 @@
OutputTargetFactory.makeOutputTarget(
this.task.getRendererType(), this.outputConfig, out,
session.getLogger(), session.getGraphicServer());
- final ForayTarget target = new ForayTarget(document, session.getTextServer(),
- session.getLineBreakerFactory(), null, outputTarget.getFontSelectionConstraints());
+ final ForayTarget target = new ForayTarget(document, session.getTextServer(), null,
+ outputTarget.getFontSelectionConstraints());
target.addOutputTarget(outputTarget, out);
session.process();
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/test/TestConverter.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/test/TestConverter.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/test/TestConverter.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -311,8 +311,8 @@
rendererType, renderOptions, bos, session.getLogger(),
session.getGraphicServer());
- final ForayTarget target = new ForayTarget(document, session.getTextServer(),
- session.getLineBreakerFactory(), null, renderer.getFontSelectionConstraints());
+ final ForayTarget target = new ForayTarget(document, session.getTextServer(), null,
+ renderer.getFontSelectionConstraints());
target.addOutputTarget(renderer, bos);
this.log.debug("ddir:" + this.destdir + " on:" + outname + ".pdf");
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoAwtViewer.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoAwtViewer.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoAwtViewer.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -150,8 +150,8 @@
final AwtRenderer renderer = new AwtRenderer(null);
//Setup ForayTarget
- final ForayTarget target = new ForayTarget(document, session.getTextServer(), session.getLineBreakerFactory(),
- null, renderer.getFontSelectionConstraints());
+ final ForayTarget target = new ForayTarget(document, session.getTextServer(), null,
+ renderer.getFontSelectionConstraints());
target.addOutputTarget(renderer, null);
//Create preview dialog (target for the AWTRenderer)
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoFo2Pdf.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoFo2Pdf.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoFo2Pdf.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -77,8 +77,8 @@
session.getGraphicServer());
//Setup ForayTarget
- final ForayTarget target = new ForayTarget(document, session.getTextServer(), session.getLineBreakerFactory(),
- null, renderer.getFontSelectionConstraints());
+ final ForayTarget target = new ForayTarget(document, session.getTextServer(), null,
+ renderer.getFontSelectionConstraints());
target.addOutputTarget(renderer, out);
// Start the processing.
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoObj2Pdf.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoObj2Pdf.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoObj2Pdf.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -100,8 +100,8 @@
session.getGraphicServer());
//Setup ForayTarget
- final ForayTarget target = new ForayTarget(document, session.getTextServer(), session.getLineBreakerFactory(),
- null, renderer.getFontSelectionConstraints());
+ final ForayTarget target = new ForayTarget(document, session.getTextServer(), null,
+ renderer.getFontSelectionConstraints());
target.addOutputTarget(renderer, out);
// Start the processing.
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoXml2Pdf.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoXml2Pdf.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoXml2Pdf.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -101,8 +101,8 @@
session.getGraphicServer());
//Setup ForayTarget
- final ForayTarget target = new ForayTarget(document, session.getTextServer(), session.getLineBreakerFactory(),
- null, renderer.getFontSelectionConstraints());
+ final ForayTarget target = new ForayTarget(document, session.getTextServer(), null,
+ renderer.getFontSelectionConstraints());
target.addOutputTarget(renderer, out);
// Start the processing.
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/AbstractDemoServlet.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/AbstractDemoServlet.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/AbstractDemoServlet.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -199,8 +199,7 @@
session.getLogger(), session.getGraphicServer());
// Setup ForayTarget
- final ForayTarget target = new ForayTarget(document, null, null, null,
- renderer.getFontSelectionConstraints());
+ final ForayTarget target = new ForayTarget(document, null, null, renderer.getFontSelectionConstraints());
target.addOutputTarget(renderer, output);
// Run the ForaySession
@@ -249,8 +248,7 @@
session.getLogger(), session.getGraphicServer());
// Setup ForayTarget
- final ForayTarget target = new ForayTarget(document, null, null, null,
- renderer.getFontSelectionConstraints());
+ final ForayTarget target = new ForayTarget(document, null, null, renderer.getFontSelectionConstraints());
target.addOutputTarget(renderer, output);
// Run the ForaySession
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoPrintServlet.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoPrintServlet.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoPrintServlet.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -134,7 +134,7 @@
pj.setCopies(1);
final AwtPrintRenderer renderer = new AwtPrintRenderer(null, pj);
// Setup ForayTarget
- final ForayTarget target = new ForayTarget(document, null, null, null, renderer.getFontSelectionConstraints());
+ final ForayTarget target = new ForayTarget(document, null, null, renderer.getFontSelectionConstraints());
target.addOutputTarget(renderer, null);
return target;
}
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoServlet.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoServlet.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoServlet.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -140,7 +140,7 @@
document.getLogger(), document.getGraphicServer());
// Setup ForayTarget
- final ForayTarget target = new ForayTarget(document, null, null, null, null);
+ final ForayTarget target = new ForayTarget(document, null, null, null);
target.addOutputTarget(renderer, output);
return target;
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -49,8 +49,7 @@
import java.util.Iterator;
/**
- * Singleton Helper class for tests that parses an input file and returns an
- * AreaTree instance for testing.
+ * Singleton Helper class for tests that parse an input file and return an AreaTree instance for testing.
*/
public final class AreaTreeCreator {
@@ -73,8 +72,8 @@
final FoTreeServer4a treeServer = FoDocumentReader.getInstance().getTreeServer();
final AreaTreeFactory4a areaTreeFactory = ForaySpecific.makeAreaTreeFactory();
this.areaTreeFactory = areaTreeFactory;
- final PioneerFactory layoutFactory = ForaySpecific.makeLayoutFactory(
- treeServer.getLogger());
+ final LineBreakerFactory lbFactory = ForaySpecific.makeLineBreakerFactory();
+ final PioneerFactory layoutFactory = ForaySpecific.makeLayoutFactory(treeServer.getLogger(), lbFactory);
this.layoutFactory = layoutFactory;
}
@@ -107,7 +106,7 @@
final FoDocumentReader foReader = FoDocumentReader.getInstance();
final FoTree4a foTree = foReader.buildFoTree(file);
final Root4a root = foTree.getRootFo();
- final AreaTree4a areaTree = this.areaTreeFactory.makeAreaTree(foTree, textServer, lbFactory);
+ final AreaTree4a areaTree = this.areaTreeFactory.makeAreaTree(foTree, textServer);
final PioneerLayoutStrategy layout = this.layoutFactory.makeLayout();
final Iterator<PageSequence4a> iterator = root.getPageSequenceIterator();
while (iterator.hasNext()) {
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -51,8 +51,6 @@
import org.axsl.galley.metadata.DocumentMetadataG5;
import org.axsl.galley.render.GalleyVisitor;
import org.axsl.galley.render.GalleyVisitorException;
-import org.axsl.linebreak.LineBreaker;
-import org.axsl.linebreak.LineBreakerFactory;
import org.axsl.text.TextServer;
import org.slf4j.Logger;
@@ -87,9 +85,6 @@
/** The text server for this area tree. */
private TextServer textServer;
- /** The LineBreaker for this area tree. */
- private LineBreaker lineBreaker;
-
/** The logger. */
private Logger logger = LoggerFactory.getLogger(getClass());
@@ -118,16 +113,13 @@
* @param foTree The FO tree instance that generates this area tree.
* @param fontConsumer The Font Consumer.
* @param textServer The Text Server.
- * @param lbFactory The Line Breaker Factory.
*/
- private AreaTree4a(final FoTree foTree, final FontConsumer fontConsumer, final TextServer textServer,
- final LineBreakerFactory lbFactory) {
+ private AreaTree4a(final FoTree foTree, final FontConsumer fontConsumer, final TextServer textServer) {
/* AreaTree has no parent with which to register. And it cannot
* create linkage because the AreaTreeControl isn't registered.*/
this.foTree = foTree;
this.fontConsumer = fontConsumer;
this.textServer = textServer;
- this.lineBreaker = lbFactory.obtainLineBreaker();
this.documentMetadata = new DocumentMetadata4a(this);
}
@@ -135,12 +127,10 @@
* Package-visible factory method.
* @param foTree The FO tree instance that generates this area tree.
* @param textServer The text server.
- * @param lbFactory The Line Breaker Factory.
* @return The new instance.
*/
- static AreaTree4a makeAreaTree(final FoTree foTree, final TextServer textServer,
- final LineBreakerFactory lbFactory) {
- final AreaTree4a newAreaTree = new AreaTree4a(foTree, foTree.getFontConsumer(), textServer, lbFactory);
+ static AreaTree4a makeAreaTree(final FoTree foTree, final TextServer textServer) {
+ final AreaTree4a newAreaTree = new AreaTree4a(foTree, foTree.getFontConsumer(), textServer);
/*
* These registration steps must take place after the AreaTreeControl
* has been stored.
@@ -436,11 +426,6 @@
return this.bookmarkTreeArea;
}
- @Override
- public LineBreaker getLineBreaker() {
- return this.lineBreaker;
- }
-
/**
* Returns the linkage factory.
* @return The linkage factory.
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTreeFactory4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTreeFactory4a.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTreeFactory4a.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -30,7 +30,6 @@
import org.axsl.area.AreaTreeFactory;
import org.axsl.fotree.FoTree;
-import org.axsl.linebreak.LineBreakerFactory;
import org.axsl.text.TextServer;
/**
@@ -39,9 +38,8 @@
public class AreaTreeFactory4a implements AreaTreeFactory {
@Override
- public AreaTree4a makeAreaTree(final FoTree foTree, final TextServer textServer,
- final LineBreakerFactory lbFactory) {
- final AreaTree4a areaTree = AreaTree4a.makeAreaTree(foTree, textServer, lbFactory);
+ public AreaTree4a makeAreaTree(final FoTree foTree, final TextServer textServer) {
+ final AreaTree4a areaTree = AreaTree4a.makeAreaTree(foTree, textServer);
return areaTree;
}
Modified: trunk/foray/foray-core/src/main/java/org/foray/core/ForayTarget.java
===================================================================
--- trunk/foray/foray-core/src/main/java/org/foray/core/ForayTarget.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-core/src/main/java/org/foray/core/ForayTarget.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -47,7 +47,6 @@
import org.axsl.layout.Layout;
import org.axsl.layout.LayoutException;
import org.axsl.layout.LayoutFactory;
-import org.axsl.linebreak.LineBreakerFactory;
import org.axsl.output.OutputException;
import org.axsl.output.OutputTarget;
import org.axsl.output.Renderer;
@@ -107,9 +106,6 @@
/** The text server. */
private TextServer textServer;
- /** The line-breaker factory to be used. */
- private LineBreakerFactory lbFactory;
-
/** The LayoutStrategy implementation to be used for this target. */
private Layout layout;
@@ -123,13 +119,12 @@
* Constructor.
* @param document The parent document.
* @param textServer The text server.
- * @param lbFactory The line-breaker factory to be used.
* @param layout The layout implementation responsible for laying the document out.
* @param selectionConstraints The constraints on font selection.
* @throws ForayException For errors during document processing.
*/
- public ForayTarget(final ForayDocument document, final TextServer textServer, final LineBreakerFactory lbFactory,
- final Layout layout, final FontSelectionConstraints selectionConstraints) throws ForayException {
+ public ForayTarget(final ForayDocument document, final TextServer textServer, final Layout layout,
+ final FontSelectionConstraints selectionConstraints) throws ForayException {
// Validate the ForayDocument.
this.document = document;
if (this.document == null) {
@@ -141,7 +136,6 @@
document.getFoTreeParser().registerListener(this);
this.textServer = textServer;
- this.lbFactory = lbFactory;
// Validate the LayoutStrategy. If null, create a default one.
this.layout = layout;
if (this.layout == null) {
@@ -308,7 +302,7 @@
private org.axsl.area.AreaTree getCreatedAreaTree() {
if (this.areaTree == null) {
final FoTree foTree = this.document.getFoTreeParser().getFoTree();
- this.areaTree = this.getAreaTreeFactory().makeAreaTree(foTree, this.textServer, this.lbFactory);
+ this.areaTree = this.getAreaTreeFactory().makeAreaTree(foTree, this.textServer);
this.areaTree.registerListener(this);
}
return this.areaTree;
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -76,7 +76,7 @@
final BlockLevelAreaFactory bcArea = (BlockLevelAreaFactory) areaNode;
final NormalBlockArea blockArea = bcArea.makeNormalBlockArea(this.blockDiscrete);
- final LineBreaker breaker = blockArea.getAreaTree().getLineBreaker();
+ final LineBreaker breaker = getLayout().getLineBreaker();
final ParaContext paraContext = this.blockDiscrete.ancestorBlock(blockArea).getParaContext();
final LineBreakResult result = breaker.breakIntoLines(
this.blockDiscrete, (ParaConfig) this.blockDiscrete, paraContext, blockArea);
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoNodePnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoNodePnr.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoNodePnr.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -198,7 +198,7 @@
protected int addTextItemToLine(final LineArea lineArea, final FoLineText lineText, final int start, final int end)
throws AreaTreeException {
final FoContext foContext = lineArea;
- EagerLineBreaker lb = this.layout.getLineBreaker();
+ EagerLineBreaker lb = this.layout.getEagerLineBreaker();
if (lb == null) {
final AreaTree areaTree = lineArea.getAreaTree();
final TextServer textServer = areaTree.getTextServer();
@@ -234,7 +234,7 @@
protected int addNonTextItemToLine(final LineArea lineArea,
final FoLineNonText nonText, final FoContext foContext)
throws AreaTreeException {
- EagerLineBreaker lb = this.layout.getLineBreaker();
+ EagerLineBreaker lb = this.layout.getEagerLineBreaker();
if (lb == null) {
final AreaTree areaTree = lineArea.getAreaTree();
final TextServer textServer = areaTree.getTextServer();
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -80,7 +80,7 @@
final ParaContext paraContext = this.node.ancestorBlock(normalBlockArea).getParaContext();
if (this.result == null) {
- final LineBreaker lb = areaNode.getAreaTree().getLineBreaker();
+ final LineBreaker lb = getLayout().getLineBreaker();
this.result = lb.breakIntoLines(
this.node.getFoTokenFlow(), (ParaConfig) this.node, paraContext, normalBlockArea);
}
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerFactory.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerFactory.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerFactory.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -29,6 +29,8 @@
package org.foray.pioneer;
import org.axsl.layout.LayoutFactory;
+import org.axsl.linebreak.LineBreaker;
+import org.axsl.linebreak.LineBreakerFactory;
import org.slf4j.Logger;
@@ -40,17 +42,22 @@
/** The logger used by this factory. */
private Logger logger;
+ /** Factory that creates instances of {@link LineBreaker}. */
+ private LineBreakerFactory lbFactory;
+
/**
* Constructor.
* @param logger The logger to be used by this factory.
+ * @param lbFactory Factory that creates instances of {@link LineBreaker}.
*/
- public PioneerFactory(final Logger logger) {
+ public PioneerFactory(final Logger logger, final LineBreakerFactory lbFactory) {
this.logger = logger;
+ this.lbFactory = lbFactory;
}
@Override
public PioneerLayoutStrategy makeLayout() {
- return new PioneerLayoutStrategy(this.logger);
+ return new PioneerLayoutStrategy(this.logger, lbFactory);
}
}
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java 2022-02-03 15:11:12 UTC (rev 12548)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java 2022-02-03 19:13:00 UTC (rev 12549)
@@ -99,6 +99,8 @@
import org.axsl.fotree.fo.Wrapper;
import org.axsl.fotree.fo.prop.BreakBeforePa;
import org.axsl.fotree.foreign.SvgElement;
+import org.axsl.linebreak.LineBreaker;
+import org.axsl.linebreak.LineBreakerFactory;
import org.axsl.text.line.EagerLineBreaker;
import org.slf4j.Logger;
@@ -144,6 +146,9 @@
/** The line-breaker to be used by this layout system. */
private EagerLineBreaker currentLineBreaker;
+ /** Factory that creates instances of {@link LineBreaker}. */
+ private LineBreakerFactory lbFactory;
+
/** The FIFO queue of footnotes yet to be laid out. */
private List<FootnoteBody> pendingFootnotes = new ArrayList<FootnoteBody>();
@@ -150,9 +155,11 @@
/**
* Constructor.
* @param logger The logger to be used by this layout system.
+ * @param lbFactory The factory to be used to create {@link LineBreaker} instances.
*/
- public PioneerLayoutStrategy(final Logger logger) {
+ public PioneerLayoutStrategy(final Logger logger, final LineBreakerFactory lbFactory) {
super(logger);
+ this.lbFactory = lbFactory;
}
/**
@@ -643,11 +650,17 @@
return new NoLayoutPnr(node, this);
}
+ @Override
+ public LineBreaker getLineBreaker() {
+ return this.lbFactory.obtainLineBreaker();
+ }
+
/**
* Return the line breaker used by this layout system.
* @return The line breaker.
*/
- public EagerLineBreaker getLineBreaker() {
+ public EagerLineBreaker getEagerLineBreaker() {
+ /* TODO: Remove this method and the related setter after converting to the new LineBreaker scheme. */
return this.currentLineBreaker;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-03 15:11:15
|
Revision: 12548
http://sourceforge.net/p/foray/code/12548
Author: victormote
Date: 2022-02-03 15:11:12 +0000 (Thu, 03 Feb 2022)
Log Message:
-----------
Conform to aXSL change: Move dependency on ParaContext from axsl-areatree to axsl-fotree. Remove axsl-areatree dependency on axsl-kp-model.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block4a.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2022-02-03 14:51:28 UTC (rev 12547)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2022-02-03 15:11:12 UTC (rev 12548)
@@ -29,7 +29,6 @@
package org.foray.area;
import org.foray.area.link.Link;
-import org.foray.common.para.ParaPenalty4a;
import org.axsl.area.AreaTreeException;
import org.axsl.area.NormalBlockArea;
@@ -46,8 +45,6 @@
import org.axsl.galley.render.GalleyVisitor;
import org.axsl.galley.render.GalleyVisitorException;
import org.axsl.graphic.Graphic;
-import org.axsl.kpModel.ParaContext;
-import org.axsl.kpModel.ParaPenalty;
import org.axsl.value.BackgroundRepeat;
import org.axsl.value.BorderStyle;
import org.axsl.value.RelativeAxis;
@@ -60,7 +57,7 @@
* This class represents a Block Area.
* A block area is made up of a sequence of Line Areas.
*/
-public final class NormalBlockArea4a extends BlockArea implements NormalBlockArea, ParaContext {
+public final class NormalBlockArea4a extends BlockArea implements NormalBlockArea {
/** The link to the FO tree. */
private Link<Block> foLink;
@@ -491,44 +488,4 @@
return this.crIpd();
}
- @Override
- public int getLastNonEquivalentLineNumber() {
- /* The normal case here is zero. */
- return 0;
- }
-
- @Override
- public int getLooseness() {
- return 0;
- }
-
- @Override
- public int getConsecutiveFlaggedLinesDemerits() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public int getIncompatibleFitnessClassDemerits() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public float getAdjustmentRatioTolerance() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public int getCost(final ParaPenalty.Quality quality) {
- /* TODO: This should be more configurable. */
- return ParaPenalty4a.DEFAULT_PENALTY;
- }
-
- @Override
- public ParaContext getParaContext() {
- return this;
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block4a.java 2022-02-03 14:51:28 UTC (rev 12547)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block4a.java 2022-02-03 15:11:12 UTC (rev 12548)
@@ -28,6 +28,7 @@
package org.foray.fotree.fo.obj;
+import org.foray.common.para.ParaPenalty4a;
import org.foray.fotree.FoContainerComplex;
import org.foray.fotree.FoObj;
import org.foray.fotree.Namespace;
@@ -37,11 +38,13 @@
import org.axsl.fotree.FoTreeException;
import org.axsl.fotree.FoVisitor;
import org.axsl.fotree.fo.Block;
+import org.axsl.kpModel.ParaContext;
+import org.axsl.kpModel.ParaPenalty;
/**
* A "block" object in XSL-FO.
*/
-public class Block4a extends FoContainerComplex implements Block {
+public class Block4a extends FoContainerComplex implements Block, ParaContext {
/** The parent of this node. */
private FoObj parent;
@@ -244,4 +247,44 @@
discrete.addChild(fobj);
}
+ @Override
+ public ParaContext getParaContext() {
+ return this;
+ }
+
+ @Override
+ public int getLastNonEquivalentLineNumber() {
+ /* The normal case here is zero. */
+ return 0;
+ }
+
+ @Override
+ public int getLooseness() {
+ return 0;
+ }
+
+ @Override
+ public int getConsecutiveFlaggedLinesDemerits() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getIncompatibleFitnessClassDemerits() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public float getAdjustmentRatioTolerance() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getCost(final ParaPenalty.Quality quality) {
+ /* TODO: This should be more configurable. */
+ return ParaPenalty4a.DEFAULT_PENALTY;
+ }
+
}
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java 2022-02-03 14:51:28 UTC (rev 12547)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java 2022-02-03 15:11:12 UTC (rev 12548)
@@ -38,6 +38,7 @@
import org.axsl.fotree.fo.BlockDiscrete;
import org.axsl.kpModel.ParaBranch;
import org.axsl.kpModel.ParaConfig;
+import org.axsl.kpModel.ParaContext;
import org.axsl.kpModel.ParaNode;
import org.axsl.linebreak.LineBreakResult;
import org.axsl.linebreak.LineBreaker;
@@ -76,8 +77,9 @@
final NormalBlockArea blockArea = bcArea.makeNormalBlockArea(this.blockDiscrete);
final LineBreaker breaker = blockArea.getAreaTree().getLineBreaker();
+ final ParaContext paraContext = this.blockDiscrete.ancestorBlock(blockArea).getParaContext();
final LineBreakResult result = breaker.breakIntoLines(
- this.blockDiscrete, (ParaConfig) this.blockDiscrete, blockArea.getParaContext(), blockArea);
+ this.blockDiscrete, (ParaConfig) this.blockDiscrete, paraContext, blockArea);
int lastBreakPosition = 0;
for (int lineIndex = 0; lineIndex < result.getQtyLines(); lineIndex ++) {
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java 2022-02-03 14:51:28 UTC (rev 12547)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java 2022-02-03 15:11:12 UTC (rev 12548)
@@ -77,7 +77,7 @@
throw new IllegalArgumentException(AreaNode.class.getName() + " must be or have an ancestor " +
NormalBlockArea.class.getName());
}
- final ParaContext paraContext = normalBlockArea.getParaContext();
+ final ParaContext paraContext = this.node.ancestorBlock(normalBlockArea).getParaContext();
if (this.result == null) {
final LineBreaker lb = areaNode.getAreaTree().getLineBreaker();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-03 14:51:31
|
Revision: 12547
http://sourceforge.net/p/foray/code/12547
Author: victormote
Date: 2022-02-03 14:51:28 +0000 (Thu, 03 Feb 2022)
Log Message:
-----------
1. Conform to aXSL change: Add method to get the nearest ancestor Block. 2. Roll up existing method that had the same purpose.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextDecoration.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2022-02-03 13:05:17 UTC (rev 12546)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2022-02-03 14:51:28 UTC (rev 12547)
@@ -602,14 +602,9 @@
return getParent().getRoot();
}
- /**
- * Finds the nearest self-or-ancestor that is a Block.
- * @param context An object that knows how to resolve FO Tree context issues.
- * @return If this is an instance of Block, returns this, otherwise returns the nearest ancestor that is a Block, or
- * null if there is no ancestor Block.
- */
- public Block4a getContainingBlock(final FoContext context) {
- return effectiveParent(context).getContainingBlock(context);
+ @Override
+ public Block4a ancestorBlock(final FoContext context) {
+ return effectiveParent(context).ancestorBlock(context);
}
/**
@@ -3478,8 +3473,8 @@
if (thisLeader != testLeader) {
return null;
}
- final Block4a thisBlock = this.effectiveParent(context).getContainingBlock(context);
- final Block4a testBlock = leafToTest.effectiveParent(context).getContainingBlock(context);
+ final Block4a thisBlock = this.effectiveParent(context).ancestorBlock(context);
+ final Block4a testBlock = leafToTest.effectiveParent(context).ancestorBlock(context);
if (thisBlock != testBlock) {
return null;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-02-03 13:05:17 UTC (rev 12546)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-02-03 14:51:28 UTC (rev 12547)
@@ -205,7 +205,7 @@
}
if (this.currentFObj instanceof FoContainerComplex) {
- if (this.currentFObj.getContainingBlock(null) == null) {
+ if (this.currentFObj.ancestorBlock(null) == null) {
return;
}
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block4a.java 2022-02-03 13:05:17 UTC (rev 12546)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block4a.java 2022-02-03 14:51:28 UTC (rev 12547)
@@ -95,13 +95,14 @@
/**
* {@inheritDoc}
- * Overrides the method in FoObj, because this is the containing block.
+ * Overrides the method in {@link FoObj}, because this is the block.
*/
@Override
- public Block4a getContainingBlock(final FoContext context) {
+ public Block4a ancestorBlock(final FoContext context) {
return this;
}
+
@Override
public Namespace getNamespace() {
return this.getFoTree().getFONamespace();
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root4a.java 2022-02-03 13:05:17 UTC (rev 12546)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root4a.java 2022-02-03 14:51:28 UTC (rev 12547)
@@ -180,7 +180,7 @@
/**
* {@inheritDoc}
- * Overrides the method in FoObj because this is the root.
+ * Overrides the {@link FoObj} method, because this is the root.
*/
@Override
public Root4a getRoot() {
@@ -189,17 +189,16 @@
/**
* {@inheritDoc}
- * Overrides the method in FoObj because there is no parent for Root, and
- * therefore no containing block.
+ * Overrides the {@link FoObj} method, because {@link Root4a} has no parent.
*/
@Override
- public Block4a getContainingBlock(final FoContext context) {
+ public Block4a ancestorBlock(final FoContext context) {
return null;
}
/**
* {@inheritDoc}
- * Overrides the FoObj method, because there are no Tables above here.
+ * Overrides the {@link FoObj} method, because {@link Root4a} has no parent.
*/
@Override
public Table4a ancestorTable(final FoContext context) {
@@ -208,8 +207,7 @@
/**
* {@inheritDoc}
- * Overrides the FoObj method, because Root has no parent from which to
- * check for a link.
+ * Overrides the {@link FoObj} method, because {@link Root4a} has no parent.
*/
@Override
public BasicLink4a ancestorBasicLink(final FoContext context) {
@@ -218,11 +216,10 @@
/**
* {@inheritDoc}
- * Overrides the FoObj method, because Root has no parent.
+ * Overrides the {@link FoObj} method, because {@link Root4a} has no parent.
*/
@Override
- public FoObj ancestorListRelatedObject(
- final FoContext context) {
+ public FoObj ancestorListRelatedObject(final FoContext context) {
return null;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextDecoration.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextDecoration.java 2022-02-03 13:05:17 UTC (rev 12546)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextDecoration.java 2022-02-03 14:51:28 UTC (rev 12547)
@@ -190,7 +190,7 @@
public static DtTextDeco getValueNoInstance(final FoContext context,
final FoObj fobj) {
if (! (fobj instanceof Block4a)) {
- final Block4a nearestBlock = fobj.getContainingBlock(context);
+ final Block4a nearestBlock = fobj.ancestorBlock(context);
if (nearestBlock == null) {
return null;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-03 13:05:19
|
Revision: 12546
http://sourceforge.net/p/foray/code/12546
Author: victormote
Date: 2022-02-03 13:05:17 +0000 (Thu, 03 Feb 2022)
Log Message:
-----------
Conform to aXSL change: Move LineBreakContext to new axsl-context project.
Modified Paths:
--------------
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/BestFitLb.java
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/TotalFitLb.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/BestFitLb.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/BestFitLb.java 2022-02-03 00:56:57 UTC (rev 12545)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/BestFitLb.java 2022-02-03 13:05:17 UTC (rev 12546)
@@ -28,10 +28,10 @@
package org.foray.linebreak;
+import org.axsl.context.LineBreakContext;
import org.axsl.kpModel.ParaBranch;
import org.axsl.kpModel.ParaConfig;
import org.axsl.kpModel.ParaContext;
-import org.axsl.linebreak.LineBreakContext;
/**
* Implementation of the Knuth-Plass "best-fit" linebreaking algorithm.
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2022-02-03 00:56:57 UTC (rev 12545)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2022-02-03 13:05:17 UTC (rev 12546)
@@ -30,6 +30,7 @@
import org.foray.common.sequence.IntArrayBuilder;
+import org.axsl.context.LineBreakContext;
import org.axsl.kpModel.ParaBranch;
import org.axsl.kpModel.ParaConfig;
import org.axsl.kpModel.ParaContext;
@@ -36,7 +37,6 @@
import org.axsl.kpModel.ParaGlue;
import org.axsl.kpModel.ParaLeaf;
import org.axsl.kpModel.ParaPenalty;
-import org.axsl.linebreak.LineBreakContext;
import java.util.ArrayList;
import java.util.List;
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/TotalFitLb.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/TotalFitLb.java 2022-02-03 00:56:57 UTC (rev 12545)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/TotalFitLb.java 2022-02-03 13:05:17 UTC (rev 12546)
@@ -34,6 +34,7 @@
import org.foray.common.primitive.BooleanUtils;
import org.foray.common.sequence.IntArrayBuilder;
+import org.axsl.context.LineBreakContext;
import org.axsl.kpModel.ParaBox;
import org.axsl.kpModel.ParaBranch;
import org.axsl.kpModel.ParaConfig;
@@ -43,7 +44,6 @@
import org.axsl.kpModel.ParaNode;
import org.axsl.kpModel.ParaPenalty;
import org.axsl.linebreak.KpFitnessClass;
-import org.axsl.linebreak.LineBreakContext;
import java.util.ArrayList;
import java.util.Arrays;
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java 2022-02-03 00:56:57 UTC (rev 12545)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java 2022-02-03 13:05:17 UTC (rev 12546)
@@ -30,9 +30,9 @@
import org.foray.common.para.ParaBranch4a;
+import org.axsl.context.LineBreakContext;
import org.axsl.kpModel.ParaConfig;
import org.axsl.kpModel.ParaContext;
-import org.axsl.linebreak.LineBreakContext;
import org.junit.Assert;
import org.junit.Test;
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2022-02-03 00:56:57 UTC (rev 12545)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2022-02-03 13:05:17 UTC (rev 12546)
@@ -37,9 +37,9 @@
import org.foray.font.util.MockFontUse;
import org.foray.orthography.Punctuation4a;
+import org.axsl.context.LineBreakContext;
import org.axsl.kpModel.ParaContext;
import org.axsl.kpModel.ParaPenalty;
-import org.axsl.linebreak.LineBreakContext;
import org.junit.Assert;
import org.mockito.Mockito;
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2022-02-03 00:56:57 UTC (rev 12545)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2022-02-03 13:05:17 UTC (rev 12546)
@@ -30,9 +30,9 @@
import org.foray.common.para.ParaBranch4a;
+import org.axsl.context.LineBreakContext;
import org.axsl.kpModel.ParaConfig;
import org.axsl.kpModel.ParaContext;
-import org.axsl.linebreak.LineBreakContext;
import org.junit.Assert;
import org.junit.Ignore;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-03 00:57:00
|
Revision: 12545
http://sourceforge.net/p/foray/code/12545
Author: victormote
Date: 2022-02-03 00:56:57 +0000 (Thu, 03 Feb 2022)
Log Message:
-----------
Conform to aXSL change: Break TextTokenFlowLocation into a separate class file, to avoid any temptation to address it via any subinterface of TextTokenFlow.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutableTokenFlowLocation.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/TokenFlow4aTests.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java 2022-02-03 00:31:19 UTC (rev 12544)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java 2022-02-03 00:56:57 UTC (rev 12545)
@@ -48,8 +48,8 @@
import org.axsl.fotree.fo.PageNumberCitationLast;
import org.axsl.fotree.fo.RetrieveMarker;
import org.axsl.fotree.fo.ScalingValueCitation;
-import org.axsl.fotree.text.FoTextTokenFlow;
import org.axsl.galley.GlyphAreaSequenceG5;
+import org.axsl.orthography.TextTokenFlowLocation;
import java.util.ArrayList;
import java.util.List;
@@ -92,7 +92,7 @@
@Override
public GlyphAreaSequenceG5 makeGlyphAreaSequence(final FoTextWords paragraph,
- final FoTextTokenFlow.Location startLocation, final FoTextTokenFlow.Location endLocation,
+ final TextTokenFlowLocation startLocation, final TextTokenFlowLocation endLocation,
final boolean hasFauxSmallCaps) {
throw new UnsupportedOperationException();
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java 2022-02-03 00:31:19 UTC (rev 12544)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java 2022-02-03 00:56:57 UTC (rev 12545)
@@ -57,7 +57,7 @@
import org.axsl.galley.GlyphAreaSequenceG5;
import org.axsl.galley.render.GalleyVisitor;
import org.axsl.galley.render.GalleyVisitorException;
-import org.axsl.orthography.TextTokenFlow;
+import org.axsl.orthography.TextTokenFlowLocation;
import org.axsl.value.Conditionality;
import org.axsl.value.LineStackingStrategy;
import org.axsl.value.RelativeAxis;
@@ -1018,7 +1018,7 @@
@Override
public GlyphAreaSequenceG5 makeGlyphAreaSequence(final FoTextWords paragraph,
- final TextTokenFlow.Location startLocation, final TextTokenFlow.Location endLocation,
+ final TextTokenFlowLocation startLocation, final TextTokenFlowLocation endLocation,
final boolean hasFauxSmallCaps) {
final TextAreaWords newTextArea = TextAreaWords.makeTextArea(paragraph, this, startLocation, endLocation);
this.children.add(newTextArea);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java 2022-02-03 00:31:19 UTC (rev 12544)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java 2022-02-03 00:56:57 UTC (rev 12545)
@@ -31,7 +31,7 @@
import org.foray.area.link.Link;
import org.axsl.fotree.fo.FoTextWords;
-import org.axsl.orthography.TextTokenFlow;
+import org.axsl.orthography.TextTokenFlowLocation;
/**
* A {@link TextArea} that wraps a sequence of words and interword content.
@@ -43,10 +43,10 @@
private Link<FoTextWords> foLink;
/** The starting location in {@link #foLink} for the text in this area, inclusive. */
- private TextTokenFlow.Location startLocation;
+ private TextTokenFlowLocation startLocation;
/** The ending location in {@link #foLink} for the text in this area, exclusive. */
- private TextTokenFlow.Location endLocation;
+ private TextTokenFlowLocation endLocation;
/**
* Constructor.
@@ -56,7 +56,7 @@
* @param endLocation The ending location in {@code generatedBy} for the text in this area, exclusive.
*/
public TextAreaWords(final LineArea4a parentArea, final Link<FoTextWords> generatedBy,
- final TextTokenFlow.Location startLocation, final TextTokenFlow.Location endLocation) {
+ final TextTokenFlowLocation startLocation, final TextTokenFlowLocation endLocation) {
super(parentArea);
this.foLink = generatedBy;
this.startLocation = startLocation;
@@ -72,7 +72,7 @@
* @return The newly-created TextArea.
*/
static TextAreaWords makeTextArea(final FoTextWords generatedBy, final LineArea4a parentArea,
- final TextTokenFlow.Location startLocation, final TextTokenFlow.Location endLocation) {
+ final TextTokenFlowLocation startLocation, final TextTokenFlowLocation endLocation) {
final Link<FoTextWords> linkage = parentArea.getLink(generatedBy);
final TextAreaWords newTextArea = new TextAreaWords(parentArea, linkage, startLocation, endLocation);
newTextArea.registerLink(generatedBy);
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutableTokenFlowLocation.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutableTokenFlowLocation.java 2022-02-03 00:31:19 UTC (rev 12544)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutableTokenFlowLocation.java 2022-02-03 00:56:57 UTC (rev 12545)
@@ -29,11 +29,12 @@
package org.foray.orthography;
import org.axsl.orthography.TextTokenFlow;
+import org.axsl.orthography.TextTokenFlowLocation;
/**
- * A mutable version of {@link TextTokenFlow.Location}, useful when iterating locations.
+ * A mutable version of {@link TextTokenFlowLocation}, useful when iterating locations.
*/
-public class MutableTokenFlowLocation implements TextTokenFlow.Location {
+public class MutableTokenFlowLocation implements TextTokenFlowLocation {
/** String format for {@link #toString()}. */
private static final String TO_STRING_FORMAT = "[%d, %d, %d]";
@@ -51,7 +52,7 @@
* Creates a mutable token flow location, using another location for its starting indexes.
* @param location The location whose indexes should be used as starting indexes for this new location.
*/
- public MutableTokenFlowLocation(final TextTokenFlow.Location location) {
+ public MutableTokenFlowLocation(final TextTokenFlowLocation location) {
this.tokenIndex = location.getTokenIndex();
this.segmentIndex = location.getSegmentIndex();
this.charIndex = location.getCharIndex();
@@ -73,7 +74,7 @@
}
@Override
- public int compareTo(final TextTokenFlow.Location other) {
+ public int compareTo(final TextTokenFlowLocation other) {
if (this.tokenIndex == other.getTokenIndex()) {
if (this.segmentIndex == other.getSegmentIndex()) {
if (this.charIndex == other.getCharIndex()) {
@@ -94,7 +95,7 @@
* @param other The other location.
* @return True if and only if the token index in this location is the same as the token index in {@code other}.
*/
- public boolean isSameTokenAs(final TextTokenFlow.Location other) {
+ public boolean isSameTokenAs(final TextTokenFlowLocation other) {
return this.tokenIndex == other.getTokenIndex();
}
@@ -104,7 +105,7 @@
* @return True if and only if the token index in this location is the same as the token index in {@code other},
* <em>and</em> the segment index in this location is the same as the segment index in {@code other}.
*/
- public boolean isSameTokenAndSegmentAs(final TextTokenFlow.Location other) {
+ public boolean isSameTokenAndSegmentAs(final TextTokenFlowLocation other) {
return (this.tokenIndex == other.getTokenIndex())
&& (this.segmentIndex == other.getSegmentIndex());
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-02-03 00:31:19 UTC (rev 12544)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-02-03 00:56:57 UTC (rev 12545)
@@ -39,7 +39,7 @@
import org.axsl.kpModel.ParaBranch;
import org.axsl.kpModel.ParaLeaf;
import org.axsl.kpModel.ParaNode;
-import org.axsl.orthography.TextTokenFlow;
+import org.axsl.orthography.TextTokenFlowLocation;
import org.axsl.orthography.Whitespace;
import org.axsl.value.WhiteSpaceTreatment;
import org.axsl.value.group.TextModifiers;
@@ -54,10 +54,10 @@
public class TokenFlow4a implements FoTextTokenFlow {
/**
- * FOray implementation of {@link TextTokenFlow.Location}.
+ * FOray implementation of {@link TextTokenFlowLocation}.
* Instances of this class are immutable.
*/
- public final class Location implements TextTokenFlow.Location {
+ public final class Location implements TextTokenFlowLocation {
/* TODO: If 16 bits is not enough for the token index, consider cramming the three parameters into one int,
* using the 32 bits as 20 bits for the token, 6 for the segment, and 6 for the char, adding 4 bits to the size
* of the token index. */
@@ -117,7 +117,7 @@
}
@Override
- public int compareTo(final TextTokenFlow.Location o) {
+ public int compareTo(final TextTokenFlowLocation o) {
if (this.tokenIndex == o.getTokenIndex()) {
if (this.segmentIndex == o.getSegmentIndex()) {
if (this.charIndex == o.getCharIndex()) {
@@ -217,12 +217,12 @@
}
@Override
- public TextTokenFlow.Location markLocation(final int tokenIndex, final int segmentIndex, final int charIndex) {
+ public TextTokenFlowLocation markLocation(final int tokenIndex, final int segmentIndex, final int charIndex) {
return new Location(tokenIndex, segmentIndex, charIndex);
}
@Override
- public CharSequence extract(final TextTokenFlow.Location startLocation, final TextTokenFlow.Location endLocation,
+ public CharSequence extract(final TextTokenFlowLocation startLocation, final TextTokenFlowLocation endLocation,
final TextModifiers textModifiers, final boolean isStartOfLine, final boolean isEndOfLine) {
final StringBuilder builder = new StringBuilder();
final MutableTokenFlowLocation currentLocation = new MutableTokenFlowLocation(startLocation);
@@ -275,7 +275,7 @@
* @param isEndOfLine Indicates whether {@code endLocation} is at the very end of a line.
* @return True if and only if a discretionary hyphen is needed at {@code endLocation}.
*/
- private boolean isHyphenNeeded(final TextTokenFlow.Location endLocation, final boolean isEndOfLine) {
+ private boolean isHyphenNeeded(final TextTokenFlowLocation endLocation, final boolean isEndOfLine) {
if (! isEndOfLine) {
return false;
}
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/TokenFlow4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/TokenFlow4aTests.java 2022-02-03 00:31:19 UTC (rev 12544)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/TokenFlow4aTests.java 2022-02-03 00:56:57 UTC (rev 12545)
@@ -28,7 +28,7 @@
package org.foray.orthography;
-import org.axsl.orthography.TextTokenFlow;
+import org.axsl.orthography.TextTokenFlowLocation;
import org.axsl.unicode.block.Basic_Latin_Block;
import org.axsl.value.LinefeedTreatment;
import org.axsl.value.TextTransform;
@@ -197,8 +197,8 @@
Mockito.when(textModifiers.traitHyphenationCharacter()).thenReturn((int) Basic_Latin_Block.HYPHEN_MINUS);
/* Test extract starting at the start. */
- TextTokenFlow.Location start = out.markLocation(0, 0, 0);
- TextTokenFlow.Location end = out.markLocation(7, 0, 0);
+ TextTokenFlowLocation start = out.markLocation(0, 0, 0);
+ TextTokenFlowLocation end = out.markLocation(7, 0, 0);
Assert.assertEquals("What’s done we partly", out.extract(start, end, textModifiers, false, false));
/* Test extract ending with a space. */
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java 2022-02-03 00:31:19 UTC (rev 12544)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java 2022-02-03 00:56:57 UTC (rev 12545)
@@ -35,11 +35,11 @@
import org.axsl.area.LineArea;
import org.axsl.area.NormalBlockArea;
import org.axsl.fotree.fo.FoTextWords;
-import org.axsl.fotree.text.FoTextTokenFlow;
import org.axsl.kpModel.ParaConfig;
import org.axsl.kpModel.ParaContext;
import org.axsl.linebreak.LineBreakResult;
import org.axsl.linebreak.LineBreaker;
+import org.axsl.orthography.TextTokenFlowLocation;
/**
* Pioneer Layout for {@link FoTextWords}.
@@ -85,7 +85,7 @@
this.node.getFoTokenFlow(), (ParaConfig) this.node, paraContext, normalBlockArea);
}
- FoTextTokenFlow.Location startLocation = this.node.getFoTokenFlow().markLocation(0, 0, 0);
+ TextTokenFlowLocation startLocation = this.node.getFoTokenFlow().markLocation(0, 0, 0);
/* Run a leaf iterator alongside the iteration of the line-break results, so that we can conveniently retrieve
* the branch indexes. */
final ParaBranch4aIterator iterator = new ParaBranch4aIterator(this.node.getFoTokenFlow());
@@ -106,7 +106,7 @@
/* Element 0 should be the token index. If there is an element 1, it is the segment index. */
final int tokenIndex = iterator.branchIndexAt(0);
final int segmentIndex = iterator.depth() > 1 ? iterator.branchIndexAt(1) : 0;
- final FoTextTokenFlow.Location endLocation =
+ final TextTokenFlowLocation endLocation =
this.node.getFoTokenFlow().markLocation(tokenIndex, segmentIndex, 0);
lineArea.makeGlyphAreaSequence(this.node, startLocation, endLocation, false);
startLocation = endLocation;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-03 00:31:22
|
Revision: 12544
http://sourceforge.net/p/foray/code/12544
Author: victormote
Date: 2022-02-03 00:31:19 +0000 (Thu, 03 Feb 2022)
Log Message:
-----------
Conform to aXSL changes: Rename interfaces for clarity.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/TokenFlow4aTests.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java 2022-02-03 00:13:39 UTC (rev 12543)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java 2022-02-03 00:31:19 UTC (rev 12544)
@@ -48,7 +48,7 @@
import org.axsl.fotree.fo.PageNumberCitationLast;
import org.axsl.fotree.fo.RetrieveMarker;
import org.axsl.fotree.fo.ScalingValueCitation;
-import org.axsl.fotree.text.FoTokenFlow;
+import org.axsl.fotree.text.FoTextTokenFlow;
import org.axsl.galley.GlyphAreaSequenceG5;
import java.util.ArrayList;
@@ -92,7 +92,7 @@
@Override
public GlyphAreaSequenceG5 makeGlyphAreaSequence(final FoTextWords paragraph,
- final FoTokenFlow.Location startLocation, final FoTokenFlow.Location endLocation,
+ final FoTextTokenFlow.Location startLocation, final FoTextTokenFlow.Location endLocation,
final boolean hasFauxSmallCaps) {
throw new UnsupportedOperationException();
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java 2022-02-03 00:13:39 UTC (rev 12543)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java 2022-02-03 00:31:19 UTC (rev 12544)
@@ -54,10 +54,10 @@
import org.axsl.fotree.fo.PageNumberCitationLast;
import org.axsl.fotree.fo.RetrieveMarker;
import org.axsl.fotree.fo.ScalingValueCitation;
-import org.axsl.fotree.text.FoTokenFlow;
import org.axsl.galley.GlyphAreaSequenceG5;
import org.axsl.galley.render.GalleyVisitor;
import org.axsl.galley.render.GalleyVisitorException;
+import org.axsl.orthography.TextTokenFlow;
import org.axsl.value.Conditionality;
import org.axsl.value.LineStackingStrategy;
import org.axsl.value.RelativeAxis;
@@ -1018,7 +1018,7 @@
@Override
public GlyphAreaSequenceG5 makeGlyphAreaSequence(final FoTextWords paragraph,
- final FoTokenFlow.Location startLocation, final FoTokenFlow.Location endLocation,
+ final TextTokenFlow.Location startLocation, final TextTokenFlow.Location endLocation,
final boolean hasFauxSmallCaps) {
final TextAreaWords newTextArea = TextAreaWords.makeTextArea(paragraph, this, startLocation, endLocation);
this.children.add(newTextArea);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java 2022-02-03 00:13:39 UTC (rev 12543)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java 2022-02-03 00:31:19 UTC (rev 12544)
@@ -31,7 +31,7 @@
import org.foray.area.link.Link;
import org.axsl.fotree.fo.FoTextWords;
-import org.axsl.fotree.text.FoTokenFlow;
+import org.axsl.orthography.TextTokenFlow;
/**
* A {@link TextArea} that wraps a sequence of words and interword content.
@@ -43,10 +43,10 @@
private Link<FoTextWords> foLink;
/** The starting location in {@link #foLink} for the text in this area, inclusive. */
- private FoTokenFlow.Location startLocation;
+ private TextTokenFlow.Location startLocation;
/** The ending location in {@link #foLink} for the text in this area, exclusive. */
- private FoTokenFlow.Location endLocation;
+ private TextTokenFlow.Location endLocation;
/**
* Constructor.
@@ -56,7 +56,7 @@
* @param endLocation The ending location in {@code generatedBy} for the text in this area, exclusive.
*/
public TextAreaWords(final LineArea4a parentArea, final Link<FoTextWords> generatedBy,
- final FoTokenFlow.Location startLocation, final FoTokenFlow.Location endLocation) {
+ final TextTokenFlow.Location startLocation, final TextTokenFlow.Location endLocation) {
super(parentArea);
this.foLink = generatedBy;
this.startLocation = startLocation;
@@ -72,7 +72,7 @@
* @return The newly-created TextArea.
*/
static TextAreaWords makeTextArea(final FoTextWords generatedBy, final LineArea4a parentArea,
- final FoTokenFlow.Location startLocation, final FoTokenFlow.Location endLocation) {
+ final TextTokenFlow.Location startLocation, final TextTokenFlow.Location endLocation) {
final Link<FoTextWords> linkage = parentArea.getLink(generatedBy);
final TextAreaWords newTextArea = new TextAreaWords(parentArea, linkage, startLocation, endLocation);
newTextArea.registerLink(generatedBy);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-02-03 00:13:39 UTC (rev 12543)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-02-03 00:31:19 UTC (rev 12544)
@@ -35,8 +35,8 @@
import org.axsl.fotree.fo.FoTextWords;
import org.axsl.fotree.text.FoOrthography;
import org.axsl.fotree.text.FoOrthographyServer;
-import org.axsl.fotree.text.FoToken;
-import org.axsl.fotree.text.FoTokenFlow;
+import org.axsl.fotree.text.FoTextToken;
+import org.axsl.fotree.text.FoTextTokenFlow;
import org.axsl.kpModel.ParaBranch;
import org.axsl.kpModel.ParaLeaf;
import org.axsl.kpModel.ParaNode;
@@ -47,7 +47,8 @@
/**
* Text in an FO document that has been tokenized into words.
- * This is a thin wrapper around an instance of {@link FoTokenFlow} that allows that token flow to live in an FO tree.
+ * This is a thin wrapper around an instance of {@link FoTextTokenFlow} that allows that token flow to live in an FO
+ * tree.
*/
public class FoTextWords4a extends FoText4a implements FoTextWords, ParaBranch {
@@ -55,7 +56,7 @@
private FoObj parent;
/** The parsed words. */
- private FoTokenFlow tokenFlow;
+ private FoTextTokenFlow tokenFlow;
/**
* Constructor.
@@ -79,7 +80,7 @@
@Override
public boolean isAllWhiteSpace() {
for (int index = 0; index < this.tokenFlow.qtyTokens(); index ++) {
- final FoToken token = this.tokenFlow.tokenAt(index);
+ final FoTextToken token = this.tokenFlow.tokenAt(index);
if (! (token instanceof Whitespace)) {
return false;
}
@@ -111,7 +112,7 @@
}
@Override
- public FoTokenFlow getFoTokenFlow() {
+ public FoTextTokenFlow getFoTokenFlow() {
return this.tokenFlow;
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-02-03 00:13:39 UTC (rev 12543)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-02-03 00:31:19 UTC (rev 12544)
@@ -32,8 +32,8 @@
import org.foray.common.para.ParaBranch4a;
import org.foray.common.para.ParaBranch4aIterator;
-import org.axsl.fotree.text.FoToken;
-import org.axsl.fotree.text.FoTokenFlow;
+import org.axsl.fotree.text.FoTextToken;
+import org.axsl.fotree.text.FoTextTokenFlow;
import org.axsl.fotree.text.FoWord;
import org.axsl.fotree.text.FoWordSegment;
import org.axsl.kpModel.ParaBranch;
@@ -49,9 +49,9 @@
import java.util.ListIterator;
/**
- * FOray implementation of {@link FoTokenFlow}.
+ * FOray implementation of {@link FoTextTokenFlow}.
*/
-public class TokenFlow4a implements FoTokenFlow {
+public class TokenFlow4a implements FoTextTokenFlow {
/**
* FOray implementation of {@link TextTokenFlow.Location}.
@@ -141,13 +141,13 @@
}
/** The tokens (children) of this text flow. */
- private List<FoToken> tokens = new ArrayList<FoToken>();
+ private List<FoTextToken> tokens = new ArrayList<FoTextToken>();
/**
* Add a token.
* @param token The token to be added.
*/
- public void addToken(final FoToken token) {
+ public void addToken(final FoTextToken token) {
this.tokens.add(token);
}
@@ -157,7 +157,7 @@
}
@Override
- public FoToken tokenAt(final int index) {
+ public FoTextToken tokenAt(final int index) {
return this.tokens.get(index);
}
@@ -227,7 +227,7 @@
final StringBuilder builder = new StringBuilder();
final MutableTokenFlowLocation currentLocation = new MutableTokenFlowLocation(startLocation);
while (currentLocation.compareTo(endLocation) < 0) {
- final FoToken token = tokenAt(currentLocation.getTokenIndex());
+ final FoTextToken token = tokenAt(currentLocation.getTokenIndex());
final int codepointBefore = relevantWhitespaceBefore(currentLocation.getTokenIndex());
final int codepointAfter = relevantWhitespaceAfter(currentLocation.getTokenIndex());
if (token instanceof FoWord) {
@@ -284,7 +284,7 @@
* token was included. */
return false;
}
- final FoToken lastToken = this.tokenAt(endLocation.getTokenIndex());
+ final FoTextToken lastToken = this.tokenAt(endLocation.getTokenIndex());
if (lastToken instanceof FoWord) {
final FoWord word = (FoWord) lastToken;
final int qtySegments = word.qtyWordSegments();
@@ -304,7 +304,7 @@
* For all other tokens, returns -1, as this computation is not relevant.
*/
private int relevantWhitespaceBefore(final int tokenIndex) {
- final FoToken token = tokenAt(tokenIndex);
+ final FoTextToken token = tokenAt(tokenIndex);
if (! (token instanceof Whitespace)) {
return -1;
}
@@ -311,7 +311,7 @@
if (tokenIndex == 0) {
return -1;
}
- final FoToken previousToken = tokenAt(tokenIndex - 1);
+ final FoTextToken previousToken = tokenAt(tokenIndex - 1);
if (previousToken instanceof Whitespace) {
final Whitespace whitespace = (Whitespace) previousToken;
return whitespace.charAt(whitespace.length() - 1);
@@ -330,7 +330,7 @@
* For all other tokens, returns -1, as this computation is not relevant.
*/
private int relevantWhitespaceAfter(final int tokenIndex) {
- final FoToken token = tokenAt(tokenIndex);
+ final FoTextToken token = tokenAt(tokenIndex);
if (! (token instanceof Whitespace)) {
return -1;
}
@@ -337,7 +337,7 @@
if (tokenIndex == qtyTokens() - 1) {
return -1;
}
- final FoToken nextToken = tokenAt(tokenIndex + 1);
+ final FoTextToken nextToken = tokenAt(tokenIndex + 1);
if (nextToken instanceof Whitespace) {
final Whitespace whitespace = (Whitespace) nextToken;
return whitespace.charAt(0);
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/TokenFlow4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/TokenFlow4aTests.java 2022-02-03 00:13:39 UTC (rev 12543)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/TokenFlow4aTests.java 2022-02-03 00:31:19 UTC (rev 12544)
@@ -28,7 +28,6 @@
package org.foray.orthography;
-import org.axsl.fotree.text.FoTokenFlow;
import org.axsl.orthography.TextTokenFlow;
import org.axsl.unicode.block.Basic_Latin_Block;
import org.axsl.value.LinefeedTreatment;
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java 2022-02-03 00:13:39 UTC (rev 12543)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java 2022-02-03 00:31:19 UTC (rev 12544)
@@ -35,7 +35,7 @@
import org.axsl.area.LineArea;
import org.axsl.area.NormalBlockArea;
import org.axsl.fotree.fo.FoTextWords;
-import org.axsl.fotree.text.FoTokenFlow;
+import org.axsl.fotree.text.FoTextTokenFlow;
import org.axsl.kpModel.ParaConfig;
import org.axsl.kpModel.ParaContext;
import org.axsl.linebreak.LineBreakResult;
@@ -85,7 +85,7 @@
this.node.getFoTokenFlow(), (ParaConfig) this.node, paraContext, normalBlockArea);
}
- FoTokenFlow.Location startLocation = this.node.getFoTokenFlow().markLocation(0, 0, 0);
+ FoTextTokenFlow.Location startLocation = this.node.getFoTokenFlow().markLocation(0, 0, 0);
/* Run a leaf iterator alongside the iteration of the line-break results, so that we can conveniently retrieve
* the branch indexes. */
final ParaBranch4aIterator iterator = new ParaBranch4aIterator(this.node.getFoTokenFlow());
@@ -106,7 +106,7 @@
/* Element 0 should be the token index. If there is an element 1, it is the segment index. */
final int tokenIndex = iterator.branchIndexAt(0);
final int segmentIndex = iterator.depth() > 1 ? iterator.branchIndexAt(1) : 0;
- final FoTokenFlow.Location endLocation =
+ final FoTextTokenFlow.Location endLocation =
this.node.getFoTokenFlow().markLocation(tokenIndex, segmentIndex, 0);
lineArea.makeGlyphAreaSequence(this.node, startLocation, endLocation, false);
startLocation = endLocation;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-03 00:13:41
|
Revision: 12543
http://sourceforge.net/p/foray/code/12543
Author: victormote
Date: 2022-02-03 00:13:39 +0000 (Thu, 03 Feb 2022)
Log Message:
-----------
Conform to aXSL change: Rename interface for clarity.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutableTokenFlowLocation.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/TokenFlow4aTests.java
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutableTokenFlowLocation.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutableTokenFlowLocation.java 2022-02-02 23:21:32 UTC (rev 12542)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutableTokenFlowLocation.java 2022-02-03 00:13:39 UTC (rev 12543)
@@ -28,23 +28,23 @@
package org.foray.orthography;
-import org.axsl.orthography.TokenFlow;
+import org.axsl.orthography.TextTokenFlow;
/**
- * A mutable version of {@link TokenFlow.Location}, useful when iterating locations.
+ * A mutable version of {@link TextTokenFlow.Location}, useful when iterating locations.
*/
-public class MutableTokenFlowLocation implements TokenFlow.Location {
+public class MutableTokenFlowLocation implements TextTokenFlow.Location {
/** String format for {@link #toString()}. */
private static final String TO_STRING_FORMAT = "[%d, %d, %d]";
- /** The token index. See {@link TokenFlow.Location#getTokenIndex()}. */
+ /** The token index. See {@link TextTokenFlow.Location#getTokenIndex()}. */
private int tokenIndex;
- /** The segment index. See {@link TokenFlow.Location#getSegmentIndex()}. */
+ /** The segment index. See {@link TextTokenFlow.Location#getSegmentIndex()}. */
private byte segmentIndex;
- /** The char index. See {@link TokenFlow.Location#getCharIndex()}. */
+ /** The char index. See {@link TextTokenFlow.Location#getCharIndex()}. */
private byte charIndex;
/**
@@ -51,7 +51,7 @@
* Creates a mutable token flow location, using another location for its starting indexes.
* @param location The location whose indexes should be used as starting indexes for this new location.
*/
- public MutableTokenFlowLocation(final TokenFlow.Location location) {
+ public MutableTokenFlowLocation(final TextTokenFlow.Location location) {
this.tokenIndex = location.getTokenIndex();
this.segmentIndex = location.getSegmentIndex();
this.charIndex = location.getCharIndex();
@@ -73,7 +73,7 @@
}
@Override
- public int compareTo(final TokenFlow.Location other) {
+ public int compareTo(final TextTokenFlow.Location other) {
if (this.tokenIndex == other.getTokenIndex()) {
if (this.segmentIndex == other.getSegmentIndex()) {
if (this.charIndex == other.getCharIndex()) {
@@ -94,7 +94,7 @@
* @param other The other location.
* @return True if and only if the token index in this location is the same as the token index in {@code other}.
*/
- public boolean isSameTokenAs(final TokenFlow.Location other) {
+ public boolean isSameTokenAs(final TextTokenFlow.Location other) {
return this.tokenIndex == other.getTokenIndex();
}
@@ -104,7 +104,7 @@
* @return True if and only if the token index in this location is the same as the token index in {@code other},
* <em>and</em> the segment index in this location is the same as the segment index in {@code other}.
*/
- public boolean isSameTokenAndSegmentAs(final TokenFlow.Location other) {
+ public boolean isSameTokenAndSegmentAs(final TextTokenFlow.Location other) {
return (this.tokenIndex == other.getTokenIndex())
&& (this.segmentIndex == other.getSegmentIndex());
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-02-02 23:21:32 UTC (rev 12542)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-02-03 00:13:39 UTC (rev 12543)
@@ -39,7 +39,7 @@
import org.axsl.kpModel.ParaBranch;
import org.axsl.kpModel.ParaLeaf;
import org.axsl.kpModel.ParaNode;
-import org.axsl.orthography.TokenFlow;
+import org.axsl.orthography.TextTokenFlow;
import org.axsl.orthography.Whitespace;
import org.axsl.value.WhiteSpaceTreatment;
import org.axsl.value.group.TextModifiers;
@@ -54,10 +54,10 @@
public class TokenFlow4a implements FoTokenFlow {
/**
- * FOray implementation of {@link TokenFlow.Location}.
+ * FOray implementation of {@link TextTokenFlow.Location}.
* Instances of this class are immutable.
*/
- public final class Location implements TokenFlow.Location {
+ public final class Location implements TextTokenFlow.Location {
/* TODO: If 16 bits is not enough for the token index, consider cramming the three parameters into one int,
* using the 32 bits as 20 bits for the token, 6 for the segment, and 6 for the char, adding 4 bits to the size
* of the token index. */
@@ -117,7 +117,7 @@
}
@Override
- public int compareTo(final TokenFlow.Location o) {
+ public int compareTo(final TextTokenFlow.Location o) {
if (this.tokenIndex == o.getTokenIndex()) {
if (this.segmentIndex == o.getSegmentIndex()) {
if (this.charIndex == o.getCharIndex()) {
@@ -217,12 +217,12 @@
}
@Override
- public TokenFlow.Location markLocation(final int tokenIndex, final int segmentIndex, final int charIndex) {
+ public TextTokenFlow.Location markLocation(final int tokenIndex, final int segmentIndex, final int charIndex) {
return new Location(tokenIndex, segmentIndex, charIndex);
}
@Override
- public CharSequence extract(final TokenFlow.Location startLocation, final TokenFlow.Location endLocation,
+ public CharSequence extract(final TextTokenFlow.Location startLocation, final TextTokenFlow.Location endLocation,
final TextModifiers textModifiers, final boolean isStartOfLine, final boolean isEndOfLine) {
final StringBuilder builder = new StringBuilder();
final MutableTokenFlowLocation currentLocation = new MutableTokenFlowLocation(startLocation);
@@ -275,7 +275,7 @@
* @param isEndOfLine Indicates whether {@code endLocation} is at the very end of a line.
* @return True if and only if a discretionary hyphen is needed at {@code endLocation}.
*/
- private boolean isHyphenNeeded(final TokenFlow.Location endLocation, final boolean isEndOfLine) {
+ private boolean isHyphenNeeded(final TextTokenFlow.Location endLocation, final boolean isEndOfLine) {
if (! isEndOfLine) {
return false;
}
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/TokenFlow4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/TokenFlow4aTests.java 2022-02-02 23:21:32 UTC (rev 12542)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/TokenFlow4aTests.java 2022-02-03 00:13:39 UTC (rev 12543)
@@ -29,7 +29,7 @@
package org.foray.orthography;
import org.axsl.fotree.text.FoTokenFlow;
-import org.axsl.orthography.TokenFlow;
+import org.axsl.orthography.TextTokenFlow;
import org.axsl.unicode.block.Basic_Latin_Block;
import org.axsl.value.LinefeedTreatment;
import org.axsl.value.TextTransform;
@@ -198,8 +198,8 @@
Mockito.when(textModifiers.traitHyphenationCharacter()).thenReturn((int) Basic_Latin_Block.HYPHEN_MINUS);
/* Test extract starting at the start. */
- TokenFlow.Location start = out.markLocation(0, 0, 0);
- TokenFlow.Location end = out.markLocation(7, 0, 0);
+ TextTokenFlow.Location start = out.markLocation(0, 0, 0);
+ TextTokenFlow.Location end = out.markLocation(7, 0, 0);
Assert.assertEquals("What’s done we partly", out.extract(start, end, textModifiers, false, false));
/* Test extract ending with a space. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-02 23:21:34
|
Revision: 12542
http://sourceforge.net/p/foray/code/12542
Author: victormote
Date: 2022-02-02 23:21:32 +0000 (Wed, 02 Feb 2022)
Log Message:
-----------
Conform to aXSL change: Create new LineBreakContext interface, and move one method to it from ParaContext. First step in sorting out KP line-breaking concepts from general ones.
Modified Paths:
--------------
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/BestFitLb.java
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/TotalFitLb.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/BestFitLb.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/BestFitLb.java 2022-02-02 18:39:42 UTC (rev 12541)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/BestFitLb.java 2022-02-02 23:21:32 UTC (rev 12542)
@@ -31,6 +31,7 @@
import org.axsl.kpModel.ParaBranch;
import org.axsl.kpModel.ParaConfig;
import org.axsl.kpModel.ParaContext;
+import org.axsl.linebreak.LineBreakContext;
/**
* Implementation of the Knuth-Plass "best-fit" linebreaking algorithm.
@@ -40,7 +41,7 @@
@Override
public LineBreakResult4a breakIntoLines(final ParaBranch paragraph, final ParaConfig paraConfig,
- final ParaContext paraContext) {
+ final ParaContext paraContext, final LineBreakContext lbContext) {
return new LineBreakResult4a(null, null);
}
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2022-02-02 18:39:42 UTC (rev 12541)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2022-02-02 23:21:32 UTC (rev 12542)
@@ -36,6 +36,7 @@
import org.axsl.kpModel.ParaGlue;
import org.axsl.kpModel.ParaLeaf;
import org.axsl.kpModel.ParaPenalty;
+import org.axsl.linebreak.LineBreakContext;
import java.util.ArrayList;
import java.util.List;
@@ -119,16 +120,21 @@
/** The paragraph context. */
private ParaContext paraContext;
+ /** The target of the line-breaker. */
+ private LineBreakContext lineBreakTarget;
+
/**
* Constructor.
* @param paraConfig The configuration of the paragraph being processed.
* @param paraContext The paragraph context instance.
+ * @param lbContext The line-break target.
*/
- private State(final ParaConfig paraConfig, final ParaContext paraContext) {
+ private State(final ParaConfig paraConfig, final ParaContext paraContext, final LineBreakContext lbContext) {
this.paraConfig = paraConfig;
this.paraContext = paraContext;
+ this.lineBreakTarget = lbContext;
this.currentLineNumber = 1;
- this.lineLengths.append(this.paraContext.getLineLength(currentLineNumber));
+ this.lineLengths.append(this.lineBreakTarget.getLineLength(currentLineNumber));
}
/**
@@ -222,7 +228,7 @@
this.currentLineShrinkability = 0;
this.currentLineStretchability = 0;
this.currentLineNumber ++;
- this.lineLengths.append(this.paraContext.getLineLength(currentLineNumber));
+ this.lineLengths.append(this.lineBreakTarget.getLineLength(currentLineNumber));
}
/**
@@ -271,7 +277,7 @@
@Override
public LineBreakResult4a breakIntoLines(final ParaBranch paragraph, final ParaConfig paraConfig,
- final ParaContext paraContext) {
+ final ParaContext paraContext, final LineBreakContext lbContext) {
/* For purposes of this algorithm, "word" means the content between glue items, or, really, if (a) is non-glue,
* (b) is glue, (c) is non-glue, and (d) is glue, then (a) is the end of the previous word, and (b) and (c)
* together are the current word, and (d) is the beginning of the next word. */
@@ -280,7 +286,7 @@
return LineBreakResult4a.EMPTY_RESULT;
}
- final State state = new State(paraConfig, paraContext);
+ final State state = new State(paraConfig, paraContext, lbContext);
final ListIterator<ParaLeaf> leafIterator = paragraph.leafIterator();
while (leafIterator.hasNext()) {
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/TotalFitLb.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/TotalFitLb.java 2022-02-02 18:39:42 UTC (rev 12541)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/TotalFitLb.java 2022-02-02 23:21:32 UTC (rev 12542)
@@ -43,6 +43,7 @@
import org.axsl.kpModel.ParaNode;
import org.axsl.kpModel.ParaPenalty;
import org.axsl.linebreak.KpFitnessClass;
+import org.axsl.linebreak.LineBreakContext;
import java.util.ArrayList;
import java.util.Arrays;
@@ -94,11 +95,15 @@
/** The total shrink computed so far. */
private int cumulativeShrink;
+ /** The line-break target. */
+ private LineBreakContext lbContext;
+
@Override
public LineBreakResult4a breakIntoLines(final ParaBranch paragraph, final ParaConfig paraConfig,
- final ParaContext paraContext) {
+ final ParaContext paraContext, final LineBreakContext lbContext) {
this.paragraph = paragraph;
this.paraContext = paraContext;
+ this.lbContext = lbContext;
final IntArrayBuilder returnValue = new IntArrayBuilder();
if (paragraph == null) {
return new LineBreakResult4a(new int[0], new int[0]);
@@ -336,18 +341,18 @@
final ParaPenalty penalty = b.getContent().asParaPenalty();
length += penalty.getWidth(b.getConfig());
}
- if (length < this.paraContext.getLineLength(j - 1)) {
+ if (length < this.lbContext.getLineLength(j - 1)) {
final int stretch = this.cumulativeStretch - a.getTotalStretch();
if (stretch > 0) {
- final int numerator = this.paraContext.getLineLength(j - 1) - length;
+ final int numerator = this.lbContext.getLineLength(j - 1) - length;
ratio = numerator / stretch;
} else {
ratio = Double.MAX_VALUE;
}
- } else if (length > this.paraContext.getLineLength(j - 1)) {
+ } else if (length > this.lbContext.getLineLength(j - 1)) {
final int shrink = this.cumulativeShrink - a.getTotalShrink();
if (shrink > 0) {
- final int numerator = this.paraContext.getLineLength(j - 1) - length;
+ final int numerator = this.lbContext.getLineLength(j - 1) - length;
ratio = numerator / shrink;
} else {
ratio = Double.MAX_VALUE;
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java 2022-02-02 18:39:42 UTC (rev 12541)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java 2022-02-02 23:21:32 UTC (rev 12542)
@@ -32,6 +32,7 @@
import org.axsl.kpModel.ParaConfig;
import org.axsl.kpModel.ParaContext;
+import org.axsl.linebreak.LineBreakContext;
import org.junit.Assert;
import org.junit.Test;
@@ -50,9 +51,10 @@
para.addWord("Hello World!");
para.addSpace();
final ParaConfig paraConfig = createGrimmParaConfig();
- final ParaContext paraContext = createParaContext(-1);
+ final ParaContext paraContext = createParaContext();
+ final LineBreakContext lineBreakTarget = createLineBreakTarget(-1);
final FirstFitLb out = new FirstFitLb();
- final LineBreakResult4a actual = out.breakIntoLines(para, paraConfig, paraContext);
+ final LineBreakResult4a actual = out.breakIntoLines(para, paraConfig, paraContext, lineBreakTarget);
Assert.assertEquals(1, actual.getQtyLines());
Assert.assertEquals(468000, actual.getLineLength(0));
Assert.assertEquals(2, actual.getBreakPosition(0));
@@ -67,10 +69,11 @@
final ParaConfig paraConfig = createGrimmParaConfig();
/* Line width obtained from "Digital Typography," p. 73. We leave it expressed here in Monotype "units". */
final int lineWidth = 390;
- final ParaContext paraContext = createParaContext(lineWidth);
+ final ParaContext paraContext = createParaContext();
+ final LineBreakContext lbContext = createLineBreakTarget(lineWidth);
final FirstFitLb out = new FirstFitLb();
- final LineBreakResult4a actual = out.breakIntoLines(para, paraConfig, paraContext);
+ final LineBreakResult4a actual = out.breakIntoLines(para, paraConfig, paraContext, lbContext);
Assert.assertEquals(12, actual.getQtyLines());
Assert.assertEquals(390, actual.getLineLength(0));
Assert.assertEquals(390, actual.getLineLength(1));
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2022-02-02 18:39:42 UTC (rev 12541)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2022-02-02 23:21:32 UTC (rev 12542)
@@ -39,6 +39,7 @@
import org.axsl.kpModel.ParaContext;
import org.axsl.kpModel.ParaPenalty;
+import org.axsl.linebreak.LineBreakContext;
import org.junit.Assert;
import org.mockito.Mockito;
@@ -383,20 +384,29 @@
/**
* Creates a standard paragraph context, used for testing.
- * @param lineWidth The line width that this control should use, in millipoints.
- * If less than zero, a line width of 6.5 inches will be used.
* @return A paragraph context for testing.
*/
- public ParaContext createParaContext(final int lineWidth) {
+ public ParaContext createParaContext() {
final ParaContext paraControl = Mockito.mock(ParaContext.class);
Mockito.when(paraControl.getCost(Mockito.any(ParaPenalty.Quality.class))).thenReturn(50);
+ return paraControl;
+ }
+
+ /**
+ * Creates a standard paragraph context, used for testing.
+ * @param lineWidth The line width that this control should use, in millipoints.
+ * If less than zero, a line width of 6.5 inches will be used.
+ * @return A line-break target for testing.
+ */
+ public LineBreakContext createLineBreakTarget(final int lineWidth) {
+ final LineBreakContext lbContext = Mockito.mock(LineBreakContext.class);
if (lineWidth < 0) {
/* Page is 8.5 inches wide, 1 inch margin on both ends, leaving 6.5 inches, or 468,000 millipoints. */
- Mockito.when(paraControl.getLineLength(Mockito.anyInt())).thenReturn(468000);
+ Mockito.when(lbContext.getLineLength(Mockito.anyInt())).thenReturn(468000);
} else {
- Mockito.when(paraControl.getLineLength(Mockito.anyInt())).thenReturn(lineWidth);
+ Mockito.when(lbContext.getLineLength(Mockito.anyInt())).thenReturn(lineWidth);
}
- return paraControl;
+ return lbContext;
}
}
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2022-02-02 18:39:42 UTC (rev 12541)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2022-02-02 23:21:32 UTC (rev 12542)
@@ -32,6 +32,7 @@
import org.axsl.kpModel.ParaConfig;
import org.axsl.kpModel.ParaContext;
+import org.axsl.linebreak.LineBreakContext;
import org.junit.Assert;
import org.junit.Ignore;
@@ -52,11 +53,12 @@
final ParaBranch4a para = this.createPara();
final ParaConfig paraConfig = createGrimmParaConfig();
+ final ParaContext paraContext = createParaContext();
/* Line width obtained from "Digital Typography," p. 73.*/
- final ParaContext paraContext = createParaContext(390_000);
+ final LineBreakContext lineBreakTarget = createLineBreakTarget(390_000);
final TotalFitLb out = new TotalFitLb();
- final LineBreakResult4a actual = out.breakIntoLines(para, paraConfig, paraContext);
+ final LineBreakResult4a actual = out.breakIntoLines(para, paraConfig, paraContext, lineBreakTarget);
final int[] expected = new int[0];
Assert.assertEquals(expected, actual);
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java 2022-02-02 18:39:42 UTC (rev 12541)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java 2022-02-02 23:21:32 UTC (rev 12542)
@@ -77,7 +77,7 @@
final LineBreaker breaker = blockArea.getAreaTree().getLineBreaker();
final LineBreakResult result = breaker.breakIntoLines(
- this.blockDiscrete, (ParaConfig) this.blockDiscrete, blockArea.getParaContext());
+ this.blockDiscrete, (ParaConfig) this.blockDiscrete, blockArea.getParaContext(), blockArea);
int lastBreakPosition = 0;
for (int lineIndex = 0; lineIndex < result.getQtyLines(); lineIndex ++) {
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java 2022-02-02 18:39:42 UTC (rev 12541)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java 2022-02-02 23:21:32 UTC (rev 12542)
@@ -81,7 +81,8 @@
if (this.result == null) {
final LineBreaker lb = areaNode.getAreaTree().getLineBreaker();
- this.result = lb.breakIntoLines(this.node.getFoTokenFlow(), (ParaConfig) this.node, paraContext);
+ this.result = lb.breakIntoLines(
+ this.node.getFoTokenFlow(), (ParaConfig) this.node, paraContext, normalBlockArea);
}
FoTokenFlow.Location startLocation = this.node.getFoTokenFlow().markLocation(0, 0, 0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-02 18:39:45
|
Revision: 12541
http://sourceforge.net/p/foray/code/12541
Author: victormote
Date: 2022-02-02 18:39:42 +0000 (Wed, 02 Feb 2022)
Log Message:
-----------
Conform to aXSL changes: Remove ugly and unused dependencies on the knuth-plass model.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java 2022-02-02 18:19:33 UTC (rev 12540)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java 2022-02-02 18:39:42 UTC (rev 12541)
@@ -50,8 +50,6 @@
import org.axsl.fotree.fo.ScalingValueCitation;
import org.axsl.fotree.text.FoTokenFlow;
import org.axsl.galley.GlyphAreaSequenceG5;
-import org.axsl.kpModel.ParaBranch;
-import org.axsl.kpModel.ParaLeaf;
import java.util.ArrayList;
import java.util.List;
@@ -195,18 +193,6 @@
return newRmNode;
}
- @Override
- public void addParaLeaf(final ParaLeaf leaf) {
- /* TODO: Fix this. */
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void addParaBranch(final ParaBranch branch, final int offset, final int length) {
- /* TODO: Fix this. */
- throw new UnsupportedOperationException();
- }
-
/**
* Returns the font options.
* @return The font options.
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java 2022-02-02 18:19:33 UTC (rev 12540)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java 2022-02-02 18:39:42 UTC (rev 12541)
@@ -58,8 +58,6 @@
import org.axsl.galley.GlyphAreaSequenceG5;
import org.axsl.galley.render.GalleyVisitor;
import org.axsl.galley.render.GalleyVisitorException;
-import org.axsl.kpModel.ParaBranch;
-import org.axsl.kpModel.ParaLeaf;
import org.axsl.value.Conditionality;
import org.axsl.value.LineStackingStrategy;
import org.axsl.value.RelativeAxis;
@@ -1122,26 +1120,6 @@
return newRmNode;
}
- @Override
- public void addParaLeaf(final ParaLeaf leaf) {
- if (leaf == null) {
- return;
- }
- throw new IllegalArgumentException();
- // TODO Auto-generated method stub
- }
-
- @Override
- public void addParaBranch(final ParaBranch branch, final int offset, final int length) {
-// if (branch instanceof FoTextWords) {
-// final FoTextWords foTextWords = (FoTextWords) branch;
-// makeGlyphAreaSequence(foTextWords, offset, length, false);
-// return;
-// }
-// throw new IllegalArgumentException();
- throw new UnsupportedOperationException();
- }
-
/**
* Indicates whether this line-area has a half-leading on both its before
* and after edges.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-02-02 18:19:33 UTC (rev 12540)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-02-02 18:39:42 UTC (rev 12541)
@@ -36,7 +36,6 @@
import org.foray.orthography.wrapper.UppercaseWord;
import org.axsl.fotree.text.FoOrthography;
-import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.Word;
import org.axsl.orthography.optional.Dictionary;
@@ -260,7 +259,7 @@
}
@Override
- public FoWord recognizeWord(final CharSequence wordChars, final int offset, final int length,
+ public Word4a recognizeWord(final CharSequence wordChars, final int offset, final int length,
final Word.PartOfSpeech pos, final List<Dictionary> adhocDictionaries) {
// TODO Auto-generated method stub
return null;
@@ -368,10 +367,10 @@
}
@Override
- public FoWord hyphenateUnrecognizedWord(final CharSequence word, final int offset, final int length) {
+ public Word4a hyphenateUnrecognizedWord(final CharSequence word, final int offset, final int length) {
/* The character sequence containing the characters in the word that we are looking for. */
final CharSequence chars = word.subSequence(offset, offset + length);
- FoWord hyphenatedWord = null;
+ Word4a hyphenatedWord = null;
/* Look in the dictionary first, as it should be more accurate. */
final SegmentDictionary dictionary = getDictionary();
@@ -431,7 +430,7 @@
parseInterwordContent(chunk, wordSequence);
} else {
/* Chunk is a word. */
- FoWord word = recognizeWord(chunk, 0, chunk.length(), null, null);
+ Word4a word = recognizeWord(chunk, 0, chunk.length(), null, null);
if (word == null) {
word = hyphenateUnrecognizedWord(chunk, 0, chunk.length());
}
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java 2022-02-02 18:19:33 UTC (rev 12540)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java 2022-02-02 18:39:42 UTC (rev 12541)
@@ -28,6 +28,8 @@
package org.foray.pioneer;
+import org.foray.common.primitive.ObjectUtils;
+
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
import org.axsl.area.LineArea;
@@ -82,6 +84,8 @@
final int breakPosition = result.getBreakPosition(lineIndex);
final int qtyLineNodes = breakPosition - lastBreakPosition;
final LineArea lineArea = blockArea.makeLineArea(true);
+ /* TODO: Remove following line after logic to fill line area is added. */
+ ObjectUtils.noOperation(lineArea);
int lineNodesConsumed = 0;
ParaBranch currentBranch = null;
int branchNodesConsumed = 0;
@@ -91,7 +95,11 @@
case LEAF: {
currentBranch = null;
branchNodesConsumed = 0;
- lineArea.addParaLeaf(paraNode.asParaLeaf());
+
+
+ /* TODO: Convert the leaf node to an AreaTree concept and add it. */
+
+
lineNodesConsumed ++;
break;
}
@@ -106,7 +114,11 @@
final int branchNodesRemaining = branch.qtyParaNodes() - branchNodesConsumed;
final int lineNodesRemaining = qtyLineNodes - lineNodesConsumed;
final int length = Math.min(lineNodesRemaining, branchNodesRemaining);
- lineArea.addParaBranch(paraNode.asParaBranch(), branchNodesConsumed, length);
+
+
+ /* TODO: Convert the branch node to AreaTree concept(s) and add it/them. */
+
+
lineNodesConsumed += length;
break;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-02 18:19:36
|
Revision: 12540
http://sourceforge.net/p/foray/code/12540
Author: victormote
Date: 2022-02-02 18:19:33 +0000 (Wed, 02 Feb 2022)
Log Message:
-----------
Conform to aXSL change: Reverse last commit.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
Removed Paths:
-------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/FoToken4a.java
Deleted: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/FoToken4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/FoToken4a.java 2022-02-02 14:58:51 UTC (rev 12539)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/FoToken4a.java 2022-02-02 18:19:33 UTC (rev 12540)
@@ -1,39 +0,0 @@
-/*
- * Copyright 2022 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
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.orthography;
-
-import org.axsl.fotree.text.FoToken;
-import org.axsl.kpModel.ParaNode;
-
-/**
- * Interface for FOray implementations of {@link FoToken}.
- */
-public interface FoToken4a extends FoToken, ParaNode {
-
-}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-02-02 14:58:51 UTC (rev 12539)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-02-02 18:19:33 UTC (rev 12540)
@@ -36,6 +36,7 @@
import org.foray.orthography.wrapper.UppercaseWord;
import org.axsl.fotree.text.FoOrthography;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.Word;
import org.axsl.orthography.optional.Dictionary;
@@ -259,7 +260,7 @@
}
@Override
- public Word4a recognizeWord(final CharSequence wordChars, final int offset, final int length,
+ public FoWord recognizeWord(final CharSequence wordChars, final int offset, final int length,
final Word.PartOfSpeech pos, final List<Dictionary> adhocDictionaries) {
// TODO Auto-generated method stub
return null;
@@ -367,10 +368,10 @@
}
@Override
- public Word4a hyphenateUnrecognizedWord(final CharSequence word, final int offset, final int length) {
+ public FoWord hyphenateUnrecognizedWord(final CharSequence word, final int offset, final int length) {
/* The character sequence containing the characters in the word that we are looking for. */
final CharSequence chars = word.subSequence(offset, offset + length);
- Word4a hyphenatedWord = null;
+ FoWord hyphenatedWord = null;
/* Look in the dictionary first, as it should be more accurate. */
final SegmentDictionary dictionary = getDictionary();
@@ -430,7 +431,7 @@
parseInterwordContent(chunk, wordSequence);
} else {
/* Chunk is a word. */
- Word4a word = recognizeWord(chunk, 0, chunk.length(), null, null);
+ FoWord word = recognizeWord(chunk, 0, chunk.length(), null, null);
if (word == null) {
word = hyphenateUnrecognizedWord(chunk, 0, chunk.length());
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java 2022-02-02 14:58:51 UTC (rev 12539)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java 2022-02-02 18:19:33 UTC (rev 12540)
@@ -47,7 +47,7 @@
* Handles punctuation between words.
* Instances of this class are immutable.
*/
-public final class Punctuation4a implements FoPunctuation, FoToken4a {
+public final class Punctuation4a implements FoPunctuation {
/** Common punctuation item, a comma. */
public static final Punctuation4a COMMA = new Punctuation4a(",");
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-02-02 14:58:51 UTC (rev 12539)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-02-02 18:19:33 UTC (rev 12540)
@@ -141,13 +141,13 @@
}
/** The tokens (children) of this text flow. */
- private List<FoToken4a> tokens = new ArrayList<FoToken4a>();
+ private List<FoToken> tokens = new ArrayList<FoToken>();
/**
* Add a token.
* @param token The token to be added.
*/
- public void addToken(final FoToken4a token) {
+ public void addToken(final FoToken token) {
this.tokens.add(token);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java 2022-02-02 14:58:51 UTC (rev 12539)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java 2022-02-02 18:19:33 UTC (rev 12540)
@@ -53,7 +53,7 @@
* Handles whitespace between words.
* Instances of this class are immutable.
*/
-public final class Whitespace4a implements FoWhitespace, FoToken4a {
+public final class Whitespace4a implements FoWhitespace {
/** A space character. */
public static final Whitespace4a SPACE = new Whitespace4a(" ", ' ');
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-02-02 14:58:51 UTC (rev 12539)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-02-02 18:19:33 UTC (rev 12540)
@@ -57,7 +57,7 @@
* Therefore this abstract superclass is able to do a lot of the grunt work needed to conform to the other three API
* subsets.</p>
*/
-public abstract class Word4a implements FoWord, FoToken4a, Serializable, Comparable<CharSequence> {
+public abstract class Word4a implements FoWord, Serializable, Comparable<CharSequence> {
/** Constant needed for serialization. */
private static final long serialVersionUID = -5425415601308185409L;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-02 14:58:54
|
Revision: 12539
http://sourceforge.net/p/foray/code/12539
Author: victormote
Date: 2022-02-02 14:58:51 +0000 (Wed, 02 Feb 2022)
Log Message:
-----------
Conform to aXSL change: Remove requirement that FoToken implement ParaNode. That is an implementation decision.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
Added Paths:
-----------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/FoToken4a.java
Added: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/FoToken4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/FoToken4a.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/FoToken4a.java 2022-02-02 14:58:51 UTC (rev 12539)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.orthography;
+
+import org.axsl.fotree.text.FoToken;
+import org.axsl.kpModel.ParaNode;
+
+/**
+ * Interface for FOray implementations of {@link FoToken}.
+ */
+public interface FoToken4a extends FoToken, ParaNode {
+
+}
Property changes on: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/FoToken4a.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-02-02 14:12:58 UTC (rev 12538)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-02-02 14:58:51 UTC (rev 12539)
@@ -36,7 +36,6 @@
import org.foray.orthography.wrapper.UppercaseWord;
import org.axsl.fotree.text.FoOrthography;
-import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.Word;
import org.axsl.orthography.optional.Dictionary;
@@ -260,7 +259,7 @@
}
@Override
- public FoWord recognizeWord(final CharSequence wordChars, final int offset, final int length,
+ public Word4a recognizeWord(final CharSequence wordChars, final int offset, final int length,
final Word.PartOfSpeech pos, final List<Dictionary> adhocDictionaries) {
// TODO Auto-generated method stub
return null;
@@ -368,10 +367,10 @@
}
@Override
- public FoWord hyphenateUnrecognizedWord(final CharSequence word, final int offset, final int length) {
+ public Word4a hyphenateUnrecognizedWord(final CharSequence word, final int offset, final int length) {
/* The character sequence containing the characters in the word that we are looking for. */
final CharSequence chars = word.subSequence(offset, offset + length);
- FoWord hyphenatedWord = null;
+ Word4a hyphenatedWord = null;
/* Look in the dictionary first, as it should be more accurate. */
final SegmentDictionary dictionary = getDictionary();
@@ -431,7 +430,7 @@
parseInterwordContent(chunk, wordSequence);
} else {
/* Chunk is a word. */
- FoWord word = recognizeWord(chunk, 0, chunk.length(), null, null);
+ Word4a word = recognizeWord(chunk, 0, chunk.length(), null, null);
if (word == null) {
word = hyphenateUnrecognizedWord(chunk, 0, chunk.length());
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java 2022-02-02 14:12:58 UTC (rev 12538)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java 2022-02-02 14:58:51 UTC (rev 12539)
@@ -47,7 +47,7 @@
* Handles punctuation between words.
* Instances of this class are immutable.
*/
-public final class Punctuation4a implements FoPunctuation {
+public final class Punctuation4a implements FoPunctuation, FoToken4a {
/** Common punctuation item, a comma. */
public static final Punctuation4a COMMA = new Punctuation4a(",");
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-02-02 14:12:58 UTC (rev 12538)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-02-02 14:58:51 UTC (rev 12539)
@@ -141,13 +141,13 @@
}
/** The tokens (children) of this text flow. */
- private List<FoToken> tokens = new ArrayList<FoToken>();
+ private List<FoToken4a> tokens = new ArrayList<FoToken4a>();
/**
* Add a token.
* @param token The token to be added.
*/
- public void addToken(final FoToken token) {
+ public void addToken(final FoToken4a token) {
this.tokens.add(token);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java 2022-02-02 14:12:58 UTC (rev 12538)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java 2022-02-02 14:58:51 UTC (rev 12539)
@@ -53,7 +53,7 @@
* Handles whitespace between words.
* Instances of this class are immutable.
*/
-public final class Whitespace4a implements FoWhitespace {
+public final class Whitespace4a implements FoWhitespace, FoToken4a {
/** A space character. */
public static final Whitespace4a SPACE = new Whitespace4a(" ", ' ');
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-02-02 14:12:58 UTC (rev 12538)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-02-02 14:58:51 UTC (rev 12539)
@@ -57,7 +57,7 @@
* Therefore this abstract superclass is able to do a lot of the grunt work needed to conform to the other three API
* subsets.</p>
*/
-public abstract class Word4a implements FoWord, Serializable, Comparable<CharSequence> {
+public abstract class Word4a implements FoWord, FoToken4a, Serializable, Comparable<CharSequence> {
/** Constant needed for serialization. */
private static final long serialVersionUID = -5425415601308185409L;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-02 14:13:01
|
Revision: 12538
http://sourceforge.net/p/foray/code/12538
Author: victormote
Date: 2022-02-02 14:12:58 +0000 (Wed, 02 Feb 2022)
Log Message:
-----------
Make FoTextWords4a implement ParaBranch.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-02-02 00:56:57 UTC (rev 12537)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-02-02 14:12:58 UTC (rev 12538)
@@ -28,6 +28,7 @@
package org.foray.fotree.fo.obj;
+import org.foray.common.MarkedIndexOutOfBoundsException;
import org.foray.fotree.FoObj;
import org.axsl.fotree.FoVisitor;
@@ -36,15 +37,19 @@
import org.axsl.fotree.text.FoOrthographyServer;
import org.axsl.fotree.text.FoToken;
import org.axsl.fotree.text.FoTokenFlow;
+import org.axsl.kpModel.ParaBranch;
+import org.axsl.kpModel.ParaLeaf;
import org.axsl.kpModel.ParaNode;
import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.Whitespace;
+import java.util.ListIterator;
+
/**
* Text in an FO document that has been tokenized into words.
* This is a thin wrapper around an instance of {@link FoTokenFlow} that allows that token flow to live in an FO tree.
*/
-public class FoTextWords4a extends FoText4a implements FoTextWords {
+public class FoTextWords4a extends FoText4a implements FoTextWords, ParaBranch {
/** The parent of this node. */
private FoObj parent;
@@ -110,4 +115,57 @@
return this.tokenFlow;
}
+ @Override
+ public Type getParaNodeType() {
+ return Type.BRANCH;
+ }
+
+ @Override
+ public ParaLeaf asParaLeaf() {
+ return null;
+ }
+
+ @Override
+ public ParaBranch asParaBranch() {
+ return this;
+ }
+
+ @Override
+ public int qtyParaNodes() {
+ return 1;
+ }
+
+ @Override
+ public ParaNode paraNodeAt(final int nodeIndex) {
+ if (nodeIndex == 0) {
+ return this.tokenFlow;
+ }
+ throw new MarkedIndexOutOfBoundsException(nodeIndex, 1);
+ }
+
+ @Override
+ public int qtyParaLeaves() {
+ return this.tokenFlow.qtyParaLeaves();
+ }
+
+ @Override
+ public ParaLeaf paraLeafAt(final int leafIndex) {
+ return this.tokenFlow.paraLeafAt(leafIndex);
+ }
+
+ @Override
+ public int qtyKpLeaves() {
+ return this.tokenFlow.qtyKpLeaves();
+ }
+
+ @Override
+ public CharSequence getText() {
+ return this.tokenFlow.getText();
+ }
+
+ @Override
+ public ListIterator<ParaLeaf> leafIterator() {
+ return this.tokenFlow.leafIterator();
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-02 00:57:00
|
Revision: 12537
http://sourceforge.net/p/foray/code/12537
Author: victormote
Date: 2022-02-02 00:56:57 +0000 (Wed, 02 Feb 2022)
Log Message:
-----------
Add missing javadoc and change the scope on checkstyle MissingJavadocMethod to "private" for future enforcement.
Modified Paths:
--------------
trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Lexer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/Word4aTests.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfParser.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfReport.java
Modified: trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml
===================================================================
--- trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml 2022-02-02 00:00:35 UTC (rev 12536)
+++ trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml 2022-02-02 00:56:57 UTC (rev 12537)
@@ -118,7 +118,7 @@
<!-- Make sure each Method has javadoc, regardless of visibility. -->
<module name="MissingJavadocMethod">
- <property name="scope" value="public"/>
+ <property name="scope" value="private"/>
</module>
<!-- Make sure Method javadoc is well-formed. -->
<module name="JavadocMethod"/>
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Lexer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Lexer4a.java 2022-02-02 00:00:35 UTC (rev 12536)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Lexer4a.java 2022-02-02 00:56:57 UTC (rev 12537)
@@ -249,6 +249,13 @@
}
}
+ /**
+ * Create the token list.
+ * @param sequence The sequence of characters being tokenized.
+ * @param rawBreaks The breaks found by the break iterator.
+ * @param breakTypes The filtered break types.
+ * @return The list of tokens.
+ */
protected List<CharSequence> createTokens(final CharSequence sequence, final IntSequence rawBreaks,
final CharType[] breakTypes) {
final List<CharSequence> tokens = new ArrayList<CharSequence>();
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-02-02 00:00:35 UTC (rev 12536)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-02-02 00:56:57 UTC (rev 12537)
@@ -314,7 +314,7 @@
if (adhocDictionaries != null) {
for (int dictIndex = 0; dictIndex < adhocDictionaries.size(); dictIndex ++) {
final Dictionary adhocDictionary = adhocDictionaries.get(dictIndex);
- if (isDerivativeFound(adhocDictionary, wordChars)) {
+ if (isDerivativeFound(wordChars, adhocDictionary)) {
return true;
}
}
@@ -322,7 +322,7 @@
/* 6. Check derivative matches in standard dictionaries for the orthography. */
if (orthoDictionary != null) {
- if (isDerivativeFound(orthoDictionary, wordChars)) {
+ if (isDerivativeFound(wordChars, orthoDictionary)) {
return true;
}
}
@@ -345,7 +345,15 @@
return false;
}
- private boolean isDerivativeFound(final Dictionary dictionary, final CharSequence wordChars) {
+ /**
+ * Indicates whether a given word can be found in a given dictionary after considering the derivative rules in this
+ * orthography.
+ * @param wordChars The word characters.
+ * @param dictionary The dictionary to be searched.
+ * @return True if and only if a root for {@code wordChars} can be found in {@code dictionary} using the derivative
+ * rules in this orthography.
+ */
+ private boolean isDerivativeFound(final CharSequence wordChars, final Dictionary dictionary) {
for (int listIndex = 0; listIndex < this.derivativeRuleListIds.size(); listIndex ++) {
final String ruleListKey = this.derivativeRuleListIds.get(listIndex);
final List<DerivativePattern> patternList = this.server.getDerivativePatterns(ruleListKey);
@@ -420,7 +428,7 @@
final boolean isChunkIndexOdd = NumberUtils.isOdd(chunkIndex);
if (isChunkIndexOdd) {
/* Chunk is interword content. */
- parseInterwordContent(wordSequence, chunk);
+ parseInterwordContent(chunk, wordSequence);
} else {
/* Chunk is a word. */
FoWord word = recognizeWord(chunk, 0, chunk.length(), null, null);
@@ -436,7 +444,14 @@
return wordSequence;
}
- private void parseInterwordContent(final TokenFlow4a wordSequence, final CharSequence interword)
+ /**
+ * Converts interword characters to instances of {@link Punctuation4a} or {@link Whitespace4a}, and adds them as
+ * tokens to a given word sequence.
+ * @param interword The interword characters to be tokenized.
+ * @param wordSequence The sequence of tokens to which tokens will be added.
+ * @throws OrthographyException If {@code interword} cannot be converted to punctuation and whitespace tokens.
+ */
+ private void parseInterwordContent(final CharSequence interword, final TokenFlow4a wordSequence)
throws OrthographyException {
int index = 0;
while (index < interword.length()) {
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-02-02 00:00:35 UTC (rev 12536)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-02-02 00:56:57 UTC (rev 12537)
@@ -261,7 +261,7 @@
currentLocation.markTokenComplete();
}
- if (isHyphenNeeded(isEndOfLine, endLocation)) {
+ if (isHyphenNeeded(endLocation, isEndOfLine)) {
builder.append(Character.toChars(textModifiers.traitHyphenationCharacter()));
}
@@ -269,7 +269,13 @@
return builder.toString();
}
- private boolean isHyphenNeeded(final boolean isEndOfLine, final TokenFlow.Location endLocation) {
+ /**
+ * Indicates whether a discretionary hyphen is needed at a given token location.
+ * @param endLocation The location being tested.
+ * @param isEndOfLine Indicates whether {@code endLocation} is at the very end of a line.
+ * @return True if and only if a discretionary hyphen is needed at {@code endLocation}.
+ */
+ private boolean isHyphenNeeded(final TokenFlow.Location endLocation, final boolean isEndOfLine) {
if (! isEndOfLine) {
return false;
}
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/Word4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/Word4aTests.java 2022-02-02 00:00:35 UTC (rev 12536)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/Word4aTests.java 2022-02-02 00:56:57 UTC (rev 12537)
@@ -41,6 +41,13 @@
*/
public class Word4aTests {
+ /**
+ * Assertions used by tests of refined characters.
+ * @param word The raw word being tested.
+ * @param textTransform The fo:text-transform property being applied to {@code word}.
+ * @param expectedLength The expected length of the result.
+ * @param expectedRefined The expected refined result.
+ */
private void refinedCharsAssertions(final Word4a word, final TextTransform textTransform, final int expectedLength,
final String expectedRefined) {
final TextModifiers textModifiers = Mockito.mock(TextModifiers.class);
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfParser.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfParser.java 2022-02-02 00:00:35 UTC (rev 12536)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfParser.java 2022-02-02 00:56:57 UTC (rev 12537)
@@ -289,6 +289,12 @@
STREAM,
}
+ /**
+ * Until an end-of-object marker is detected, takes tokens from the tokenizer and pushes them onto the token stack,
+ * first considering and adjusting the mode of the tokenizer.
+ * @param tokenizer The object producing the tokens.
+ * @param tokenStack The token stack onto which tokens are being placed.
+ */
private void parseObjectTokens(final ByteSequenceTokenizer tokenizer, final Stack<ByteSequencePlus> tokenStack) {
TokenizerMode mode = TokenizerMode.STANDARD;
while (tokenizer.hasMoreTokens()) {
@@ -332,6 +338,12 @@
}
}
+ /**
+ * Until the token stack is exhausted, converts the tokens on the token stack to objects.
+ * @param tokenStack The stack of tokens that is the input to this method.
+ * @param objectStack The stack of objects that is the output of this method.
+ * @throws PdfException For errors processing the tokens.
+ */
private void processTokenStack(final Stack<ByteSequencePlus> tokenStack, final Stack<PdfObject> objectStack)
throws PdfException {
while (tokenStack.size() > 0) {
@@ -339,6 +351,13 @@
}
}
+ /**
+ * Using the token stack, creates a single object and pushes it onto the object stack.
+ * While processing the object, other objects may be encountered, in which case this method is called recursively.
+ * @param tokenStack The stack of tokens that is the input to this method.
+ * @param objectStack The stack of objects that is the output of this method.
+ * @throws PdfException For errors processing the tokens.
+ */
private void processNextObject(final Stack<ByteSequencePlus> tokenStack, final Stack<PdfObject> objectStack)
throws PdfException {
final ByteSequencePlus token = tokenStack.pop();
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java 2022-02-02 00:00:35 UTC (rev 12536)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java 2022-02-02 00:56:57 UTC (rev 12537)
@@ -51,7 +51,6 @@
import org.axsl.unicode.block.Basic_Latin_Block;
import org.apache.batik.ext.awt.g2d.GraphicContext;
-import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.AlphaComposite;
@@ -162,9 +161,6 @@
/** The current orthography system. */
private Orthography orthography;
- /** Lazily-loaded logger. Use {@link #getLogger()} to obtain the instance. */
- private Logger logger;
-
/**
* Create a new PdfGraphics2D with the given pdf document info.
* This is used to create a Graphics object for use inside an already existing document.
@@ -729,7 +725,7 @@
@Override
public void drawString(final AttributedCharacterIterator iterator, final float x, final float y) {
- getLogger().error("drawString(AttributedCharacterIterator)");
+ LoggerFactory.getLogger(this.getClass()).error("drawString(AttributedCharacterIterator)");
/* TODO: This method may not ever be called, as we never see the above error logged. Investigate further. */
final Shape imclip = getClip();
@@ -889,7 +885,7 @@
this.currentStream.write(text);
} catch (final IOException e) {
/* Log it and convert it to an unchecked exception. */
- getLogger().error("Error writing SVG", e);
+ LoggerFactory.getLogger(this.getClass()).error("Error writing SVG", e);
throw new IllegalStateException(e);
}
}
@@ -903,7 +899,7 @@
this.currentStream.comment(text);
} catch (final IOException e) {
/* Log it and convert it to an unchecked exception. */
- getLogger().error("Error writing SVG", e);
+ LoggerFactory.getLogger(this.getClass()).error("Error writing SVG", e);
throw new IllegalStateException(e);
}
}
@@ -938,11 +934,4 @@
this.graphicsStateStack.pop();
}
- private Logger getLogger() {
- if (this.logger == null) {
- this.logger = LoggerFactory.getLogger(PdfGraphics2D.class);
- }
- return this.logger;
- }
-
}
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfReport.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfReport.java 2022-02-02 00:00:35 UTC (rev 12536)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfReport.java 2022-02-02 00:56:57 UTC (rev 12537)
@@ -50,18 +50,17 @@
/**
* Constructor.
- * @param inStream The input stream containing the PDF to be parsed. Client code is responsible to close
- * this after processing.
- * @param output The writer to which the report should be written. Client code is responsible to close
- * this after processing.
+ * @param inStream The input stream containing the PDF to be parsed.
+ * Client code is responsible to close this after processing.
+ * @param output The writer to which the report should be written.
+ * Client code is responsible to close this after processing.
* @param inputDescription The description of {@code inStream}, which will be written in the report.
* @param password The password (if any) needed to open the input file. This can be null.
* @throws IOException For errors reading {@code inStream} or writing to {@code output}.
* @throws PdfException For errors parsing the PDF.
*/
- public PdfReport(final InputStream inStream, final PrintStream output, final String password,
- final String inputDescription)
- throws IOException, PdfException {
+ public PdfReport(final InputStream inStream, final PrintStream output, final String inputDescription,
+ final String password) throws IOException, PdfException {
output.println("PDF Report for: " + inputDescription);
output.println(StringUtils.EMPTY_STRING);
@@ -70,6 +69,11 @@
process4a(pdf4a, output);
}
+ /**
+ * Writes the report content from the parsed PDF.
+ * @param pdf The parsed PDF.
+ * @param output The stream to which the report should be written.
+ */
private void process4a(final PdfDocument4a pdf, final PrintStream output) {
output.println("PDF Version: " + pdf.getVersion().getVersionString());
output.println("Qty Indirect Objects: " + pdf.getIndirectObjects().size());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-02 00:00:41
|
Revision: 12536
http://sourceforge.net/p/foray/code/12536
Author: victormote
Date: 2022-02-02 00:00:35 +0000 (Wed, 02 Feb 2022)
Log Message:
-----------
Add, and conform to, more checkstyle checks of javadocs.
Modified Paths:
--------------
trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml
trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionOuterRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractOrderedTreeNode.java
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ByteArrayBuilder.java
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/CharArrayBuilder.java
trunk/foray/foray-common/src/main/java/org/foray/common/xml/SaxParser.java
trunk/foray/foray-font/src/main/java/org/foray/font/format/type1/Type1MetricsParserAfm.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/prop/AxslEnumerated.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/prop/Lang.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PngGraphic.java
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/EagerLineBreaker.java
trunk/foray/foray-mif/src/main/java/org/foray/mif/MifFlow.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PosUtils.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParserText.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionarySorter.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/zzarchive/PatGen.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/function/PdfFunction.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfHeader.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphicsConfiguration.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInputFile.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInterpreter4a.java
trunk/foray/foray-ps/src/main/java/org/foray/ps/PsOperandStack.java
trunk/foray/foray-render/src/main/java/org/foray/render/Renderer.java
trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/LoadableProperties.java
trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java
trunk/foray/foray-render/src/main/java/org/foray/render/txt/TxtRenderer.java
Modified: trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml
===================================================================
--- trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml 2022-02-02 00:00:35 UTC (rev 12536)
@@ -133,6 +133,31 @@
<property name="scope" value="private"/>
<property name="checkEmptyJavadoc" value="true"/>
</module>
+ <module name="AtclauseOrder"/>
+ <module name="InvalidJavadocPosition"/>
+ <module name="JavadocBlockTagLocation"/>
+ <module name="JavadocContentLocation">
+ <!-- We would like to use this check, but we currently have a different convention for javadoc for variables than
+ we do for methods. -->
+ <property name="severity" value="ignore"/>
+ </module>
+ <!-- JavadocMissingLeadingAsterisk is not available until Checkstyle version 8.38. -->
+ <!-- <module name="JavadocMissingLeadingAsterisk"/> -->
+ <module name="JavadocMissingWhitespaceAfterAsterisk"/>
+ <!-- JavadocParagraph does not seem to work correctly in Checkstyle 8.36.1. It does not recognize blank lines as
+ being blank, at least within @param blocks. -->
+ <module name="JavadocParagraph">
+ <property name="severity" value="ignore"/>
+ </module>
+ <!-- We do not want the indentation check on continuation lines. -->
+ <!-- <module name="JavadocTagContinuationIndentation"/> -->
+ <module name="NonEmptyAtclauseDescription"/>
+ <!-- We do not want the empty lie before block tag group. -->
+ <!-- <module name="RequireEmptyLineBeforeBlockTagGroup"/> -->
+ <module name="SingleLineJavadoc"/>
+ <module name="SummaryJavadoc"/>
+ <!-- We do not want the write tag check. -->
+ <!-- <module name="WriteTag"/> -->
<!-- Avoid magic numbers. -->
<module name="MagicNumber"/>
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -50,8 +50,8 @@
*/
public final class MainRa4a extends AreaFixed implements MainRa {
- /** A definitely-not-sacred legacy span safety factor. It appears to be
- * allowing for 2 12-point lines with leading of 30%. */
+// /** A definitely-not-sacred legacy span safety factor. It appears to be allowing for 2 12-point lines with
+// * leading of 30%. */
// private static final int SPAN_SAFETY_FACTOR = (int) Math.round(
// 2 * 12000 * 1.3);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -96,7 +96,7 @@
private List<Marker> markers = new ArrayList<Marker>();
/** The page index for this page. This index is not meaningful until the document layout is complete.
- * @see {@link org.axsl.galley.PageG5#getPageIndex()}.*/
+ * @see PageG5#getPageIndex() */
private int pageIndex = -1;
/** Indicates whether the layout for this page is complete. */
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionOuterRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionOuterRa4a.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionOuterRa4a.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -164,7 +164,7 @@
@Override
public Area4a getOverflowArea(final Area4a childRequesting) {
- /** Regions have no place to overflow. */
+ /* Regions have no place to overflow. */
return null;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -42,10 +42,10 @@
/** The link to the FO tree. */
private Link<FoTextWords> foLink;
- /** The starting location in {@link #foLink#traitGeneratedBy()} for the text in this area, inclusive. */
+ /** The starting location in {@link #foLink} for the text in this area, inclusive. */
private FoTokenFlow.Location startLocation;
- /** The ending location in {@link #foLink#traitGeneratedBy()} for the text in this area, exclusive. */
+ /** The ending location in {@link #foLink} for the text in this area, exclusive. */
private FoTokenFlow.Location endLocation;
/**
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractOrderedTreeNode.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractOrderedTreeNode.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractOrderedTreeNode.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -384,10 +384,10 @@
* If {@code anotherNode} is null, returns false.
* This operation is at worst O(h) where h is the distance from the root to {@code anotherNode}.
*
+ * @param anotherNode Node to test as descendant of this node.
+ * @return True if this node is an ancestor of {@code anotherNode}
* @see #isNodeOtnAncestor
* @see #getSharedAncestor
- * @param anotherNode Node to test as descendant of this node.
- * @return True if this node is an ancestor of {@code anotherNode}
*/
public boolean isNodeDescendant(final OrderedTreeNode<T> anotherNode) {
if (anotherNode == null) {
@@ -402,11 +402,10 @@
* {@code aNode} is null.
* A node is considered an ancestor of itself.
*
+ * @param aNode node to find common ancestor with
+ * @return nearest ancestor common to this node and {@code aNode}, or null if none
* @see #isNodeOtnAncestor
* @see #isNodeDescendant
- * @param aNode node to find common ancestor with
- * @return nearest ancestor common to this node and {@code aNode},
- * or null if none
*/
public OrderedTreeNode<T> getSharedAncestor(final AbstractOrderedTreeNode<T> aNode) {
if (aNode == this) {
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ByteArrayBuilder.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ByteArrayBuilder.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ByteArrayBuilder.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -272,7 +272,7 @@
* If {@code minimumCapacity} is non positive due to numeric
* overflow, this method throws {@code OutOfMemoryError}.
* @param minimumCapacity the minimum desired capacity.
- * @see {@link StringBuilder#ensureCapacity(int)}
+ * @see StringBuilder#ensureCapacity(int)
*/
private void ensureCapacityInternal(final int minimumCapacity) {
// overflow-conscious code
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/CharArrayBuilder.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/CharArrayBuilder.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/CharArrayBuilder.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -157,7 +157,7 @@
* If {@code minimumCapacity} is non positive due to numeric
* overflow, this method throws {@code OutOfMemoryError}.
* @param minimumCapacity the minimum desired capacity.
- * @see {@link StringBuilder#ensureCapacity(int)}
+ * @see StringBuilder#ensureCapacity(int)
*/
private void ensureCapacityInternal(final int minimumCapacity) {
// overflow-conscious code
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/xml/SaxParser.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/xml/SaxParser.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/xml/SaxParser.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -65,10 +65,8 @@
/** Constant used to initialize string builders. */
private static final int MAX_EXPECTED_TEXT_LENGTH = 4096;
- /**
- * Register the URLStreamHandler for classpath: URLs.
- * This has to be done only once, hence a static statement.
- */
+ /* Register the URLStreamHandler for classpath: URLs.
+ * This has to be done only once, hence a static statement. */
static {
org.foray.common.url.classpath.Handler.register();
}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/format/type1/Type1MetricsParserAfm.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/format/type1/Type1MetricsParserAfm.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/format/type1/Type1MetricsParserAfm.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -565,9 +565,9 @@
/**
* Parses the Metric content.
+ * @return The parsed metric content.
* @throws IOException For errors reading the metrics file.
* @throws FontException For internal errors in the metrics file.
- * @return The parsed metric content.
*/
public Type1Metrics parse() throws IOException, FontException {
this.input.seek(0);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/prop/AxslEnumerated.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/prop/AxslEnumerated.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/prop/AxslEnumerated.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -158,15 +158,15 @@
}
}
- /**
- * Returns the inherited value for this property.
- * @param context An object that knows how to resolve FO Tree context
- * issues.
- * @param fobj This is the ancestor FoObj node that should be used to get
- * the inherited value. Note that this method does no error-checking on
- * fobj.
- * @return The value for this property for fobj.
- */
+// /**
+// * Returns the inherited value for this property.
+// * @param context An object that knows how to resolve FO Tree context
+// * issues.
+// * @param fobj This is the ancestor FoObj node that should be used to get
+// * the inherited value. Note that this method does no error-checking on
+// * fobj.
+// * @return The value for this property for fobj.
+// */
// private AxslValue getInheritedValue(final FoContext context,
// final FoObj fobj) {
// switch (getPropertyType()) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/prop/Lang.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/prop/Lang.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/prop/Lang.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -78,8 +78,8 @@
* @param fobj The FoObj to which this property belongs.
* @param propertyFullName The full name of this property.
* @param value The parsed property value.
+ * @return The parsed property value.
* @throws PropertyException For an invalid property value.
- * @return The parsed property value.
*/
private PropertyValue createPropertyValue(final FoObj fobj,
final String propertyFullName, final String value)
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PngGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PngGraphic.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/PngGraphic.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -80,7 +80,7 @@
*/
private static final float SRGB_GAMMA = 2.2f;
- /** The alpha channel for the image?? */
+ /** The alpha channel for the image??, perhaps. */
private byte[] softMask = null;
/** The InputStream wrapped into a SeekableStream for decoding. */
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -42,8 +42,8 @@
import java.util.ListIterator;
/**
- * <p>Implementation of the Knuth-Plass "first-fit" linebreaking algorithm, which is described as follows on pages
- * 68-69:</p>
+ * <p>Implementation of the Knuth-Plass "first-fit" linebreaking algorithm.
+ * The first-fit algorithm is described as follows on pages 68-69:</p>
*
* <blockquote>Traditional practice has been to assign a minimum and maximum width to interword spaces, together with a
* normal width representing the ideal situation. The standard algorithm for line breaking ... then proceeds as follows:
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/EagerLineBreaker.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/EagerLineBreaker.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/EagerLineBreaker.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -74,8 +74,8 @@
* @param textModifiers The modification parameters to be applied to the text.
* @param start The staring index in the line content to be processed.
* @param end The ending index in the line content to be processed.
+ * @return The index in the line to the last character processed.
* @throws TextException For errors during line-breaking.
- * @return The index in the line to the last character processed.
*/
protected int processInput(final LineContent lineContent, final TextModifiers textModifiers, final int start,
final int end) throws TextException {
Modified: trunk/foray/foray-mif/src/main/java/org/foray/mif/MifFlow.java
===================================================================
--- trunk/foray/foray-mif/src/main/java/org/foray/mif/MifFlow.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-mif/src/main/java/org/foray/mif/MifFlow.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -45,7 +45,7 @@
public abstract MifPgf curPara();
/**
- * Starts a new paragraph??
+ * Starts a new paragraph??, possibly.
*/
public abstract void startPara();
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PosUtils.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PosUtils.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PosUtils.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -40,7 +40,7 @@
/* Checkstyle: Allow Magic Numbers that are hard-coded data. */
- /** Message format for unexpected XML attribute values. */
+// /** Message format for unexpected XML attribute values. */
// private static final String INVALID_QUALIFIER_VALUE_MESSAGE = "Unexpected value for \"%1\": %2";
/** Return value indicating that the requested qualifier is a valid qualifier in this context, but that there is no
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParserText.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParserText.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParserText.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -81,8 +81,8 @@
* Parses a given InputStream and places the parsed information into the dictionary.
* @param inputStream The input stream to parse.
* @param description Description of {@literal inputStream}, useful for user messages.
+ * @return The parsed dictionary.
* @throws IOException For IO errors during parsing.
- * @return The parsed dictionary.
*/
public SegmentDictionary parse(final InputStream inputStream, final String description) throws IOException {
logger.info("Begin dictionary word list parsing: " + description);
@@ -90,7 +90,7 @@
final InputStreamReader isReader = new InputStreamReader(inputStream);
final BufferedReader reader = new BufferedReader(isReader);
final Set<StringWordSegment> segmentSet = new HashSet<StringWordSegment>();
- /** The data structure containing the dictionary words. */
+ /* The data structure containing the dictionary words. */
final Map<String, StringWord> wordMap = new HashMap<String, StringWord>();
/* Reusable builder. */
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionarySorter.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionarySorter.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionarySorter.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -71,7 +71,7 @@
*/
private class WordComparator implements Comparator<String> {
- /** Pattern to find a line containing a <w> element. */
+ /** Pattern to find a line containing a {@code <w>} element. */
private Pattern linePattern = Pattern.compile("^<w><t>(.*)</t>(.*)</w>$");
/** Pattern used to remove hyphens. */
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/zzarchive/PatGen.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/zzarchive/PatGen.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/zzarchive/PatGen.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -475,8 +475,8 @@
* An overflow stop occurs if PATGEN's tables aren't large enough.
* @param message The specifics of what has overflowed.
* @param capacity The capacity of the item that has overflowed.
+ * @throws OrthographyException Always, as that is the purpose of this method.
* @see "patgen.web, line 256"
- * @throws OrthographyException Always, as that is the purpose of this method.
*/
private void overflow(final String message, final int capacity) throws OrthographyException {
throw new OrthographyException("PatGen capacity exceeded: " + message
@@ -739,8 +739,8 @@
* Used only while reading the |translate| file.
* @param c The character for which an ASCII value is needed.
* @return The ASCII code corresponding to {@code c}.
+ * @throws OrthographyException If the capacity has been exceeded.
* @see "patgen.web, line 392"
- * @throws OrthographyException If the capacity has been exceeded.
*/
private char getASCII(final char c) throws OrthographyException {
char i = this.xord[c];
@@ -3572,7 +3572,7 @@
/** A frequently used blocking factor. */
private static final short NODE_BLOCK_SIZE = 4096;
- /** Constant indicating initialization is bad. */
+// /** Constant indicating initialization is bad. */
// private static final byte BAD_INIT_1 = 1;
/** Constant indicating initialization is bad. */
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/function/PdfFunction.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/function/PdfFunction.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/function/PdfFunction.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -130,9 +130,9 @@
*/
private List<Double> decode = null;
- /**
- * Optional For Type 0: A stream of sample values
- */
+// /**
+// * Optional For Type 0: A stream of sample values
+// */
/**
* Required For Type 4: Postscript Calculator function composed of
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfHeader.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfHeader.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfHeader.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -85,8 +85,8 @@
/**
* Returns the binary comment, written immediately after the header line, indicating to parsing applications that
* this document may contain binary data.
+ * @return The binary comment.
* @see "PDF Reference, Sixth Edition (PDF version 1.7), Section 3.4.1."
- * @return The binary comment.
*/
public ByteArray getBinaryComment() {
return binaryComment;
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -162,7 +162,7 @@
/** The current orthography system. */
private Orthography orthography;
- /** Lazily-loaded logger. Use {@link getLogger()} to obtain the instance. */
+ /** Lazily-loaded logger. Use {@link #getLogger()} to obtain the instance. */
private Logger logger;
/**
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphicsConfiguration.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphicsConfiguration.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphicsConfiguration.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -90,7 +90,7 @@
@Override
public VolatileImage createCompatibleVolatileImage(final int width,
final int height, final int transparency) {
- /** Stub implementation to get Java 5 to compile.
+ /* Stub implementation to get Java 5 to compile.
* TODO: This needs to be implemented properly. */
return null;
}
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInputFile.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInputFile.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInputFile.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -40,8 +40,8 @@
/**
* An implementation of PsInput that wraps a java.io.File instance.
+ * @author Jeremias Maerki
* @see PsInput
- * @author Jeremias Maerki
*/
public class PsInputFile implements PsInput {
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInterpreter4a.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInterpreter4a.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/PsInterpreter4a.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -169,7 +169,7 @@
*/
private short tokenBeingBuiltSize = 0;
- /** Counter of the number of tokens processes, useful in debugging. */
+// /** Counter of the number of tokens processes, useful in debugging. */
// private long tokenCount = 0;
/** Reusable buffer for building Strings. */
Modified: trunk/foray/foray-ps/src/main/java/org/foray/ps/PsOperandStack.java
===================================================================
--- trunk/foray/foray-ps/src/main/java/org/foray/ps/PsOperandStack.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-ps/src/main/java/org/foray/ps/PsOperandStack.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -130,10 +130,10 @@
/**
* Implements the PostScript countomark operator.
- * @return The number of non-marks objects that are on the operand stack,
- * down to, but not including, the first mark object.
* @param operator The PostScript operator requesting the counttomark.
* This is used in user messages.
+ * @return The number of non-marks objects that are on the operand stack, down to, but not including, the first mark
+ * object.
* @throws PsInterpreterException4a For PS unmatchedmark error.
*/
int countToMark(final PsOperator operator) throws PsInterpreterException4a {
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/Renderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/Renderer.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/Renderer.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -303,8 +303,8 @@
* scaled during drawing.
* @param clipRectangle The rectangle to which the content should be clipped
* after any scaling.
+ * @throws GalleyVisitorException For errors during rendering.
* @see #drawGraphic(GraphicAreaG5, Graphic, Rectangle, Rectangle)
- * @throws GalleyVisitorException For errors during rendering.
*/
protected abstract void drawGraphic(GraphicAreaG5 area, Graphic image,
Rectangle contentRectangle, Rectangle clipRectangle) throws GalleyVisitorException;
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/LoadableProperties.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/LoadableProperties.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/LoadableProperties.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -42,8 +42,8 @@
* Die Klasse LoadableProperties lässt im Gegensatz zu der Klasse Properties
* die Schlüsselwerte mit Leerzeichen zu.
*
+ * @author Sta...@jC...
* @version 02.12.99
- * @author Sta...@jC...
*
*/
public class LoadableProperties extends Hashtable<String, String> {
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -839,11 +839,11 @@
}
}
- /**
- * render an image area to PostScript
- *
- * @param area the area to render
- */
+// /**
+// * render an image area to PostScript
+// *
+// * @param area the area to render
+// */
/*
public void renderImageArea(ImageArea area) {
int x = this.currentXPosition + area.getXOffset();
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/txt/TxtRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/txt/TxtRenderer.java 2022-02-01 23:30:07 UTC (rev 12535)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/txt/TxtRenderer.java 2022-02-02 00:00:35 UTC (rev 12536)
@@ -115,13 +115,13 @@
/** Tthe current stream to add Text commands to. */
private TxtStream currentStream;
- /** The page height in decipoints?? */
+ /** The page height in decipoints??, perhaps. */
private int pageHeight = Math.round(TxtRenderer.STD_PAGE_HEIGHT
* WellKnownConstants.POINTS_PER_INCH * WellKnownConstants.DECIPOINTS_PER_POINT);
// These variables control the virtual paggination functionality.
- /** Paper height in decipoints? */
+ /** Paper height in decipoints??, perhaps. */
private int paperheight = -1;
/** Indicates whether we are operating in debug mode. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-01 23:30:10
|
Revision: 12535
http://sourceforge.net/p/foray/code/12535
Author: victormote
Date: 2022-02-01 23:30:07 +0000 (Tue, 01 Feb 2022)
Log Message:
-----------
Add missing javadoc.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
trunk/foray/foray-core/src/main/java/org/foray/core/ForayTarget.java
trunk/foray/foray-font/src/main/java/org/foray/font/Subset.java
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/interact/PdfNamedDestinationsTree4a.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfGenericStream.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfSerializer.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2022-02-01 22:17:39 UTC (rev 12534)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2022-02-01 23:30:07 UTC (rev 12535)
@@ -100,6 +100,12 @@
return newBlockArea;
}
+ /**
+ * Factory method that creates a new {@link NormalBlockArea4a}.
+ * @param generatedBy The FO node generating this area.
+ * @param parentArea The parent area.
+ * @return The new instance.
+ */
static NormalBlockArea4a makeNormalBlockArea(final BlockDiscrete generatedBy, final AreaNode4a parentArea) {
final NormalBlockArea4a newBlockArea = new NormalBlockArea4a(parentArea);
final Link<Block> linkage = newBlockArea.getLink((Block) generatedBy);
Modified: trunk/foray/foray-core/src/main/java/org/foray/core/ForayTarget.java
===================================================================
--- trunk/foray/foray-core/src/main/java/org/foray/core/ForayTarget.java 2022-02-01 22:17:39 UTC (rev 12534)
+++ trunk/foray/foray-core/src/main/java/org/foray/core/ForayTarget.java 2022-02-01 23:30:07 UTC (rev 12535)
@@ -268,6 +268,12 @@
}
}
+ /**
+ * Renders one {@link PageSequence} to one {@link OutputTarget}.
+ * @param pageSequence The page sequence to be rendered.
+ * @param outputTarget The output target on which {@code pageSequence} is to be rendered.
+ * @throws ForayException For errors during rendering.
+ */
private void renderOutputTarget(final PageSequence pageSequence, final OutputTarget outputTarget)
throws ForayException {
if (outputTarget instanceof Renderer) {
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/Subset.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/Subset.java 2022-02-01 22:17:39 UTC (rev 12534)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/Subset.java 2022-02-01 23:30:07 UTC (rev 12535)
@@ -142,6 +142,8 @@
return newIndex;
}
+ /**
+ * Sorts the {@link #originalByOriginal} array, keeping the {@link #subsetByOriginal} array synchronized with it. */
private void sortByOriginal() {
/* Since these arrays are always sorted, and since we appended the new entries, if we start at the end and
* work backwards, this should require only one pass. */
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2022-02-01 22:17:39 UTC (rev 12534)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2022-02-01 23:30:07 UTC (rev 12535)
@@ -78,7 +78,7 @@
/** The 1-based line number of the layout for this paragraph. */
private int currentLineNumber;
- /** The length(s) of the line(s) onto which the content is being laid out. */
+ /** The length, in millipoints, of the lines onto which the content is being laid out. */
private IntArrayBuilder lineLengths = new IntArrayBuilder(BREAKPOINTS_INIT_SIZE);
/** The accepted content of the current line. */
@@ -340,6 +340,12 @@
return state.createResult();
}
+ /**
+ * For the case where there is no more room on the line, decides whether the line-break should come before, after,
+ * or within the last word.
+ * @param state The current line-breaking state.
+ * @param lineCapacity The size, in millipoints, of the line which is being processed.
+ */
private void processEndOfLine(final State state, final int lineCapacity) {
/* Does the provisional word fit if we compress the word spacing? */
if (state.minProvisionalLineWidth() <= lineCapacity) {
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/interact/PdfNamedDestinationsTree4a.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/interact/PdfNamedDestinationsTree4a.java 2022-02-01 22:17:39 UTC (rev 12534)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/interact/PdfNamedDestinationsTree4a.java 2022-02-01 23:30:07 UTC (rev 12535)
@@ -37,6 +37,7 @@
*/
public class PdfNamedDestinationsTree4a extends PdfNameTree<PdfDestinationNamed4a> {
+ @Override
protected String valueToPDF(final PdfDestinationNamed4a value, final PdfDocument4a doc) {
return value.getReferencedDestination().pdfReference(doc);
}
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfGenericStream.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfGenericStream.java 2022-02-01 22:17:39 UTC (rev 12534)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfGenericStream.java 2022-02-01 23:30:07 UTC (rev 12535)
@@ -69,10 +69,18 @@
return null;
}
+ /**
+ * Returns the dictionary component of this stream.
+ * @return The dictionary.
+ */
public PdfDictionary getDictionary() {
return this.dictionary;
}
+ /**
+ * Returns the content component of this stream.
+ * @return The content.
+ */
public ByteSequence getContent() {
return this.streamContent;
}
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfSerializer.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfSerializer.java 2022-02-01 22:17:39 UTC (rev 12534)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfSerializer.java 2022-02-01 23:30:07 UTC (rev 12535)
@@ -104,12 +104,8 @@
/* Write the pages and other indirect objects. */
this.document.registerOptionalIndirectObjects();
- final List<PdfObject> indirectObjects = this.document.getIndirectObjects();
+ final PdfCrossRefInfo xrefInfo = writeIndirectObjects();
- final PdfCrossRefInfo xrefInfo = new PdfCrossRefInfo();
- writeIndirectObjects(indirectObjects, xrefInfo);
- writeDeferredIndirectObjects(indirectObjects, xrefInfo);
-
/* Remember position of xref table. */
final long xrefPosition = this.position;
xrefInfo.writeTable(output);
@@ -117,12 +113,19 @@
writeTrailer(output, xrefPosition);
}
- private void writeIndirectObjects(final List<PdfObject> indirectObjects, final PdfCrossRefInfo xrefInfo)
- throws PdfException {
+ /**
+ * Writes the indirect objects to the output stream.
+ * @return The cross-reference table containing the location of each indirect object.
+ * @throws PdfException For errors computing or writing the indirect objects.
+ */
+ private PdfCrossRefInfo writeIndirectObjects() throws PdfException {
+ final List<PdfObject> indirectObjects = this.document.getIndirectObjects();
+ final PdfCrossRefInfo xrefInfo = new PdfCrossRefInfo();
+ /* First write the normal (non-deferred) indirect. objects. */
+
/* Use a "while" loop here, because as each object is written, it has potential to reference another object
- * indirectly, which will add an item to indirectObjects.
- */
+ * indirectly, which will add an item to indirectObjects. */
int objectId = 1;
while (objectId < indirectObjects.size()) {
final PdfObject object = indirectObjects.get(objectId);
@@ -143,14 +146,13 @@
}
objectId ++;
}
- }
- private void writeDeferredIndirectObjects(final List<PdfObject> indirectObjects, final PdfCrossRefInfo xrefInfo)
- throws PdfException {
+
+ /* Now write the deferred indirect objects. */
/* Treat the deferred items like a stack, and iterate in reverse order. */
final IntPrimitiveIterator deferredObjectIterator = this.document.getWriteLastIterator();
while (deferredObjectIterator.hasNext()) {
- final int objectId = deferredObjectIterator.nextInt();
+ objectId = deferredObjectIterator.nextInt();
final PdfObject object = indirectObjects.get(objectId);
if (object != null) {
final PdfObjectReference reference = object.getIndirectReference();
@@ -160,6 +162,8 @@
this.position += object.serialize(output, this.document);
}
}
+
+ return xrefInfo;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-01 22:17:42
|
Revision: 12534
http://sourceforge.net/p/foray/code/12534
Author: victormote
Date: 2022-02-01 22:17:39 +0000 (Tue, 01 Feb 2022)
Log Message:
-----------
Add missing javadoc.
Modified Paths:
--------------
trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml
trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractOrderedTreeNode.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceTokenizer.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/OrderedTreeNode.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/TernaryTreeIterator.java
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4aIterator.java
trunk/foray/foray-common/src/main/java/org/foray/common/primitive/ArrayUtils.java
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ByteArrayBuilder.java
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/CharArrayBuilder.java
trunk/foray/foray-common/src/test/java/org/foray/common/data/AbstractIntSequenceTests.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block4a.java
Modified: trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml
===================================================================
--- trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml 2022-02-01 21:16:45 UTC (rev 12533)
+++ trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml 2022-02-01 22:17:39 UTC (rev 12534)
@@ -118,8 +118,7 @@
<!-- Make sure each Method has javadoc, regardless of visibility. -->
<module name="MissingJavadocMethod">
- <property name="scope" value="private"/>
- <property name="severity" value="ignore"/>
+ <property name="scope" value="public"/>
</module>
<!-- Make sure Method javadoc is well-formed. -->
<module name="JavadocMethod"/>
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractOrderedTreeNode.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractOrderedTreeNode.java 2022-02-01 21:16:45 UTC (rev 12533)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractOrderedTreeNode.java 2022-02-01 22:17:39 UTC (rev 12534)
@@ -204,6 +204,10 @@
return children.get(0);
}
+ /**
+ * Returns the first child of this node.
+ * @return The first child of this node, or null if this node has no children.
+ */
public T getFirstChild() {
return nullSafeNativeType(getFirstOtnChild());
}
@@ -220,6 +224,10 @@
return children.get(children.size() - 1);
}
+ /**
+ * Returns the last child of this node.
+ * @return The last child of this node, or null if this node has no children.
+ */
public T getLastChild() {
return nullSafeNativeType(getLastOtnChild());
}
@@ -243,15 +251,16 @@
return null;
}
+ /**
+ * Returns the next node in the tree relative to the current node, in pre-order traversal order.
+ * This is also known as breadth-first order.
+ * @return The next pre-order node, or null if there is none.
+ */
public T getNextPreOrderNode() {
return nullSafeNativeType(getNextOtnPreOrderNode());
}
- /**
- * Returns the next node in the tree relative to the current node, in
- * post-order traversal order. This is also known as depth-first order.
- * @return The next post-order node, or null if there is none.
- */
+ @Override
public AbstractOrderedTreeNode<T> getNextOtnPostOrderNode() {
/* All of the children would come before this. */
/* If there are siblings, they or their descendants come next. */
@@ -265,6 +274,11 @@
return getParent().asOrderedNode();
}
+ /**
+ * Returns the next node in the tree relative to the current node, in post-order traversal order.
+ * This is also known as depth-first order.
+ * @return The next post-order node, or null if there is none.
+ */
public T getNextPostOrderNode() {
return nullSafeNativeType(getNextOtnPostOrderNode());
}
@@ -278,6 +292,10 @@
return node;
}
+ /**
+ * Returns the first self-or-descendant leaf relative to this node.
+ * @return The first leaf in the subtree rooted at this node.
+ */
public T getFirstLeaf() {
return nullSafeNativeType(getFirstOtnLeaf());
}
@@ -291,6 +309,10 @@
return node;
}
+ /**
+ * Returns the last self-or-descendant leaf relative to this node.
+ * @return The last leaf in the subtree rooted at this node.
+ */
public T getLastLeaf() {
return nullSafeNativeType(getLastOtnLeaf());
}
@@ -310,6 +332,10 @@
return myParent.getNextOtnLeaf();
}
+ /**
+ * <p>Returns the leaf after this node or null if this node is the last leaf in the tree.</p>
+ * @return The next leaf past this node.
+ */
public T getNextLeaf() {
return nullSafeNativeType(getNextOtnLeaf());
}
@@ -329,6 +355,10 @@
return myParent.getPreviousOtnLeaf();
}
+ /**
+ * <p>Returns the leaf before this node or null if this node is the first leaf in the tree.</p>
+ * @return The leaf before this node.
+ */
public T getPreviousLeaf() {
return nullSafeNativeType(getPreviousOtnLeaf());
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceTokenizer.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceTokenizer.java 2022-02-01 21:16:45 UTC (rev 12533)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceTokenizer.java 2022-02-01 22:17:39 UTC (rev 12534)
@@ -130,11 +130,17 @@
markNextTokenStart();
}
+ /**
+ * Resets the internal state of this tokenizer.
+ */
private void resetInternalState() {
this.nextTokenStart = Integer.MIN_VALUE;
this.balancingCounters = new int[config.getReturnableDelimiterBalancers().size()];
}
+ /**
+ * Marks the location of the start of the next token.
+ */
private void markNextTokenStart() {
/* Set the default. */
this.nextTokenStart = NO_MORE_TOKENS;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/OrderedTreeNode.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/OrderedTreeNode.java 2022-02-01 21:16:45 UTC (rev 12533)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/OrderedTreeNode.java 2022-02-01 22:17:39 UTC (rev 12534)
@@ -127,18 +127,13 @@
OrderedTreeNode<T> getNextOtnPostOrderNode();
/**
- * Finds and returns the first leaf that is a descendant of this node: either this node or its first child's first
- * leaf.
- * Returns this node if it is a leaf.
- * @return the first leaf in the subtree rooted at this node
+ * Returns the first self-or-descendant leaf relative to this node.
+ * @return The first leaf in the subtree rooted at this node.
*/
OrderedTreeNode<T> getFirstOtnLeaf();
-
/**
- * Finds and returns the last leaf that is a descendant of this node: either this node or its last child's last
- * leaf.
- * Returns this node if it is a leaf.
+ * Returns the last self-or-descendant leaf relative to this node.
* @return The last leaf in the subtree rooted at this node.
*/
OrderedTreeNode<T> getLastOtnLeaf();
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/TernaryTreeIterator.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/TernaryTreeIterator.java 2022-02-01 21:16:45 UTC (rev 12533)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/TernaryTreeIterator.java 2022-02-01 22:17:39 UTC (rev 12534)
@@ -77,6 +77,10 @@
return returnValue;
}
+ /**
+ * Internal logic to find the next node.
+ * @return The next node, or null if there is none.
+ */
private TernaryTreeNode findNext() {
while (this.innerIterator.hasNext()) {
final TernaryNode node = this.innerIterator.next();
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4aIterator.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4aIterator.java 2022-02-01 21:16:45 UTC (rev 12533)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4aIterator.java 2022-02-01 22:17:39 UTC (rev 12534)
@@ -88,6 +88,10 @@
return next;
}
+ /**
+ * Internal computation of the next leaf.
+ * @return The next leaf, or null if there is none.
+ */
private ParaLeaf internalNext() {
if (this.branchStack.isEmpty()) {
throw new NoSuchElementException("There is no \"next\" element.");
@@ -122,6 +126,10 @@
return previous;
}
+ /**
+ * Internal computation of the previous leaf.
+ * @return The previous leaf, or null if there is none.
+ */
private ParaLeaf internalPrevious() {
if (this.branchStack.isEmpty()) {
throw new NoSuchElementException("There is no \"previous\" element.");
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/primitive/ArrayUtils.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/primitive/ArrayUtils.java 2022-02-01 21:16:45 UTC (rev 12533)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/primitive/ArrayUtils.java 2022-02-01 22:17:39 UTC (rev 12534)
@@ -33,6 +33,10 @@
*/
public final class ArrayUtils {
+ /**
+ * Private constructor.
+ * This is a utility class that should never be instantiated.
+ */
private ArrayUtils() { }
/**
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ByteArrayBuilder.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ByteArrayBuilder.java 2022-02-01 21:16:45 UTC (rev 12533)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/ByteArrayBuilder.java 2022-02-01 22:17:39 UTC (rev 12534)
@@ -305,12 +305,17 @@
: newCapacity;
}
+ /**
+ * Computes the new capacity for the case where the minimum requested capacity is greater than the normal increment
+ * amount.
+ * @param minCapacity The requested minimum capacity.
+ * @return The computed new capacity.
+ */
private int hugeCapacity(final int minCapacity) {
if (Integer.MAX_VALUE - minCapacity < 0) { // overflow
throw new OutOfMemoryError();
}
- return (minCapacity > MAX_ARRAY_SIZE)
- ? minCapacity : MAX_ARRAY_SIZE;
+ return (minCapacity > MAX_ARRAY_SIZE) ? minCapacity : MAX_ARRAY_SIZE;
}
/**
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/CharArrayBuilder.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/CharArrayBuilder.java 2022-02-01 21:16:45 UTC (rev 12533)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/CharArrayBuilder.java 2022-02-01 22:17:39 UTC (rev 12534)
@@ -190,6 +190,12 @@
: newCapacity;
}
+ /**
+ * Computes the new capacity for the case where the minimum requested capacity is greater than the normal increment
+ * amount.
+ * @param minCapacity The requested minimum capacity.
+ * @return The computed new capacity.
+ */
private int hugeCapacity(final int minCapacity) {
if (Integer.MAX_VALUE - minCapacity < 0) { // overflow
throw new OutOfMemoryError();
Modified: trunk/foray/foray-common/src/test/java/org/foray/common/data/AbstractIntSequenceTests.java
===================================================================
--- trunk/foray/foray-common/src/test/java/org/foray/common/data/AbstractIntSequenceTests.java 2022-02-01 21:16:45 UTC (rev 12533)
+++ trunk/foray/foray-common/src/test/java/org/foray/common/data/AbstractIntSequenceTests.java 2022-02-01 22:17:39 UTC (rev 12534)
@@ -59,6 +59,10 @@
this.builder = builder;
}
+ /**
+ * Standard "indexOf" assertions.
+ * @param out The object under test.
+ */
private void indexOfAssertions(final AbstractIntSequence out) {
Assert.assertEquals(0, out.indexOf(48));
Assert.assertEquals(1, out.indexOf(-2041191));
@@ -75,6 +79,10 @@
Assert.assertEquals(-1, out.indexOf(Integer.MIN_VALUE + 1));
}
+ /**
+ * Standard "contains" assertions.
+ * @param out The object under test.
+ */
private void containsAssertions(final AbstractIntSequence out) {
Assert.assertTrue(out.contains(48));
Assert.assertTrue(out.contains(-2041191));
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-02-01 21:16:45 UTC (rev 12533)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-02-01 22:17:39 UTC (rev 12534)
@@ -389,6 +389,10 @@
this.foTreeListeners.remove(listener);
}
+ /**
+ * Counts the number of registered {@link FoTreeListener}s that want to receive "FO complete" events.
+ * @return The number of listeners that want "FO complete" events.
+ */
private int qtyFoCompleteListeners() {
int count = 0;
for (int index = 0; index < this.foTreeListeners.size(); index ++) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block4a.java 2022-02-01 21:16:45 UTC (rev 12533)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block4a.java 2022-02-01 22:17:39 UTC (rev 12534)
@@ -222,6 +222,12 @@
throwException("Unable to handle this kind of mixed content.");
}
+ /**
+ * Adds the object to a child instance of {@link BlockDiscrete4a} instead of directly as a child of this block,
+ * first creating the {@link BlockDiscrete4a} if needed.
+ * @param fobj The object to be added.
+ * @throws FoTreeException For errors adding the child.
+ */
private void addBlockDiscreteContent(final FoObj fobj) throws FoTreeException {
final FoObj lastChild = this.getLastChild();
BlockDiscrete4a discrete = null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-01 21:16:50
|
Revision: 12533
http://sourceforge.net/p/foray/code/12533
Author: victormote
Date: 2022-02-01 21:16:45 +0000 (Tue, 01 Feb 2022)
Log Message:
-----------
Add missing javadoc.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/BatikUaDocument.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionarySorter.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayAssignId.java
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/BatikUaDocument.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/BatikUaDocument.java 2022-02-01 20:03:40 UTC (rev 12532)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/BatikUaDocument.java 2022-02-01 21:16:45 UTC (rev 12533)
@@ -32,7 +32,6 @@
import org.foray.common.WellKnownConstants;
import org.apache.batik.bridge.UserAgentAdapter;
-import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.Dimension;
@@ -55,9 +54,6 @@
/** The current AffineTransform. */
private AffineTransform currentTransform = null;
- /** The lazily-loaded logger. Use {@link #getLogger()} to obtain the instance. */
- private Logger logger;
-
/**
* Creates a new SVGUserAgent.
* @param at The AffineTransform for this.
@@ -68,17 +64,12 @@
@Override
public void displayError(final String message) {
- getLogger().error(message);
+ LoggerFactory.getLogger(this.getClass()).error(message);
}
@Override
- public void displayError(final Exception ex) {
- getLogger().error("SVG Error", ex);
- }
-
- @Override
public void displayMessage(final String message) {
- getLogger().info(message);
+ LoggerFactory.getLogger(this.getClass()).info(message);
}
@Override
@@ -129,11 +120,5 @@
return true;
}
- private Logger getLogger() {
- if (this.logger == null) {
- this.logger = LoggerFactory.getLogger(BatikUaDocument.class);
- }
- return this.logger;
- }
}
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java 2022-02-01 20:03:40 UTC (rev 12532)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java 2022-02-01 21:16:45 UTC (rev 12533)
@@ -49,7 +49,6 @@
import org.apache.batik.gvt.font.GVTFontFamily;
import org.apache.batik.gvt.text.GVTAttributedCharacterIterator;
import org.apache.batik.gvt.text.TextPaintInfo;
-import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.Color;
@@ -86,9 +85,6 @@
/** The font family name used by this text. */
private String fontFamily = null;
- /** Lazily-loaded logger. Use {@link #getLogger()} to obtain the instance. */
- private Logger logger;
-
/**
* Constructor.
* @param consumer The FontConsumer that should be used for font resolution.
@@ -268,7 +264,7 @@
try {
fontToUse = getFontToUse(aci, g2d, taFontSize, isItalic, isBold);
} catch (final FontException e) {
- getLogger().error(e.getMessage());
+ LoggerFactory.getLogger(this.getClass()).error(e.getMessage());
}
final String awtFontFamily = this.fontFamily;
@@ -412,11 +408,4 @@
return PdfTextPainter.PROXY_PAINTER.getOutline(node);
}
- private Logger getLogger() {
- if (this.logger == null) {
- this.logger = LoggerFactory.getLogger(PdfTextPainter.class);
- }
- return this.logger;
- }
-
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionarySorter.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionarySorter.java 2022-02-01 20:03:40 UTC (rev 12532)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionarySorter.java 2022-02-01 21:16:45 UTC (rev 12533)
@@ -96,6 +96,13 @@
return word1.compareTo(word2);
}
+ /**
+ * For a given {@link Matcher} instance, computes the raw word value in it, by removing all discretionary
+ * hyphen characters, then replacing non-discretionary hyphens, which are encoded as "=" with their normal
+ * value "-".
+ * @param matcher The matcher containing the identified word.
+ * @return The raw word value.
+ */
private String computeWord(final Matcher matcher) {
String word = matcher.group(1).toLowerCase();
word = hyphenPattern.matcher(word).replaceAll("");
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2022-02-01 20:03:40 UTC (rev 12532)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2022-02-01 21:16:45 UTC (rev 12533)
@@ -233,6 +233,12 @@
this.elementStack.push(element);
}
+ /**
+ * For a given element and its attributes, parses the {@link WritingSystem} from them and then finds the
+ * {@link Orthogrpahy} for that {@link WritingSystem}.
+ * @param attributes The attributes that possibly contain language, country, and script data.
+ * @param element The element to which the {@link Orthography} instance should be attached.
+ */
private void parseOrthography(final Attributes attributes, final Element element) {
String languageAttr = null;
languageAttr = attributes.getValue("xml:lang");
Modified: trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java
===================================================================
--- trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java 2022-02-01 20:03:40 UTC (rev 12532)
+++ trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java 2022-02-01 21:16:45 UTC (rev 12533)
@@ -103,6 +103,10 @@
}
}
+ /**
+ * Writes the Java class for a given code block.
+ * @param block The Unicode code block for which a Java class should be written.
+ */
private void createClass(final Block block) throws IOException {
File outDir = new File(this.outputDir, "org/");
outDir.mkdir();
@@ -213,6 +217,11 @@
}
}
+ /**
+ * Parses the code points from the UnicodeData.txt file.
+ * @param unicodeDir The directory where the UnicodeData.txt file is located.
+ * @throws IOException For errors finding, opening, or reading the UnicodeData.txt file.
+ */
private void parseCodePoints(final File unicodeDir) throws IOException {
int codepointLinesRead = 0;
final File unicodeDataFile = new File(unicodeDir, "UnicodeData.txt");
@@ -235,6 +244,11 @@
LOGGER.info("Count of CodePoints read: " + codepointLinesRead);
}
+ /**
+ * Parses the blocks from the Blocks.txt file.
+ * @param unicodeDir The directory where the Blocks.txt file is located.
+ * @throws IOException For errors finding, opening, or reading the Blocks.txt file.
+ */
private void parseBlocks(final File unicodeDir) throws IOException {
final File blocksFile = new File(unicodeDir, "Blocks.txt");
try (Reader reader = new FileReader(blocksFile);
@@ -253,6 +267,11 @@
}
}
+ /**
+ * Parses a single Unicode block from a line of the Blocks.txt file.
+ * @param line The line from Block.txt to be parsed as a code block.
+ * @return The parsed block.
+ */
private Block parseBlock(final String line) {
final String[] split1 = line.split("; ");
final String range = split1[0];
@@ -265,6 +284,10 @@
return new Block(name, start, end);
}
+ /**
+ * Builds and returns the boilerplate content of the class header.
+ * @return The content of the class header.
+ */
private String classHeader() {
final String eol = System.lineSeparator();
final StringBuilder builder = new StringBuilder();
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayAssignId.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayAssignId.java 2022-02-01 20:03:40 UTC (rev 12532)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayAssignId.java 2022-02-01 21:16:45 UTC (rev 12533)
@@ -178,6 +178,10 @@
transformer.transform(source, result);
}
+ /**
+ * Sets up processing for a new {@link Document}.
+ * @param doc The document to be processed.
+ */
private void changeDocument(final Document doc) {
final DocumentTraversal dt = (DocumentTraversal) doc;
final NodeIterator ni = dt.createNodeIterator(doc.getDocumentElement(), NodeFilter.SHOW_ELEMENT, null, false);
@@ -193,6 +197,11 @@
}
+ /**
+ * Computes the "Id" for a given element.
+ * @param element The element for which an "Id" should be computed.
+ * @return The computed "Id" for {@code element}.
+ */
private String computeIdValue(final Element element) {
AncestorInfo ancestorInfo = null;
if (paraLevelElements.contains(element.getTagName())) {
@@ -210,6 +219,11 @@
return "unknown";
}
+ /**
+ * Computes the "Id" for a given paragraph-level element.
+ * @param element The paragraph-level element for which an "Id" should be computed.
+ * @return The computed "Id" for {@code element}.
+ */
private String computeParaIdValue(final Element element) {
final Element ancestor = findAncestorWithId(element);
final AncestorInfo info = counterMap.get(ancestor);
@@ -232,6 +246,11 @@
return prefix + "p" + String.format(ancestorParaFormatString, ++info.paraCount);
}
+ /**
+ * For a given {@link Element}, finds its nearest ancestor node that has an "Id" attribute.
+ * @param element The element for which an "Id" ancestor is wanted.
+ * @return The nearest ancestor element that has an "Id" attribute, or null if none is found.
+ */
private Element findAncestorWithId(final Element element) {
Element ancestor = (Element) element.getParentNode();
while (! ancestor.hasAttribute("Id")) {
@@ -240,6 +259,11 @@
return ancestor;
}
+ /**
+ * Creates a standard {@link DocumentBuilder}.
+ * @return A new document builder.
+ * @throws ParserConfigurationException For errors creating or configuring the document builder.
+ */
private DocumentBuilder createDocumentBuilder() throws ParserConfigurationException {
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-01 20:03:43
|
Revision: 12532
http://sourceforge.net/p/foray/code/12532
Author: victormote
Date: 2022-02-01 20:03:40 +0000 (Tue, 01 Feb 2022)
Log Message:
-----------
Ensure javadoc on all types, regardless of visibility.
Modified Paths:
--------------
trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfGenericDictionary.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayAssignId.java
Modified: trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml
===================================================================
--- trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml 2022-02-01 19:45:10 UTC (rev 12531)
+++ trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml 2022-02-01 20:03:40 UTC (rev 12532)
@@ -110,11 +110,13 @@
<module name="MissingJavadocPackage"/>
<!-- Make sure each Type has javadoc, regardless of visibility. -->
- <module name="MissingJavadocType"/>
+ <module name="MissingJavadocType">
+ <property name="scope" value="private"/>
+ </module>
<!-- Make sure Type javadoc is well-formed. -->
<module name="JavadocType"/>
- <!-- Make sure each Method has javadoc -->
+ <!-- Make sure each Method has javadoc, regardless of visibility. -->
<module name="MissingJavadocMethod">
<property name="scope" value="private"/>
<property name="severity" value="ignore"/>
@@ -122,7 +124,7 @@
<!-- Make sure Method javadoc is well-formed. -->
<module name="JavadocMethod"/>
- <!-- Make sure each variable has javadoc -->
+ <!-- Make sure each variable has javadoc. -->
<module name="JavadocVariable">
<property name="scope" value="private"/>
</module>
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParser.java 2022-02-01 19:45:10 UTC (rev 12531)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParser.java 2022-02-01 20:03:40 UTC (rev 12532)
@@ -66,6 +66,9 @@
*/
public class DictionaryParser extends SaxParser<List<SegmentDictionary>> {
+ /**
+ * Container for the "axsl-dictionary" element as it is being parsed.
+ */
private class DictionaryElement {
/** The orthography for this dictionary. */
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2022-02-01 19:45:10 UTC (rev 12531)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2022-02-01 20:03:40 UTC (rev 12532)
@@ -73,12 +73,17 @@
import javax.xml.parsers.ParserConfigurationException;
/**
- * Parses a document, looking for spelling errors.
- * The specified natural language can change at any time, and must be tracked
+ * Parses a generic XML document, looking for spelling errors.
+ * The specified natural language can change at any time, and must be tracked.
* General plan is to capture all of the text data in one CharSequence, then parse and compare to dictionary entries.
*/
public class SpellChecker extends SaxParser<Object> {
+ /**
+ * An element parsed from the input document.
+ * This class is a SAX parser, but is designed to work with any(???) XML document, and is therefore agnostic about
+ * the elements or their content, so we capture that information in this class.
+ */
private class Element {
/** The namespace URI, if specified. */
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfGenericDictionary.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfGenericDictionary.java 2022-02-01 19:45:10 UTC (rev 12531)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfGenericDictionary.java 2022-02-01 20:03:40 UTC (rev 12532)
@@ -34,6 +34,9 @@
import java.util.Collections;
import java.util.List;
+/**
+ * A general-purpose concrete dictionary class, mostly useful during parsing.
+ */
class PdfGenericDictionary extends PdfDictionary {
@Override
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayAssignId.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayAssignId.java 2022-02-01 19:45:10 UTC (rev 12531)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayAssignId.java 2022-02-01 20:03:40 UTC (rev 12532)
@@ -115,6 +115,9 @@
* so far. */
private Map<Element, AncestorInfo> counterMap = new HashMap<Element, AncestorInfo>();
+ /**
+ * Stores the information for one ancestor node.
+ */
private class AncestorInfo {
/** The number of Para-level children counted so far. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-01 19:45:12
|
Revision: 12531
http://sourceforge.net/p/foray/code/12531
Author: victormote
Date: 2022-02-01 19:45:10 +0000 (Tue, 01 Feb 2022)
Log Message:
-----------
Generate true javadoc for the private constructor.
Modified Paths:
--------------
trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml
trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java
Modified: trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml
===================================================================
--- trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml 2022-02-01 19:25:58 UTC (rev 12530)
+++ trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml 2022-02-01 19:45:10 UTC (rev 12531)
@@ -116,7 +116,8 @@
<!-- Make sure each Method has javadoc -->
<module name="MissingJavadocMethod">
- <property name="severity" value="ignore"/>
+ <property name="scope" value="private"/>
+ <property name="severity" value="ignore"/>
</module>
<!-- Make sure Method javadoc is well-formed. -->
<module name="JavadocMethod"/>
Modified: trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java
===================================================================
--- trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java 2022-02-01 19:25:58 UTC (rev 12530)
+++ trunk/foray/foray-unicode/src/main/java/org/foray/unicode/UnicodeParser.java 2022-02-01 19:45:10 UTC (rev 12531)
@@ -197,8 +197,12 @@
/* The file footer. */
writer.write(eol);
- writer.write(" /* Private constructor. This is a utility class and should never be instantiated. */");
+ writer.write(" /*");
writer.write(eol);
+ writer.write(" * Private constructor. This is a utility class and should never be instantiated.");
+ writer.write(eol);
+ writer.write(" */");
+ writer.write(eol);
writer.write(" private ");
writer.write(className);
writer.write("() { }");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-01 19:26:01
|
Revision: 12530
http://sourceforge.net/p/foray/code/12530
Author: victormote
Date: 2022-02-01 19:25:58 +0000 (Tue, 01 Feb 2022)
Log Message:
-----------
Add missing javadoc.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceTokenizerConfig.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/TernaryNode.java
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4aIterator.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/document/PdfNameDictionary.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceTokenizerConfig.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceTokenizerConfig.java 2022-02-01 19:07:05 UTC (rev 12529)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/ByteSequenceTokenizerConfig.java 2022-02-01 19:25:58 UTC (rev 12530)
@@ -114,18 +114,34 @@
}
}
+ /**
+ * Returns the list of returnable delimiters.
+ * @return The list of returnable delimiters.
+ */
public List<ByteArray> getReturnableDelimiters() {
return this.returnableDelimiters;
}
+ /**
+ * Returns the list of non-returnable delimiters.
+ * @return The list of non-returnable delimiters.
+ */
public ByteArray getNonReturnableDelimiters() {
return this.nonReturnableDelimiters;
}
+ /**
+ * Returns the list of escape codes.
+ * @return The list of escape codes.
+ */
public ByteArray getEscapeCodes() {
return this.escapeCodes;
}
+ /**
+ * Returns the list of returnable delimiter balancers.
+ * @return The list of returnable delimiter balancers.
+ */
public List<ByteArray> getReturnableDelimiterBalancers() {
return this.returnableDelimiterBalancers;
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/TernaryNode.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/TernaryNode.java 2022-02-01 19:07:05 UTC (rev 12529)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/TernaryNode.java 2022-02-01 19:25:58 UTC (rev 12530)
@@ -183,6 +183,11 @@
return -1;
}
+ /**
+ * Returns the key for this node.
+ * @param tree The ancestor tree.
+ * @return The key for this node.
+ */
public CharSequence getKey(final TernaryTree tree) {
return tree.getKey(this.index, this.rawKey);
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4aIterator.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4aIterator.java 2022-02-01 19:07:05 UTC (rev 12529)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4aIterator.java 2022-02-01 19:25:58 UTC (rev 12530)
@@ -66,6 +66,10 @@
* stored is conceptually the "next" index to be iterated. */
private IntArrayBuilder branchIndexes = new IntArrayBuilder();
+ /**
+ * Constructor.
+ * @param branch The branch to be iterated.
+ */
public ParaBranch4aIterator(final ParaBranch branch) {
this.branchStack.push(branch);
this.paraLeafSize = branch.qtyParaLeaves();
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java 2022-02-01 19:07:05 UTC (rev 12529)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java 2022-02-01 19:25:58 UTC (rev 12530)
@@ -101,6 +101,10 @@
return this.root != null;
}
+ /**
+ * Setter for the root element of this tree.
+ * @param root The new root element.
+ */
public void setRootFo(final Root4a root) {
this.root = root;
}
@@ -155,6 +159,10 @@
this.graphicSearchPath = graphicSearchPath;
}
+ /**
+ * Returns the graphic search path for this FO tree.
+ * @return The graphic search path.
+ */
public URL[] getGraphicSearchPath() {
return this.graphicSearchPath;
}
@@ -164,6 +172,10 @@
this.cachingGraphics = cachingGraphics;
}
+ /**
+ * Indicates whether this FO tree wants graphic objects to be cached for reuse.
+ * @return True if and only if graphic objects should be cached for reuse.
+ */
public boolean isCachingGraphics() {
return this.cachingGraphics;
}
@@ -177,6 +189,10 @@
return this.lastSequentialIndex;
}
+ /**
+ * Returns the parent FO tree server for this tree.
+ * @return The parent FO tree server.
+ */
public FoTreeServer4a getTreeServer() {
return this.treeServer;
}
@@ -229,6 +245,10 @@
return getTreeServer().getAxslNamespace();
}
+ /**
+ * Returns the logger that should be used by this tree and its descendants.
+ * @return The logger.
+ */
public Logger getLogger() {
return this.treeBuilder.getLogger();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java 2022-02-01 19:07:05 UTC (rev 12529)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java 2022-02-01 19:25:58 UTC (rev 12530)
@@ -308,10 +308,18 @@
return this.fontServer;
}
+ /**
+ * Returns the graphic server.
+ * @return The graphic server.
+ */
public GraphicServer getGraphicServer() {
return this.graphicServer;
}
+ /**
+ * Returns the orthography server.
+ * @return The orthography server.
+ */
public FoOrthographyServer getOrthographyServer() {
return this.orthographyServer;
}
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/document/PdfNameDictionary.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/document/PdfNameDictionary.java 2022-02-01 19:07:05 UTC (rev 12529)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/document/PdfNameDictionary.java 2022-02-01 19:25:58 UTC (rev 12530)
@@ -137,6 +137,10 @@
return this.embeddedFiles;
}
+ /**
+ * Indicates whether any of this dictionary's children have any content.
+ * @return True if and only if all of this dictionary's children are empty.
+ */
public boolean isEmpty() {
return this.dests.isEmpty()
&& this.embeddedFiles.isEmpty();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-01 19:07:08
|
Revision: 12529
http://sourceforge.net/p/foray/code/12529
Author: victormote
Date: 2022-02-01 19:07:05 +0000 (Tue, 01 Feb 2022)
Log Message:
-----------
Rename methods for clarity and consistency.
Modified Paths:
--------------
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/document/PdfDocument4a.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfParser.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfSerializer.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfFont4a.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfArray.java
trunk/foray/foray-pdf/src/test/java/org/foray/pdf/object/PdfArrayTests.java
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/document/PdfDocument4a.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/document/PdfDocument4a.java 2022-02-01 18:56:39 UTC (rev 12528)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/document/PdfDocument4a.java 2022-02-01 19:07:05 UTC (rev 12529)
@@ -294,7 +294,11 @@
return this.resources;
}
- public PdfTrailer getTrailer() {
+ /**
+ * Creates a trailer object for this document based on its current state.
+ * @return The newly-created trailer object.
+ */
+ public PdfTrailer createTrailer() {
final PdfTrailer trailer = new PdfTrailer();
trailer.put("Size", this.indirectObjects.size());
trailer.put("Root", this.root);
@@ -308,8 +312,8 @@
}
if (this.permanentFileId != null) {
final PdfArray array = new PdfArray();
- array.addElement(new PdfHexString(getPermanentFileId()));
- array.addElement(new PdfHexString(getIncrementalFileId()));
+ array.add(new PdfHexString(getPermanentFileId()));
+ array.add(new PdfHexString(getIncrementalFileId()));
trailer.put("ID", array);
}
return trailer;
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfParser.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfParser.java 2022-02-01 18:56:39 UTC (rev 12528)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfParser.java 2022-02-01 19:07:05 UTC (rev 12529)
@@ -401,7 +401,7 @@
* above. */
while (objectStack.peek() != array) {
final PdfObject element = objectStack.pop();
- array.addElement(element);
+ array.add(element);
}
} else if (PdfConstants.CLOSE_DICTIONARY.equals(token)) {
/* Create the dictionary object and push it onto the object stack. */
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfSerializer.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfSerializer.java 2022-02-01 18:56:39 UTC (rev 12528)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfSerializer.java 2022-02-01 19:07:05 UTC (rev 12529)
@@ -172,7 +172,7 @@
/* Write the trailer. */
final ByteArrayBuilder builder = new ByteArrayBuilder();
builder.append("trailer" + PdfObject.EOL);
- builder.append(this.document.getTrailer().serialize(this.document));
+ builder.append(this.document.createTrailer().serialize(this.document));
builder.append("startxref");
builder.append(PdfObject.EOL);
builder.append(Long.toString(xrefPosition));
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfFont4a.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfFont4a.java 2022-02-01 18:56:39 UTC (rev 12528)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/text/PdfFont4a.java 2022-02-01 19:07:05 UTC (rev 12529)
@@ -254,7 +254,7 @@
}
final PdfArray widthArray = new PdfArray();
for (short aShort : this.fsFont.getWidths()) {
- widthArray.addElement(aShort);
+ widthArray.add(aShort);
}
buffer.append("/Widths ");
buffer.append(widthArray.serialize(doc));
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfArray.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfArray.java 2022-02-01 18:56:39 UTC (rev 12528)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfArray.java 2022-02-01 19:07:05 UTC (rev 12529)
@@ -67,7 +67,7 @@
* Adds a {@link PdfObject} to this array.
* @param newElement The element to be added to this array.
*/
- public void addElement(final PdfObject newElement) {
+ public void add(final PdfObject newElement) {
this.arrayContents.add(newElement);
}
@@ -75,9 +75,9 @@
* Converts a {@link Integer#TYPE} to a {@link PdfInteger}, and adds it to this array.
* @param anInteger The element to be added to this array.
*/
- public void addElement(final int anInteger) {
+ public void add(final int anInteger) {
final PdfInteger newElement = new PdfInteger(anInteger);
- addElement(newElement);
+ add(newElement);
}
/**
@@ -84,9 +84,9 @@
* Converts a {@link BigDecimal} to a {@link PdfReal}, and adds it to this array.
* @param aReal The element to be added to this array.
*/
- public void addElement(final BigDecimal aReal) {
+ public void add(final BigDecimal aReal) {
final PdfReal newElement = new PdfReal(aReal);
- addElement(newElement);
+ add(newElement);
}
@Override
Modified: trunk/foray/foray-pdf/src/test/java/org/foray/pdf/object/PdfArrayTests.java
===================================================================
--- trunk/foray/foray-pdf/src/test/java/org/foray/pdf/object/PdfArrayTests.java 2022-02-01 18:56:39 UTC (rev 12528)
+++ trunk/foray/foray-pdf/src/test/java/org/foray/pdf/object/PdfArrayTests.java 2022-02-01 19:07:05 UTC (rev 12529)
@@ -51,11 +51,11 @@
@Test
public void basicTest() {
final PdfArray out = new PdfArray();
- out.addElement(549);
- out.addElement(new BigDecimal("3.14"));
- out.addElement(PdfBoolean.FALSE);
- out.addElement(new PdfTextString("Ralph"));
- out.addElement(new PdfName("SomeName"));
+ out.add(549);
+ out.add(new BigDecimal("3.14"));
+ out.add(PdfBoolean.FALSE);
+ out.add(new PdfTextString("Ralph"));
+ out.add(new PdfName("SomeName"));
final ByteArray actual = new ByteArray(out.serialize(null));
final ByteArray expected = new ByteArray("[\n549\n3.14\nfalse\n(Ralph)\n/SomeName\n]");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-01 18:56:42
|
Revision: 12528
http://sourceforge.net/p/foray/code/12528
Author: victormote
Date: 2022-02-01 18:56:39 +0000 (Tue, 01 Feb 2022)
Log Message:
-----------
Replace some ugly methods in PdfArray and PdfDictionary.
Modified Paths:
--------------
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/document/PdfDocument4a.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfParser.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfArray.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfDictionary.java
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/document/PdfDocument4a.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/document/PdfDocument4a.java 2022-02-01 17:43:10 UTC (rev 12527)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/document/PdfDocument4a.java 2022-02-01 18:56:39 UTC (rev 12528)
@@ -307,10 +307,10 @@
trailer.put("Encrypt", this.encryption);
}
if (this.permanentFileId != null) {
- final PdfArray array = trailer.ensureArray("ID");
- array.ensureMinimumSize(2);
- array.set(0, new PdfHexString(getPermanentFileId()));
- array.set(1, new PdfHexString(getIncrementalFileId()));
+ final PdfArray array = new PdfArray();
+ array.addElement(new PdfHexString(getPermanentFileId()));
+ array.addElement(new PdfHexString(getIncrementalFileId()));
+ trailer.put("ID", array);
}
return trailer;
}
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfParser.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfParser.java 2022-02-01 17:43:10 UTC (rev 12527)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/serial/PdfParser.java 2022-02-01 18:56:39 UTC (rev 12528)
@@ -197,12 +197,13 @@
new ByteSequenceSubset(source, trailerDictStart, trailerDictEnd - trailerDictStart);
final ByteSequenceTokenizer tokenizer = new ByteSequenceTokenizer(parseArea, STD_TOKENIZER_CONFIG);
final PdfObject trailerObject = this.parseObject(tokenizer);
-
+ if (trailerObject instanceof PdfTrailer) {
+ return (PdfTrailer) trailerObject;
+ }
if (trailerObject instanceof PdfGenericDictionary) {
- return ((PdfGenericDictionary) trailerObject).asPdfTrailer();
- } else {
- throw new PdfException("Unable to parse the trailer dictionary.");
+ return new PdfTrailer((PdfGenericDictionary) trailerObject);
}
+ throw new PdfException("Unable to parse the trailer dictionary.");
}
/**
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfArray.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfArray.java 2022-02-01 17:43:10 UTC (rev 12527)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfArray.java 2022-02-01 18:56:39 UTC (rev 12528)
@@ -55,7 +55,7 @@
*/
public class PdfArray extends PdfObject {
/* CAVEAT: It is tempting to think that an "array" class should have a generic qualifier. See the class javadocs
- * for explanation of why that is not appropriate. */
+ * for explanation of why that is NOT appropriate. */
/** Format for type mismatch error messages. */
private static final String TYPE_EXCEPTION_FORMAT = "Type mismatch at index {0}. Expected: {1}, Actual: {2}.";
@@ -89,16 +89,6 @@
addElement(newElement);
}
- /**
- * Ensures that this array has a specified minimum size, adding null elements as needed.
- * @param minimumSize The minimum size for this array.
- */
- public void ensureMinimumSize(final int minimumSize) {
- while (this.arrayContents.size() < minimumSize) {
- addElement((PdfObject) null);
- }
- }
-
@Override
public ByteSequencePlus serialize(final PdfDocument4a doc) {
final ByteArrayBuilder builder = new ByteArrayBuilder();
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfDictionary.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfDictionary.java 2022-02-01 17:43:10 UTC (rev 12527)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfDictionary.java 2022-02-01 18:56:39 UTC (rev 12528)
@@ -33,7 +33,6 @@
import org.foray.pdf.PdfConstants;
import org.foray.pdf.PdfObjectReference;
import org.foray.pdf.document.PdfDocument4a;
-import org.foray.pdf.serial.PdfTrailer;
import org.foray.pdf.structure.PdfDate;
import org.foray.pdf.structure.PdfTextString;
@@ -56,10 +55,9 @@
/** Format for type mismatch error messages. */
private static final String TYPE_EXCEPTION_FORMAT = "Type mismatch for key [{0}]. Expected: {1}, Actual: {2}.";
- /** Internal map of the dictionary. */
+ /** Internal map of the dictionary. NB: The key to this map should technically be a {@link PdfName}, but storing it
+ * as a {@link String} seems to work fine. */
private Map<String, PdfObject> entries = new HashMap<String, PdfObject>();
- /* TODO: The key to this map should technically be a PdfName. However, this seems unimportant at the
- * moment. Find out whether that is necessary, and either document that it is not, or change the type. */
/**
* The specified output order for entries in this dictionary.
@@ -76,7 +74,8 @@
public PdfDictionary() { }
/**
- * Constructor allowing subclasses to remake themselves as a different subclass.
+ * Constructor allowing subclasses to remake themselves as a different subclass, which is mostly useful during
+ * parsing.
* @param existing The existing {@link PdfDictionary} whose contents will be pushed into the new instance.
*/
protected PdfDictionary(final PdfDictionary existing) {
@@ -158,6 +157,12 @@
return new ByteArray(builder);
}
+ /**
+ * Returns the output order for the entries that should be used as this dictionary is serialized.
+ * If there is an explicit output order <em>stored</em> with this instance, that will be used.
+ * Otherwise, the order at {@link #getOutputOrder()} will be used.
+ * @return The output order to be used as this dictionary is serialized.
+ */
private List<String> getRealOutputOrder() {
return this.outputOrder == null ? getOutputOrder() : this.outputOrder;
}
@@ -331,32 +336,6 @@
}
/**
- * Ensures that there is a PdfArray as the value for a given key, creating it if necessary.
- * @param key The key for which an array is needed.
- * @return The array.
- */
- public PdfArray ensureArray(final String key) {
- PdfArray value = getPdfArray(key);
- if (value == null) {
- value = new PdfArray();
- this.put(key, value);
- }
- return value;
- }
-
- /**
- * Converts this to an instance of {@link PdfTrailer}.
- * @return If this is an instance of PdfTrailer, returns this, otherwise a new instance of PdfTrailer with this's
- * instance variables.
- */
- public PdfTrailer asPdfTrailer() {
- if (this instanceof PdfTrailer) {
- return (PdfTrailer) this;
- }
- return new PdfTrailer(this);
- }
-
- /**
* Retrieves an object from the internal array and casts it to its expected type.
* @param key The key at which the value should be found.
* @param expectedType The type expected for {@code value}.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-02-01 17:43:13
|
Revision: 12527
http://sourceforge.net/p/foray/code/12527
Author: victormote
Date: 2022-02-01 17:43:10 +0000 (Tue, 01 Feb 2022)
Log Message:
-----------
Move unwrap logic to static methods in the type/structure classes.
Modified Paths:
--------------
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/interchange/PdfDocumentInfo4a.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/structure/PdfDate.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/structure/PdfTextString.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfArray.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfDictionary.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfInteger.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfReal.java
trunk/foray/foray-pdf/src/test/java/org/foray/pdf/serial/PdfParserTests.java
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/interchange/PdfDocumentInfo4a.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/interchange/PdfDocumentInfo4a.java 2022-02-01 16:37:22 UTC (rev 12526)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/interchange/PdfDocumentInfo4a.java 2022-02-01 17:43:10 UTC (rev 12527)
@@ -28,6 +28,8 @@
package org.foray.pdf.interchange;
+import org.foray.pdf.structure.PdfDate;
+import org.foray.pdf.structure.PdfTextString;
import org.foray.pdf.type.PdfDictionary;
import org.axsl.pdf.PdfDocumentInfo;
@@ -158,47 +160,47 @@
@Override
public String getTitle() {
- return getString(TITLE_KEY);
+ return PdfTextString.unwrap(getPdfTextString(TITLE_KEY));
}
@Override
public String getAuthor() {
- return getString(AUTHOR_KEY);
+ return PdfTextString.unwrap(getPdfTextString(AUTHOR_KEY));
}
@Override
public String getSubject() {
- return getString(SUBJECT_KEY);
+ return PdfTextString.unwrap(getPdfTextString(SUBJECT_KEY));
}
@Override
public String getKeywords() {
- return getString(KEYWORDS_KEY);
+ return PdfTextString.unwrap(getPdfTextString(KEYWORDS_KEY));
}
@Override
public String getCreator() {
- return getString(CREATOR_KEY);
+ return PdfTextString.unwrap(getPdfTextString(CREATOR_KEY));
}
@Override
public String getProducer() {
- return getString(PRODUCER_KEY);
+ return PdfTextString.unwrap(getPdfTextString(PRODUCER_KEY));
}
@Override
public Date getCreationDate() {
- return getDate(CREATION_DATE_KEY);
+ return PdfDate.unwrap(getPdfDate(CREATION_DATE_KEY));
}
@Override
public Date getModDate() {
- return getDate(MOD_DATE_KEY);
+ return PdfDate.unwrap(getPdfDate(MOD_DATE_KEY));
}
@Override
public PdfDocumentTrapped getTrapped() {
- return PdfDocumentTrapped.fromName(getString(PRODUCER_KEY));
+ return PdfDocumentTrapped.fromName(PdfTextString.unwrap(getPdfTextString(PRODUCER_KEY)));
}
@Override
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/structure/PdfDate.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/structure/PdfDate.java 2022-02-01 16:37:22 UTC (rev 12526)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/structure/PdfDate.java 2022-02-01 17:43:10 UTC (rev 12527)
@@ -49,12 +49,10 @@
*/
public class PdfDate extends PdfObject {
- /** The number of chars used to represent the time zone hours in a Java
- * Date. */
+ /** The number of chars used to represent the time zone hours in a Java Date. */
private static final int TIMEZONE_HOURS_SIZE = 3;
- /** The number of chars used to represent the time zone minutes in a Java
- * Date. */
+ /** The number of chars used to represent the time zone minutes in a Java Date. */
private static final int TIMEZONE_MINUTES_SIZE = 2;
/** The encapsulated Date instance. */
@@ -97,4 +95,16 @@
return this.date;
}
+ /**
+ * Null-safe unwrapping of a given date.
+ * @param pdfDate The date to be unwrapped, which can be null.
+ * @return The wrapped date, or null if {@code pdfDate} is null.
+ */
+ public static Date unwrap(final PdfDate pdfDate) {
+ if (pdfDate == null) {
+ return null;
+ }
+ return pdfDate.getValue();
+ }
+
}
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/structure/PdfTextString.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/structure/PdfTextString.java 2022-02-01 16:37:22 UTC (rev 12526)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/structure/PdfTextString.java 2022-02-01 17:43:10 UTC (rev 12527)
@@ -212,4 +212,16 @@
return this.theSequence;
}
+ /**
+ * Null-safe unwrapping of a given string.
+ * @param pdfTextString The text string to be unwrapped, which can be null.
+ * @return The wrapped String, or null if {@code pdfTextString} is null.
+ */
+ public static String unwrap(final PdfTextString pdfTextString) {
+ if (pdfTextString == null) {
+ return null;
+ }
+ return pdfTextString.getValue().toString();
+ }
+
}
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfArray.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfArray.java 2022-02-01 16:37:22 UTC (rev 12526)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfArray.java 2022-02-01 17:43:10 UTC (rev 12527)
@@ -40,7 +40,6 @@
import java.math.BigDecimal;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
/**
@@ -153,11 +152,6 @@
return retrieve(index, PdfTextString.class);
}
- public String getString(final int index) {
- final PdfTextString value = getPdfTextString(index);
- return value == null ? null : value.toString();
- }
-
/**
* Returns the {@link PdfHexString} at a given index.
* @param index The index for which the element should be returned.
@@ -178,11 +172,6 @@
return retrieve(index, PdfInteger.class);
}
- public int getInteger(final int index) {
- final PdfInteger value = getPdfInteger(index);
- return value == null ? null : value.getValue();
- }
-
/**
* Returns the {@link PdfReal} at a given index.
* @param index The index for which the element should be returned.
@@ -193,11 +182,6 @@
return retrieve(index, PdfReal.class);
}
- public BigDecimal getBigDecimal(final int index) {
- final PdfReal value = getPdfReal(index);
- return value == null ? null : value.getValue();
- }
-
/**
* Returns the {@link PdfDate} at a given index.
* @param index The index for which the element should be returned.
@@ -208,11 +192,6 @@
return retrieve(index, PdfDate.class);
}
- public Date getDate(final int index) {
- final PdfDate value = getPdfDate(index);
- return value == null ? null : value.getValue();
- }
-
/**
* Returns the {@link PdfDictionary} at a given index.
* @param index The index for which the element should be returned.
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfDictionary.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfDictionary.java 2022-02-01 16:37:22 UTC (rev 12526)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfDictionary.java 2022-02-01 17:43:10 UTC (rev 12527)
@@ -162,10 +162,19 @@
return this.outputOrder == null ? getOutputOrder() : this.outputOrder;
}
+ /**
+ * Indicates whether this dictionary is empty.
+ * @return True if and only if this dictionary has no entries.
+ */
public boolean isEmpty() {
return this.entries.isEmpty();
}
+ /**
+ * Adds an entry to this dictionary.
+ * @param key The key to the entry being added.
+ * @param value The value of the entry being added.
+ */
public void put(final String key, final PdfObject value) {
this.entries.put(key, value);
}
@@ -184,16 +193,31 @@
put(key, textString);
}
+ /**
+ * Adds an integer to this dictionary.
+ * @param key The key to the entry being added.
+ * @param value The value of the entry being added.
+ */
public void put(final String key, final int value) {
final PdfInteger integer = new PdfInteger(value);
put(key, integer);
}
+ /**
+ * Adds an real number to this dictionary.
+ * @param key The key to the entry being added.
+ * @param value The value of the entry being added.
+ */
public void put(final String key, final BigDecimal value) {
final PdfReal integer = new PdfReal(value);
put(key, integer);
}
+ /**
+ * Adds a date to this dictionary.
+ * @param key The key to the entry being added.
+ * @param value The value of the entry being added.
+ */
public void put(final String key, final Date value) {
final PdfDate date = new PdfDate(value);
put(key, date);
@@ -207,6 +231,11 @@
return this.entries.size();
}
+ /**
+ * Returns an object from this dictionary, with no casting to the specific type.
+ * @param key The key for which the element should be returned.
+ * @return The value of {@code key}, or null if that key is not in this dictionary, or its value is null.
+ */
public PdfObject get(final String key) {
return this.entries.get(key);
}
@@ -221,11 +250,6 @@
return retrieve(key, PdfTextString.class);
}
- public String getString(final String key) {
- final PdfTextString value = getPdfTextString(key);
- return value == null ? null : value.toString();
- }
-
/**
* Returns the {@link PdfHexString} for a given key.
* @param key The key for which the element should be returned.
@@ -246,11 +270,6 @@
return retrieve(key, PdfInteger.class);
}
- public int getInteger(final String key) {
- final PdfInteger value = getPdfInteger(key);
- return value == null ? null : value.getValue();
- }
-
/**
* Returns the {@link PdfReal} for a given key.
* @param key The key for which the element should be returned.
@@ -261,11 +280,6 @@
return retrieve(key, PdfReal.class);
}
- public BigDecimal getBigDecimal(final String key) {
- final PdfReal value = getPdfReal(key);
- return value == null ? null : value.getValue();
- }
-
/**
* Returns the {@link PdfDate} for a given key.
* @param key The key for which the element should be returned.
@@ -276,11 +290,6 @@
return retrieve(key, PdfDate.class);
}
- public Date getDate(final String key) {
- final PdfDate value = getPdfDate(key);
- return value == null ? null : value.getValue();
- }
-
/**
* Returns the {@link PdfDictionary} for a given key.
* @param key The key for which the element should be returned.
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfInteger.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfInteger.java 2022-02-01 16:37:22 UTC (rev 12526)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfInteger.java 2022-02-01 17:43:10 UTC (rev 12527)
@@ -68,4 +68,16 @@
return Long.toString(this.value);
}
+ /**
+ * Null-safe unwrapping of a given integer.
+ * @param pdfInteger The integer to be unwrapped, which can be null.
+ * @return The wrapped int, or null if {@code pdfTextString} is null.
+ */
+ public static Integer unwrap(final PdfInteger pdfInteger) {
+ if (pdfInteger == null) {
+ return null;
+ }
+ return pdfInteger.getValue();
+ }
+
}
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfReal.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfReal.java 2022-02-01 16:37:22 UTC (rev 12526)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/type/PdfReal.java 2022-02-01 17:43:10 UTC (rev 12527)
@@ -67,4 +67,16 @@
return this.value;
}
+ /**
+ * Null-safe unwrapping of a given real number.
+ * @param pdfReal The real number to be unwrapped, which can be null.
+ * @return The wrapped real number, or null if {@code pdfReal} is null.
+ */
+ public static BigDecimal unwrap(final PdfReal pdfReal) {
+ if (pdfReal == null) {
+ return null;
+ }
+ return pdfReal.getValue();
+ }
+
}
Modified: trunk/foray/foray-pdf/src/test/java/org/foray/pdf/serial/PdfParserTests.java
===================================================================
--- trunk/foray/foray-pdf/src/test/java/org/foray/pdf/serial/PdfParserTests.java 2022-02-01 16:37:22 UTC (rev 12526)
+++ trunk/foray/foray-pdf/src/test/java/org/foray/pdf/serial/PdfParserTests.java 2022-02-01 17:43:10 UTC (rev 12527)
@@ -274,7 +274,7 @@
final PdfDictionary trailer = out.parseTrailer();
Assert.assertEquals(3, trailer.size());
- Assert.assertEquals(7, trailer.getInteger("Size"));
+ Assert.assertEquals(7, PdfInteger.unwrap(trailer.getPdfInteger("Size")).intValue());
final PdfObjectReference rootReference = trailer.getPdfObjectReference("Root");
Assert.assertEquals(1, rootReference.getNumber());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|