foray-commit Mailing List for FOray (Page 64)
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(139) |
Apr
(98) |
May
(250) |
Jun
(394) |
Jul
(84) |
Aug
(13) |
Sep
(420) |
Oct
(186) |
Nov
(1) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(108) |
Feb
(202) |
Mar
(291) |
Apr
(247) |
May
(374) |
Jun
(227) |
Jul
(231) |
Aug
(60) |
Sep
(31) |
Oct
(45) |
Nov
(18) |
Dec
|
| 2008 |
Jan
(38) |
Feb
(71) |
Mar
(142) |
Apr
|
May
(59) |
Jun
(6) |
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
(12) |
Feb
(4) |
Mar
(88) |
Apr
(121) |
May
(17) |
Jun
(30) |
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2010 |
Jan
(11) |
Feb
(76) |
Mar
(11) |
Apr
|
May
(11) |
Jun
|
Jul
|
Aug
(44) |
Sep
(14) |
Oct
(7) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(168) |
| 2017 |
Jan
(77) |
Feb
(11) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(88) |
Mar
(118) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(141) |
| 2021 |
Jan
(170) |
Feb
(20) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(62) |
Nov
(189) |
Dec
(162) |
| 2022 |
Jan
(201) |
Feb
(118) |
Mar
(8) |
Apr
|
May
(2) |
Jun
(47) |
Jul
(19) |
Aug
(14) |
Sep
(3) |
Oct
|
Nov
(28) |
Dec
(235) |
| 2023 |
Jan
(112) |
Feb
(23) |
Mar
(2) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
(70) |
Sep
(92) |
Oct
(20) |
Nov
(1) |
Dec
(1) |
| 2024 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
(14) |
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(10) |
Feb
(29) |
Mar
|
Apr
(162) |
May
(245) |
Jun
(83) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(4) |
Dec
|
|
From: <vic...@us...> - 2021-12-30 21:35:44
|
Revision: 12302
http://sourceforge.net/p/foray/code/12302
Author: victormote
Date: 2021-12-30 21:35:41 +0000 (Thu, 30 Dec 2021)
Log Message:
-----------
Rename types for clarity and consistency.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractListItemContent.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/BasicLinkArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/BidiOverrideArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockContainerRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/ExternalGraphicArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/ForeignObjectArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/IndexPageCitationListArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineContainerArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/LeaderArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/ListBlockArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/ListItemArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationLastArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRaBody.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableBodyContainer.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableCellRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableFooterContainer.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableHeaderContainer.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRowContainer.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaCharacters.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/link/GraftingPointLink.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/link/NormalLink.java
Added Paths:
-----------
trunk/foray/foray-areatree/src/main/java/org/foray/area/link/Link.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/link/LinkFactory.java
Removed Paths:
-------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/link/Linkage.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/link/LinkageFactory.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractListItemContent.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractListItemContent.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractListItemContent.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.area.BlockLevelAreaFactory;
@@ -51,7 +51,7 @@
public abstract class AbstractListItemContent extends NonArea implements BlockLevelAreaFactory {
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The parent of this node. */
private ListItemArea parent;
@@ -145,7 +145,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
@@ -153,7 +153,7 @@
* Sets the "generated by" for this Area.
* @param generatedBy The new "generated by" value.
*/
- protected void setGeneratedBy(final Linkage generatedBy) {
+ protected void setGeneratedBy(final Link generatedBy) {
this.generatedBy = generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -29,7 +29,7 @@
package org.foray.area;
import org.foray.area.link.GraftingPointLink;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.foray.area.link.NormalLink;
import org.foray.common.data.AbstractOrderedTreeNode;
@@ -146,12 +146,12 @@
* @param graftingPoint The ancestor RetrieveMarker, if any.
* @return The linkage item.
*/
- public Linkage linkage(final Fo foNode, final GraftingPoint graftingPoint) {
+ public Link linkage(final Fo foNode, final GraftingPoint graftingPoint) {
if (foNode == null) {
return null;
}
final AreaTree4a areaTree = this.getAreaTree();
- Linkage linkage = areaTree.getFONodeLinkage(foNode);
+ Link linkage = areaTree.getFONodeLinkage(foNode);
if (linkage != null) {
return linkage;
}
@@ -202,7 +202,7 @@
*/
public NormalLink getNormalLinkage(
final GraftingPoint graftingPoint) {
- final Linkage linkage = this.getLinkage();
+ final Link linkage = this.getLinkage();
if (linkage instanceof NormalLink) {
return (NormalLink) linkage;
}
@@ -578,7 +578,7 @@
* Returns the raw "generated by" instance.
* @return The raw linkage item.
*/
- public abstract Linkage getLinkage();
+ public abstract Link getLinkage();
/**
* This method should be run after layout is complete, allowing cleanup and
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 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,8 +28,8 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
-import org.foray.area.link.LinkageFactory;
+import org.foray.area.link.Link;
+import org.foray.area.link.LinkFactory;
import org.foray.area.link.NormalLink;
import org.axsl.area.AreaTree;
@@ -93,7 +93,7 @@
/** The list of FoLinkage items for the nodes in the FOTree.
* Each {@link Fo} in the {@link FoTree} has a unique index, which
* indexes into this linkage map. */
- private ArrayList<Linkage> linkageMap = new ArrayList<Linkage>(AreaTree4a.INITIAL_LINKAGE_MAP_SIZE);
+ private ArrayList<Link> linkageMap = new ArrayList<Link>(AreaTree4a.INITIAL_LINKAGE_MAP_SIZE);
/* Checkstyle-IllegalType-On. */
/**
@@ -115,7 +115,7 @@
private List<PageRa> renderQueue = new ArrayList<PageRa>();
/** Factory that knows how to create new linkage instances. */
- private LinkageFactory linkageFactory = new LinkageFactory();
+ private LinkFactory linkageFactory = new LinkFactory();
/**
* Private Constructor.
@@ -271,7 +271,7 @@
*/
public Area4a firstNormalAreaReturned(final String id) {
final Fo fobj = retrieveId(id);
- final Linkage linkage = linkage(fobj, null);
+ final Link linkage = linkage(fobj, null);
if (linkage instanceof NormalLink) {
final NormalLink normalLinkage = (NormalLink) linkage;
return normalLinkage.firstNormalAreaReturned();
@@ -391,7 +391,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return null;
// return this.generatedBy;
}
@@ -407,7 +407,7 @@
* @param node The FONode whose linkage is needed.
* @return The FoLinkage for {@code node}, or null if there is none.
*/
- protected Linkage getFONodeLinkage(final Fo node) {
+ protected Link getFONodeLinkage(final Fo node) {
final int index = node.getSequentialIndex();
if (index < 0) {
throw new IndexOutOfBoundsException("FONode has a negative "
@@ -425,7 +425,7 @@
* @param linkage The linkage for {@code node}.
*/
protected void setFONodeLinkage(final Fo node,
- final Linkage linkage) {
+ final Link linkage) {
final int index = node.getSequentialIndex();
if (index < 0) {
throw new IndexOutOfBoundsException("FONode has a negative "
@@ -482,7 +482,7 @@
* Returns the linkage factory.
* @return The linkage factory.
*/
- public LinkageFactory getLinkageFactory() {
+ public LinkFactory getLinkageFactory() {
return this.linkageFactory;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/BasicLinkArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/BasicLinkArea.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/BasicLinkArea.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.BorderStyle;
@@ -51,7 +51,7 @@
private Area4a parent;
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/**
* Private Constructor for a LineArea parent.
@@ -130,7 +130,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.RelativeAxis;
@@ -47,7 +47,7 @@
public final class BeforeFloatRa extends AreaFixed implements BeforeFloatAreaG5, org.axsl.area.BeforeFloatRefArea {
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The parent of this node. */
private AreaNode4a parent;
@@ -162,7 +162,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/BidiOverrideArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/BidiOverrideArea.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/BidiOverrideArea.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.fotree.fo.BidiOverride;
@@ -50,7 +50,7 @@
private Area4a parent;
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/**
* Private Constructor for a LineArea parent.
@@ -129,7 +129,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockContainerRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockContainerRa.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockContainerRa.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.AbsolutePosition;
@@ -59,7 +59,7 @@
implements BlockContainerAreaG5, org.axsl.area.BlockContainerRefArea {
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The parent of this node. */
private AreaNode4a parent;
@@ -203,7 +203,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/ExternalGraphicArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/ExternalGraphicArea.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/ExternalGraphicArea.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.fotree.fo.ExternalGraphic;
@@ -53,7 +53,7 @@
private Area4a parent;
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/**
* Private Constructor.
@@ -187,7 +187,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.RelativeAxis;
@@ -46,7 +46,7 @@
public final class FootnoteRa extends AreaFixed implements FootnoteAreaG5, org.axsl.area.FootnoteRefArea {
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The parent of this node. */
private AreaNode4a parent;
@@ -172,7 +172,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/ForeignObjectArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/ForeignObjectArea.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/ForeignObjectArea.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.fotree.FoForeignXml;
@@ -56,7 +56,7 @@
private Area4a parent;
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The foreign content encapsulated inside this area. */
private ForeignContentG5 foreignContent;
@@ -201,7 +201,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/IndexPageCitationListArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/IndexPageCitationListArea.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/IndexPageCitationListArea.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.fotree.fo.GraftingPoint;
@@ -50,7 +50,7 @@
private Area4a parent;
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/**
* Private Constructor for a LineArea parent.
@@ -133,7 +133,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineArea.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineArea.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.BackgroundRepeat;
@@ -53,7 +53,7 @@
private Area4a parent;
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/**
* Private Constructor for a LineArea parent.
@@ -137,7 +137,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineContainerArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineContainerArea.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineContainerArea.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.fotree.fo.Block;
@@ -57,7 +57,7 @@
private Area4a parent;
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The children of this node. */
private List<Area4a> children = new ArrayList<Area4a>();
@@ -145,7 +145,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/LeaderArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/LeaderArea.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/LeaderArea.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.LeaderAlignment;
@@ -77,7 +77,7 @@
private Area4a parent;
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/**
* Private Constructor.
@@ -418,7 +418,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/ListBlockArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/ListBlockArea.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/ListBlockArea.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.RelativeAxis;
@@ -48,7 +48,7 @@
public final class ListBlockArea extends ContainerRa implements ListBlockAreaG5, org.axsl.area.ListBlockArea {
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The parent of this node. */
private AreaNode4a parent;
@@ -168,7 +168,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/ListItemArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/ListItemArea.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/ListItemArea.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.RelativeAxis;
@@ -50,7 +50,7 @@
implements org.axsl.area.ListItemArea {
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The parent of this node. */
private ListBlockArea parent;
@@ -206,7 +206,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.RelativeAxis;
@@ -57,7 +57,7 @@
// 2 * 12000 * 1.3);
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The parent of this node. */
private AreaNode4a parent;
@@ -354,7 +354,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
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 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -29,7 +29,7 @@
package org.foray.area;
import org.foray.area.link.BlockLink;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.foray.common.para.DiscretionaryHyphen4a;
import org.axsl.area.AreaTreeException;
@@ -94,7 +94,7 @@
static NormalBlockArea4a makeNormalBlockArea(final Block generatedBy,
final AreaNode4a parentArea, final GraftingPoint graftingPoint) {
final NormalBlockArea4a newBlockArea = new NormalBlockArea4a(parentArea);
- final Linkage linkage = newBlockArea.linkage(generatedBy, graftingPoint);
+ final Link linkage = newBlockArea.linkage(generatedBy, graftingPoint);
newBlockArea.generatedBy = (BlockLink) linkage;
newBlockArea.registerWithLinkage(graftingPoint);
final int initialPD = newBlockArea.computeInitialPD();
@@ -106,7 +106,7 @@
static NormalBlockArea4a makeNormalBlockArea(final BlockDiscrete generatedBy,
final AreaNode4a parentArea, final GraftingPoint graftingPoint) {
final NormalBlockArea4a newBlockArea = new NormalBlockArea4a(parentArea);
- final Linkage linkage = newBlockArea.linkage(generatedBy, graftingPoint);
+ final Link linkage = newBlockArea.linkage(generatedBy, graftingPoint);
newBlockArea.generatedBy = (BlockLink) linkage;
newBlockArea.registerWithLinkage(graftingPoint);
final int initialPD = newBlockArea.computeInitialPD();
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.RelativeAxis;
@@ -54,7 +54,7 @@
implements org.axsl.area.NormalFlowRefArea {
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The parent of this node. */
private SpanRa parent;
@@ -261,7 +261,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.foray.common.WellKnownConstants;
import org.axsl.area.AreaTreeException;
@@ -58,7 +58,7 @@
public final class PageCollection extends NonArea implements PageCollectionG5, org.axsl.area.PageCollection {
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The parent of this node. */
private AreaTree4a parent;
@@ -421,7 +421,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberArea.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberArea.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.font.FontUse;
@@ -52,7 +52,7 @@
private Area4a parent;
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/**
* Private Constructor.
@@ -151,7 +151,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationArea.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationArea.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.font.FontUse;
@@ -52,7 +52,7 @@
private Area4a parent;
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/**
* Private Constructor.
@@ -170,7 +170,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationLastArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationLastArea.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationLastArea.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.font.FontUse;
@@ -52,7 +52,7 @@
private Area4a parent;
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/**
* Private Constructor.
@@ -170,7 +170,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.foray.area.link.NormalLink;
import org.axsl.area.AreaTreeException;
@@ -68,7 +68,7 @@
org.axsl.area.PageArea {
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The parent of this node. */
private PageCollection parent;
@@ -619,7 +619,7 @@
*/
private NormalLink markerParentLinkage(final Marker marker) {
final Fo parent = marker.getParent();
- final Linkage proxy = linkage(parent, null);
+ final Link proxy = linkage(parent, null);
if (proxy instanceof NormalLink) {
return (NormalLink) proxy;
}
@@ -674,7 +674,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRa.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRa.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.BackgroundRepeat;
@@ -59,7 +59,7 @@
public final class RegionRa extends AreaFixed implements RegionAreaG5, org.axsl.area.RegionRefArea {
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The parent of this node. */
private AreaNode4a parent;
@@ -250,7 +250,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRaBody.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRaBody.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRaBody.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.AbsoluteDirection;
@@ -52,7 +52,7 @@
/* TODO: Why doesn't this class extend RegionRa? */
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The parent of this node. */
private AreaNode4a parent;
@@ -341,7 +341,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.foray.common.FontContext4a;
import org.axsl.area.AreaTreeException;
@@ -56,7 +56,7 @@
private Area4a parent;
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/**
* Private Constructor.
@@ -163,7 +163,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.RelativeAxis;
@@ -51,7 +51,7 @@
implements org.axsl.area.SpanRefArea {
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The parent of this node. */
private AreaNode4a parent;
@@ -417,7 +417,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableBodyContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableBodyContainer.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableBodyContainer.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.BackgroundRepeat;
@@ -48,7 +48,7 @@
org.axsl.area.TableBodyContainer {
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/**
* Private Constructor.
@@ -115,7 +115,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableCellRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableCellRa.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableCellRa.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.BackgroundRepeat;
@@ -58,7 +58,7 @@
public final class TableCellRa extends ContainerRa implements TableCellAreaG5, org.axsl.area.TableCellArea {
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The parent of this node. */
private TableRowContainer parent;
@@ -485,7 +485,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableFooterContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableFooterContainer.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableFooterContainer.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.BackgroundRepeat;
@@ -48,7 +48,7 @@
org.axsl.area.TableFooterContainer {
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/**
* Private Constructor.
@@ -115,7 +115,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableHeaderContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableHeaderContainer.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableHeaderContainer.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.BackgroundRepeat;
@@ -48,7 +48,7 @@
org.axsl.area.TableHeaderContainer {
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/**
* Private Constructor.
@@ -115,7 +115,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRa.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRa.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.BackgroundRepeat;
@@ -62,7 +62,7 @@
private static final int MINCOLWIDTH = 10000;
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The parent of this node. */
private AreaNode4a parent;
@@ -547,7 +547,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRowContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRowContainer.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRowContainer.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
import org.axsl.common.value.BackgroundRepeat;
@@ -56,7 +56,7 @@
BackgroundAreaG5 {
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The parent of this node. */
private AbstractTablePartContainer parent;
@@ -217,7 +217,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaCharacters.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaCharacters.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaCharacters.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.area.link.Linkage;
+import org.foray.area.link.Link;
import org.foray.common.CharSequenceSubset;
import org.axsl.fotree.fo.FoTextCharacters;
@@ -40,7 +40,7 @@
public final class TextAreaCharacters extends TextArea {
/** The "generated-by" trait, as defined in Section 6.1.1. */
- private Linkage generatedBy;
+ private Link generatedBy;
/** The resolved textual content of this text area. */
private TextAreaCharSequence charSequence;
@@ -50,7 +50,7 @@
* @param parentArea The parent area.
* @param generatedBy The FO tree linkage.
*/
- private TextAreaCharacters(final LineArea4a parentArea, final Linkage generatedBy) {
+ private TextAreaCharacters(final LineArea4a parentArea, final Link generatedBy) {
super(parentArea);
this.generatedBy = generatedBy;
}
@@ -60,7 +60,7 @@
* @param parentArea The parent area.
* @param generatedBy The FO tree linkage.
*/
- private TextAreaCharacters(final AbstractInlineArea parentArea, final Linkage generatedBy) {
+ private TextAreaCharacters(final AbstractInlineArea parentArea, final Link generatedBy) {
super(parentArea);
this.generatedBy = generatedBy;
}
@@ -90,7 +90,7 @@
final int backingSize, final int progressionDimensionUsed,
final boolean hasDiscretionaryHyphen,
final boolean hasFauxSmallCaps) {
- final Linkage linkage = parentArea.linkage(generatedBy, graftingPoint);
+ final Link linkage = parentArea.linkage(generatedBy, graftingPoint);
final TextAreaCharacters newTextArea = new TextAreaCharacters(parentArea, linkage);
newTextArea.registerWithLinkage(graftingPoint);
newTextArea.init(parentArea, backingOffset, backingSize,
@@ -131,7 +131,7 @@
final int backingSize, final int progressionDimensionUsed,
final boolean hasDiscretionaryHyphen,
final boolean hasFauxSmallCaps) {
- final Linkage linkage = parentArea.linkage(generatedBy, graftingPoint);
+ final Link linkage = parentArea.linkage(generatedBy, graftingPoint);
final TextAreaCharacters newTextArea = new TextAreaCharacters(parentArea, linkage);
newTextArea.registerWithLinkage(graftingPoint);
newTextArea.init(parentArea, backingOffset, backingSize, progressionDimensionUsed, hasDiscretionaryHyphen,
@@ -177,7 +177,7 @@
}
@Override
- public Linkage getLinkage() {
+ public Link getLinkage() {
return this.generatedBy;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/link/GraftingPointLink.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/link/GraftingPointLink.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/link/GraftingPointLink.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -44,7 +44,7 @@
* <p>Handles linkage to the FO Tree for the specialized case of fo:marker descendants, which can be laid out multiple
* times in the AreaTree.</p>
*/
-public class GraftingPointLink implements Linkage {
+public class GraftingPointLink implements Link {
/** The FONode for which this linkage tracks Area generation. */
private Fo generatedBy;
@@ -65,7 +65,7 @@
* <p>Since the conceptual key is the combination of marker and retrieve-marker, we must explain why only the
* {@link RetrieveMarker} is used as the key to this Map.
* Answer: it is unnecessary, because the {@link Marker} instance is implied in this's
- * {@link Linkage#getGeneratedBy()}.</p>
+ * {@link Link#getGeneratedBy()}.</p>
*
* <p>The value of the Map is an {@link NormalLink} just as would be used to store the linkage information for
* non-marker content.
@@ -111,7 +111,7 @@
if (graftingPoint == null) {
return null;
}
- final Linkage object = this.map.get(graftingPoint);
+ final Link object = this.map.get(graftingPoint);
if (object != null) {
return (NormalLink) object;
}
Copied: trunk/foray/foray-areatree/src/main/java/org/foray/area/link/Link.java (from rev 12301, trunk/foray/foray-areatree/src/main/java/org/foray/area/link/Linkage.java)
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/link/Link.java (rev 0)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/link/Link.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2006 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.area.link;
+
+import org.foray.area.AreaNode4a;
+
+import org.axsl.fotree.Fo;
+import org.axsl.fotree.fo.GraftingPoint;
+
+/**
+ * Interface for classes that handle the linkage between the FO Tree and the Area Tree.
+ */
+public interface Link {
+
+ /**
+ * Returns the FONode that generated this linkage.
+ * @return The node that generated this linkage.
+ */
+ Fo getGeneratedBy();
+
+ /**
+ * Retrieves the GraftingPoint, if any, for a given area node.
+ * @param areaNode The area node for which the retrieve marker is needed.
+ * @return The GraftingPoint generating the area, or null.
+ */
+ GraftingPoint getGraftingPoint(AreaNode4a areaNode);
+
+}
Copied: trunk/foray/foray-areatree/src/main/java/org/foray/area/link/LinkFactory.java (from rev 12248, trunk/foray/foray-areatree/src/main/java/org/foray/area/link/LinkageFactory.java)
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/link/LinkFactory.java (rev 0)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/link/LinkFactory.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -0,0 +1,376 @@
+/*
+ * Copyright 2021 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.area.link;
+
+import org.axsl.fotree.Fo;
+import org.axsl.fotree.FoVisitor;
+import org.axsl.fotree.fo.BasicLink;
+import org.axsl.fotree.fo.BidiOverride;
+import org.axsl.fotree.fo.Block;
+import org.axsl.fotree.fo.BlockContainer;
+import org.axsl.fotree.fo.BlockDiscrete;
+import org.axsl.fotree.fo.Bookmark;
+import org.axsl.fotree.fo.BookmarkTitle;
+import org.axsl.fotree.fo.BookmarkTree;
+import org.axsl.fotree.fo.ColorProfile;
+import org.axsl.fotree.fo.Declarations;
+import org.axsl.fotree.fo.ExternalGraphic;
+import org.axsl.fotree.fo.Float;
+import org.axsl.fotree.fo.Flow;
+import org.axsl.fotree.fo.FoTextCharacters;
+import org.axsl.fotree.fo.FoTextWords;
+import org.axsl.fotree.fo.Footnote;
+import org.axsl.fotree.fo.FootnoteBody;
+import org.axsl.fotree.fo.InitialPropertySet;
+import org.axsl.fotree.fo.Inline;
+import org.axsl.fotree.fo.InlineContainer;
+import org.axsl.fotree.fo.InstreamForeignObject;
+import org.axsl.fotree.fo.Leader;
+import org.axsl.fotree.fo.ListBlock;
+import org.axsl.fotree.fo.ListItem;
+import org.axsl.fotree.fo.ListItemBody;
+import org.axsl.fotree.fo.ListItemLabel;
+import org.axsl.fotree.fo.Marker;
+import org.axsl.fotree.fo.MultiCase;
+import org.axsl.fotree.fo.MultiProperties;
+import org.axsl.fotree.fo.MultiPropertySet;
+import org.axsl.fotree.fo.MultiSwitch;
+import org.axsl.fotree.fo.MultiToggle;
+import org.axsl.fotree.fo.PageNumber;
+import org.axsl.fotree.fo.PageNumberCitation;
+import org.axsl.fotree.fo.PageSequence;
+import org.axsl.fotree.fo.RegionAfter;
+import org.axsl.fotree.fo.RegionBefore;
+import org.axsl.fotree.fo.RegionBody;
+import org.axsl.fotree.fo.RegionEnd;
+import org.axsl.fotree.fo.RegionStart;
+import org.axsl.fotree.fo.RetrieveMarker;
+import org.axsl.fotree.fo.Root;
+import org.axsl.fotree.fo.SimplePageMaster;
+import org.axsl.fotree.fo.StaticContent;
+import org.axsl.fotree.fo.Table;
+import org.axsl.fotree.fo.TableAndCaption;
+import org.axsl.fotree.fo.TableBody;
+import org.axsl.fotree.fo.TableCaption;
+import org.axsl.fotree.fo.TableCell;
+import org.axsl.fotree.fo.TableColumn;
+import org.axsl.fotree.fo.TableFooter;
+import org.axsl.fotree.fo.TableHeader;
+import org.axsl.fotree.fo.TableRow;
+import org.axsl.fotree.fo.Title;
+import org.axsl.fotree.fo.Wrapper;
+import org.axsl.fotree.foreign.SvgElement;
+
+public class LinkFactory implements FoVisitor<Link> {
+
+ @Override
+ public GenericLink visit(final Fo host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final BasicLink host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final BidiOverride host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public BlockLink visit(final Block host) {
+ return new BlockLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final BlockContainer host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final BlockDiscrete host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final Bookmark host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final BookmarkTitle host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final BookmarkTree host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final ColorProfile host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final Declarations host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final ExternalGraphic host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final Float host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final Flow host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final Footnote host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final FootnoteBody host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final FoTextCharacters host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public FoTextWordsLink visit(final FoTextWords host) {
+ return new FoTextWordsLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final InitialPropertySet host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final Inline host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final InlineContainer host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final InstreamForeignObject host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final Leader host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final ListBlock host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final ListItem host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final ListItemBody host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final ListItemLabel host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final Marker host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final MultiCase host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final MultiProperties host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final MultiPropertySet host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final MultiSwitch host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final MultiToggle host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final PageNumber host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final PageNumberCitation host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final PageSequence host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final RegionAfter host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final RegionBefore host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final RegionBody host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final RegionEnd host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final RegionStart host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final RetrieveMarker host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final Root host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final SimplePageMaster host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final StaticContent host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final SvgElement host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final Table host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final TableAndCaption host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final TableBody host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final TableCaption host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final TableCell host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final TableColumn host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final TableFooter host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final TableHeader host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final TableRow host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final Title host) {
+ return new GenericLink(host);
+ }
+
+ @Override
+ public GenericLink visit(final Wrapper host) {
+ return new GenericLink(host);
+ }
+
+}
Deleted: trunk/foray/foray-areatree/src/main/java/org/foray/area/link/Linkage.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/link/Linkage.java 2021-12-30 21:30:53 UTC (rev 12301)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/link/Linkage.java 2021-12-30 21:35:41 UTC (rev 12302)
@@ -1,54 +0,0 @@
-/*
- * Copyright 2006 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,...
[truncated message content] |
|
From: <vic...@us...> - 2021-12-30 21:30:55
|
Revision: 12301
http://sourceforge.net/p/foray/code/12301
Author: victormote
Date: 2021-12-30 21:30:53 +0000 (Thu, 30 Dec 2021)
Log Message:
-----------
Rename class for clarity.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/link/BlockLink.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/link/FoTextWordsLink.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/link/GenericLink.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/link/GraftingPointLink.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/link/Linkage.java
Added Paths:
-----------
trunk/foray/foray-areatree/src/main/java/org/foray/area/link/NormalLink.java
Removed Paths:
-------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/link/FoLink.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2021-12-30 17:55:40 UTC (rev 12300)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2021-12-30 21:30:53 UTC (rev 12301)
@@ -28,9 +28,9 @@
package org.foray.area;
-import org.foray.area.link.FoLink;
import org.foray.area.link.GraftingPointLink;
import org.foray.area.link.Linkage;
+import org.foray.area.link.NormalLink;
import org.foray.common.data.AbstractOrderedTreeNode;
import org.axsl.area.AreaNode;
@@ -72,7 +72,7 @@
* @param graftingPoint The ancestor grafting point, if any.
*/
protected void registerWithLinkage(final GraftingPoint graftingPoint) {
- final FoLink normalLinkage = this.getNormalLinkage(
+ final NormalLink normalLinkage = this.getNormalLinkage(
graftingPoint);
normalLinkage.registerGeneratedArea(this);
}
@@ -179,9 +179,9 @@
* Returns the normal linkage associated with this Area.
* @return The normal linkage associated with this Area.
*/
- public FoLink getNormalLinkage() {
- if (this.getLinkage() instanceof FoLink) {
- return (FoLink) this.getLinkage();
+ public NormalLink getNormalLinkage() {
+ if (this.getLinkage() instanceof NormalLink) {
+ return (NormalLink) this.getLinkage();
}
if (this.getLinkage() instanceof GraftingPointLink) {
final GraftingPointLink linkageMarker = (GraftingPointLink)
@@ -200,11 +200,11 @@
* @param graftingPoint The retrieve-marker.
* @return The normal linkage associated with this Area.
*/
- public FoLink getNormalLinkage(
+ public NormalLink getNormalLinkage(
final GraftingPoint graftingPoint) {
final Linkage linkage = this.getLinkage();
- if (linkage instanceof FoLink) {
- return (FoLink) linkage;
+ if (linkage instanceof NormalLink) {
+ return (NormalLink) linkage;
}
if (linkage instanceof GraftingPointLink) {
final GraftingPointLink linkageMarker = (GraftingPointLink) linkage;
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 2021-12-30 17:55:40 UTC (rev 12300)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java 2021-12-30 21:30:53 UTC (rev 12301)
@@ -28,9 +28,9 @@
package org.foray.area;
-import org.foray.area.link.FoLink;
import org.foray.area.link.Linkage;
import org.foray.area.link.LinkageFactory;
+import org.foray.area.link.NormalLink;
import org.axsl.area.AreaTree;
import org.axsl.area.AreaTreeEvent;
@@ -272,8 +272,8 @@
public Area4a firstNormalAreaReturned(final String id) {
final Fo fobj = retrieveId(id);
final Linkage linkage = linkage(fobj, null);
- if (linkage instanceof FoLink) {
- final FoLink normalLinkage = (FoLink) linkage;
+ if (linkage instanceof NormalLink) {
+ final NormalLink normalLinkage = (NormalLink) linkage;
return normalLinkage.firstNormalAreaReturned();
}
/* Hopefully we can't reference ids in static content, right? */
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa.java 2021-12-30 17:55:40 UTC (rev 12300)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa.java 2021-12-30 21:30:53 UTC (rev 12301)
@@ -28,8 +28,8 @@
package org.foray.area;
-import org.foray.area.link.FoLink;
import org.foray.area.link.Linkage;
+import org.foray.area.link.NormalLink;
import org.axsl.area.AreaTreeException;
import org.axsl.area.PageCollection.Force;
@@ -578,7 +578,7 @@
* @return True if the first area returned by marker is on this page.
*/
private boolean startsHere(final Marker marker) {
- final FoLink normalLinkage = this.markerParentLinkage(marker);
+ final NormalLink normalLinkage = this.markerParentLinkage(marker);
if (normalLinkage == null) {
return false;
}
@@ -598,7 +598,7 @@
* @return True if the last area returned by marker is on this page.
*/
private boolean endsHere(final Marker marker) {
- final FoLink normalLinkage = this.markerParentLinkage(marker);
+ final NormalLink normalLinkage = this.markerParentLinkage(marker);
if (normalLinkage == null) {
return false;
}
@@ -617,11 +617,11 @@
* @param marker The marker for which the linkage is needed.
* @return The linkage.
*/
- private FoLink markerParentLinkage(final Marker marker) {
+ private NormalLink markerParentLinkage(final Marker marker) {
final Fo parent = marker.getParent();
final Linkage proxy = linkage(parent, null);
- if (proxy instanceof FoLink) {
- return (FoLink) proxy;
+ if (proxy instanceof NormalLink) {
+ return (NormalLink) proxy;
}
/* This would mean nested markers. Should never happen. */
return null;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/link/BlockLink.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/link/BlockLink.java 2021-12-30 17:55:40 UTC (rev 12300)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/link/BlockLink.java 2021-12-30 21:30:53 UTC (rev 12301)
@@ -33,7 +33,7 @@
/**
* Linkage for {@link Block} formatting objects.
*/
-public class BlockLink extends FoLink {
+public class BlockLink extends NormalLink {
/** The FONode for which this linkage tracks Area generation. */
private Block generatedBy;
Deleted: trunk/foray/foray-areatree/src/main/java/org/foray/area/link/FoLink.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/link/FoLink.java 2021-12-30 17:55:40 UTC (rev 12300)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/link/FoLink.java 2021-12-30 21:30:53 UTC (rev 12301)
@@ -1,249 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.area.link;
-
-import org.foray.area.Area4a;
-import org.foray.area.AreaNode4a;
-
-import org.axsl.fotree.fo.RetrieveMarker;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * <p>A "normal" linkage manager, that is, one that simply matches an FONode to the Areas that it has created.</p>
- */
-public abstract class FoLink implements Linkage {
-
- /**
- * The ordered list of Area instances generated by {@link Linkage#getGeneratedBy()}.
- * Index 0 "is-first" and Index size() - 1 "is-last".
- * This is currently set up to only store the root node of any subtree that was generated by
- * {@link Linkage#getGeneratedBy()}.
- */
- private List<AreaNode4a> generatedAreas = new ArrayList<AreaNode4a>();
-
- /**
- * Register a given area node as being generated by this linkage.
- * @param areaNode The area node to register.
- */
- public void registerGeneratedArea(final AreaNode4a areaNode) {
- final AreaNode4a parent = areaNode.getParent();
- if (parent != null) {
- /*
- * If the parent was generated by the same FObj, then we shouldn't
- * register this one also.
- */
- if (areaNode.traitGeneratedBy() == parent.traitGeneratedBy()) {
- return;
- }
- }
- if (this.generatedAreas == null) {
- this.generatedAreas = new ArrayList<AreaNode4a>();
- }
- this.generatedAreas.add(areaNode);
- }
-
- /**
- * Unregisters a given area node.
- * @param areaNode The area node to unregister.
- */
- public void unregisterGeneratedArea(final AreaNode4a areaNode) {
- this.generatedAreas.remove(areaNode);
- }
-
- /**
- * Returns the first area generated by this linkage, that is, by the FO node in this linkage.
- * @return The first area generated.
- */
- public AreaNode4a getFirstGeneratedBy() {
- if (this.generatedAreas == null
- || this.generatedAreas.size() < 1) {
- return null;
- }
- return this.generatedAreas.get(0);
- }
-
- /**
- * For a given area, returns the previous area generated by this linkage.
- * @param area The area whose previous area is needed.
- * @return The previous area, or null, if {@code area} is the first area generated by this linkage.
- */
- public AreaNode4a getPreviousGeneratedBy(final AreaNode4a area) {
- if (this.generatedAreas == null) {
- return null;
- }
- final int index = this.generatedAreas.indexOf(area);
- if (index > 0) {
- return this.generatedAreas.get(index - 1);
- }
- return null;
- }
-
- /**
- * For a given area, returns the next area generated by this linkage.
- * @param area The area whose next area is needed.
- * @return The next area, or null, if {@code area} is the last area generated by this linkage.
- */
- public AreaNode4a getNextGeneratedBy(final AreaNode4a area) {
- if (this.generatedAreas == null) {
- return null;
- }
- final int index = this.generatedAreas.indexOf(area);
- if (index > 0 && index < this.generatedAreas.size() - 1) {
- return this.generatedAreas.get(index + 1);
- }
- return null;
- }
-
- /**
- * Indicates whether a given area is the first one generated by this linkage.
- * @param area An Area instance.
- * @return True if and only if area is the first Area generated by this.
- */
- public boolean isFirstGeneratedBy(final AreaNode4a area) {
- if (this.generatedAreas.indexOf(area) == 0) {
- return true;
- }
- return false;
- }
-
- /**
- * Indicates whether a given area is the last one generated by this linkage.
- * @param area An Area instance.
- * @return True if and only if area is the first Area generated by this.
- */
- public boolean isLastGeneratedBy(final AreaNode4a area) {
- if (this.generatedAreas.indexOf(area) == (this.generatedAreas.size() - 1)) {
- return true;
- }
- return false;
- }
-
- /**
- * Returns the number of areas generated by the FO.
- * @return The current count of areas that have been generated by the FObj.
- */
- public int qtyAreasGenerated() {
- return this.generatedAreas.size();
- }
-
- /**
- * Returns the last area node generated by the FO.
- * @return The last AreaNode generated by the parent FObj.
- */
- public AreaNode4a getLastGeneratedBy() {
- if (this.generatedAreas == null
- || this.generatedAreas.size() < 1) {
- return null;
- }
- return this.generatedAreas.get(this.generatedAreas.size() - 1);
- }
-
- /**
- * Returns the last Area generated by the FO.
- * @return The last Area generated by the parent FObj.
- */
- public Area4a getLastAreaGeneratedBy() {
- if (this.generatedAreas == null
- || this.generatedAreas.size() < 1) {
- return null;
- }
- for (int i = this.generatedAreas.size() - 1; i >= 0; i--) {
- final Object object = this.generatedAreas.get(i);
- if (object instanceof Area4a) {
- return (Area4a) object;
- }
- }
- return null;
- }
-
- /**
- * Returns the first normal area returned by this linkage.
- * @return The first normal area returned by this linkage.
- */
- public Area4a firstNormalAreaReturned() {
- /*
- * TODO: This is not right, but will do for now. It is not considering
- * areas that are returned by the FO but not generated by it.
- */
- if (this.generatedAreas == null) {
- return null;
- }
- for (int i = 0; i < this.generatedAreas.size(); i ++) {
- final Object object = this.generatedAreas.get(i);
- if (object instanceof Area4a) {
- return (Area4a) object;
- }
- }
- return null;
- }
-
- /**
- * Returns the last normal area returned by this linkage.
- * @return The last normal area returned by this linkage.
- */
- public Area4a lastNormalAreaReturned() {
- /*
- * TODO: This is not right, but will do for now. It is not considering
- * areas that are returned by the FO but not generated by it.
- */
- if (this.generatedAreas == null) {
- return null;
- }
- for (int i = this.generatedAreas.size() - 1; i >= 0; i --) {
- final Object object = this.generatedAreas.get(i);
- if (object instanceof Area4a) {
- return (Area4a) object;
- }
- }
- return null;
- }
-
- @Override
- public RetrieveMarker getGraftingPoint(final AreaNode4a areaNode) {
- return null;
- }
-
- /**
- * Indicates whether a given area was generated by this linkage.
- * @param areaNode The node to be tested.
- * @return True if and only if this linkage generated {@code areaNode}.
- */
- public boolean contains(final AreaNode4a areaNode) {
- for (int i = 0; i < this.generatedAreas.size(); i++) {
- final Object object = this.generatedAreas.get(i);
- if (object == areaNode) {
- return true;
- }
- }
- return false;
- }
-
-}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/link/FoTextWordsLink.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/link/FoTextWordsLink.java 2021-12-30 17:55:40 UTC (rev 12300)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/link/FoTextWordsLink.java 2021-12-30 21:30:53 UTC (rev 12301)
@@ -33,7 +33,7 @@
/**
* Linkage for {@link FoTextWords} formatting objects.
*/
-public class FoTextWordsLink extends FoLink {
+public class FoTextWordsLink extends NormalLink {
/** The FONode for which this linkage tracks Area generation. */
private FoTextWords generatedBy;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/link/GenericLink.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/link/GenericLink.java 2021-12-30 17:55:40 UTC (rev 12300)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/link/GenericLink.java 2021-12-30 21:30:53 UTC (rev 12301)
@@ -33,7 +33,7 @@
/**
* Linkage for formatting objects that do not need special handling.
*/
-public class GenericLink extends FoLink {
+public class GenericLink extends NormalLink {
/** The FONode for which this linkage tracks Area generation. */
private Fo generatedBy;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/link/GraftingPointLink.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/link/GraftingPointLink.java 2021-12-30 17:55:40 UTC (rev 12300)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/link/GraftingPointLink.java 2021-12-30 21:30:53 UTC (rev 12301)
@@ -50,7 +50,7 @@
private Fo generatedBy;
/**
- * <p>Map whose key is a {@link GraftingPoint} instance, and whose value is an {@link FoLink} instance.</p>
+ * <p>Map whose key is a {@link GraftingPoint} instance, and whose value is an {@link NormalLink} instance.</p>
*
* <p>An fo:marker can be grafted to multiple fo:retrieve-marker instances, and can therefore be laid out in the
* Area Tree multiple times.
@@ -67,11 +67,11 @@
* Answer: it is unnecessary, because the {@link Marker} instance is implied in this's
* {@link Linkage#getGeneratedBy()}.</p>
*
- * <p>The value of the Map is an {@link FoLink} just as would be used to store the linkage information for
+ * <p>The value of the Map is an {@link NormalLink} just as would be used to store the linkage information for
* non-marker content.
* So the net effect is that we have forced a {@link RetrieveMarker} into the key that tracks this content.</p>
*/
- private Map<GraftingPoint, FoLink> map = new HashMap<GraftingPoint, FoLink>();
+ private Map<GraftingPoint, NormalLink> map = new HashMap<GraftingPoint, NormalLink>();
/* TODO: Since the typical case presumably has the marker being used with
* only one retrieve-marker, a HashMap is probably overkill. We should
* probably use parallel arrays of size 1 for this information, and just
@@ -107,15 +107,15 @@
* @param graftingPoint The RetrieveMarker for which the linkage is needed.
* @return The normal linkage.
*/
- public FoLink getNormalLinkage(final GraftingPoint graftingPoint) {
+ public NormalLink getNormalLinkage(final GraftingPoint graftingPoint) {
if (graftingPoint == null) {
return null;
}
final Linkage object = this.map.get(graftingPoint);
if (object != null) {
- return (FoLink) object;
+ return (NormalLink) object;
}
- final FoLink newLinkage = new GenericLink(this.getGeneratedBy());
+ final NormalLink newLinkage = new GenericLink(this.getGeneratedBy());
this.map.put(graftingPoint, newLinkage);
return newLinkage;
}
@@ -122,9 +122,9 @@
@Override
public GraftingPoint getGraftingPoint(final AreaNode4a areaNode) {
- for (Map.Entry<GraftingPoint, FoLink> entry
+ for (Map.Entry<GraftingPoint, NormalLink> entry
: this.map.entrySet()) {
- final FoLink normalLinkage = entry.getValue();
+ final NormalLink normalLinkage = entry.getValue();
if (normalLinkage.contains(areaNode)) {
return entry.getKey();
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/link/Linkage.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/link/Linkage.java 2021-12-30 17:55:40 UTC (rev 12300)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/link/Linkage.java 2021-12-30 21:30:53 UTC (rev 12301)
@@ -34,7 +34,7 @@
import org.axsl.fotree.fo.GraftingPoint;
/**
- * Abstract superclass for classes that handle the linkage between the FO Tree and the Area Tree.
+ * Interface for classes that handle the linkage between the FO Tree and the Area Tree.
*/
public interface Linkage {
Copied: trunk/foray/foray-areatree/src/main/java/org/foray/area/link/NormalLink.java (from rev 12300, trunk/foray/foray-areatree/src/main/java/org/foray/area/link/FoLink.java)
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/link/NormalLink.java (rev 0)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/link/NormalLink.java 2021-12-30 21:30:53 UTC (rev 12301)
@@ -0,0 +1,249 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.area.link;
+
+import org.foray.area.Area4a;
+import org.foray.area.AreaNode4a;
+
+import org.axsl.fotree.fo.RetrieveMarker;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <p>A "normal" linkage manager, that is, one that simply matches an FONode to the Areas that it has created.</p>
+ */
+public abstract class NormalLink implements Linkage {
+
+ /**
+ * The ordered list of Area instances generated by {@link Linkage#getGeneratedBy()}.
+ * Index 0 "is-first" and Index size() - 1 "is-last".
+ * This is currently set up to only store the root node of any subtree that was generated by
+ * {@link Linkage#getGeneratedBy()}.
+ */
+ private List<AreaNode4a> generatedAreas = new ArrayList<AreaNode4a>();
+
+ /**
+ * Register a given area node as being generated by this linkage.
+ * @param areaNode The area node to register.
+ */
+ public void registerGeneratedArea(final AreaNode4a areaNode) {
+ final AreaNode4a parent = areaNode.getParent();
+ if (parent != null) {
+ /*
+ * If the parent was generated by the same FObj, then we shouldn't
+ * register this one also.
+ */
+ if (areaNode.traitGeneratedBy() == parent.traitGeneratedBy()) {
+ return;
+ }
+ }
+ if (this.generatedAreas == null) {
+ this.generatedAreas = new ArrayList<AreaNode4a>();
+ }
+ this.generatedAreas.add(areaNode);
+ }
+
+ /**
+ * Unregisters a given area node.
+ * @param areaNode The area node to unregister.
+ */
+ public void unregisterGeneratedArea(final AreaNode4a areaNode) {
+ this.generatedAreas.remove(areaNode);
+ }
+
+ /**
+ * Returns the first area generated by this linkage, that is, by the FO node in this linkage.
+ * @return The first area generated.
+ */
+ public AreaNode4a getFirstGeneratedBy() {
+ if (this.generatedAreas == null
+ || this.generatedAreas.size() < 1) {
+ return null;
+ }
+ return this.generatedAreas.get(0);
+ }
+
+ /**
+ * For a given area, returns the previous area generated by this linkage.
+ * @param area The area whose previous area is needed.
+ * @return The previous area, or null, if {@code area} is the first area generated by this linkage.
+ */
+ public AreaNode4a getPreviousGeneratedBy(final AreaNode4a area) {
+ if (this.generatedAreas == null) {
+ return null;
+ }
+ final int index = this.generatedAreas.indexOf(area);
+ if (index > 0) {
+ return this.generatedAreas.get(index - 1);
+ }
+ return null;
+ }
+
+ /**
+ * For a given area, returns the next area generated by this linkage.
+ * @param area The area whose next area is needed.
+ * @return The next area, or null, if {@code area} is the last area generated by this linkage.
+ */
+ public AreaNode4a getNextGeneratedBy(final AreaNode4a area) {
+ if (this.generatedAreas == null) {
+ return null;
+ }
+ final int index = this.generatedAreas.indexOf(area);
+ if (index > 0 && index < this.generatedAreas.size() - 1) {
+ return this.generatedAreas.get(index + 1);
+ }
+ return null;
+ }
+
+ /**
+ * Indicates whether a given area is the first one generated by this linkage.
+ * @param area An Area instance.
+ * @return True if and only if area is the first Area generated by this.
+ */
+ public boolean isFirstGeneratedBy(final AreaNode4a area) {
+ if (this.generatedAreas.indexOf(area) == 0) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Indicates whether a given area is the last one generated by this linkage.
+ * @param area An Area instance.
+ * @return True if and only if area is the first Area generated by this.
+ */
+ public boolean isLastGeneratedBy(final AreaNode4a area) {
+ if (this.generatedAreas.indexOf(area) == (this.generatedAreas.size() - 1)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns the number of areas generated by the FO.
+ * @return The current count of areas that have been generated by the FObj.
+ */
+ public int qtyAreasGenerated() {
+ return this.generatedAreas.size();
+ }
+
+ /**
+ * Returns the last area node generated by the FO.
+ * @return The last AreaNode generated by the parent FObj.
+ */
+ public AreaNode4a getLastGeneratedBy() {
+ if (this.generatedAreas == null
+ || this.generatedAreas.size() < 1) {
+ return null;
+ }
+ return this.generatedAreas.get(this.generatedAreas.size() - 1);
+ }
+
+ /**
+ * Returns the last Area generated by the FO.
+ * @return The last Area generated by the parent FObj.
+ */
+ public Area4a getLastAreaGeneratedBy() {
+ if (this.generatedAreas == null
+ || this.generatedAreas.size() < 1) {
+ return null;
+ }
+ for (int i = this.generatedAreas.size() - 1; i >= 0; i--) {
+ final Object object = this.generatedAreas.get(i);
+ if (object instanceof Area4a) {
+ return (Area4a) object;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the first normal area returned by this linkage.
+ * @return The first normal area returned by this linkage.
+ */
+ public Area4a firstNormalAreaReturned() {
+ /*
+ * TODO: This is not right, but will do for now. It is not considering
+ * areas that are returned by the FO but not generated by it.
+ */
+ if (this.generatedAreas == null) {
+ return null;
+ }
+ for (int i = 0; i < this.generatedAreas.size(); i ++) {
+ final Object object = this.generatedAreas.get(i);
+ if (object instanceof Area4a) {
+ return (Area4a) object;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the last normal area returned by this linkage.
+ * @return The last normal area returned by this linkage.
+ */
+ public Area4a lastNormalAreaReturned() {
+ /*
+ * TODO: This is not right, but will do for now. It is not considering
+ * areas that are returned by the FO but not generated by it.
+ */
+ if (this.generatedAreas == null) {
+ return null;
+ }
+ for (int i = this.generatedAreas.size() - 1; i >= 0; i --) {
+ final Object object = this.generatedAreas.get(i);
+ if (object instanceof Area4a) {
+ return (Area4a) object;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public RetrieveMarker getGraftingPoint(final AreaNode4a areaNode) {
+ return null;
+ }
+
+ /**
+ * Indicates whether a given area was generated by this linkage.
+ * @param areaNode The node to be tested.
+ * @return True if and only if this linkage generated {@code areaNode}.
+ */
+ public boolean contains(final AreaNode4a areaNode) {
+ for (int i = 0; i < this.generatedAreas.size(); i++) {
+ final Object object = this.generatedAreas.get(i);
+ if (object == areaNode) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-30 17:55:42
|
Revision: 12300
http://sourceforge.net/p/foray/code/12300
Author: victormote
Date: 2021-12-30 17:55:40 +0000 (Thu, 30 Dec 2021)
Log Message:
-----------
Convert Linkage to interface. Clean up method name in it.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/link/FoLink.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/link/GraftingPointLink.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/link/Linkage.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2021-12-30 13:28:02 UTC (rev 12299)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2021-12-30 17:55:40 UTC (rev 12300)
@@ -571,7 +571,7 @@
@Override
public GraftingPoint getGraftingPoint() {
- return this.getLinkage().getRetrieveMarker(this);
+ return this.getLinkage().getGraftingPoint(this);
}
/**
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/link/FoLink.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/link/FoLink.java 2021-12-30 13:28:02 UTC (rev 12299)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/link/FoLink.java 2021-12-30 17:55:40 UTC (rev 12300)
@@ -39,7 +39,7 @@
/**
* <p>A "normal" linkage manager, that is, one that simply matches an FONode to the Areas that it has created.</p>
*/
-public abstract class FoLink extends Linkage {
+public abstract class FoLink implements Linkage {
/**
* The ordered list of Area instances generated by {@link Linkage#getGeneratedBy()}.
@@ -227,7 +227,7 @@
}
@Override
- public RetrieveMarker getRetrieveMarker(final AreaNode4a areaNode) {
+ public RetrieveMarker getGraftingPoint(final AreaNode4a areaNode) {
return null;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/link/GraftingPointLink.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/link/GraftingPointLink.java 2021-12-30 13:28:02 UTC (rev 12299)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/link/GraftingPointLink.java 2021-12-30 17:55:40 UTC (rev 12300)
@@ -44,7 +44,7 @@
* <p>Handles linkage to the FO Tree for the specialized case of fo:marker descendants, which can be laid out multiple
* times in the AreaTree.</p>
*/
-public class GraftingPointLink extends Linkage {
+public class GraftingPointLink implements Linkage {
/** The FONode for which this linkage tracks Area generation. */
private Fo generatedBy;
@@ -121,7 +121,7 @@
}
@Override
- public GraftingPoint getRetrieveMarker(final AreaNode4a areaNode) {
+ public GraftingPoint getGraftingPoint(final AreaNode4a areaNode) {
for (Map.Entry<GraftingPoint, FoLink> entry
: this.map.entrySet()) {
final FoLink normalLinkage = entry.getValue();
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/link/Linkage.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/link/Linkage.java 2021-12-30 13:28:02 UTC (rev 12299)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/link/Linkage.java 2021-12-30 17:55:40 UTC (rev 12300)
@@ -36,13 +36,13 @@
/**
* Abstract superclass for classes that handle the linkage between the FO Tree and the Area Tree.
*/
-public abstract class Linkage {
+public interface Linkage {
/**
* Returns the FONode that generated this linkage.
* @return The node that generated this linkage.
*/
- public abstract Fo getGeneratedBy();
+ Fo getGeneratedBy();
/**
* Retrieves the GraftingPoint, if any, for a given area node.
@@ -49,6 +49,6 @@
* @param areaNode The area node for which the retrieve marker is needed.
* @return The GraftingPoint generating the area, or null.
*/
- public abstract GraftingPoint getRetrieveMarker(AreaNode4a areaNode);
+ GraftingPoint getGraftingPoint(AreaNode4a areaNode);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-30 13:28:05
|
Revision: 12299
http://sourceforge.net/p/foray/code/12299
Author: victormote
Date: 2021-12-30 13:28:02 +0000 (Thu, 30 Dec 2021)
Log Message:
-----------
Remove duplicate method causing confusion.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.java
trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aTests.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaBranch4aTestFixture.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaContentIteratorTests.java
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 2021-12-29 23:20:48 UTC (rev 12298)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java 2021-12-30 13:28:02 UTC (rev 12299)
@@ -1147,9 +1147,6 @@
@Override
public void addParaBranch(final ParaBranch branch, final int offset, final int length) {
- if (branch == null) {
- return;
- }
if (branch instanceof FoTextWords) {
final FoTextWords foTextWords = (FoTextWords) branch;
makeGlyphAreaSequence(foTextWords, offset, length, false, null);
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.java 2021-12-29 23:20:48 UTC (rev 12298)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.java 2021-12-30 13:28:02 UTC (rev 12299)
@@ -158,17 +158,6 @@
}
/**
- * Adds a child node to this branch.
- * @param newNode The node to be added.
- */
- public void add(final ParaNode newNode) {
- if (newNode == null) {
- throw new IllegalArgumentException(this.getClass().getName() + " content cannot be null.");
- }
- this.nodes.add(newNode);
- }
-
- /**
* Replaces a node in a branch with a different node. This is useful mostly for testing.
* @param index The index at which the new node should be placed.
* @param newNode The node to replace the node at {@code index}.
@@ -197,6 +186,9 @@
@Override
public void addNode(final ParaNode node) {
+ if (node == null) {
+ throw new IllegalArgumentException(this.getClass().getName() + " content cannot be null.");
+ }
this.nodes.add(node);
}
Modified: trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aTests.java
===================================================================
--- trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aTests.java 2021-12-29 23:20:48 UTC (rev 12298)
+++ trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aTests.java 2021-12-30 13:28:02 UTC (rev 12299)
@@ -49,61 +49,61 @@
final ParaBranch4a out = new ParaBranch4a();
final ParaBranch4a nodeGreatness = new ParaBranch4a();
- nodeGreatness.add(new ParaBoxChars("great"));
- nodeGreatness.add(DiscretionaryHyphen4a.GOOD);
- nodeGreatness.add(new ParaBoxChars("ness"));
+ nodeGreatness.addNode(new ParaBoxChars("great"));
+ nodeGreatness.addNode(DiscretionaryHyphen4a.GOOD);
+ nodeGreatness.addNode(new ParaBoxChars("ness"));
/* Putting "Be" in a branch is unnecessary, but we with to test a branch as the first node. */
final ParaBranch4a nodeBe = new ParaBranch4a();
- nodeBe.add(new ParaBoxChars("B"));
- nodeBe.add(new ParaBoxChars("e"));
- out.add(nodeBe); // Node 0, Leaf 0 - 1
- out.add(ParaGlueChars.SPACE); // Node 1, Leaf 2
- out.add(new ParaBoxChars("not")); // Node 2, Leaf 3
- out.add(ParaGlueChars.SPACE); // Node 3, Leaf 4
- out.add(new ParaBoxChars("afraid")); // Node 4, Leaf 5
- out.add(ParaGlueChars.SPACE); // Node 5, Leaf 6
- out.add(new ParaBoxChars("of")); // Node 6, Leaf 7
- out.add(ParaGlueChars.SPACE); // Node 7, Leaf 8
- out.add(nodeGreatness); // Node 8, Leaf 9 - 11
- out.add(new ParaBoxChars(".")); // Node 9, Leaf 12
- out.add(ParaGlueChars.SPACE); // Node 10, Leaf 13
- out.add(new ParaBoxChars("Some")); // Node 11, Leaf 14
- out.add(ParaGlueChars.SPACE); // Node 12, Leaf 15
- out.add(new ParaBoxChars("are")); // Node 13, Leaf 16
- out.add(ParaGlueChars.SPACE); // Node 14, Leaf 17
- out.add(new ParaBoxChars("born")); // Node 15, Leaf 18
- out.add(ParaGlueChars.SPACE); // Node 16, Leaf 19
- out.add(new ParaBoxChars("great,")); // Node 17, Leaf 20
- out.add(ParaGlueChars.SPACE); // Node 18, Leaf 21
- out.add(new ParaBoxChars("some")); // Node 19, Leaf 22
- out.add(ParaGlueChars.SPACE); // Node 20, Leaf 23
- out.add(new ParaBoxChars("achieve")); // Node 21, Leaf 24
- out.add(ParaGlueChars.SPACE); // Node 22, Leaf 25
- out.add(nodeGreatness); // Node 23, Leaf 26 - 28
- out.add(new ParaBoxChars(",")); // Node 24, Leaf 29
- out.add(ParaGlueChars.SPACE); // Node 25, Leaf 30
- out.add(new ParaBoxChars("and")); // Node 26, Leaf 31
- out.add(ParaGlueChars.SPACE); // Node 27, Leaf 32
- out.add(new ParaBoxChars("some")); // Node 28, Leaf 33
- out.add(ParaGlueChars.SPACE); // Node 29, Leaf 34
- out.add(new ParaBoxChars("have")); // Node 30, Leaf 35
- out.add(ParaGlueChars.SPACE); // Node 31, Leaf 36
- out.add(nodeGreatness); // Node 32, Leaf 37 - 39
- out.add(ParaGlueChars.SPACE); // Node 33, Leaf 40
- out.add(new ParaBoxChars("thrust")); // Node 34, Leaf 41
- out.add(ParaGlueChars.SPACE); // Node 35, Leaf 42
- out.add(new ParaBoxChars("upon")); // Node 36, Leaf 43
- out.add(ParaGlueChars.SPACE); // Node 37, Leaf 44
+ nodeBe.addNode(new ParaBoxChars("B"));
+ nodeBe.addNode(new ParaBoxChars("e"));
+ out.addNode(nodeBe); // Node 0, Leaf 0 - 1
+ out.addNode(ParaGlueChars.SPACE); // Node 1, Leaf 2
+ out.addNode(new ParaBoxChars("not")); // Node 2, Leaf 3
+ out.addNode(ParaGlueChars.SPACE); // Node 3, Leaf 4
+ out.addNode(new ParaBoxChars("afraid")); // Node 4, Leaf 5
+ out.addNode(ParaGlueChars.SPACE); // Node 5, Leaf 6
+ out.addNode(new ParaBoxChars("of")); // Node 6, Leaf 7
+ out.addNode(ParaGlueChars.SPACE); // Node 7, Leaf 8
+ out.addNode(nodeGreatness); // Node 8, Leaf 9 - 11
+ out.addNode(new ParaBoxChars(".")); // Node 9, Leaf 12
+ out.addNode(ParaGlueChars.SPACE); // Node 10, Leaf 13
+ out.addNode(new ParaBoxChars("Some")); // Node 11, Leaf 14
+ out.addNode(ParaGlueChars.SPACE); // Node 12, Leaf 15
+ out.addNode(new ParaBoxChars("are")); // Node 13, Leaf 16
+ out.addNode(ParaGlueChars.SPACE); // Node 14, Leaf 17
+ out.addNode(new ParaBoxChars("born")); // Node 15, Leaf 18
+ out.addNode(ParaGlueChars.SPACE); // Node 16, Leaf 19
+ out.addNode(new ParaBoxChars("great,")); // Node 17, Leaf 20
+ out.addNode(ParaGlueChars.SPACE); // Node 18, Leaf 21
+ out.addNode(new ParaBoxChars("some")); // Node 19, Leaf 22
+ out.addNode(ParaGlueChars.SPACE); // Node 20, Leaf 23
+ out.addNode(new ParaBoxChars("achieve")); // Node 21, Leaf 24
+ out.addNode(ParaGlueChars.SPACE); // Node 22, Leaf 25
+ out.addNode(nodeGreatness); // Node 23, Leaf 26 - 28
+ out.addNode(new ParaBoxChars(",")); // Node 24, Leaf 29
+ out.addNode(ParaGlueChars.SPACE); // Node 25, Leaf 30
+ out.addNode(new ParaBoxChars("and")); // Node 26, Leaf 31
+ out.addNode(ParaGlueChars.SPACE); // Node 27, Leaf 32
+ out.addNode(new ParaBoxChars("some")); // Node 28, Leaf 33
+ out.addNode(ParaGlueChars.SPACE); // Node 29, Leaf 34
+ out.addNode(new ParaBoxChars("have")); // Node 30, Leaf 35
+ out.addNode(ParaGlueChars.SPACE); // Node 31, Leaf 36
+ out.addNode(nodeGreatness); // Node 32, Leaf 37 - 39
+ out.addNode(ParaGlueChars.SPACE); // Node 33, Leaf 40
+ out.addNode(new ParaBoxChars("thrust")); // Node 34, Leaf 41
+ out.addNode(ParaGlueChars.SPACE); // Node 35, Leaf 42
+ out.addNode(new ParaBoxChars("upon")); // Node 36, Leaf 43
+ out.addNode(ParaGlueChars.SPACE); // Node 37, Leaf 44
/* Putting "them." in a branch is unnecessary, but we with to test a branch as the last node. */
final ParaBranch4a nodeThem = new ParaBranch4a();
- nodeThem.add(new ParaBoxChars("t"));
- nodeThem.add(new ParaBoxChars("h"));
- nodeThem.add(new ParaBoxChars("e"));
- nodeThem.add(new ParaBoxChars("m"));
- nodeThem.add(new ParaBoxChars("."));
- out.add(nodeThem); // Node 38, Leaf 45 - 49
+ nodeThem.addNode(new ParaBoxChars("t"));
+ nodeThem.addNode(new ParaBoxChars("h"));
+ nodeThem.addNode(new ParaBoxChars("e"));
+ nodeThem.addNode(new ParaBoxChars("m"));
+ nodeThem.addNode(new ParaBoxChars("."));
+ out.addNode(nodeThem); // Node 38, Leaf 45 - 49
return out;
}
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 2021-12-29 23:20:48 UTC (rev 12298)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2021-12-30 13:28:02 UTC (rev 12299)
@@ -91,251 +91,251 @@
*/
public ParaBranch4a createPara() {
final ParaBranch4aTestFixture para = new ParaBranch4aTestFixture('-');
-// ----Leaf--- Ideal Cumul
-// Index Qty Width Width
-// ------ --- ----- -----
- para.add(new ParaBox4a(18)); // 0 1 18 18 Empty box (indent)
- para.addWord("In"); // 1 1 16 34 6+10
- para.addSpace(); // 2 1 6 40
- para.addWord("olden"); // 3 1 42 82 9+5+10+8+10
- para.addSpace(); // 4 1 6 88
- para.addWord("times"); // 5 1 42 130 7+5+15+8+7
- para.addSpace(); // 6 1 6 136
- para.addWord("when"); // 7 1 41 177 13+10+8+10
- para.addSpace(); // 8 1 6 183
- para.addWord("wish-ing"); // 9 3 59 242 13+5+7+10 5+10+9
- para.addSpace(); // 12 1 6 248
- para.addWord("still"); // 13 1 29 277 7+7+5+5+5
- para.addSpace(); // 14 1 6 283
- para.addWord("helped"); // 15 1 51 334 10+8+5+10+8+10
- para.addSpace(); // 16 1 6 340
- para.addWord("one"); // 17 1 27 367 9+10+8
- para.addNode(Punctuation4a.COMMA); // 18 1 5 372
- para.addSpace(); // 19 1 6 378
- para.addWord("there"); // 20 1 40 418 7+10+8+7+8
- para.addSpace(); // 21 1 6 424
- para.addWord("lived"); // 22 1 37 461 5+5+9+8+10
- para.addSpace(); // 23 1 6 467
- para.addWord("a"); // 24 1 9 476 9
- para.addSpace(); // 25 1 6 482
- para.addWord("king"); // 26 1 34 516 10+5+10+9
- para.addSpace(); // 27 1 6 522
- para.addWord("whose"); // 28 1 47 569 13+10+9+7+8
- para.addSpace(); // 29 1 6 575
- para.addWord("daugh-ters"); // 30 3 77 652 10+9+10+9+10 7+8+7+7
- para.addSpace(); // 33 1 6 658
- para.addWord("were"); // 34 1 36 694 13+8+7+8
- para.addSpace(); // 35 1 6 700
- para.addWord("all"); // 36 1 19 719 9+5+5
- para.addSpace(); // 37 1 6 725
- para.addWord("beau-ti-ful"); // 38 5 70 795 10+8+9+10 7+5 6+10+5
- para.addNode(Punctuation4a.SEMICOLON); // 43 1 5 800
- para.addSpace(); // 44 1 6 806
- para.addWord("and"); // 45 1 29 835 9+10+10
- para.addSpace(); // 46 1 6 841
- para.addWord("the"); // 47 1 25 866 7+10+8
- para.addSpace(); // 48 1 6 872
- para.addWord("young-est"); // 49 3 60 932 10+9+10+10+9 8+7+7
- para.addSpace(); // 52 1 6 938
- para.addWord("was"); // 53 1 29 967 13+9+7
- para.addSpace(); // 54 1 6 973
- para.addWord("so"); // 55 1 16 989 7+9
- para.addSpace(); // 56 1 6 995
- para.addWord("beau-ti-ful"); // 57 5 70 1065 10+8+9+10 7+5 6+10+5
- para.addSpace(); // 62 1 6 1071
- para.addWord("that"); // 63 1 33 1104 7+10+9+7
- para.addSpace(); // 64 1 6 1110
- para.addWord("the"); // 65 1 25 1135 7+10+8
- para.addSpace(); // 66 1 6 1141
- para.addWord("sun"); // 67 1 27 1168 7+10+10
- para.addSpace(); // 68 1 6 1174
- para.addWord("it-self"); // 69 3
- para.addNode(Punctuation4a.COMMA); // 72 1
- para.addSpace(); // 73 1 6
- para.addWord("which"); // 74 1
- para.addSpace(); // 75 1 6
- para.addWord("has"); // 76 1
- para.addSpace(); // 77 1 6
- para.addWord("seen"); // 78 1
- para.addSpace(); // 79 1 6
- para.addWord("so"); // 80 1
- para.addSpace(); // 81 1 6
- para.addWord("much"); // 82 1
- para.addNode(Punctuation4a.COMMA); // 83 1
- para.addSpace(); // 84 1 6
- para.addWord("was"); // 85 1
- para.addSpace(); // 86 1 6
- para.addWord("aston-ished"); // 87 3
- para.addSpace(); // 90 1 6
- para.addWord("when-ever"); // 91 3
- para.addSpace(); // 94 1 6
- para.addWord("it"); // 95 1
- para.addSpace(); // 96 1 6
- para.addWord("shone"); // 97 1
- para.addSpace(); // 98 1 6
- para.addWord("in"); // 99 1
- para.addSpace(); // 100 1 6
- para.addWord("her"); // 101 1
- para.addSpace(); // 102 1 6
- para.addWord("face"); // 103 1
- para.addNode(Punctuation4a.PERIOD); // 104 1
- para.addSpace(); // 105 1 6
- para.addWord("Close"); // 106 1
- para.addSpace(); // 107 1 6
- para.addWord("by"); // 108 1
- para.addSpace(); // 109 1 6
- para.addWord("the"); // 110 1
- para.addSpace(); // 111 1 6
- para.addWord("king’s"); // 112 1
- para.addSpace(); // 113 1 6
- para.addWord("castle"); // 114 1
- para.addSpace(); // 115 1 6
- para.addWord("lay"); // 116 1
- para.addSpace(); // 117 1 6
- para.addWord("a"); // 118 1
- para.addSpace(); // 119 1 6
- para.addWord("great"); // 120 1
- para.addSpace(); // 121 1 6
- para.addWord("dark"); // 122 1
- para.addSpace(); // 123 1 6
- para.addWord("for-est"); // 124 3
- para.addNode(Punctuation4a.COMMA); // 127 1
- para.addSpace(); // 128 1 6
- para.addWord("and"); // 129 1
- para.addSpace(); // 130 1 6
- para.addWord("un-der"); // 131 3
- para.addSpace(); // 134 1 6
- para.addWord("an"); // 135 1
- para.addSpace(); // 136 1 6
- para.addWord("old"); // 137 1
- para.addSpace(); // 138 1 6
- para.addWord("lime"); // 139 1
- para.add(Punctuation4a.MANDATORY_HYPHEN); // 140 1
- para.add(new ParaPenalty4a(0, 50, true)); // 141 1
- para.addWord("tree"); // 142 1
- para.addSpace(); // 143 1 6
- para.addWord("in"); // 144 1
- para.addSpace(); // 145 1 6
- para.addWord("the"); // 146 1
- para.addSpace(); // 147 1 6
- para.addWord("for-est"); // 148 3
- para.addSpace(); // 151 1 6
- para.addWord("was"); // 152 1
- para.addSpace(); // 153 1 6
- para.addWord("a"); // 154 1
- para.addSpace(); // 155 1 6
- para.addWord("well"); // 156 1
- para.addNode(Punctuation4a.COMMA); // 157 1
- para.addSpace(); // 158 1 6
- para.addWord("and"); // 159 1
- para.addSpace(); // 160 1 6
- para.addWord("when"); // 161 1
- para.addSpace(); // 162 1 6
- para.addWord("the"); // 163 1
- para.addSpace(); // 164 1 6
- para.addWord("day"); // 165 1
- para.addSpace(); // 166 1 6
- para.addWord("was"); // 167 1
- para.addSpace(); // 168 1 6
- para.addWord("very"); // 169 1
- para.addSpace(); // 170 1 6
- para.addWord("warm"); // 171 1
- para.addNode(Punctuation4a.COMMA); // 172 1
- para.addSpace(); // 173 1 6
- para.addWord("the"); // 174 1
- para.addSpace(); // 175 1 6
- para.addWord("king’s"); // 176 1
- para.addSpace(); // 177 1 6
- para.addWord("child"); // 178 1
- para.addSpace(); // 179 1 6
- para.addWord("went"); // 180 1
- para.addSpace(); // 181 1 6
- para.addWord("out"); // 182 1
- para.addSpace(); // 183 1 6
- para.addWord("into"); // 184 1
- para.addSpace(); // 185 1 6
- para.addWord("the"); // 186 1
- para.addSpace(); // 187 1 6
- para.addWord("for-est"); // 188 3
- para.addSpace(); // 191 1 6
- para.addWord("and"); // 192 1
- para.addSpace(); // 193 1 6
- para.addWord("sat"); // 194 1
- para.addSpace(); // 195 1 6
- para.addWord("down"); // 196 1
- para.addSpace(); // 197 1 6
- para.addWord("by"); // 198 1
- para.addSpace(); // 199 1 6
- para.addWord("the"); // 200 1
- para.addSpace(); // 201 1 6
- para.addWord("side"); // 202 1
- para.addSpace(); // 203 1 6
- para.addWord("of"); // 204 1
- para.addSpace(); // 205 1 6
- para.addWord("the"); // 206 1
- para.addSpace(); // 207 1 6
- para.addWord("cool"); // 208 1
- para.addSpace(); // 209 1 6
- para.addWord("foun-tain"); // 210 3
- para.addNode(Punctuation4a.SEMICOLON); // 213 1
- para.addSpace(); // 214 1 6
- para.addWord("and"); // 215 1
- para.addSpace(); // 216 1 6
- para.addWord("when"); // 217 1
- para.addSpace(); // 218 1 6
- para.addWord("she"); // 219 1
- para.addSpace(); // 220 1 6
- para.addWord("was"); // 221 1
- para.addSpace(); // 222 1 6
- para.addWord("bored"); // 223 1
- para.addSpace(); // 224 1 6
- para.addWord("she"); // 225 1
- para.addSpace(); // 226 1 6
- para.addWord("took"); // 227 1
- para.addSpace(); // 228 1 6
- para.addWord("a"); // 229 1
- para.addSpace(); // 230 1 6
- para.addWord("golden"); // 231 1
- para.addSpace(); // 232 1 6
- para.addWord("ball"); // 233 1
- para.addNode(Punctuation4a.COMMA); // 234 1
- para.addSpace(); // 235 1 6
- para.addWord("and"); // 236 1
- para.addSpace(); // 237 1 6
- para.addWord("threw"); // 238 1
- para.addSpace(); // 239 1 6
- para.addWord("it"); // 240 1
- para.addSpace(); // 241 1 6
- para.addWord("up"); // 242 1
- para.addSpace(); // 243 1 6
- para.addWord("on"); // 244 1
- para.addSpace(); // 245 1 6
- para.addWord("high"); // 246 1
- para.addSpace(); // 247 1 6
- para.addWord("and"); // 248 1
- para.addSpace(); // 249 1 6
- para.addWord("caught"); // 250 1
- para.addSpace(); // 251 1 6
- para.addWord("it"); // 252 1
- para.addNode(Punctuation4a.SEMICOLON); // 253 1
- para.addSpace(); // 254 1 6
- para.addWord("and"); // 255 1
- para.addSpace(); // 256 1 6
- para.addWord("this"); // 257 1
- para.addSpace(); // 258 1 6
- para.addWord("ball"); // 259 1
- para.addSpace(); // 260 1 6
- para.addWord("was"); // 261 1
- para.addSpace(); // 262 1 6
- para.addWord("her"); // 263 1
- para.addSpace(); // 264 1 6
- para.addWord("favor-ite"); // 265 3
- para.addSpace(); // 268 1 6
- para.addWord("play-thing"); // 269 3
- para.add(Punctuation4a.PERIOD); // 272 1
- para.add(ParaPenalty4a.DISALLOWED_BREAK); // 273 1
- para.add(ParaGlue4a.FINISHING_GLUE); // 274 1
- para.add(ParaPenalty4a.FORCED_BREAK); // 275 1
+// ----Leaf--- Ideal Cumul
+// Index Qty Width Width
+// ------ --- ----- -----
+ para.addNode(new ParaBox4a(18)); // 0 1 18 18 Empty box (indent)
+ para.addWord("In"); // 1 1 16 34 6+10
+ para.addSpace(); // 2 1 6 40
+ para.addWord("olden"); // 3 1 42 82 9+5+10+8+10
+ para.addSpace(); // 4 1 6 88
+ para.addWord("times"); // 5 1 42 130 7+5+15+8+7
+ para.addSpace(); // 6 1 6 136
+ para.addWord("when"); // 7 1 41 177 13+10+8+10
+ para.addSpace(); // 8 1 6 183
+ para.addWord("wish-ing"); // 9 3 59 242 13+5+7+10 5+10+9
+ para.addSpace(); // 12 1 6 248
+ para.addWord("still"); // 13 1 29 277 7+7+5+5+5
+ para.addSpace(); // 14 1 6 283
+ para.addWord("helped"); // 15 1 51 334 10+8+5+10+8+10
+ para.addSpace(); // 16 1 6 340
+ para.addWord("one"); // 17 1 27 367 9+10+8
+ para.addNode(Punctuation4a.COMMA); // 18 1 5 372
+ para.addSpace(); // 19 1 6 378
+ para.addWord("there"); // 20 1 40 418 7+10+8+7+8
+ para.addSpace(); // 21 1 6 424
+ para.addWord("lived"); // 22 1 37 461 5+5+9+8+10
+ para.addSpace(); // 23 1 6 467
+ para.addWord("a"); // 24 1 9 476 9
+ para.addSpace(); // 25 1 6 482
+ para.addWord("king"); // 26 1 34 516 10+5+10+9
+ para.addSpace(); // 27 1 6 522
+ para.addWord("whose"); // 28 1 47 569 13+10+9+7+8
+ para.addSpace(); // 29 1 6 575
+ para.addWord("daugh-ters"); // 30 3 77 652 10+9+10+9+10 7+8+7+7
+ para.addSpace(); // 33 1 6 658
+ para.addWord("were"); // 34 1 36 694 13+8+7+8
+ para.addSpace(); // 35 1 6 700
+ para.addWord("all"); // 36 1 19 719 9+5+5
+ para.addSpace(); // 37 1 6 725
+ para.addWord("beau-ti-ful"); // 38 5 70 795 10+8+9+10 7+5 6+10+5
+ para.addNode(Punctuation4a.SEMICOLON); // 43 1 5 800
+ para.addSpace(); // 44 1 6 806
+ para.addWord("and"); // 45 1 29 835 9+10+10
+ para.addSpace(); // 46 1 6 841
+ para.addWord("the"); // 47 1 25 866 7+10+8
+ para.addSpace(); // 48 1 6 872
+ para.addWord("young-est"); // 49 3 60 932 10+9+10+10+9 8+7+7
+ para.addSpace(); // 52 1 6 938
+ para.addWord("was"); // 53 1 29 967 13+9+7
+ para.addSpace(); // 54 1 6 973
+ para.addWord("so"); // 55 1 16 989 7+9
+ para.addSpace(); // 56 1 6 995
+ para.addWord("beau-ti-ful"); // 57 5 70 1065 10+8+9+10 7+5 6+10+5
+ para.addSpace(); // 62 1 6 1071
+ para.addWord("that"); // 63 1 33 1104 7+10+9+7
+ para.addSpace(); // 64 1 6 1110
+ para.addWord("the"); // 65 1 25 1135 7+10+8
+ para.addSpace(); // 66 1 6 1141
+ para.addWord("sun"); // 67 1 27 1168 7+10+10
+ para.addSpace(); // 68 1 6 1174
+ para.addWord("it-self"); // 69 3
+ para.addNode(Punctuation4a.COMMA); // 72 1
+ para.addSpace(); // 73 1 6
+ para.addWord("which"); // 74 1
+ para.addSpace(); // 75 1 6
+ para.addWord("has"); // 76 1
+ para.addSpace(); // 77 1 6
+ para.addWord("seen"); // 78 1
+ para.addSpace(); // 79 1 6
+ para.addWord("so"); // 80 1
+ para.addSpace(); // 81 1 6
+ para.addWord("much"); // 82 1
+ para.addNode(Punctuation4a.COMMA); // 83 1
+ para.addSpace(); // 84 1 6
+ para.addWord("was"); // 85 1
+ para.addSpace(); // 86 1 6
+ para.addWord("aston-ished"); // 87 3
+ para.addSpace(); // 90 1 6
+ para.addWord("when-ever"); // 91 3
+ para.addSpace(); // 94 1 6
+ para.addWord("it"); // 95 1
+ para.addSpace(); // 96 1 6
+ para.addWord("shone"); // 97 1
+ para.addSpace(); // 98 1 6
+ para.addWord("in"); // 99 1
+ para.addSpace(); // 100 1 6
+ para.addWord("her"); // 101 1
+ para.addSpace(); // 102 1 6
+ para.addWord("face"); // 103 1
+ para.addNode(Punctuation4a.PERIOD); // 104 1
+ para.addSpace(); // 105 1 6
+ para.addWord("Close"); // 106 1
+ para.addSpace(); // 107 1 6
+ para.addWord("by"); // 108 1
+ para.addSpace(); // 109 1 6
+ para.addWord("the"); // 110 1
+ para.addSpace(); // 111 1 6
+ para.addWord("king’s"); // 112 1
+ para.addSpace(); // 113 1 6
+ para.addWord("castle"); // 114 1
+ para.addSpace(); // 115 1 6
+ para.addWord("lay"); // 116 1
+ para.addSpace(); // 117 1 6
+ para.addWord("a"); // 118 1
+ para.addSpace(); // 119 1 6
+ para.addWord("great"); // 120 1
+ para.addSpace(); // 121 1 6
+ para.addWord("dark"); // 122 1
+ para.addSpace(); // 123 1 6
+ para.addWord("for-est"); // 124 3
+ para.addNode(Punctuation4a.COMMA); // 127 1
+ para.addSpace(); // 128 1 6
+ para.addWord("and"); // 129 1
+ para.addSpace(); // 130 1 6
+ para.addWord("un-der"); // 131 3
+ para.addSpace(); // 134 1 6
+ para.addWord("an"); // 135 1
+ para.addSpace(); // 136 1 6
+ para.addWord("old"); // 137 1
+ para.addSpace(); // 138 1 6
+ para.addWord("lime"); // 139 1
+ para.addNode(Punctuation4a.MANDATORY_HYPHEN); // 140 1
+ para.addNode(new ParaPenalty4a(0, 50, true)); // 141 1
+ para.addWord("tree"); // 142 1
+ para.addSpace(); // 143 1 6
+ para.addWord("in"); // 144 1
+ para.addSpace(); // 145 1 6
+ para.addWord("the"); // 146 1
+ para.addSpace(); // 147 1 6
+ para.addWord("for-est"); // 148 3
+ para.addSpace(); // 151 1 6
+ para.addWord("was"); // 152 1
+ para.addSpace(); // 153 1 6
+ para.addWord("a"); // 154 1
+ para.addSpace(); // 155 1 6
+ para.addWord("well"); // 156 1
+ para.addNode(Punctuation4a.COMMA); // 157 1
+ para.addSpace(); // 158 1 6
+ para.addWord("and"); // 159 1
+ para.addSpace(); // 160 1 6
+ para.addWord("when"); // 161 1
+ para.addSpace(); // 162 1 6
+ para.addWord("the"); // 163 1
+ para.addSpace(); // 164 1 6
+ para.addWord("day"); // 165 1
+ para.addSpace(); // 166 1 6
+ para.addWord("was"); // 167 1
+ para.addSpace(); // 168 1 6
+ para.addWord("very"); // 169 1
+ para.addSpace(); // 170 1 6
+ para.addWord("warm"); // 171 1
+ para.addNode(Punctuation4a.COMMA); // 172 1
+ para.addSpace(); // 173 1 6
+ para.addWord("the"); // 174 1
+ para.addSpace(); // 175 1 6
+ para.addWord("king’s"); // 176 1
+ para.addSpace(); // 177 1 6
+ para.addWord("child"); // 178 1
+ para.addSpace(); // 179 1 6
+ para.addWord("went"); // 180 1
+ para.addSpace(); // 181 1 6
+ para.addWord("out"); // 182 1
+ para.addSpace(); // 183 1 6
+ para.addWord("into"); // 184 1
+ para.addSpace(); // 185 1 6
+ para.addWord("the"); // 186 1
+ para.addSpace(); // 187 1 6
+ para.addWord("for-est"); // 188 3
+ para.addSpace(); // 191 1 6
+ para.addWord("and"); // 192 1
+ para.addSpace(); // 193 1 6
+ para.addWord("sat"); // 194 1
+ para.addSpace(); // 195 1 6
+ para.addWord("down"); // 196 1
+ para.addSpace(); // 197 1 6
+ para.addWord("by"); // 198 1
+ para.addSpace(); // 199 1 6
+ para.addWord("the"); // 200 1
+ para.addSpace(); // 201 1 6
+ para.addWord("side"); // 202 1
+ para.addSpace(); // 203 1 6
+ para.addWord("of"); // 204 1
+ para.addSpace(); // 205 1 6
+ para.addWord("the"); // 206 1
+ para.addSpace(); // 207 1 6
+ para.addWord("cool"); // 208 1
+ para.addSpace(); // 209 1 6
+ para.addWord("foun-tain"); // 210 3
+ para.addNode(Punctuation4a.SEMICOLON); // 213 1
+ para.addSpace(); // 214 1 6
+ para.addWord("and"); // 215 1
+ para.addSpace(); // 216 1 6
+ para.addWord("when"); // 217 1
+ para.addSpace(); // 218 1 6
+ para.addWord("she"); // 219 1
+ para.addSpace(); // 220 1 6
+ para.addWord("was"); // 221 1
+ para.addSpace(); // 222 1 6
+ para.addWord("bored"); // 223 1
+ para.addSpace(); // 224 1 6
+ para.addWord("she"); // 225 1
+ para.addSpace(); // 226 1 6
+ para.addWord("took"); // 227 1
+ para.addSpace(); // 228 1 6
+ para.addWord("a"); // 229 1
+ para.addSpace(); // 230 1 6
+ para.addWord("golden"); // 231 1
+ para.addSpace(); // 232 1 6
+ para.addWord("ball"); // 233 1
+ para.addNode(Punctuation4a.COMMA); // 234 1
+ para.addSpace(); // 235 1 6
+ para.addWord("and"); // 236 1
+ para.addSpace(); // 237 1 6
+ para.addWord("threw"); // 238 1
+ para.addSpace(); // 239 1 6
+ para.addWord("it"); // 240 1
+ para.addSpace(); // 241 1 6
+ para.addWord("up"); // 242 1
+ para.addSpace(); // 243 1 6
+ para.addWord("on"); // 244 1
+ para.addSpace(); // 245 1 6
+ para.addWord("high"); // 246 1
+ para.addSpace(); // 247 1 6
+ para.addWord("and"); // 248 1
+ para.addSpace(); // 249 1 6
+ para.addWord("caught"); // 250 1
+ para.addSpace(); // 251 1 6
+ para.addWord("it"); // 252 1
+ para.addNode(Punctuation4a.SEMICOLON); // 253 1
+ para.addSpace(); // 254 1 6
+ para.addWord("and"); // 255 1
+ para.addSpace(); // 256 1 6
+ para.addWord("this"); // 257 1
+ para.addSpace(); // 258 1 6
+ para.addWord("ball"); // 259 1
+ para.addSpace(); // 260 1 6
+ para.addWord("was"); // 261 1
+ para.addSpace(); // 262 1 6
+ para.addWord("her"); // 263 1
+ para.addSpace(); // 264 1 6
+ para.addWord("favor-ite"); // 265 3
+ para.addSpace(); // 268 1 6
+ para.addWord("play-thing"); // 269 3
+ para.addNode(Punctuation4a.PERIOD); // 272 1
+ para.addNode(ParaPenalty4a.DISALLOWED_BREAK); // 273 1
+ para.addNode(ParaGlue4a.FINISHING_GLUE); // 274 1
+ para.addNode(ParaPenalty4a.FORCED_BREAK); // 275 1
/* There are 242 lines of code creating the paragraph.
* Each of them adds exactly one node. */
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaBranch4aTestFixture.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaBranch4aTestFixture.java 2021-12-29 23:20:48 UTC (rev 12298)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaBranch4aTestFixture.java 2021-12-30 13:28:02 UTC (rev 12299)
@@ -32,8 +32,6 @@
import org.foray.orthography.StringWord;
import org.foray.orthography.Whitespace4a;
-import org.axsl.common.para.ParaNode;
-
import java.util.regex.Pattern;
/**
@@ -60,15 +58,11 @@
final char partsOfSpeech = 0;
final String[] components = this.wordBreaker.split(wordChars);
final StringWord word = new StringWord(partsOfSpeech, components);
- this.add(word);
+ this.addNode(word);
}
public void addSpace() {
- this.add(Whitespace4a.SPACE);
+ this.addNode(Whitespace4a.SPACE);
}
- public void addNode(final ParaNode node) {
- this.add(node);
- }
-
}
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaContentIteratorTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaContentIteratorTests.java 2021-12-29 23:20:48 UTC (rev 12298)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaContentIteratorTests.java 2021-12-30 13:28:02 UTC (rev 12299)
@@ -59,22 +59,22 @@
final ParaBox4a h = new ParaBox4a(0);
/* root has two children, a and b. */
- root.add(a);
- root.add(b);
+ root.addNode(a);
+ root.addNode(b);
/* a has no children. */
/* b has two children, c and d. */
- b.add(c);
- b.add(d);
+ b.addNode(c);
+ b.addNode(d);
/* c has three children, e, f, and g. */
- c.add(e);
- c.add(f);
- c.add(g);
+ c.addNode(e);
+ c.addNode(f);
+ c.addNode(g);
/* d has one child, h. */
- d.add(h);
+ d.addNode(h);
final ParaContentIterator out = new ParaContentIterator(root);
final List<OrderedTreePath4a> actual = new ArrayList<OrderedTreePath4a>();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-29 23:20:51
|
Revision: 12298
http://sourceforge.net/p/foray/code/12298
Author: victormote
Date: 2021-12-29 23:20:48 +0000 (Wed, 29 Dec 2021)
Log Message:
-----------
Use ForayEntityResolver to resolve FOray as well as aXSL DTDs.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/ForayEntityResolver.java
trunk/foray/foray-core/src/main/java/org/foray/core/ForayConfigParser.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/ForayEntityResolver.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/ForayEntityResolver.java 2021-12-29 22:31:05 UTC (rev 12297)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/ForayEntityResolver.java 2021-12-29 23:20:48 UTC (rev 12298)
@@ -28,10 +28,13 @@
package org.foray.common;
+import org.slf4j.LoggerFactory;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
+import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -59,8 +62,11 @@
public static final String AREA_TREE_PUBLIC_ID = "-//aXSL//DTD Area Tree V0.1//EN";
/** The public id of the "parts of speech" DTD. */
- public static final String PARTS_OF_SPEECH = "-//aXSL//DTD Parts of Speech V0.1//EN";
+ public static final String PARTS_OF_SPEECH_PUBLIC_ID = "-//aXSL//DTD Parts of Speech V0.1//EN";
+ /** The public id of the "foray config" DTD. */
+ public static final String FORAY_CONFIG_DTD_PUBLIC_ID = "-//FOray//DTD FOray Configuration V0.1//EN";
+
/** The singleton instance. */
private static final ForayEntityResolver INSTANCE = new ForayEntityResolver();
@@ -80,40 +86,63 @@
}
/**
- * Returns an aXSL DTD as an InputStream.
+ * Returns an aXSL DTD as an InputSource.
* @param dtdName The name of the DTD to be retrieved.
* @return The appropriate aXSL DTD, or null if not found.
*/
- public InputStream getAxslDtdAsInputStream(final String dtdName) {
- final InputStream theStream =
- ForayEntityResolver.class.getResourceAsStream("/resources/org/axsl/dtds/" + dtdName);
- return theStream;
+ private InputStream getAxslDtdAsInputStream(final String dtdName) {
+ return ForayEntityResolver.class.getResourceAsStream("/resources/org/axsl/dtds/" + dtdName);
}
+ /**
+ * Returns a FOray DTD as an InputStream.
+ * @param dtdName The name of the DTD to be retrieved.
+ * @return The appropriate FOray DTD, or null if not found.
+ */
+ private InputStream getForayDtdAsInputStream(final String dtdName) throws IOException {
+ InputStream inputStream = this.getClass().getResourceAsStream("/resources/org/foray/dtds/" + dtdName);
+
+ if (inputStream == null) {
+ /* The aXSL DTDs should all be found in jar files resolved by the build system.
+ * For FOray DTDs, the user could be a developer running in an IDE, and, because the DTD files live in the
+ * website directory in the "master" project, the IDE does not know about them.
+ * See build.gradle where the file is copied into the jar file.
+ * Therefore, we look for the file on the local file system. */
+ final File file = new File("../master/doc/web/dtds/0.1/en/" + dtdName);
+ if (file.exists()) {
+ inputStream = new FileInputStream(file);
+ }
+ }
+
+ return inputStream;
+ }
+
+ public InputStream getInputStream(final String publicId) throws IOException {
+ switch(publicId) {
+ /* aXSL DTDs. */
+ case NATURAL_LANGUAGE_PUBLIC_ID: return getAxslDtdAsInputStream("axsl-natural-language.dtd");
+ case HYPHENATION_PUBLIC_ID: return getAxslDtdAsInputStream("axsl-hyphenation.dtd");
+ case DICTIONARY_PUBLIC_ID: return getAxslDtdAsInputStream("axsl-dictionary.dtd");
+ case FONT_CONFIG_PUBLIC_ID: return getAxslDtdAsInputStream("axsl-font-config.dtd");
+ case ORTHOGRAPHY_CONFIG_PUBLIC_ID: return getAxslDtdAsInputStream("axsl-orthography-config.dtd");
+ case AREA_TREE_PUBLIC_ID: return getAxslDtdAsInputStream("axsl-area-tree.dtd");
+ case PARTS_OF_SPEECH_PUBLIC_ID: return getAxslDtdAsInputStream("axsl-parts-of-speech.dtd");
+
+ /* FOray DTDs. */
+ case FORAY_CONFIG_DTD_PUBLIC_ID: return getForayDtdAsInputStream("foray-config.dtd");
+
+ default: return null;
+ }
+
+ }
+
@Override
- public InputSource resolveEntity(final String publicId, final String systemId) throws SAXException,
- IOException {
- InputStream inputStream = null;
- if (ForayEntityResolver.NATURAL_LANGUAGE_PUBLIC_ID.equals(publicId)) {
- inputStream = getAxslDtdAsInputStream("axsl-natural-language.dtd");
- } else if (ForayEntityResolver.HYPHENATION_PUBLIC_ID.equals(publicId)) {
- inputStream = getAxslDtdAsInputStream("axsl-hyphenation.dtd");
- } else if (ForayEntityResolver.DICTIONARY_PUBLIC_ID.equals(publicId)) {
- inputStream = getAxslDtdAsInputStream("axsl-dictionary.dtd");
- } else if (ForayEntityResolver.FONT_CONFIG_PUBLIC_ID.equals(publicId)) {
- inputStream = getAxslDtdAsInputStream("axsl-font-config.dtd");
- } else if (ForayEntityResolver.ORTHOGRAPHY_CONFIG_PUBLIC_ID.equals(publicId)) {
- inputStream = getAxslDtdAsInputStream("axsl-orthography-config.dtd");
- } else if (ForayEntityResolver.AREA_TREE_PUBLIC_ID.equals(publicId)) {
- inputStream = getAxslDtdAsInputStream("axsl-area-tree.dtd");
- } else if (ForayEntityResolver.PARTS_OF_SPEECH.equals(publicId)) {
- inputStream = getAxslDtdAsInputStream("axsl-parts-of-speech.dtd");
- }
+ public InputSource resolveEntity(final String publicId, final String systemId) throws SAXException, IOException {
+ final InputStream inputStream = getInputStream(publicId);
if (inputStream == null) {
- return null;
+ LoggerFactory.getLogger(this.getClass()).warn("Unable to resolve resource locally: " + publicId);
}
- final InputSource inputSource = new InputSource(inputStream);
- return inputSource;
+ return inputStream == null ? null : new InputSource(inputStream);
}
}
Modified: trunk/foray/foray-core/src/main/java/org/foray/core/ForayConfigParser.java
===================================================================
--- trunk/foray/foray-core/src/main/java/org/foray/core/ForayConfigParser.java 2021-12-29 22:31:05 UTC (rev 12297)
+++ trunk/foray/foray-core/src/main/java/org/foray/core/ForayConfigParser.java 2021-12-29 23:20:48 UTC (rev 12298)
@@ -30,6 +30,7 @@
import org.foray.common.Configuration;
import org.foray.common.ConfigurationException;
+import org.foray.common.ForayEntityResolver;
import org.foray.common.xml.SaxParser;
import org.xml.sax.Attributes;
@@ -38,9 +39,7 @@
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
-import java.io.FileInputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.net.URL;
import javax.xml.parsers.ParserConfigurationException;
@@ -52,9 +51,6 @@
*/
public class ForayConfigParser extends SaxParser<Object> {
- /** Public ID of the FOray configuration DTD. */
- public static final String FORAY_CONFIG_DTD_PUBLIC_ID = "-//FOray//DTD FOray Configuration V0.1//EN";
-
/** Constant indicating that the current status of the parser is outside
* of either key or value. */
private static final int OUT = 0;
@@ -117,24 +113,7 @@
@Override
public Object parse(final InputSource inputSource) throws IOException, ParserConfigurationException, SAXException {
- final EntityResolver resolver = new EntityResolver() {
- public InputSource resolveEntity(final String publicId, final String systemId) throws SAXException,
- IOException {
- if (ForayConfigParser.FORAY_CONFIG_DTD_PUBLIC_ID.equals(publicId)) {
- InputStream inputStream =
- ForayConfigParser.class.getResourceAsStream("/resources/org/foray/dtds/foray-config.dtd");
- /* If null, the user could be a developer running in an IDE.
- * See build.gradle where the file is copied into the jar file.
- * However, the IDE doesn't know how to find it because it lives with the website files.
- * Therefore look for it on the file system instead. */
- if (inputStream == null) {
- inputStream = new FileInputStream("../master/doc/web/dtds/0.1/en/foray-config.dtd");
- }
- return new InputSource(inputStream);
- }
- return null;
- }
- };
+ final EntityResolver resolver = ForayEntityResolver.getInstance();
final XMLReader parser = createSax2Parser(true, true, true, resolver, false);
parser.parse(inputSource);
return null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-29 22:31:08
|
Revision: 12297
http://sourceforge.net/p/foray/code/12297
Author: victormote
Date: 2021-12-29 22:31:05 +0000 (Wed, 29 Dec 2021)
Log Message:
-----------
Convert ForayEntityResolver into a true singleton.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/ForayEntityResolver.java
trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NatLangParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/OrthographyParser.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/ForayEntityResolver.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/ForayEntityResolver.java 2021-12-29 22:14:05 UTC (rev 12296)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/ForayEntityResolver.java 2021-12-29 22:31:05 UTC (rev 12297)
@@ -36,9 +36,9 @@
import java.io.InputStream;
/**
- * Utilities related to the aXSL DTDs.
+ * Entity resolver for FOray and aXSL entities (including DTDs).
*/
-public final class ForayEntityResolver {
+public final class ForayEntityResolver implements EntityResolver {
/** The public id of the "natural language" DTD. */
public static final String NATURAL_LANGUAGE_PUBLIC_ID = "-//aXSL//DTD Natural Language V0.1//EN";
@@ -61,54 +61,59 @@
/** The public id of the "parts of speech" DTD. */
public static final String PARTS_OF_SPEECH = "-//aXSL//DTD Parts of Speech V0.1//EN";
+ /** The singleton instance. */
+ private static final ForayEntityResolver INSTANCE = new ForayEntityResolver();
+
/**
- * Private Constructor. This class is a utility class and should never be instantiated.
+ * Private Constructor.
+ * This class is a utility class and should never be instantiated.
+ * Use {@link #getInstance()} to obtain the singleton instance.
*/
private ForayEntityResolver() { }
/**
+ * Returns the singleton instance.
+ * @return The singleton instance.
+ */
+ public static ForayEntityResolver getInstance() {
+ return ForayEntityResolver.INSTANCE;
+ }
+
+ /**
* Returns an aXSL DTD as an InputStream.
* @param dtdName The name of the DTD to be retrieved.
* @return The appropriate aXSL DTD, or null if not found.
*/
- public static InputStream getAxslDtdAsInputStream(final String dtdName) {
+ public InputStream getAxslDtdAsInputStream(final String dtdName) {
final InputStream theStream =
ForayEntityResolver.class.getResourceAsStream("/resources/org/axsl/dtds/" + dtdName);
return theStream;
}
- /**
- * Create an entity resolver that knows how to find the local copy of all aXSL DTDs.
- * @return An entity resolver for the appropriate DTD, or null if none is found.
- */
- public static EntityResolver getEntityResolver() {
- final EntityResolver resolver = new EntityResolver() {
- public InputSource resolveEntity(final String publicId, final String systemId) throws SAXException,
- IOException {
- InputStream inputStream = null;
- if (ForayEntityResolver.NATURAL_LANGUAGE_PUBLIC_ID.equals(publicId)) {
- inputStream = ForayEntityResolver.getAxslDtdAsInputStream("axsl-natural-language.dtd");
- } else if (ForayEntityResolver.HYPHENATION_PUBLIC_ID.equals(publicId)) {
- inputStream = ForayEntityResolver.getAxslDtdAsInputStream("axsl-hyphenation.dtd");
- } else if (ForayEntityResolver.DICTIONARY_PUBLIC_ID.equals(publicId)) {
- inputStream = ForayEntityResolver.getAxslDtdAsInputStream("axsl-dictionary.dtd");
- } else if (ForayEntityResolver.FONT_CONFIG_PUBLIC_ID.equals(publicId)) {
- inputStream = ForayEntityResolver.getAxslDtdAsInputStream("axsl-font-config.dtd");
- } else if (ForayEntityResolver.ORTHOGRAPHY_CONFIG_PUBLIC_ID.equals(publicId)) {
- inputStream = ForayEntityResolver.getAxslDtdAsInputStream("axsl-orthography-config.dtd");
- } else if (ForayEntityResolver.AREA_TREE_PUBLIC_ID.equals(publicId)) {
- inputStream = ForayEntityResolver.getAxslDtdAsInputStream("axsl-area-tree.dtd");
- } else if (ForayEntityResolver.PARTS_OF_SPEECH.equals(publicId)) {
- inputStream = ForayEntityResolver.getAxslDtdAsInputStream("axsl-parts-of-speech.dtd");
- }
- if (inputStream == null) {
- return null;
- }
- final InputSource inputSource = new InputSource(inputStream);
- return inputSource;
- }
- };
- return resolver;
+ @Override
+ public InputSource resolveEntity(final String publicId, final String systemId) throws SAXException,
+ IOException {
+ InputStream inputStream = null;
+ if (ForayEntityResolver.NATURAL_LANGUAGE_PUBLIC_ID.equals(publicId)) {
+ inputStream = getAxslDtdAsInputStream("axsl-natural-language.dtd");
+ } else if (ForayEntityResolver.HYPHENATION_PUBLIC_ID.equals(publicId)) {
+ inputStream = getAxslDtdAsInputStream("axsl-hyphenation.dtd");
+ } else if (ForayEntityResolver.DICTIONARY_PUBLIC_ID.equals(publicId)) {
+ inputStream = getAxslDtdAsInputStream("axsl-dictionary.dtd");
+ } else if (ForayEntityResolver.FONT_CONFIG_PUBLIC_ID.equals(publicId)) {
+ inputStream = getAxslDtdAsInputStream("axsl-font-config.dtd");
+ } else if (ForayEntityResolver.ORTHOGRAPHY_CONFIG_PUBLIC_ID.equals(publicId)) {
+ inputStream = getAxslDtdAsInputStream("axsl-orthography-config.dtd");
+ } else if (ForayEntityResolver.AREA_TREE_PUBLIC_ID.equals(publicId)) {
+ inputStream = getAxslDtdAsInputStream("axsl-area-tree.dtd");
+ } else if (ForayEntityResolver.PARTS_OF_SPEECH.equals(publicId)) {
+ inputStream = getAxslDtdAsInputStream("axsl-parts-of-speech.dtd");
+ }
+ if (inputStream == null) {
+ return null;
+ }
+ final InputSource inputSource = new InputSource(inputStream);
+ return inputSource;
}
}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java 2021-12-29 22:14:05 UTC (rev 12296)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java 2021-12-29 22:31:05 UTC (rev 12297)
@@ -150,7 +150,7 @@
@Override
public Object parse(final InputSource inputSource) throws IOException, ParserConfigurationException, SAXException {
- final XMLReader parser = createSax2Parser(true, true, true, ForayEntityResolver.getEntityResolver(), false);
+ final XMLReader parser = createSax2Parser(true, true, true, ForayEntityResolver.getInstance(), false);
parser.parse(inputSource);
return null;
}
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 2021-12-29 22:14:05 UTC (rev 12296)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParser.java 2021-12-29 22:31:05 UTC (rev 12297)
@@ -141,7 +141,7 @@
throws IOException, SAXException, ParserConfigurationException {
getLogger().debug("Begin dictionary word list parsing: " + inputSource.getSystemId());
- final XMLReader parser = createSax2Parser(true, true, true, ForayEntityResolver.getEntityResolver(), false);
+ final XMLReader parser = createSax2Parser(true, true, true, ForayEntityResolver.getInstance(), false);
if (parser != null) {
parser.parse(inputSource);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NatLangParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NatLangParser.java 2021-12-29 22:14:05 UTC (rev 12296)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NatLangParser.java 2021-12-29 22:31:05 UTC (rev 12297)
@@ -57,7 +57,7 @@
@Override
public NaturalLanguage parse(final InputSource inputSource)
throws IOException, SAXException, ParserConfigurationException {
- final XMLReader parser = createSax2Parser(false, true, true, ForayEntityResolver.getEntityResolver(), false);
+ final XMLReader parser = createSax2Parser(false, true, true, ForayEntityResolver.getInstance(), false);
parser.parse(inputSource);
return this.nl;
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/OrthographyParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/OrthographyParser.java 2021-12-29 22:14:05 UTC (rev 12296)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/OrthographyParser.java 2021-12-29 22:31:05 UTC (rev 12297)
@@ -152,7 +152,7 @@
@Override
public Orthography4a parse(final InputSource inputSource)
throws IOException, SAXException, ParserConfigurationException {
- final XMLReader parser = createSax2Parser(true, true, true, ForayEntityResolver.getEntityResolver(), false);
+ final XMLReader parser = createSax2Parser(true, true, true, ForayEntityResolver.getInstance(), false);
parser.parse(inputSource);
return this.currentOrthographyConfig;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-29 22:14:08
|
Revision: 12296
http://sourceforge.net/p/foray/code/12296
Author: victormote
Date: 2021-12-29 22:14:05 +0000 (Wed, 29 Dec 2021)
Log Message:
-----------
Rename resolver class to make it more general.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NatLangParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/OrthographyParser.java
Added Paths:
-----------
trunk/foray/foray-common/src/main/java/org/foray/common/ForayEntityResolver.java
Removed Paths:
-------------
trunk/foray/foray-common/src/main/java/org/foray/common/AxslDtdUtil.java
Deleted: trunk/foray/foray-common/src/main/java/org/foray/common/AxslDtdUtil.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/AxslDtdUtil.java 2021-12-29 21:45:24 UTC (rev 12295)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/AxslDtdUtil.java 2021-12-29 22:14:05 UTC (rev 12296)
@@ -1,113 +0,0 @@
-/*
- * Copyright 2009 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.common;
-
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Utilities related to the aXSL DTDs.
- */
-public final class AxslDtdUtil {
-
- /** The public id of the "natural language" DTD. */
- public static final String NATURAL_LANGUAGE_PUBLIC_ID = "-//aXSL//DTD Natural Language V0.1//EN";
-
- /** The public id of the "hyphenation" DTD. */
- public static final String HYPHENATION_PUBLIC_ID = "-//aXSL//DTD Hyphenation V0.1//EN";
-
- /** The public id of the "dictionary" DTD. */
- public static final String DICTIONARY_PUBLIC_ID = "-//aXSL//DTD Dictionary V0.1//EN";
-
- /** The public id of the "font config" DTD. */
- public static final String FONT_CONFIG_PUBLIC_ID = "-//aXSL//DTD Font Configuration V0.1//EN";
-
- /** The public id of the "orthography config" DTD. */
- public static final String ORTHOGRAPHY_CONFIG_PUBLIC_ID = "-//aXSL//DTD Orthography Configuration V0.1//EN";
-
- /** The public id of the "area tree" DTD. */
- public static final String AREA_TREE_PUBLIC_ID = "-//aXSL//DTD Area Tree V0.1//EN";
-
- /** The public id of the "parts of speech" DTD. */
- public static final String PARTS_OF_SPEECH = "-//aXSL//DTD Parts of Speech V0.1//EN";
-
- /**
- * Private Constructor. This class is a utility class and should never be instantiated.
- */
- private AxslDtdUtil() { }
-
- /**
- * Returns an aXSL DTD as an InputStream.
- * @param dtdName The name of the DTD to be retrieved.
- * @return The appropriate aXSL DTD, or null if not found.
- */
- public static InputStream getAxslDtdAsInputStream(final String dtdName) {
- final InputStream theStream = AxslDtdUtil.class.getResourceAsStream("/resources/org/axsl/dtds/" + dtdName);
- return theStream;
- }
-
- /**
- * Create an entity resolver that knows how to find the local copy of all aXSL DTDs.
- * @return An entity resolver for the appropriate DTD, or null if none is found.
- */
- public static EntityResolver getEntityResolver() {
- final EntityResolver resolver = new EntityResolver() {
- public InputSource resolveEntity(final String publicId, final String systemId) throws SAXException,
- IOException {
- InputStream inputStream = null;
- if (AxslDtdUtil.NATURAL_LANGUAGE_PUBLIC_ID.equals(publicId)) {
- inputStream = AxslDtdUtil.getAxslDtdAsInputStream("axsl-natural-language.dtd");
- } else if (AxslDtdUtil.HYPHENATION_PUBLIC_ID.equals(publicId)) {
- inputStream = AxslDtdUtil.getAxslDtdAsInputStream("axsl-hyphenation.dtd");
- } else if (AxslDtdUtil.DICTIONARY_PUBLIC_ID.equals(publicId)) {
- inputStream = AxslDtdUtil.getAxslDtdAsInputStream("axsl-dictionary.dtd");
- } else if (AxslDtdUtil.FONT_CONFIG_PUBLIC_ID.equals(publicId)) {
- inputStream = AxslDtdUtil.getAxslDtdAsInputStream("axsl-font-config.dtd");
- } else if (AxslDtdUtil.ORTHOGRAPHY_CONFIG_PUBLIC_ID.equals(publicId)) {
- inputStream = AxslDtdUtil.getAxslDtdAsInputStream("axsl-orthography-config.dtd");
- } else if (AxslDtdUtil.AREA_TREE_PUBLIC_ID.equals(publicId)) {
- inputStream = AxslDtdUtil.getAxslDtdAsInputStream("axsl-area-tree.dtd");
- } else if (AxslDtdUtil.PARTS_OF_SPEECH.equals(publicId)) {
- inputStream = AxslDtdUtil.getAxslDtdAsInputStream("axsl-parts-of-speech.dtd");
- }
- if (inputStream == null) {
- return null;
- }
- final InputSource inputSource = new InputSource(inputStream);
- return inputSource;
- }
- };
- return resolver;
- }
-
-}
Copied: trunk/foray/foray-common/src/main/java/org/foray/common/ForayEntityResolver.java (from rev 12181, trunk/foray/foray-common/src/main/java/org/foray/common/AxslDtdUtil.java)
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/ForayEntityResolver.java (rev 0)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/ForayEntityResolver.java 2021-12-29 22:14:05 UTC (rev 12296)
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2009 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.common;
+
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Utilities related to the aXSL DTDs.
+ */
+public final class ForayEntityResolver {
+
+ /** The public id of the "natural language" DTD. */
+ public static final String NATURAL_LANGUAGE_PUBLIC_ID = "-//aXSL//DTD Natural Language V0.1//EN";
+
+ /** The public id of the "hyphenation" DTD. */
+ public static final String HYPHENATION_PUBLIC_ID = "-//aXSL//DTD Hyphenation V0.1//EN";
+
+ /** The public id of the "dictionary" DTD. */
+ public static final String DICTIONARY_PUBLIC_ID = "-//aXSL//DTD Dictionary V0.1//EN";
+
+ /** The public id of the "font config" DTD. */
+ public static final String FONT_CONFIG_PUBLIC_ID = "-//aXSL//DTD Font Configuration V0.1//EN";
+
+ /** The public id of the "orthography config" DTD. */
+ public static final String ORTHOGRAPHY_CONFIG_PUBLIC_ID = "-//aXSL//DTD Orthography Configuration V0.1//EN";
+
+ /** The public id of the "area tree" DTD. */
+ public static final String AREA_TREE_PUBLIC_ID = "-//aXSL//DTD Area Tree V0.1//EN";
+
+ /** The public id of the "parts of speech" DTD. */
+ public static final String PARTS_OF_SPEECH = "-//aXSL//DTD Parts of Speech V0.1//EN";
+
+ /**
+ * Private Constructor. This class is a utility class and should never be instantiated.
+ */
+ private ForayEntityResolver() { }
+
+ /**
+ * Returns an aXSL DTD as an InputStream.
+ * @param dtdName The name of the DTD to be retrieved.
+ * @return The appropriate aXSL DTD, or null if not found.
+ */
+ public static InputStream getAxslDtdAsInputStream(final String dtdName) {
+ final InputStream theStream =
+ ForayEntityResolver.class.getResourceAsStream("/resources/org/axsl/dtds/" + dtdName);
+ return theStream;
+ }
+
+ /**
+ * Create an entity resolver that knows how to find the local copy of all aXSL DTDs.
+ * @return An entity resolver for the appropriate DTD, or null if none is found.
+ */
+ public static EntityResolver getEntityResolver() {
+ final EntityResolver resolver = new EntityResolver() {
+ public InputSource resolveEntity(final String publicId, final String systemId) throws SAXException,
+ IOException {
+ InputStream inputStream = null;
+ if (ForayEntityResolver.NATURAL_LANGUAGE_PUBLIC_ID.equals(publicId)) {
+ inputStream = ForayEntityResolver.getAxslDtdAsInputStream("axsl-natural-language.dtd");
+ } else if (ForayEntityResolver.HYPHENATION_PUBLIC_ID.equals(publicId)) {
+ inputStream = ForayEntityResolver.getAxslDtdAsInputStream("axsl-hyphenation.dtd");
+ } else if (ForayEntityResolver.DICTIONARY_PUBLIC_ID.equals(publicId)) {
+ inputStream = ForayEntityResolver.getAxslDtdAsInputStream("axsl-dictionary.dtd");
+ } else if (ForayEntityResolver.FONT_CONFIG_PUBLIC_ID.equals(publicId)) {
+ inputStream = ForayEntityResolver.getAxslDtdAsInputStream("axsl-font-config.dtd");
+ } else if (ForayEntityResolver.ORTHOGRAPHY_CONFIG_PUBLIC_ID.equals(publicId)) {
+ inputStream = ForayEntityResolver.getAxslDtdAsInputStream("axsl-orthography-config.dtd");
+ } else if (ForayEntityResolver.AREA_TREE_PUBLIC_ID.equals(publicId)) {
+ inputStream = ForayEntityResolver.getAxslDtdAsInputStream("axsl-area-tree.dtd");
+ } else if (ForayEntityResolver.PARTS_OF_SPEECH.equals(publicId)) {
+ inputStream = ForayEntityResolver.getAxslDtdAsInputStream("axsl-parts-of-speech.dtd");
+ }
+ if (inputStream == null) {
+ return null;
+ }
+ final InputSource inputSource = new InputSource(inputStream);
+ return inputSource;
+ }
+ };
+ return resolver;
+ }
+
+}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java 2021-12-29 21:45:24 UTC (rev 12295)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java 2021-12-29 22:14:05 UTC (rev 12296)
@@ -28,7 +28,7 @@
package org.foray.font.config;
-import org.foray.common.AxslDtdUtil;
+import org.foray.common.ForayEntityResolver;
import org.foray.common.url.UrlFactory;
import org.foray.common.xml.SaxParser;
import org.foray.font.FontServer4a;
@@ -150,7 +150,7 @@
@Override
public Object parse(final InputSource inputSource) throws IOException, ParserConfigurationException, SAXException {
- final XMLReader parser = createSax2Parser(true, true, true, AxslDtdUtil.getEntityResolver(), false);
+ final XMLReader parser = createSax2Parser(true, true, true, ForayEntityResolver.getEntityResolver(), false);
parser.parse(inputSource);
return null;
}
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 2021-12-29 21:45:24 UTC (rev 12295)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParser.java 2021-12-29 22:14:05 UTC (rev 12296)
@@ -28,7 +28,7 @@
package org.foray.orthography.util;
-import org.foray.common.AxslDtdUtil;
+import org.foray.common.ForayEntityResolver;
import org.foray.common.i18n.WritingSystem4a;
import org.foray.common.primitive.StringUtils;
import org.foray.common.xml.SaxParser;
@@ -141,7 +141,7 @@
throws IOException, SAXException, ParserConfigurationException {
getLogger().debug("Begin dictionary word list parsing: " + inputSource.getSystemId());
- final XMLReader parser = this.createSax2Parser(true, true, true, AxslDtdUtil.getEntityResolver(), false);
+ final XMLReader parser = createSax2Parser(true, true, true, ForayEntityResolver.getEntityResolver(), false);
if (parser != null) {
parser.parse(inputSource);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NatLangParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NatLangParser.java 2021-12-29 21:45:24 UTC (rev 12295)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NatLangParser.java 2021-12-29 22:14:05 UTC (rev 12296)
@@ -28,7 +28,7 @@
package org.foray.orthography.util;
-import org.foray.common.AxslDtdUtil;
+import org.foray.common.ForayEntityResolver;
import org.foray.common.primitive.UnicodeCharUtils;
import org.foray.common.xml.SaxParser;
@@ -57,7 +57,7 @@
@Override
public NaturalLanguage parse(final InputSource inputSource)
throws IOException, SAXException, ParserConfigurationException {
- final XMLReader parser = createSax2Parser(false, true, true, AxslDtdUtil.getEntityResolver(), false);
+ final XMLReader parser = createSax2Parser(false, true, true, ForayEntityResolver.getEntityResolver(), false);
parser.parse(inputSource);
return this.nl;
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/OrthographyParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/OrthographyParser.java 2021-12-29 21:45:24 UTC (rev 12295)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/OrthographyParser.java 2021-12-29 22:14:05 UTC (rev 12296)
@@ -28,7 +28,7 @@
package org.foray.orthography.util;
-import org.foray.common.AxslDtdUtil;
+import org.foray.common.ForayEntityResolver;
import org.foray.common.i18n.Country4a;
import org.foray.common.i18n.Language4a;
import org.foray.common.i18n.Script4a;
@@ -152,7 +152,7 @@
@Override
public Orthography4a parse(final InputSource inputSource)
throws IOException, SAXException, ParserConfigurationException {
- final XMLReader parser = createSax2Parser(true, true, true, AxslDtdUtil.getEntityResolver(), false);
+ final XMLReader parser = createSax2Parser(true, true, true, ForayEntityResolver.getEntityResolver(), false);
parser.parse(inputSource);
return this.currentOrthographyConfig;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-29 21:45:27
|
Revision: 12295
http://sourceforge.net/p/foray/code/12295
Author: victormote
Date: 2021-12-29 21:45:24 +0000 (Wed, 29 Dec 2021)
Log Message:
-----------
Improvements to finding foray-config.dtd locally.
Modified Paths:
--------------
trunk/foray/foray-core/build.gradle
trunk/foray/foray-core/src/main/java/org/foray/core/ForayConfigParser.java
Removed Paths:
-------------
trunk/foray/master/doc/web/dtds/0.1/en/foray-config.dtd
Modified: trunk/foray/foray-core/build.gradle
===================================================================
--- trunk/foray/foray-core/build.gradle 2021-12-29 18:17:57 UTC (rev 12294)
+++ trunk/foray/foray-core/build.gradle 2021-12-29 21:45:24 UTC (rev 12295)
@@ -26,4 +26,13 @@
options.header = "FOray Core API ${version}"
}
+/* We want the DTDs to live as part of the website files, so we need to copy them into the jar file here. */
+jar {
+ from rootProject.projectDir.absolutePath + '/doc/web/dtds/0.1/en/',
+ {
+ include '*.dtd'
+ into '/resources/org/foray/dtds/'
+ }
+}
+
/* Last line of script. */
Modified: trunk/foray/foray-core/src/main/java/org/foray/core/ForayConfigParser.java
===================================================================
--- trunk/foray/foray-core/src/main/java/org/foray/core/ForayConfigParser.java 2021-12-29 18:17:57 UTC (rev 12294)
+++ trunk/foray/foray-core/src/main/java/org/foray/core/ForayConfigParser.java 2021-12-29 21:45:24 UTC (rev 12295)
@@ -38,6 +38,7 @@
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -118,12 +119,16 @@
public Object parse(final InputSource inputSource) throws IOException, ParserConfigurationException, SAXException {
final EntityResolver resolver = new EntityResolver() {
public InputSource resolveEntity(final String publicId, final String systemId) throws SAXException,
- IOException {
+ IOException {
if (ForayConfigParser.FORAY_CONFIG_DTD_PUBLIC_ID.equals(publicId)) {
- final InputStream inputStream = ForayConfigParser.class.getResourceAsStream(
- "/org/foray/common/dtds/foray-config.dtd");
+ InputStream inputStream =
+ ForayConfigParser.class.getResourceAsStream("/resources/org/foray/dtds/foray-config.dtd");
+ /* If null, the user could be a developer running in an IDE.
+ * See build.gradle where the file is copied into the jar file.
+ * However, the IDE doesn't know how to find it because it lives with the website files.
+ * Therefore look for it on the file system instead. */
if (inputStream == null) {
- return null;
+ inputStream = new FileInputStream("../master/doc/web/dtds/0.1/en/foray-config.dtd");
}
return new InputSource(inputStream);
}
Deleted: trunk/foray/master/doc/web/dtds/0.1/en/foray-config.dtd
===================================================================
--- trunk/foray/master/doc/web/dtds/0.1/en/foray-config.dtd 2021-12-29 18:17:57 UTC (rev 12294)
+++ trunk/foray/master/doc/web/dtds/0.1/en/foray-config.dtd 2021-12-29 21:45:24 UTC (rev 12295)
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- $Id$ -->
-
-<!--
-This file is the XML DTD for a FOray configuration file.
- For general information about FOray:
- http://www.foray.org
- For specific information about FOray configuration:
- http://www.foray.org/app/using/configuration.html
-
-Use the following public and system IDs for this DTD:
-<!DOCTYPE foray-config
- PUBLIC "-//FOray//DTD FOray Configuration V0.1//EN"
- "http://www.foray.org/dtds/0.1/en/foray-config.dtd">
-
--->
-
-<!ELEMENT foray-config (entry+) >
-<!ELEMENT entry (key, value) >
-<!ELEMENT key (#PCDATA)>
-<!ELEMENT value (#PCDATA)>
-
-<!-- Last line of file. -->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-29 18:17:58
|
Revision: 12294
http://sourceforge.net/p/foray/code/12294
Author: victormote
Date: 2021-12-29 18:17:57 +0000 (Wed, 29 Dec 2021)
Log Message:
-----------
Add catalog file for DTDs.
Added Paths:
-----------
trunk/foray/master/doc/web/dtds/0.1/en/00-foray-catalog.xml
Added: trunk/foray/master/doc/web/dtds/0.1/en/00-foray-catalog.xml
===================================================================
--- trunk/foray/master/doc/web/dtds/0.1/en/00-foray-catalog.xml (rev 0)
+++ trunk/foray/master/doc/web/dtds/0.1/en/00-foray-catalog.xml 2021-12-29 18:17:57 UTC (rev 12294)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE catalog
+ PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
+ "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
+
+
+<!--
+OASIS catalog suitable for those having access to FOray source code, or who have copied the aXSL DTDs to their local
+filesystem.
+-->
+
+
+
+<catalog prefer="public" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
+ xml:base=".">
+
+ <!-- FOray configuration DTD. -->
+ <public
+ publicId="-//FOray//DTD FOray Configuration V0.1//EN"
+ uri="./foray-config.dtd"/>
+ <system
+ systemId="http://www.foray.org/dtds/0.1/en/foray-config.dtd"
+ uri="./foray-config.dtd"/>
+
+</catalog>
Property changes on: trunk/foray/master/doc/web/dtds/0.1/en/00-foray-catalog.xml
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-29 17:14:06
|
Revision: 12293
http://sourceforge.net/p/foray/code/12293
Author: victormote
Date: 2021-12-29 17:14:03 +0000 (Wed, 29 Dec 2021)
Log Message:
-----------
Conform to aXSL change: Separate the ParaBranch from its ParaConfig.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.java
trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aTests.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
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/ParaBranch4aTestFixture.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaContentIteratorTests.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/SegmentDictionaryWordTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordWrapperTests.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-common/src/main/java/org/foray/common/para/ParaBranch4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.java 2021-12-29 16:14:05 UTC (rev 12292)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.java 2021-12-29 17:14:03 UTC (rev 12293)
@@ -30,7 +30,6 @@
import org.axsl.common.para.ParaBranch;
import org.axsl.common.para.ParaBranchFactory;
-import org.axsl.common.para.ParaConfig;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
@@ -51,21 +50,10 @@
}
};
- /** The configuration information for this branch. */
- private ParaConfig config;
-
/** The list of child nodes. */
private List<ParaNode> nodes = new ArrayList<ParaNode>();
/**
- * Constructor.
- * @param config The configuration information for this branch.
- */
- public ParaBranch4a(final ParaConfig config) {
- this.config = config;
- }
-
- /**
* No-args constructor.
*/
public ParaBranch4a() { }
@@ -169,11 +157,6 @@
return returnValue;
}
- @Override
- public ParaConfig getParaConfig() {
- return this.config;
- }
-
/**
* Adds a child node to this branch.
* @param newNode The node to be added.
@@ -198,11 +181,6 @@
}
@Override
- public void setParaConfig(final ParaConfig config) {
- this.config = config;
- }
-
- @Override
public ListIterator<ParaLeaf> leafIterator() {
return new ParaBranch4aIterator(this);
}
Modified: trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aTests.java
===================================================================
--- trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aTests.java 2021-12-29 16:14:05 UTC (rev 12292)
+++ trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aTests.java 2021-12-29 17:14:03 UTC (rev 12293)
@@ -28,11 +28,8 @@
package org.foray.common.para;
-import org.axsl.common.para.ParaConfig;
-
import org.junit.Assert;
import org.junit.Test;
-import org.mockito.Mockito;
/**
* Tests of {@Link ParaBranch4a}.
@@ -50,15 +47,14 @@
* -- William Shakespeare, "Twelfth Night," Act II, Scene 5.
*/
- final ParaConfig config = Mockito.mock(ParaConfig.class);
- final ParaBranch4a out = new ParaBranch4a(config);
- final ParaBranch4a nodeGreatness = new ParaBranch4a(config);
+ final ParaBranch4a out = new ParaBranch4a();
+ final ParaBranch4a nodeGreatness = new ParaBranch4a();
nodeGreatness.add(new ParaBoxChars("great"));
nodeGreatness.add(DiscretionaryHyphen4a.GOOD);
nodeGreatness.add(new ParaBoxChars("ness"));
/* Putting "Be" in a branch is unnecessary, but we with to test a branch as the first node. */
- final ParaBranch4a nodeBe = new ParaBranch4a(config);
+ final ParaBranch4a nodeBe = new ParaBranch4a();
nodeBe.add(new ParaBoxChars("B"));
nodeBe.add(new ParaBoxChars("e"));
out.add(nodeBe); // Node 0, Leaf 0 - 1
@@ -101,7 +97,7 @@
out.add(ParaGlueChars.SPACE); // Node 37, Leaf 44
/* Putting "them." in a branch is unnecessary, but we with to test a branch as the last node. */
- final ParaBranch4a nodeThem = new ParaBranch4a(config);
+ final ParaBranch4a nodeThem = new ParaBranch4a();
nodeThem.add(new ParaBoxChars("t"));
nodeThem.add(new ParaBoxChars("h"));
nodeThem.add(new ParaBoxChars("e"));
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete4a.java 2021-12-29 16:14:05 UTC (rev 12292)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete4a.java 2021-12-29 17:14:03 UTC (rev 12293)
@@ -36,7 +36,6 @@
import org.foray.fotree.PropertyList;
import org.axsl.common.para.ParaBranch;
-import org.axsl.common.para.ParaConfig;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
import org.axsl.font.FontUse;
@@ -273,16 +272,6 @@
}
@Override
- public ParaConfig getParaConfig() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setParaConfig(final ParaConfig config) {
- throw new UnsupportedOperationException();
- }
-
- @Override
public Type getParaNodeType() {
return ParaNode.Type.BRANCH;
}
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 2021-12-29 16:14:05 UTC (rev 12292)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2021-12-29 17:14:03 UTC (rev 12293)
@@ -29,11 +29,9 @@
package org.foray.fotree.fo.obj;
import org.foray.common.para.ParaBranch4a;
-import org.foray.common.para.ParaConfig4a;
import org.foray.fotree.FoObj;
import org.axsl.common.para.ParaBranch;
-import org.axsl.common.para.ParaConfig;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
import org.axsl.common.value.LinefeedTreatment;
@@ -76,9 +74,6 @@
final OrthographyServer orthographyServer = getOrthographyServer();
final Orthography orthography = orthographyServer.getOrthography(getWritingSystem());
this.paraBranch = orthography.tokenizeWordSequence(ParaBranch4a.getFactory(), content, 0, content.length());
- final ParaConfig4a config = new ParaConfig4a(getPrimaryFont(null), parent.traitFontSize(null), orthography,
- parent.traitWordSpacingMax(null), parent.traitWordSpacingMin(null));
- this.paraBranch.setParaConfig(config);
this.content = new ArrayList<FoWordSequenceContent>(this.paraBranch.paraNodeSize());
for (int index = 0; index < this.paraBranch.paraNodeSize(); index ++) {
final ParaNode wordSequenceContent = this.paraBranch.paraNodeAt(index);
@@ -123,16 +118,6 @@
}
@Override
- public ParaConfig getParaConfig() {
- return this.paraBranch.getParaConfig();
- }
-
- @Override
- public void setParaConfig(final ParaConfig config) {
- this.paraBranch.setParaConfig(config);
- }
-
- @Override
public Type getParaNodeType() {
return this.paraBranch.getParaNodeType();
}
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 2021-12-29 16:14:05 UTC (rev 12292)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/BestFitLb.java 2021-12-29 17:14:03 UTC (rev 12293)
@@ -29,6 +29,7 @@
package org.foray.linebreak;
import org.axsl.common.para.ParaBranch;
+import org.axsl.common.para.ParaConfig;
import org.axsl.common.para.ParaContext;
/**
@@ -38,7 +39,8 @@
public class BestFitLb extends LineBreaker4a {
@Override
- public LineBreakResult4a breakIntoLines(final ParaBranch paragraph, final ParaContext paraContext) {
+ public LineBreakResult4a breakIntoLines(final ParaBranch paragraph, final ParaConfig paraConfig,
+ final ParaContext paraContext) {
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 2021-12-29 16:14:05 UTC (rev 12292)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2021-12-29 17:14:03 UTC (rev 12293)
@@ -269,12 +269,12 @@
}
@Override
- public LineBreakResult4a breakIntoLines(final ParaBranch paragraph, final ParaContext paraContext) {
+ public LineBreakResult4a breakIntoLines(final ParaBranch paragraph, final ParaConfig paraConfig,
+ final ParaContext paraContext) {
/* 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. */
- final ParaConfig paraConfig = paragraph.getParaConfig();
final State state = new State(paraConfig, paraContext);
final ListIterator<ParaLeaf> leafIterator = paragraph.leafIterator();
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 2021-12-29 16:14:05 UTC (rev 12292)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/TotalFitLb.java 2021-12-29 17:14:03 UTC (rev 12293)
@@ -95,7 +95,8 @@
private int cumulativeShrink;
@Override
- public LineBreakResult4a breakIntoLines(final ParaBranch paragraph, final ParaContext paraContext) {
+ public LineBreakResult4a breakIntoLines(final ParaBranch paragraph, final ParaConfig paraConfig,
+ final ParaContext paraContext) {
this.paragraph = paragraph;
this.paraContext = paraContext;
final IntArrayBuilder returnValue = new IntArrayBuilder();
@@ -113,11 +114,11 @@
for (int index = 0; index < this.paragraph.paraNodeSize(); index ++) {
final ParaNode node = this.paragraph.paraNodeAt(index);
currentPath.push(index);
- flatten(node, currentPath);
+ flatten(node, currentPath, paraConfig);
currentPath.pop();
}
/* Add the paragraph terminator penalty item. */
- final LbNodeWrapper wrapper = new LbNodeWrapper(ParaPenalty4a.FORCED_BREAK, paragraph.getParaConfig(),
+ final LbNodeWrapper wrapper = new LbNodeWrapper(ParaPenalty4a.FORCED_BREAK, paraConfig,
this.contentNodes.size(), null);
this.contentNodes.add(wrapper);
@@ -139,22 +140,15 @@
* First round of processing for the nodes in the paragraph.
* @param node The node being processed.
* @param currentPath The path to {@code node}.
+ * @param paraConfig The paragraph layout configuration.
*/
- private void flatten(final ParaNode node, final IntArrayBuilder currentPath) {
+ private void flatten(final ParaNode node, final IntArrayBuilder currentPath, final ParaConfig paraConfig) {
switch (node.getParaNodeType()) {
case LEAF: {
final ParaLeaf leaf = node.asParaLeaf();
- ParaConfig config = null;
- for (int index = this.branchStack.size() - 1; index > -1; index --) {
- final ParaBranch branch = this.branchStack.get(index);
- if (branch.getParaConfig() != null) {
- config = branch.getParaConfig();
- break;
- }
- }
final int index = this.contentNodes.size();
final OrderedTreePath4a path = new OrderedTreePath4a(currentPath.toIntArray());
- final LbNodeWrapper wrapper = new LbNodeWrapper(leaf, config, index, path);
+ final LbNodeWrapper wrapper = new LbNodeWrapper(leaf, paraConfig, index, path);
this.contentNodes.add(wrapper);
break;
}
@@ -164,7 +158,7 @@
for (int index = 0; index < branch.paraNodeSize(); index ++) {
final ParaNode childNode = branch.paraNodeAt(index);
currentPath.push(index);
- flatten(childNode, currentPath);
+ flatten(childNode, currentPath, paraConfig);
currentPath.pop();
}
this.branchStack.pop();
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 2021-12-29 16:14:05 UTC (rev 12292)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java 2021-12-29 17:14:03 UTC (rev 12293)
@@ -30,6 +30,7 @@
import org.foray.common.para.ParaBranch4a;
+import org.axsl.common.para.ParaConfig;
import org.axsl.common.para.ParaContext;
import org.junit.Assert;
@@ -45,13 +46,13 @@
*/
@Test
public void firstFitTestSingleLine() {
- final ParaBranch4aTestFixture para = new ParaBranch4aTestFixture(null, '-');
+ final ParaBranch4aTestFixture para = new ParaBranch4aTestFixture('-');
para.addWord("Hello World!");
para.addSpace();
- para.setParaConfig(createGrimmParaConfig());
+ final ParaConfig paraConfig = createGrimmParaConfig();
final ParaContext paraContext = createParaContext(-1);
final FirstFitLb out = new FirstFitLb();
- final LineBreakResult4a actual = out.breakIntoLines(para, paraContext);
+ final LineBreakResult4a actual = out.breakIntoLines(para, paraConfig, paraContext);
Assert.assertEquals(1, actual.getQtyLines());
Assert.assertEquals(468000, actual.getLineLength(0));
Assert.assertEquals(1, actual.getBreakPosition(0));
@@ -63,13 +64,13 @@
@Test
public void firstFitTestGrimm() {
final ParaBranch4a para = this.createPara();
- para.setParaConfig(createGrimmParaConfig());
+ 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 FirstFitLb out = new FirstFitLb();
- final LineBreakResult4a actual = out.breakIntoLines(para, paraContext);
+ final LineBreakResult4a actual = out.breakIntoLines(para, paraConfig, paraContext);
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 2021-12-29 16:14:05 UTC (rev 12292)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2021-12-29 17:14:03 UTC (rev 12293)
@@ -90,7 +90,7 @@
* @return The tokenized content of {@link #TEST_STRING_01}.
*/
public ParaBranch4a createPara() {
- final ParaBranch4aTestFixture para = new ParaBranch4aTestFixture(null, '-');
+ final ParaBranch4aTestFixture para = new ParaBranch4aTestFixture('-');
// ----Leaf--- Ideal Cumul
// Index Qty Width Width
// ------ --- ----- -----
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaBranch4aTestFixture.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaBranch4aTestFixture.java 2021-12-29 16:14:05 UTC (rev 12292)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaBranch4aTestFixture.java 2021-12-29 17:14:03 UTC (rev 12293)
@@ -32,7 +32,6 @@
import org.foray.orthography.StringWord;
import org.foray.orthography.Whitespace4a;
-import org.axsl.common.para.ParaConfig;
import org.axsl.common.para.ParaNode;
import java.util.regex.Pattern;
@@ -47,11 +46,9 @@
/**
* Constructor.
- * @param config The configuration information for this branch.
* @param softHyphenChar The character used to mark syllable breaks.
*/
- public ParaBranch4aTestFixture(final ParaConfig config, final char softHyphenChar) {
- super(config);
+ public ParaBranch4aTestFixture(final char softHyphenChar) {
this.wordBreaker = Pattern.compile(Character.toString(softHyphenChar));
}
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaContentIteratorTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaContentIteratorTests.java 2021-12-29 16:14:05 UTC (rev 12292)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaContentIteratorTests.java 2021-12-29 17:14:03 UTC (rev 12293)
@@ -48,11 +48,11 @@
*/
@Test
public void test01() {
- final ParaBranch4a root = new ParaBranch4a(null);
+ final ParaBranch4a root = new ParaBranch4a();
final ParaBox4a a = new ParaBox4a(0);
- final ParaBranch4a b = new ParaBranch4a(null);
- final ParaBranch4a c = new ParaBranch4a(null);
- final ParaBranch4a d = new ParaBranch4a(null);
+ final ParaBranch4a b = new ParaBranch4a();
+ final ParaBranch4a c = new ParaBranch4a();
+ final ParaBranch4a d = new ParaBranch4a();
final ParaBox4a e = new ParaBox4a(0);
final ParaBox4a f = new ParaBox4a(0);
final ParaBox4a g = new ParaBox4a(0);
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 2021-12-29 16:14:05 UTC (rev 12292)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2021-12-29 17:14:03 UTC (rev 12293)
@@ -30,6 +30,7 @@
import org.foray.common.para.ParaBranch4a;
+import org.axsl.common.para.ParaConfig;
import org.axsl.common.para.ParaContext;
import org.junit.Assert;
@@ -50,12 +51,12 @@
/* TODO: THE CLASS BEING TESTED IS VERY INCOMPLETE, AND SO IS THIS TEST !!!!!! */
final ParaBranch4a para = this.createPara();
- para.setParaConfig(createGrimmParaConfig());
+ final ParaConfig paraConfig = createGrimmParaConfig();
/* Line width obtained from "Digital Typography," p. 73.*/
final ParaContext paraContext = createParaContext(390_000);
final TotalFitLb out = new TotalFitLb();
- final LineBreakResult4a actual = out.breakIntoLines(para, paraContext);
+ final LineBreakResult4a actual = out.breakIntoLines(para, paraConfig, paraContext);
final int[] expected = new int[0];
Assert.assertEquals(expected, actual);
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 2021-12-29 16:14:05 UTC (rev 12292)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2021-12-29 17:14:03 UTC (rev 12293)
@@ -34,7 +34,6 @@
import org.axsl.common.para.DiscretionaryHyphen;
import org.axsl.common.para.ParaBranch;
-import org.axsl.common.para.ParaConfig;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
import org.axsl.common.sequence.ByteSequence;
@@ -217,16 +216,6 @@
return this.getWordComponent(index);
}
- @Override
- public ParaConfig getParaConfig() {
- return null;
- }
-
- @Override
- public void setParaConfig(final ParaConfig config) {
- /* Nothing to do here. */
- }
-
/**
* Returns the index (from a {@link CharSequence} standpoint) to the first character of a given segment.
* For example, for the word phi-los-o-phy, getSegmentStart(1) should return the index to the second segment
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/SegmentDictionaryWordTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/SegmentDictionaryWordTests.java 2021-12-29 16:14:05 UTC (rev 12292)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/SegmentDictionaryWordTests.java 2021-12-29 17:14:03 UTC (rev 12293)
@@ -113,15 +113,6 @@
}
/**
- * Test of {@link SegmentDictionaryWord#getParaConfig()}.
- */
- @Test
- public void getParaConfigTests() {
- final SegmentDictionaryWord word = dictionary.getWord("ambition", 0);
- Assert.assertNull(word.getParaConfig());
- }
-
- /**
* Test of {@link SegmentDictionaryWord#getParaNodeType()}.
*/
@Test
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordWrapperTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordWrapperTests.java 2021-12-29 16:14:05 UTC (rev 12292)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordWrapperTests.java 2021-12-29 17:14:03 UTC (rev 12293)
@@ -319,14 +319,6 @@
}
/**
- * Test method for {@link org.foray.orthography.WordWrapper#getParaConfig()}.
- */
- @Test
- public void testGetParaConfig() {
- Assert.assertNull(this.out.getParaConfig());
- }
-
- /**
* Test method for {@link org.foray.orthography.WordWrapper#getWrappedWord()}.
*/
@Test
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 2021-12-29 16:14:05 UTC (rev 12292)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java 2021-12-29 17:14:03 UTC (rev 12293)
@@ -34,6 +34,7 @@
import org.axsl.area.LineArea;
import org.axsl.area.NormalBlockArea;
import org.axsl.common.para.ParaBranch;
+import org.axsl.common.para.ParaConfig;
import org.axsl.common.para.ParaNode;
import org.axsl.fotree.fo.BlockDiscrete;
import org.axsl.fotree.fo.GraftingPoint;
@@ -74,7 +75,8 @@
final NormalBlockArea blockArea = bcArea.makeNormalBlockArea(this.blockDiscrete, graftingPoint);
final LineBreaker breaker = blockArea.getAreaTree().getLineBreaker();
- final LineBreakResult result = breaker.breakIntoLines(this.blockDiscrete, blockArea.getParaContext());
+ final LineBreakResult result = breaker.breakIntoLines(
+ this.blockDiscrete, (ParaConfig) this.blockDiscrete, blockArea.getParaContext());
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 2021-12-29 16:14:05 UTC (rev 12292)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java 2021-12-29 17:14:03 UTC (rev 12293)
@@ -32,6 +32,7 @@
import org.axsl.area.AreaTreeException;
import org.axsl.area.LineArea;
import org.axsl.area.NormalBlockArea;
+import org.axsl.common.para.ParaConfig;
import org.axsl.common.para.ParaContext;
import org.axsl.fotree.fo.FoTextWords;
import org.axsl.fotree.fo.GraftingPoint;
@@ -73,7 +74,7 @@
final NormalBlockArea normalBlockArea = (NormalBlockArea) areaNode;
final LineBreaker lb = areaNode.getAreaTree().getLineBreaker();
- final LineBreakResult result = lb.breakIntoLines(this.node, paraContext);
+ final LineBreakResult result = lb.breakIntoLines(this.node, (ParaConfig) this.node, paraContext);
int lastLeafIndex = 0;
for (int index = 0; index < result.getQtyLines(); index ++) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-29 16:14:07
|
Revision: 12292
http://sourceforge.net/p/foray/code/12292
Author: victormote
Date: 2021-12-29 16:14:05 +0000 (Wed, 29 Dec 2021)
Log Message:
-----------
1. Conform to aXSL change: Add methods to LineContentFactory to handle ParaLeaf and ParaBranch content. 2. Add logic to use these methods to capture line content from the KP line-breaking scheme.
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-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 2021-12-28 20:16:42 UTC (rev 12291)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java 2021-12-29 16:14:05 UTC (rev 12292)
@@ -31,6 +31,8 @@
import org.foray.common.FontContext4a;
import org.axsl.area.AreaTreeException;
+import org.axsl.common.para.ParaBranch;
+import org.axsl.common.para.ParaLeaf;
import org.axsl.font.FontContext;
import org.axsl.fotree.fo.BasicLink;
import org.axsl.fotree.fo.BidiOverride;
@@ -217,6 +219,18 @@
return newIpclArea;
}
+ @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 2021-12-28 20:16:42 UTC (rev 12291)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java 2021-12-29 16:14:05 UTC (rev 12292)
@@ -33,6 +33,8 @@
import org.axsl.area.AreaTreeException;
import org.axsl.area.LineArea;
+import org.axsl.common.para.ParaBranch;
+import org.axsl.common.para.ParaLeaf;
import org.axsl.common.value.Conditionality;
import org.axsl.common.value.LineStackingStrategy;
import org.axsl.common.value.RelativeAxis;
@@ -1134,6 +1136,28 @@
return newIpclArea;
}
+ @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 == null) {
+ return;
+ }
+ if (branch instanceof FoTextWords) {
+ final FoTextWords foTextWords = (FoTextWords) branch;
+ makeGlyphAreaSequence(foTextWords, offset, length, false, null);
+ return;
+ }
+ throw new IllegalArgumentException();
+ }
+
/**
* Indicates whether this line-area has a half-leading on both its before
* and after edges.
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 2021-12-28 20:16:42 UTC (rev 12291)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java 2021-12-29 16:14:05 UTC (rev 12292)
@@ -28,14 +28,16 @@
package org.foray.pioneer;
-import org.foray.common.primitive.ObjectUtils;
-
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
import org.axsl.area.BlockLevelAreaFactory;
+import org.axsl.area.LineArea;
import org.axsl.area.NormalBlockArea;
+import org.axsl.common.para.ParaBranch;
+import org.axsl.common.para.ParaNode;
import org.axsl.fotree.fo.BlockDiscrete;
import org.axsl.fotree.fo.GraftingPoint;
+import org.axsl.linebreak.LineBreakResult;
import org.axsl.linebreak.LineBreaker;
/**
@@ -72,9 +74,47 @@
final NormalBlockArea blockArea = bcArea.makeNormalBlockArea(this.blockDiscrete, graftingPoint);
final LineBreaker breaker = blockArea.getAreaTree().getLineBreaker();
-// final LineBreakResult result = breaker.breakIntoLines((ParaBranch) this.blockDiscrete, blockArea, blockArea);
- ObjectUtils.noOperation(breaker);
+ final LineBreakResult result = breaker.breakIntoLines(this.blockDiscrete, blockArea.getParaContext());
+ int lastBreakPosition = 0;
+ for (int lineIndex = 0; lineIndex < result.getQtyLines(); lineIndex ++) {
+ final int breakPosition = result.getBreakPosition(lineIndex);
+ final int qtyLineNodes = breakPosition - lastBreakPosition;
+ final LineArea lineArea = blockArea.makeLineArea(true);
+ int lineNodesConsumed = 0;
+ ParaBranch currentBranch = null;
+ int branchNodesConsumed = 0;
+ for (int contentIndex = lastBreakPosition; contentIndex < breakPosition; contentIndex ++) {
+ final ParaNode paraNode = this.blockDiscrete.paraNodeAt(contentIndex);
+ switch (paraNode.getParaNodeType()) {
+ case LEAF: {
+ currentBranch = null;
+ branchNodesConsumed = 0;
+ lineArea.addParaLeaf(paraNode.asParaLeaf());
+ lineNodesConsumed ++;
+ break;
+ }
+ case BRANCH: {
+ final ParaBranch branch = paraNode.asParaBranch();
+ if (currentBranch == null
+ /* This is deliberately an identity test, not an equality test. */
+ || currentBranch != branch) {
+ currentBranch = branch;
+ branchNodesConsumed = 0;
+ }
+ final int branchNodesRemaining = branch.paraNodeSize() - branchNodesConsumed;
+ final int lineNodesRemaining = qtyLineNodes - lineNodesConsumed;
+ final int length = Math.min(lineNodesRemaining, branchNodesRemaining);
+ lineArea.addParaBranch(paraNode.asParaBranch(), branchNodesConsumed, length);
+ lineNodesConsumed += length;
+ break;
+ }
+ default: throw new IllegalStateException();
+ }
+ }
+ lastBreakPosition = breakPosition;
+ }
+
return Status.OK;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-28 20:16:44
|
Revision: 12291
http://sourceforge.net/p/foray/code/12291
Author: victormote
Date: 2021-12-28 20:16:42 +0000 (Tue, 28 Dec 2021)
Log Message:
-----------
Conform to aXSL change: Since we are now passing the text modifier parameters to the methods, remove the wrapping concept used previously.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java
trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoNodePnr.java
Removed Paths:
-------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java 2021-12-28 20:04:02 UTC (rev 12290)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java 2021-12-28 20:16:42 UTC (rev 12291)
@@ -1,247 +0,0 @@
-/*
- * Copyright 2006 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.fotree;
-
-import org.axsl.common.TextModifiers;
-import org.axsl.font.FontContext;
-import org.axsl.font.FontUse;
-import org.axsl.fotree.FoContext;
-import org.axsl.fotree.fo.GraftingPoint;
-import org.axsl.orthography.Orthography;
-import org.axsl.text.line.LineText;
-
-/**
- * Wraps an underlying "real" FoLineText along with the context to be used by
- * that item for trait resolution.
- */
-public class FoLineText implements org.axsl.fotree.FoLineText {
-
- /** The wrapped text item. */
- private org.axsl.fotree.FoLineText realLineText;
-
- /** The FO context for this text item. */
- private FoContext context;
-
- /**
- * Constructor.
- * @param realLineText The wrapped text item.
- * @param context The FO context for this text item.
- */
- public FoLineText(final org.axsl.fotree.FoLineText realLineText, final FoContext context) {
- this.realLineText = realLineText;
- this.context = context;
- }
-
- @Override
- public CharSequence inlineText(final TextModifiers textModifiers) {
- return this.realLineText.inlineText(this.context);
- }
-
- @Override
- public CharSequence inlineText(final FoContext context) {
- return this.realLineText.inlineText(context);
- }
-
- @Override
- public FontUse inlinePrimaryFont() {
- return this.realLineText.inlinePrimaryFont(this.context);
- }
-
- @Override
- public FontUse inlinePrimaryFont(final FoContext context) {
- return this.realLineText.inlinePrimaryFont(context);
- }
-
- @Override
- public FontUse inlineSecondaryFont(final char c) {
- return this.realLineText.inlineSecondaryFont(this.context, c);
- }
-
- @Override
- public FontUse inlineSecondaryFont(final FoContext context, final char c) {
- return this.realLineText.inlineSecondaryFont(context, c);
- }
-
- @Override
- public int inlineFontSize() {
- return this.realLineText.inlineFontSize(this.context);
- }
-
- @Override
- public int inlineFontSize(final FoContext context) {
- return this.realLineText.inlineFontSize(context);
- }
-
- @Override
- public int inlineLetterSpacingOptimum() {
- return this.realLineText.inlineLetterSpacingOptimum(this.context);
- }
-
- @Override
- public int inlineLetterSpacingOptimum(final FoContext context) {
- return this.realLineText.inlineLetterSpacingOptimum(context);
- }
-
- @Override
- public int inlineWordSpacingOptimum() {
- return this.realLineText.inlineWordSpacingOptimum(this.context);
- }
-
- @Override
- public int inlineWordSpacingOptimum(final FoContext context) {
- return this.realLineText.inlineWordSpacingOptimum(context);
- }
-
- @Override
- public boolean inlineWrapOption() {
- return this.realLineText.inlineWrapOption(this.context);
- }
-
- @Override
- public boolean inlineWrapOption(final FoContext context) {
- return this.realLineText.inlineWrapOption(context);
- }
-
- @Override
- public boolean inlineHyphenate() {
- return this.realLineText.inlineHyphenate(this.context);
- }
-
- @Override
- public boolean inlineHyphenate(final FoContext context) {
- return this.realLineText.inlineHyphenate(context);
- }
-
- @Override
- public Orthography inlineOrthography() {
- return this.realLineText.inlineOrthography();
- }
-
- @Override
- public int inlineHyphenationRemainCount() {
- return this.realLineText.inlineHyphenationRemainCount(this.context);
- }
-
- @Override
- public int inlineHyphenationRemainCount(final FoContext context) {
- return this.realLineText.inlineHyphenationRemainCount(context);
- }
-
- @Override
- public int inlineHyphenationPushCount() {
- return this.realLineText.inlineHyphenationPushCount(this.context);
- }
-
- @Override
- public int inlineHyphenationPushCount(final FoContext context) {
- return this.realLineText.inlineHyphenationPushCount(context);
- }
-
- @Override
- public int inlineHyphenationCharacter() {
- return this.realLineText.inlineHyphenationCharacter(this.context);
- }
-
- @Override
- public int inlineHyphenationCharacter(final FoContext context) {
- return this.realLineText.inlineHyphenationCharacter(context);
- }
- @Override
- public boolean inlineIsFauxSmallCaps() {
- return this.realLineText.inlineIsFauxSmallCaps(this.context);
- }
-
- @Override
- public boolean inlineIsFauxSmallCaps(final FoContext context) {
- return this.realLineText.inlineIsFauxSmallCaps(context);
- }
-
- @Override
- public int inlineFauxSmallCapsFontSize() {
- return this.realLineText.inlineFauxSmallCapsFontSize(this.context);
- }
-
- @Override
- public int inlineFauxSmallCapsFontSize(final FoContext context) {
- return this.realLineText.inlineFauxSmallCapsFontSize(context);
- }
-
- @Override
- public LineText nextContiguousLineText() {
- return this.realLineText.nextContiguousLineText();
- }
-
- @Override
- public LineText previousContiguousLineText() {
- return this.realLineText.previousContiguousLineText();
- }
-
- @Override
- public boolean isLastItemInBlock() {
- return this.realLineText.isLastItemInBlock();
- }
-
- @Override
- public org.axsl.fotree.FoLineText getContextWrapper(final FoContext context) {
- /* This *is* the wrapper. */
- return this;
- }
-
- @Override
- public org.axsl.fotree.FoLineText getWrapped() {
- return this.realLineText;
- }
-
- @Override
- public GraftingPoint getGraftingPoint() {
- return this.context.getGraftingPoint();
- }
-
- @Override
- public FontContext inlineFontContext() {
- // TODO Auto-generated method stub
- return null;
- }
-
-// @Override
-// public int length() {
-// return this.realLineText.length();
-// }
-//
-// @Override
-// public char charAt(final int index) {
-// return this.realLineText.charAt(index);
-// }
-//
-// @Override
-// public CharSequence subSequence(final int start, final int end) {
-// return this.realLineText.subSequence(start, end);
-// }
-//
-}
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 2021-12-28 20:04:02 UTC (rev 12290)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-12-28 20:16:42 UTC (rev 12291)
@@ -133,6 +133,7 @@
import org.axsl.fotree.FoAllProperties;
import org.axsl.fotree.FoContext;
import org.axsl.fotree.FoInlineContext;
+import org.axsl.fotree.FoLineText;
import org.axsl.fotree.FoTreeException;
import org.axsl.fotree.fo.FoTextCharacters;
import org.axsl.fotree.fo.Marker;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java 2021-12-28 20:04:02 UTC (rev 12290)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java 2021-12-28 20:16:42 UTC (rev 12291)
@@ -271,21 +271,6 @@
}
@Override
- public org.axsl.fotree.FoLineText getContextWrapper(final FoContext context) {
- final org.axsl.fotree.fo.Marker marker = this.ancestorMarker();
- if (marker == null) {
- return this;
- }
- return new org.foray.fotree.FoLineText(this, context);
- }
-
- @Override
- public org.axsl.fotree.FoLineText getWrapped() {
- /* This is the wrapped item. */
- return this;
- }
-
- @Override
public GraftingPoint getGraftingPoint() {
return null;
}
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 2021-12-28 20:04:02 UTC (rev 12290)
+++ trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java 2021-12-28 20:16:42 UTC (rev 12291)
@@ -139,7 +139,7 @@
if (textToUse instanceof org.axsl.fotree.FoLineText) {
final FoLineText foLineText = (FoLineText) textToUse;
graftingPoint = foLineText.getGraftingPoint();
- textToUse = foLineText.getWrapped();
+ textToUse = foLineText;
}
LineContentFactory factory = lineArea;
if (this.areaStack.size() > 0) {
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 2021-12-28 20:04:02 UTC (rev 12290)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoNodePnr.java 2021-12-28 20:16:42 UTC (rev 12291)
@@ -230,10 +230,8 @@
fontConsumer);
}
int status = 0;
- final FoLineText contextAware = lineText.getContextWrapper(
- foContext);
try {
- status = lb.processLineContent(contextAware, foContext, start, end, lineArea);
+ status = lb.processLineContent(lineText, foContext, start, end, lineArea);
} catch (final TextException e) {
final Fo generatedBy = lineArea.traitGeneratedBy();
throw new AreaTreeException("Error in text layout:\n"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-28 20:04:04
|
Revision: 12290
http://sourceforge.net/p/foray/code/12290
Author: victormote
Date: 2021-12-28 20:04:02 +0000 (Tue, 28 Dec 2021)
Log Message:
-----------
Conform to aXSL changes: Require TextModifiers during line-breaking.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java
trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/EagerLineBreaker.java
trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoNodePnr.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java 2021-12-28 16:33:35 UTC (rev 12289)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java 2021-12-28 20:04:02 UTC (rev 12290)
@@ -28,6 +28,7 @@
package org.foray.fotree;
+import org.axsl.common.TextModifiers;
import org.axsl.font.FontContext;
import org.axsl.font.FontUse;
import org.axsl.fotree.FoContext;
@@ -58,7 +59,7 @@
}
@Override
- public CharSequence inlineText() {
+ public CharSequence inlineText(final TextModifiers textModifiers) {
return this.realLineText.inlineText(this.context);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java 2021-12-28 16:33:35 UTC (rev 12289)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java 2021-12-28 20:04:02 UTC (rev 12290)
@@ -32,6 +32,7 @@
import org.foray.common.i18n.Language4a;
import org.foray.fotree.FoObj;
+import org.axsl.common.TextModifiers;
import org.axsl.common.value.WrapOption;
import org.axsl.font.Font;
import org.axsl.font.FontContext;
@@ -63,7 +64,7 @@
public abstract boolean isAllWhiteSpace();
@Override
- public CharSequence inlineText() {
+ public CharSequence inlineText(final TextModifiers textModifers) {
return inlineText(null);
}
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 2021-12-28 16:33:35 UTC (rev 12289)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/EagerLineBreaker.java 2021-12-28 20:04:02 UTC (rev 12290)
@@ -30,6 +30,7 @@
import org.foray.text.TextServer4a;
+import org.axsl.common.TextModifiers;
import org.axsl.common.para.ParaContext;
import org.axsl.font.FontConsumer;
import org.axsl.linebreak.OutputLine;
@@ -70,17 +71,18 @@
/**
* Run a piece of content through the line-breaking system.
* @param lineContent The line content to be processed.
+ * @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.
* @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 int start,
+ protected int processInput(final LineContent lineContent, final TextModifiers textModifiers, final int start,
final int end) throws TextException {
int status = 0;
if (lineContent instanceof LineText) {
final LineText lineText = (LineText) lineContent;
- final CharSequence text = lineText.inlineText();
+ final CharSequence text = lineText.inlineText(textModifiers);
if (text.length() < 1) {
return -1;
}
@@ -101,7 +103,7 @@
}
if (shouldSwitch) {
// Process this chunk.
- status = processLineText(lineText, subsetStart, i - 1);
+ status = processLineText(lineText, textModifiers, subsetStart, i - 1);
// If it can't process the whole chunk, we need to exit.
if (status != i) {
return status;
@@ -110,10 +112,10 @@
setInLowerCase(! isInLowerCase());
}
}
- return processLineText(lineText, subsetStart, end);
+ return processLineText(lineText, textModifiers, subsetStart, end);
}
this.setInLowerCase(false);
- status = processLineText(lineText, start, end);
+ status = processLineText(lineText, textModifiers, start, end);
} else if (lineContent instanceof LineNonText) {
status = processLineNonText((LineNonText) lineContent);
} else {
@@ -156,33 +158,29 @@
/**
* Processes a line-text item.
* @param lineText The line-text item to be processed.
- * @param start The index to the first character in the line-text item that
- * should be processed.
- * @param end The index to the last character in the line-text item that
- * should be processed.
- * @return The index to the last character in the line-text item that was
- * actually processed.
+ * @param textModifiers The modification parameters to be applied to the text.
+ * @param start The index to the first character in the line-text item that should be processed.
+ * @param end The index to the last character in the line-text item that should be processed.
+ * @return The index to the last character in the line-text item that was actually processed.
* @throws TextException For errors during line-breaking.
*/
- protected abstract int processLineText(LineText lineText, int start,
- int end) throws TextException;
+ protected abstract int processLineText(LineText lineText, TextModifiers textModifiers, int start, int end)
+ throws TextException;
/**
* Add new line-content for processing.
* @param content The line-content to be processed.
- * @param start The index to the first element in the line-content to be
- * processed.
- * @param end The index to the last element in the line-content to be
- * processed.
+ * @param textModifiers The modification parameters to be applied to the text.
+ * @param start The index to the first element in the line-content to be processed.
+ * @param end The index to the last element in the line-content to be processed.
* @param output The line-output onto which the text should be placed.
- * @return The index to the last element in the line-content that was
- * actually processed.
+ * @return The index to the last element in the line-content that was actually processed.
* @throws TextException For errors during text processing.
*/
- public int addLineContent(final LineContent content, final int start,
+ public int addLineContent(final LineContent content, final TextModifiers textModifiers, final int start,
final int end, final OutputLine output) throws TextException {
setCurrentLine(output);
- return processInput(content, start, end);
+ return processInput(content, textModifiers, start, end);
}
/**
@@ -194,13 +192,13 @@
}
@Override
- public int processLineContent(final LineContent contentItem,
+ public int processLineContent(final LineContent contentItem, final TextModifiers textModifiers,
final int start, final int end, final OutputLine output)
throws TextException {
validateEagerContent(contentItem, output);
this.currentOutput = output;
this.currentLineContent = contentItem;
- return addLineContent(contentItem, start, end, output);
+ return addLineContent(contentItem, textModifiers, start, end, output);
}
/**
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2021-12-28 16:33:35 UTC (rev 12289)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2021-12-28 20:04:02 UTC (rev 12290)
@@ -31,6 +31,7 @@
import org.foray.text.TextServer4a;
import org.foray.text.line.EagerLineBreaker;
+import org.axsl.common.TextModifiers;
import org.axsl.common.para.ParaContext;
import org.axsl.font.FontConsumer;
import org.axsl.orthography.Orthography;
@@ -106,10 +107,10 @@
}
@Override
- protected int processLineText(final LineText lineText, final int start,
+ protected int processLineText(final LineText lineText, final TextModifiers textModifiers, final int start,
final int end) throws TextException {
this.currentLineText = lineText;
- this.currentChars = this.currentLineText.inlineText();
+ this.currentChars = this.currentLineText.inlineText(textModifiers);
// final WritingSystem orthography = lineText.inlineWritingSystem();
// final String language = orthography.getLanguage().getAlpha3Code();
@@ -148,7 +149,7 @@
// charCount++;
}
if (forcesLineBreak(codePoint)) {
- createLineContent(start, i, this.finalWidth, false);
+ createLineContent(textModifiers, start, i, this.finalWidth, false);
return i + 1;
}
if (allowsLineBreak(codePoint)) {
@@ -178,7 +179,7 @@
this.finalWidth += this.spaceWidth;
this.finalWidth += this.wordWidth;
this.finalWidth += getHyphenWidth(lineText);
- createLineContent(start, ret - 1, this.finalWidth, true);
+ createLineContent(textModifiers, start, ret - 1, this.finalWidth, true);
return ret;
}
}
@@ -192,13 +193,12 @@
this.finalWidth += this.spaceWidth;
this.finalWidth += this.wordWidth;
this.finalWidth -= charWidth;
- createLineContent(start, i - 1, this.finalWidth, false);
+ createLineContent(textModifiers, start, i - 1, this.finalWidth, false);
/* Return the index at the start of this character. */
return i - 1;
}
// Break the line at the end of the previous word.
- createLineContent(start, this.wordStart - 1, this.finalWidth,
- false);
+ createLineContent(textModifiers, start, this.wordStart - 1, this.finalWidth, false);
return this.wordStart;
}
/* We have now read through each character. */
@@ -205,14 +205,14 @@
/* If this ends with white space, place remaining contents on this
* line. */
if (this.previousCharacter == SolitaryLineBreaker.CONNECTOR) {
- return remainingContentOnThisLine(startIndex, endIndex);
+ return remainingContentOnThisLine(textModifiers, startIndex, endIndex);
}
/* Otherwise the word may continue into the next text. See if the
* entire word fits. */
if (this.finalWidth + this.spaceWidth + this.wordWidth
- + sizeFirstWordNextText(lineText, startIndex, endIndex)
+ + sizeFirstWordNextText(lineText, textModifiers, startIndex, endIndex)
<= lineReceivingContent().capacityRemaining()) {
- return remainingContentOnThisLine(startIndex, endIndex);
+ return remainingContentOnThisLine(textModifiers, startIndex, endIndex);
}
/* TODO: If the entire words doesn't fit, see if it can be
@@ -220,12 +220,13 @@
/* If nothing else works, the content doesn't fit on this line.
* Break the line at the end of the previous word. */
- createLineContent(start, this.wordStart - 1, this.finalWidth, false);
+ createLineContent(textModifiers, start, this.wordStart - 1, this.finalWidth, false);
return this.wordStart;
}
/**
* Returns the status of layout.
+ * @param textModifiers The modification parameters to be applied to the text.
* @param startIndex The index of the first character eligible for layout.
* @param endIndex The index of the last character eligible for layout.
* @return The index through which layout has been completed. In this case,
@@ -232,11 +233,11 @@
* it is one past endIndex, indicating that all has been laid out.
* @throws TextException For error layout out input text.
*/
- private int remainingContentOnThisLine(final int startIndex,
+ private int remainingContentOnThisLine(final TextModifiers textModifiers, final int startIndex,
final int endIndex) throws TextException {
this.finalWidth += this.spaceWidth;
this.finalWidth += this.wordWidth;
- createLineContent(startIndex, endIndex, this.finalWidth, false);
+ createLineContent(textModifiers, startIndex, endIndex, this.finalWidth, false);
return endIndex + 1;
}
@@ -243,11 +244,12 @@
/**
* Returns the size of the first word in the next text item.
* @param lineText The line-text item being processed.
+ * @param textModifiers The modification parameters to be applied to the text.
* @param start The index of the first character eligible for layout.
* @param end The index of the last character eligible for layout.
* @return The index through which layout was actually completed.
*/
- private int sizeFirstWordNextText(final LineText lineText, final int start,
+ private int sizeFirstWordNextText(final LineText lineText, final TextModifiers textModifiers, final int start,
final int end) {
int size = 0;
LineText nextText = lineText;
@@ -254,7 +256,7 @@
int whitespaceWidth = getCharWidth(nextText, ' ');
/* First see if there is additional text in the current item. Remember
* that faux small-caps breaks up the text item. */
- CharSequence text = nextText.inlineText();
+ CharSequence text = nextText.inlineText(textModifiers);
for (int i = end + 1; i < text.length(); i++) {
final char c = text.charAt(i);
if (forcesLineBreak(c) || allowsLineBreak(c)) {
@@ -267,7 +269,7 @@
if (nextText == null) {
return size;
}
- text = nextText.inlineText();
+ text = nextText.inlineText(textModifiers);
whitespaceWidth = getCharWidth(nextText, ' ');
for (int i = 0; i < text.length(); i++) {
final char c = text.charAt(i);
@@ -343,6 +345,7 @@
/**
* Outputs all or part of the current text component to the text handler.
+ * @param textModifiers The modification parameters to be applied to the text.
* @param startIndex The index to the first character that should be
* considered part of this line.
* @param endIndex The index to the last character that should be
@@ -353,12 +356,12 @@
* @throws TextException For errors disposing of the line-breaking
* results.
*/
- private void createLineContent(final int startIndex, final int endIndex,
+ private void createLineContent(final TextModifiers textModifiers, final int startIndex, final int endIndex,
final int sizeInline, final boolean isHyphenated)
throws TextException {
final LineText lineText = (LineText) this.getLineContent();
final boolean everythingWritten = endIndex >=
- lineText.inlineText().length();
+ lineText.inlineText(textModifiers).length();
boolean isLastItemOnLine = true;
if (everythingWritten) {
/* If everything was written, this may not be the last item on
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 2021-12-28 16:33:35 UTC (rev 12289)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoNodePnr.java 2021-12-28 20:04:02 UTC (rev 12290)
@@ -233,7 +233,7 @@
final FoLineText contextAware = lineText.getContextWrapper(
foContext);
try {
- status = lb.processLineContent(contextAware, start, end, lineArea);
+ status = lb.processLineContent(contextAware, foContext, start, end, lineArea);
} catch (final TextException e) {
final Fo generatedBy = lineArea.traitGeneratedBy();
throw new AreaTreeException("Error in text layout:\n"
@@ -268,10 +268,9 @@
this.layout, fontConsumer);
}
int status = 0;
- final FoLineNonText contextAware = nonText.getContextWrapper(
- foContext);
+ final FoLineNonText contextAware = nonText.getContextWrapper(foContext);
try {
- status = lb.processLineContent(contextAware, -1, -1, lineArea);
+ status = lb.processLineContent(contextAware, foContext, -1, -1, lineArea);
} catch (final TextException e) {
final Fo generatedBy = lineArea.traitGeneratedBy();
throw new AreaTreeException("Error in non-text layout:\n"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-28 16:33:38
|
Revision: 12289
http://sourceforge.net/p/foray/code/12289
Author: victormote
Date: 2021-12-28 16:33:35 +0000 (Tue, 28 Dec 2021)
Log Message:
-----------
Add FoContext to some places where text is resolved.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageNumber4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageNumberCitation4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageNumberCitationLast4a.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextPnr.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 2021-12-28 16:14:23 UTC (rev 12288)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-12-28 16:33:35 UTC (rev 12289)
@@ -145,7 +145,6 @@
import org.axsl.speech.SpeechException;
import org.axsl.speech.SpeechServer;
import org.axsl.speech.Voice;
-import org.axsl.text.line.LineText;
import org.slf4j.Logger;
@@ -2938,7 +2937,7 @@
* @return The resolved primary font.
*/
protected FontUse resolvePrimaryFont(final FoContext context) {
- final CharSequence firstTextSegment = this.firstTextSegment();
+ final CharSequence firstTextSegment = this.firstTextSegment(context);
int firstChar = UnicodeCharUtils.firstPrintable(firstTextSegment);
if (firstChar == WellKnownConstants.INVALID_UNICODE_CHARACTER) {
/* There are no printable characters in the first text segment,
@@ -3142,14 +3141,15 @@
/**
* Returns the underlying text of the first descendant text item.
+ * @param context An object that knows how to resolve FO Tree context issues.
* @return The underlying text of the first descendant text item.
*/
- public CharSequence firstTextSegment() {
- final LineText firstLineText = firstLineText();
+ public CharSequence firstTextSegment(final FoContext context) {
+ final FoLineText firstLineText = firstLineText();
if (firstLineText == null) {
return null;
}
- return firstLineText.inlineText();
+ return firstLineText.inlineText(context);
}
/**
@@ -3156,16 +3156,16 @@
* Recursively searched the descendants of this object looking for and returning the first descendant text item.
* @return The first descendant text item.
*/
- public LineText firstLineText() {
+ public FoLineText firstLineText() {
if (this.getChildren() == null) {
return null;
}
for (int i = 0; i < formattingObjectCount(); i++) {
final Object child = this.getChildren().get(i);
- if (child instanceof LineText) {
- return (LineText) child;
+ if (child instanceof FoLineText) {
+ return (FoLineText) child;
}
- LineText firstDescendant = null;
+ FoLineText firstDescendant = null;
if (child instanceof FoObj) {
firstDescendant = ((FoObj) child).firstLineText();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageNumber4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageNumber4a.java 2021-12-28 16:14:23 UTC (rev 12288)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageNumber4a.java 2021-12-28 16:33:35 UTC (rev 12289)
@@ -78,7 +78,7 @@
* encapsulates its underlying text.
*/
@Override
- public CharSequence firstTextSegment() {
+ public CharSequence firstTextSegment(final FoContext context) {
return PAGE_CITATION_TEXT_SEGMENT;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageNumberCitation4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageNumberCitation4a.java 2021-12-28 16:14:23 UTC (rev 12288)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageNumberCitation4a.java 2021-12-28 16:33:35 UTC (rev 12289)
@@ -79,7 +79,7 @@
* encapsulates its underlying text.
*/
@Override
- public CharSequence firstTextSegment() {
+ public CharSequence firstTextSegment(final FoContext context) {
return PAGE_CITATION_TEXT_SEGMENT;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageNumberCitationLast4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageNumberCitationLast4a.java 2021-12-28 16:14:23 UTC (rev 12288)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageNumberCitationLast4a.java 2021-12-28 16:33:35 UTC (rev 12289)
@@ -79,7 +79,7 @@
* encapsulates its underlying text.
*/
@Override
- public CharSequence firstTextSegment() {
+ public CharSequence firstTextSegment(final FoContext context) {
return PAGE_CITATION_TEXT_SEGMENT;
}
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextPnr.java 2021-12-28 16:14:23 UTC (rev 12288)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextPnr.java 2021-12-28 16:33:35 UTC (rev 12289)
@@ -88,7 +88,7 @@
private int addText(final FoLineText lineText, final AreaNode areaNode,
final int start, final GraftingPoint graftingPoint)
throws AreaTreeException {
- final int end = lineText.inlineText().length();
+ final int end = lineText.inlineText(areaNode).length();
final LineArea la = this.activeLineArea(areaNode);
if (la == null) {
return start;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-28 16:14:25
|
Revision: 12288
http://sourceforge.net/p/foray/code/12288
Author: victormote
Date: 2021-12-28 16:14:23 +0000 (Tue, 28 Dec 2021)
Log Message:
-----------
Conform to aXSL change: Add the four text-modification traits to the FoContext interface.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTest.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/OverrideGraftingContext.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2021-12-28 15:29:56 UTC (rev 12287)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2021-12-28 16:14:23 UTC (rev 12288)
@@ -36,16 +36,12 @@
import org.axsl.area.BlockContainerRefArea;
import org.axsl.common.value.AbsoluteAxis;
import org.axsl.common.value.AbsoluteDirection;
-import org.axsl.common.value.LinefeedTreatment;
import org.axsl.common.value.LinkType;
import org.axsl.common.value.RelativeAxis;
-import org.axsl.common.value.TextTransform;
-import org.axsl.common.value.WhiteSpaceTreatment;
import org.axsl.common.value.WritingMode;
import org.axsl.font.Font;
import org.axsl.fotree.Fo;
import org.axsl.fotree.fo.BasicLink;
-import org.axsl.fotree.fo.Block;
import org.axsl.fotree.fo.prop.IdPa;
import org.axsl.fotree.fo.prop.WritingModePa;
@@ -724,35 +720,6 @@
// return (short) (cumulative % WellKnownConstants.DEGREES_PER_CIRCLE);
}
- @Override
- public WhiteSpaceTreatment traitWhiteSpaceTreatment() {
- final NormalBlockArea4a nearestBlockArea = this.nearestNormalBlockArea();
- final Block block = nearestBlockArea.traitGeneratedBy();
- return block.traitWhiteSpaceTreatment(nearestBlockArea);
- }
-
- @Override
- public LinefeedTreatment traitLinefeedTreatment() {
- final NormalBlockArea4a nearestBlockArea = this.nearestNormalBlockArea();
- final Block block = nearestBlockArea.traitGeneratedBy();
- return block.traitLinefeedTreatment(nearestBlockArea);
- }
-
- @Override
- public TextTransform traitTextTransform() {
- /* TODO: This isn't quite right: text-transform is applicable to more areas than normal-block-area. */
- final NormalBlockArea4a nearestBlockArea = this.nearestNormalBlockArea();
- final Block block = nearestBlockArea.traitGeneratedBy();
- return block.traitTextTransform(nearestBlockArea);
- }
-
- @Override
- public boolean traitWhiteSpaceCollapse() {
- final NormalBlockArea4a nearestBlockArea = this.nearestNormalBlockArea();
- final Block block = nearestBlockArea.traitGeneratedBy();
- return block.traitWhiteSpaceCollapse(nearestBlockArea);
- }
-
/**
* Indicates whether this is the first child of the "generated by".
* @return True if and only if this is the first child of the "generated by".
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2021-12-28 15:29:56 UTC (rev 12287)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2021-12-28 16:14:23 UTC (rev 12288)
@@ -36,7 +36,11 @@
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
import org.axsl.area.BlockLevelAreaFactory;
+import org.axsl.common.value.LinefeedTreatment;
+import org.axsl.common.value.TextTransform;
+import org.axsl.common.value.WhiteSpaceTreatment;
import org.axsl.fotree.Fo;
+import org.axsl.fotree.fo.Block;
import org.axsl.fotree.fo.GraftingPoint;
import org.axsl.fotree.fo.Table;
import org.axsl.fotree.fo.prop.ColorPa;
@@ -793,4 +797,32 @@
return null;
}
+ @Override
+ public WhiteSpaceTreatment traitWhiteSpaceTreatment() {
+ final NormalBlockArea4a nearestBlockArea = this.nearestNormalBlockArea();
+ final Block block = nearestBlockArea.traitGeneratedBy();
+ return block.traitWhiteSpaceTreatment(nearestBlockArea);
+ }
+
+ @Override
+ public LinefeedTreatment traitLinefeedTreatment() {
+ final NormalBlockArea4a nearestBlockArea = this.nearestNormalBlockArea();
+ final Block block = nearestBlockArea.traitGeneratedBy();
+ return block.traitLinefeedTreatment(nearestBlockArea);
+ }
+
+ @Override
+ public TextTransform traitTextTransform() {
+ /* TODO: This isn't quite right: text-transform is applicable to more areas than normal-block-area. */
+ final NormalBlockArea4a nearestBlockArea = this.nearestNormalBlockArea();
+ final Block block = nearestBlockArea.traitGeneratedBy();
+ return block.traitTextTransform(nearestBlockArea);
+ }
+
+ @Override
+ public boolean traitWhiteSpaceCollapse() {
+ final NormalBlockArea4a nearestBlockArea = this.nearestNormalBlockArea();
+ final Block block = nearestBlockArea.traitGeneratedBy();
+ return block.traitWhiteSpaceCollapse(nearestBlockArea);
+ }
}
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTest.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTest.java 2021-12-28 15:29:56 UTC (rev 12287)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTest.java 2021-12-28 16:14:23 UTC (rev 12288)
@@ -30,6 +30,9 @@
import org.foray.fotree.fo.obj.Root4a;
+import org.axsl.common.value.LinefeedTreatment;
+import org.axsl.common.value.TextTransform;
+import org.axsl.common.value.WhiteSpaceTreatment;
import org.axsl.font.FontConsumer;
import org.axsl.font.FontServer;
import org.axsl.fotree.FoContext;
@@ -81,6 +84,22 @@
public int ipdParentArea() {
return 72000;
}
+ @Override
+ public LinefeedTreatment traitLinefeedTreatment() {
+ return LinefeedTreatment.TREAT_AS_SPACE;
+ }
+ @Override
+ public TextTransform traitTextTransform() {
+ return TextTransform.NONE;
+ }
+ @Override
+ public boolean traitWhiteSpaceCollapse() {
+ return true;
+ }
+ @Override
+ public WhiteSpaceTreatment traitWhiteSpaceTreatment() {
+ return WhiteSpaceTreatment.IGNORE_IF_SURROUNDING_LINEFEED;
+ }
};
/** Constant providing a standard, but completely bogus context to be
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/OverrideGraftingContext.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/OverrideGraftingContext.java 2021-12-28 15:29:56 UTC (rev 12287)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/OverrideGraftingContext.java 2021-12-28 16:14:23 UTC (rev 12288)
@@ -28,6 +28,9 @@
package org.foray.pioneer;
+import org.axsl.common.value.LinefeedTreatment;
+import org.axsl.common.value.TextTransform;
+import org.axsl.common.value.WhiteSpaceTreatment;
import org.axsl.fotree.FoContext;
import org.axsl.fotree.fo.GraftingPoint;
@@ -117,4 +120,24 @@
return this.wrappedContext.ipdParentArea();
}
+ @Override
+ public LinefeedTreatment traitLinefeedTreatment() {
+ return this.wrappedContext.traitLinefeedTreatment();
+ }
+
+ @Override
+ public TextTransform traitTextTransform() {
+ return this.wrappedContext.traitTextTransform();
+ }
+
+ @Override
+ public boolean traitWhiteSpaceCollapse() {
+ return this.wrappedContext.traitWhiteSpaceCollapse();
+ }
+
+ @Override
+ public WhiteSpaceTreatment traitWhiteSpaceTreatment() {
+ return this.wrappedContext.traitWhiteSpaceTreatment();
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-28 15:29:58
|
Revision: 12287
http://sourceforge.net/p/foray/code/12287
Author: victormote
Date: 2021-12-28 15:29:56 +0000 (Tue, 28 Dec 2021)
Log Message:
-----------
Get rawText and refinedText from instance variables instead of methods.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextCharacters4a.java
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/FoTextCharacters4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextCharacters4a.java 2021-12-28 14:22:19 UTC (rev 12286)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextCharacters4a.java 2021-12-28 15:29:56 UTC (rev 12287)
@@ -484,9 +484,9 @@
if (linefeedTreatment == LinefeedTreatment.PRESERVE
&& textTransform == TextTransform.NONE
&& whiteSpaceCollapse == false) {
- return inlineText();
+ return this.ca;
}
- return new FoRefinedText4a(inlineText(), linefeedTreatment, textTransform, whiteSpaceCollapse, codepointBefore,
+ return new FoRefinedText4a(this.ca, linefeedTreatment, textTransform, whiteSpaceCollapse, codepointBefore,
codepointAfter);
}
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 2021-12-28 14:22:19 UTC (rev 12286)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2021-12-28 15:29:56 UTC (rev 12287)
@@ -237,7 +237,12 @@
@Override
public CharSequence getRawText() {
- return inlineText();
+ final StringBuilder builder = new StringBuilder();
+ for (int nodeIndex = 0; nodeIndex < this.paraBranch.paraNodeSize(); nodeIndex ++) {
+ final ParaNode node = this.paraBranch.paraNodeAt(nodeIndex);
+ builder.append(node.getText());
+ }
+ return builder.toString();
}
@Override
@@ -247,9 +252,9 @@
if (linefeedTreatment == LinefeedTreatment.PRESERVE
&& textTransform == TextTransform.NONE
&& whiteSpaceCollapse == false) {
- return inlineText();
+ return getRawText();
}
- return new FoRefinedText4a(inlineText(), linefeedTreatment, textTransform, whiteSpaceCollapse, codepointBefore,
+ return new FoRefinedText4a(getRawText(), linefeedTreatment, textTransform, whiteSpaceCollapse, codepointBefore,
codepointAfter);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-28 14:22:22
|
Revision: 12286
http://sourceforge.net/p/foray/code/12286
Author: victormote
Date: 2021-12-28 14:22:19 +0000 (Tue, 28 Dec 2021)
Log Message:
-----------
Conform to aXSL change: Expose text-modification traits in the Area interface.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2021-12-28 12:47:06 UTC (rev 12285)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2021-12-28 14:22:19 UTC (rev 12286)
@@ -724,10 +724,7 @@
// return (short) (cumulative % WellKnownConstants.DEGREES_PER_CIRCLE);
}
- /**
- * Returns the whitespace-treatment trait for this area.
- * @return The whitespace-treatment trait for this area.
- */
+ @Override
public WhiteSpaceTreatment traitWhiteSpaceTreatment() {
final NormalBlockArea4a nearestBlockArea = this.nearestNormalBlockArea();
final Block block = nearestBlockArea.traitGeneratedBy();
@@ -734,10 +731,7 @@
return block.traitWhiteSpaceTreatment(nearestBlockArea);
}
- /**
- * Returns the linefeed-treatment trait for this area.
- * @return The linefeed-treatment trait for this area.
- */
+ @Override
public LinefeedTreatment traitLinefeedTreatment() {
final NormalBlockArea4a nearestBlockArea = this.nearestNormalBlockArea();
final Block block = nearestBlockArea.traitGeneratedBy();
@@ -744,20 +738,15 @@
return block.traitLinefeedTreatment(nearestBlockArea);
}
- /**
- * Returns the text-transform trait for this area.
- * @return The text-transform trait for this area.
- */
+ @Override
public TextTransform traitTextTransform() {
+ /* TODO: This isn't quite right: text-transform is applicable to more areas than normal-block-area. */
final NormalBlockArea4a nearestBlockArea = this.nearestNormalBlockArea();
final Block block = nearestBlockArea.traitGeneratedBy();
return block.traitTextTransform(nearestBlockArea);
}
- /**
- * Returns the white-space-collapse trait for this area.
- * @return The white-space-collapse trait for this area.
- */
+ @Override
public boolean traitWhiteSpaceCollapse() {
final NormalBlockArea4a nearestBlockArea = this.nearestNormalBlockArea();
final Block block = nearestBlockArea.traitGeneratedBy();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-28 12:47:08
|
Revision: 12285
http://sourceforge.net/p/foray/code/12285
Author: victormote
Date: 2021-12-28 12:47:06 +0000 (Tue, 28 Dec 2021)
Log Message:
-----------
Conform to aXSL change: For LineText, remove direct implementation of CharSequence, pushing client code toward having to request a level of refinement.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextCharacters4a.java
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/FoLineText.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java 2021-12-28 12:25:28 UTC (rev 12284)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java 2021-12-28 12:47:06 UTC (rev 12285)
@@ -228,19 +228,19 @@
return null;
}
- @Override
- public int length() {
- return this.realLineText.length();
- }
-
- @Override
- public char charAt(final int index) {
- return this.realLineText.charAt(index);
- }
-
- @Override
- public CharSequence subSequence(final int start, final int end) {
- return this.realLineText.subSequence(start, end);
- }
-
+// @Override
+// public int length() {
+// return this.realLineText.length();
+// }
+//
+// @Override
+// public char charAt(final int index) {
+// return this.realLineText.charAt(index);
+// }
+//
+// @Override
+// public CharSequence subSequence(final int start, final int end) {
+// return this.realLineText.subSequence(start, end);
+// }
+//
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextCharacters4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextCharacters4a.java 2021-12-28 12:25:28 UTC (rev 12284)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextCharacters4a.java 2021-12-28 12:47:06 UTC (rev 12285)
@@ -457,22 +457,22 @@
return this.ca;
}
- @Override
- public int length() {
- return this.ca.length();
- }
+// @Override
+// public int length() {
+// return this.ca.length();
+// }
+//
+// @Override
+// public char charAt(final int index) {
+// return this.ca.charAt(index);
+// }
+//
+// @Override
+// public CharSequence subSequence(final int start, final int end) {
+// return this.ca.subSequence(start, end);
+// }
@Override
- public char charAt(final int index) {
- return this.ca.charAt(index);
- }
-
- @Override
- public CharSequence subSequence(final int start, final int end) {
- return this.ca.subSequence(start, end);
- }
-
- @Override
public <T> T acceptVisitor(final FoVisitor<T> visitor) {
return visitor.visit(this);
}
@@ -484,9 +484,9 @@
if (linefeedTreatment == LinefeedTreatment.PRESERVE
&& textTransform == TextTransform.NONE
&& whiteSpaceCollapse == false) {
- return this;
+ return inlineText();
}
- return new FoRefinedText4a(this, linefeedTreatment, textTransform, whiteSpaceCollapse, codepointBefore,
+ return new FoRefinedText4a(inlineText(), linefeedTreatment, textTransform, whiteSpaceCollapse, codepointBefore,
codepointAfter);
}
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 2021-12-28 12:25:28 UTC (rev 12284)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2021-12-28 12:47:06 UTC (rev 12285)
@@ -192,45 +192,45 @@
return true;
}
- @Override
- public int length() {
- int totalLength = 0;
- for (int index = 0; index < this.content.size(); index ++) {
- totalLength += this.content.get(index).length();
- }
- return totalLength;
- }
+// @Override
+// public int length() {
+// int totalLength = 0;
+// for (int index = 0; index < this.content.size(); index ++) {
+// totalLength += this.content.get(index).length();
+// }
+// return totalLength;
+// }
+//
+// @Override
+// public char charAt(final int charIndex) {
+// if (charIndex < 0) {
+// throw new IndexOutOfBoundsException();
+// }
+// int totalLength = 0;
+// for (int index = 0; index < this.content.size(); index ++) {
+// final int currentLength = this.content.get(index).length();
+// totalLength += currentLength;
+// if (totalLength > charIndex) {
+// final int currentIndex = charIndex - (totalLength - currentLength);
+// return this.content.get(index).charAt(currentIndex);
+// }
+// }
+// throw new IndexOutOfBoundsException();
+// }
+//
+// @Override
+// public CharSequence subSequence(final int start, final int end) {
+// /* TODO: This is horrible performance-wise, but should not be used much. If that turns out to not be true, it
+// * needs to be rewritten, probably using a character iterator concept. */
+// final StringBuilder builder = new StringBuilder();
+// for (int index = start; index < end; index ++) {
+// final char c = charAt(index);
+// builder.append(c);
+// }
+// return builder.toString();
+// }
@Override
- public char charAt(final int charIndex) {
- if (charIndex < 0) {
- throw new IndexOutOfBoundsException();
- }
- int totalLength = 0;
- for (int index = 0; index < this.content.size(); index ++) {
- final int currentLength = this.content.get(index).length();
- totalLength += currentLength;
- if (totalLength > charIndex) {
- final int currentIndex = charIndex - (totalLength - currentLength);
- return this.content.get(index).charAt(currentIndex);
- }
- }
- throw new IndexOutOfBoundsException();
- }
-
- @Override
- public CharSequence subSequence(final int start, final int end) {
- /* TODO: This is horrible performance-wise, but should not be used much. If that turns out to not be true, it
- * needs to be rewritten, probably using a character iterator concept. */
- final StringBuilder builder = new StringBuilder();
- for (int index = start; index < end; index ++) {
- final char c = charAt(index);
- builder.append(c);
- }
- return builder.toString();
- }
-
- @Override
public <T> T acceptVisitor(final FoVisitor<T> visitor) {
return visitor.visit((AbstractCharacterSequence) this);
}
@@ -237,7 +237,7 @@
@Override
public CharSequence getRawText() {
- return this;
+ return inlineText();
}
@Override
@@ -247,9 +247,9 @@
if (linefeedTreatment == LinefeedTreatment.PRESERVE
&& textTransform == TextTransform.NONE
&& whiteSpaceCollapse == false) {
- return this;
+ return inlineText();
}
- return new FoRefinedText4a(this, linefeedTreatment, textTransform, whiteSpaceCollapse, codepointBefore,
+ return new FoRefinedText4a(inlineText(), linefeedTreatment, textTransform, whiteSpaceCollapse, codepointBefore,
codepointAfter);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-28 12:25:31
|
Revision: 12284
http://sourceforge.net/p/foray/code/12284
Author: victormote
Date: 2021-12-28 12:25:28 +0000 (Tue, 28 Dec 2021)
Log Message:
-----------
Prevent IndexOutOfBoundsException on deleted sequence.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoRefinedText4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoRefinedText4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoRefinedText4a.java 2021-12-28 12:23:03 UTC (rev 12283)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoRefinedText4a.java 2021-12-28 12:25:28 UTC (rev 12284)
@@ -122,7 +122,8 @@
int realIndex = index;
if (this.deleted.length() > 0) {
int deletedIndex = 0;
- while (this.deleted.intAt(deletedIndex) <= realIndex) {
+ while (deletedIndex < this.deleted.length()
+ && this.deleted.intAt(deletedIndex) <= realIndex) {
realIndex ++;
deletedIndex ++;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-28 12:23:06
|
Revision: 12283
http://sourceforge.net/p/foray/code/12283
Author: victormote
Date: 2021-12-28 12:23:03 +0000 (Tue, 28 Dec 2021)
Log Message:
-----------
Add missing trait computation.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2021-12-28 00:40:43 UTC (rev 12282)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2021-12-28 12:23:03 UTC (rev 12283)
@@ -39,6 +39,7 @@
import org.axsl.common.value.LinefeedTreatment;
import org.axsl.common.value.LinkType;
import org.axsl.common.value.RelativeAxis;
+import org.axsl.common.value.TextTransform;
import org.axsl.common.value.WhiteSpaceTreatment;
import org.axsl.common.value.WritingMode;
import org.axsl.font.Font;
@@ -744,6 +745,16 @@
}
/**
+ * Returns the text-transform trait for this area.
+ * @return The text-transform trait for this area.
+ */
+ public TextTransform traitTextTransform() {
+ final NormalBlockArea4a nearestBlockArea = this.nearestNormalBlockArea();
+ final Block block = nearestBlockArea.traitGeneratedBy();
+ return block.traitTextTransform(nearestBlockArea);
+ }
+
+ /**
* Returns the white-space-collapse trait for this area.
* @return The white-space-collapse trait for this area.
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-28 00:40:46
|
Revision: 12282
http://sourceforge.net/p/foray/code/12282
Author: victormote
Date: 2021-12-28 00:40:43 +0000 (Tue, 28 Dec 2021)
Log Message:
-----------
Change acquisition of marker for invalid Unicode character.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoRefinedText4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoText4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequenceContent.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoRefinedText4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoRefinedText4a.java 2021-12-27 17:37:20 UTC (rev 12281)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoRefinedText4a.java 2021-12-28 00:40:43 UTC (rev 12282)
@@ -28,6 +28,7 @@
package org.foray.fotree.fo.obj;
+import org.foray.common.WellKnownConstants;
import org.foray.common.primitive.XmlCharacterUtils;
import org.foray.common.sequence.IntArrayBuilder;
@@ -74,7 +75,7 @@
/* Check linefeed-treatment. */
final char raw = wrapped.charAt(index);
final char filtered = FoText4a.applyLinefeedTreatment(raw, linefeedTreatment);
- if (filtered == FoTextCharacters4a.DISCARD_CHAR) {
+ if (filtered == WellKnownConstants.INVALID_UNICODE_CHARACTER) {
deleted.append(index);
} else if (filtered != raw) {
changed.append(index);
@@ -97,7 +98,7 @@
final int charBefore = index == 0 ? codepointBefore : wrapped.charAt(index - 1);
final int charAfter = index == wrapped.length() - 1 ? codepointAfter : wrapped.charAt(index + 1);
final char filtered = FoText4a.applyWhiteSpaceCollapse(charBefore, raw, charAfter);
- if (filtered == FoTextCharacters4a.DISCARD_CHAR) {
+ if (filtered == WellKnownConstants.INVALID_UNICODE_CHARACTER) {
deleted.insertSortedUnique(index);
} else if (filtered != raw) {
final int changeIndex = changed.insertSortedUnique(index);
@@ -128,7 +129,7 @@
}
if (this.deleted.binarySearch(realIndex) > -1) {
- return FoTextCharacters4a.DISCARD_CHAR;
+ return WellKnownConstants.INVALID_UNICODE_CHARACTER;
}
final int deltaIndex = this.changed.binarySearch(realIndex);
final char filteredChar = deltaIndex > -1 ? this.deltas.charAt(deltaIndex) : this.wrapped.charAt(realIndex);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoText4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoText4a.java 2021-12-27 17:37:20 UTC (rev 12281)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoText4a.java 2021-12-28 00:40:43 UTC (rev 12282)
@@ -27,6 +27,7 @@
*/
package org.foray.fotree.fo.obj;
+import org.foray.common.WellKnownConstants;
import org.foray.common.primitive.XmlCharacterUtils;
import org.foray.fotree.FoObj;
import org.foray.fotree.Namespace;
@@ -48,9 +49,6 @@
*/
public abstract class FoText4a extends FoObj implements FoText {
- /** Constant indicating that a given character should be discarded. */
- public static final char DISCARD_CHAR = 0xFFFF;
-
/**
* The resolved primary Font.
* It is very, VERY tempting to think that we don't need to cache this here, since this is inherited from the
@@ -180,8 +178,9 @@
* @param index Index into charArray pointing to a char element that is to be converted.
* @param whiteSpaceTreatment The value of the whitespace-treatment trait.
* @return The character to which the charArray[index] should be converted for white-space-treatment purposes.
- * Returns {@link #DISCARD_CHAR} if charArray[index] should be discarded.
- * Note that {@link #DISCARD_CHAR} is not a valid Unicode codepoint, and should therefore never be in the input.
+ * Returns {@link WellKnownConstants#INVALID_UNICODE_CHARACTER} if charArray[index] should be discarded.
+ * Note that {@link WellKnownConstants#INVALID_UNICODE_CHARACTER} is not a valid Unicode codepoint, and should
+ * therefore never be in the input.
*/
public static char applyWhiteSpaceTreatment(final CharSequence charArray, final int index,
final WhiteSpaceTreatment whiteSpaceTreatment) {
@@ -188,7 +187,7 @@
/* The char immediately before. */
final char before;
if (index == 0) {
- before = DISCARD_CHAR;
+ before = WellKnownConstants.INVALID_UNICODE_CHARACTER;
} else {
before = charArray.charAt(index - 1);
}
@@ -199,7 +198,7 @@
/* The char immediately after. */
final char after;
if (index == charArray.length() - 1) {
- after = DISCARD_CHAR;
+ after = WellKnownConstants.INVALID_UNICODE_CHARACTER;
} else {
after = charArray.charAt(index + 1);
}
@@ -213,8 +212,10 @@
* @param c The char being tested.
* @param charAfter The char immediately after the char being tested, or -1 of there is none.
* @param whiteSpaceTreatment The value of the whitespace-treatment trait.
- * @return The char at this index, or {@link #DISCARD_CHAR} if this char should be discarded.
- * Note that {@link #DISCARD_CHAR} is not a valid Unicode codepoint, and should therefore never be in the input.
+ * @return The char at this index, or {@link WellKnownConstants#INVALID_UNICODE_CHARACTER} if this char should be
+ * discarded.
+ * Note that {@link WellKnownConstants#INVALID_UNICODE_CHARACTER} is not a valid Unicode codepoint, and should
+ * therefore never be in the input.
*/
public static char applyWhiteSpaceTreatment(final char charBefore, final char c, final char charAfter,
final WhiteSpaceTreatment whiteSpaceTreatment) {
@@ -227,42 +228,42 @@
return c;
}
switch (whiteSpaceTreatment) {
- case IGNORE: return FoTextCharacters4a.DISCARD_CHAR;
+ case IGNORE: return WellKnownConstants.INVALID_UNICODE_CHARACTER;
case PRESERVE: return ' ';
case IGNORE_IF_BEFORE_LINEFEED: {
/* If last element, no change needed. */
- if (charAfter == FoTextCharacters4a.DISCARD_CHAR) {
+ if (charAfter == WellKnownConstants.INVALID_UNICODE_CHARACTER) {
return c;
}
if (charAfter != Basic_Latin_Block.CONTROL_LINE_FEED) {
return c;
}
- return FoTextCharacters4a.DISCARD_CHAR;
+ return WellKnownConstants.INVALID_UNICODE_CHARACTER;
}
case IGNORE_IF_AFTER_LINEFEED: {
/* If first element, no change needed. */
- if (charBefore == FoTextCharacters4a.DISCARD_CHAR) {
+ if (charBefore == WellKnownConstants.INVALID_UNICODE_CHARACTER) {
return c;
}
if (charBefore != Basic_Latin_Block.CONTROL_LINE_FEED) {
return c;
}
- return FoTextCharacters4a.DISCARD_CHAR;
+ return WellKnownConstants.INVALID_UNICODE_CHARACTER;
}
/* default handles "initial" value IGNORE_IF_SURROUNDING_LINEFEED */
default: {
/* If first element, only check next. */
- if (charBefore == FoTextCharacters4a.DISCARD_CHAR) {
+ if (charBefore == WellKnownConstants.INVALID_UNICODE_CHARACTER) {
if (charAfter == Basic_Latin_Block.CONTROL_LINE_FEED) {
- return FoTextCharacters4a.DISCARD_CHAR;
+ return WellKnownConstants.INVALID_UNICODE_CHARACTER;
}
return c;
}
/* If last element, only check previous. */
- if (charAfter == FoTextCharacters4a.DISCARD_CHAR) {
+ if (charAfter == WellKnownConstants.INVALID_UNICODE_CHARACTER) {
if (charBefore == Basic_Latin_Block.CONTROL_LINE_FEED) {
- return FoTextCharacters4a.DISCARD_CHAR;
+ return WellKnownConstants.INVALID_UNICODE_CHARACTER;
}
return c;
}
@@ -269,7 +270,7 @@
/* Otherwise, check both. */
if (charBefore == Basic_Latin_Block.CONTROL_LINE_FEED
|| charAfter == Basic_Latin_Block.CONTROL_LINE_FEED) {
- return FoTextCharacters4a.DISCARD_CHAR;
+ return WellKnownConstants.INVALID_UNICODE_CHARACTER;
}
return c;
}
@@ -313,7 +314,7 @@
final char c = charArray.charAt(i);
final char conversionChar = applyWhiteSpaceTreatment(charArray, i,
whiteSpaceTreatment);
- if (conversionChar == FoTextCharacters4a.DISCARD_CHAR) {
+ if (conversionChar == WellKnownConstants.INVALID_UNICODE_CHARACTER) {
discardElements ++;
} else if (conversionChar != c) {
changeElements ++;
@@ -332,7 +333,7 @@
for (int i = 0; i < charArray.length(); i++) {
final char conversionChar = applyWhiteSpaceTreatment(charArray,
i, whiteSpaceTreatment);
- if (conversionChar == FoTextCharacters4a.DISCARD_CHAR) {
+ if (conversionChar == WellKnownConstants.INVALID_UNICODE_CHARACTER) {
discardElements ++;
} else {
returnArray[i - discardElements] = conversionChar;
@@ -347,8 +348,8 @@
* Applies the linefeed treatment to a specific character.
* @param c The character being processed, which should always be a linefeed character.
* @param linefeedTreatment The value of the linefeed-treatment trait.
- * @return The value by which the linefeed character should be replaced, or the marker {@link #DISCARD_CHAR}
- * indicating that the character should be removed.
+ * @return The value by which the linefeed character should be replaced, or the marker
+ * {@link WellKnownConstants#INVALID_UNICODE_CHARACTER} indicating that the character should be removed.
*/
public static char applyLinefeedTreatment(final char c, final LinefeedTreatment linefeedTreatment) {
if (c != Basic_Latin_Block.CONTROL_LINE_FEED) {
@@ -356,7 +357,7 @@
return c;
}
switch (linefeedTreatment) {
- case IGNORE: return FoTextCharacters4a.DISCARD_CHAR;
+ case IGNORE: return WellKnownConstants.INVALID_UNICODE_CHARACTER;
case TREAT_AS_SPACE: return ' ';
case TREAT_AS_ZERO_WIDTH_SPACE: return '\u200b';
// default handles the "initial" value of "preserve"
@@ -418,7 +419,7 @@
if (c == Basic_Latin_Block.CONTROL_LINE_FEED) {
final char conversionChar = applyLinefeedTreatment(c,
linefeedTreatment);
- if (conversionChar == FoTextCharacters4a.DISCARD_CHAR) {
+ if (conversionChar == WellKnownConstants.INVALID_UNICODE_CHARACTER) {
discardElements ++;
} else {
returnArray[i - discardElements] = conversionChar;
@@ -486,14 +487,16 @@
* should <em>not</em> be considered.</p>
* @param charArray The char[] that is being converted.
* @param index The 0-based index into charArray that points to the char that is being tested.
- * @return {@link #DISCARD_CHAR} if the previous character is whitespace or if the next character is a line-feed.
+ * @return {@link WellKnownConstants#INVALID_UNICODE_CHARACTER} if the previous character is whitespace or if the
+ * next character is a line-feed.
* If neither of these is true, returns the original character.
*/
public static char applyWhiteSpaceCollapse(final CharSequence charArray, final int index) {
- final char charBefore = (index == 0) ? AbstractCharacterSequence.DISCARD_CHAR : charArray.charAt(index - 1);
+ final char charBefore = (index == 0) ? WellKnownConstants.INVALID_UNICODE_CHARACTER :
+ charArray.charAt(index - 1);
final char c = charArray.charAt(index);
final char charAfter = (index == charArray.length() - 1) ?
- AbstractCharacterSequence.DISCARD_CHAR : charArray.charAt(index + 1);
+ WellKnownConstants.INVALID_UNICODE_CHARACTER : charArray.charAt(index + 1);
return applyWhiteSpaceCollapse(charBefore, c, charAfter);
}
@@ -502,7 +505,8 @@
* @param codepointBefore The codepoint before c, or -1 if there is none.
* @param c The character being considered for conversion.
* @param codepointAfter The codepoint after c, or if there is none.
- * @return {@link #DISCARD_CHAR} if the previous character is whitespace or if the next character is a line-feed.
+ * @return {@link WellKnownConstants#INVALID_UNICODE_CHARACTER} if the previous character is whitespace or if the
+ * next character is a line-feed.
* If neither of these is true, returns the original character.
*/
public static char applyWhiteSpaceCollapse(final int codepointBefore, final char c, final int codepointAfter) {
@@ -514,12 +518,12 @@
/* If it is a linefeed, nothing should change. */
return c;
}
- if (codepointBefore != AbstractCharacterSequence.DISCARD_CHAR
+ if (codepointBefore != WellKnownConstants.INVALID_UNICODE_CHARACTER
&& XmlCharacterUtils.isXMLWhitespace(codepointBefore)) {
- return FoTextCharacters4a.DISCARD_CHAR;
+ return WellKnownConstants.INVALID_UNICODE_CHARACTER;
}
if (codepointAfter == Basic_Latin_Block.CONTROL_LINE_FEED) {
- return FoTextCharacters4a.DISCARD_CHAR;
+ return WellKnownConstants.INVALID_UNICODE_CHARACTER;
}
return c;
}
@@ -544,7 +548,7 @@
int discardElements = 0;
for (int i = 0; i < charArray.length(); i++) {
final char convertChar = applyWhiteSpaceCollapse(charArray, i);
- if (convertChar == FoTextCharacters4a.DISCARD_CHAR) {
+ if (convertChar == WellKnownConstants.INVALID_UNICODE_CHARACTER) {
discardElements ++;
}
}
@@ -559,7 +563,7 @@
discardElements = 0;
for (int i = 0; i < charArray.length(); i++) {
final char conversionChar = applyWhiteSpaceCollapse(charArray, i);
- if (conversionChar == FoTextCharacters4a.DISCARD_CHAR) {
+ if (conversionChar == WellKnownConstants.INVALID_UNICODE_CHARACTER) {
discardElements ++;
} else {
returnArray[i - discardElements] = conversionChar;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequenceContent.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequenceContent.java 2021-12-27 17:37:20 UTC (rev 12281)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequenceContent.java 2021-12-28 00:40:43 UTC (rev 12282)
@@ -28,6 +28,8 @@
package org.foray.fotree.fo.obj;
+import org.foray.common.WellKnownConstants;
+
import org.axsl.common.para.ParaNode;
import org.axsl.common.value.LinefeedTreatment;
import org.axsl.common.value.TextTransform;
@@ -76,14 +78,15 @@
int length = 0;
for (int index = 0; index < length(); index ++) {
/* The char immediately before. */
- final char before = (index == 0) ? FoTextCharacters4a.DISCARD_CHAR : charAt(index - 1);
+ final char before = (index == 0) ? WellKnownConstants.INVALID_UNICODE_CHARACTER : charAt(index - 1);
/* The char we want to test. */
final char c = charAt(index);
/* The char immediately after. */
- final char after = (index == length() - 1) ? FoTextCharacters4a.DISCARD_CHAR : charAt(index + 1);
+ final char after = (index == length() - 1) ? WellKnownConstants.INVALID_UNICODE_CHARACTER :
+ charAt(index + 1);
final char converted = FoTextCharacters4a.applyWhiteSpaceTreatment(before, c, after, whiteSpaceTreatment);
- if (converted != FoTextCharacters4a.DISCARD_CHAR) {
+ if (converted != WellKnownConstants.INVALID_UNICODE_CHARACTER) {
length ++;
}
}
@@ -102,14 +105,15 @@
int currentIndex = -1;
for (int index = 0; index < length(); index ++) {
/* The char immediately before. */
- final char before = (index == 0) ? FoTextCharacters4a.DISCARD_CHAR : charAt(index - 1);
+ final char before = (index == 0) ? WellKnownConstants.INVALID_UNICODE_CHARACTER : charAt(index - 1);
/* The char we want to test. */
final char c = charAt(index);
/* The char immediately after. */
- final char after = (index == length() - 1) ? FoTextCharacters4a.DISCARD_CHAR : charAt(index + 1);
+ final char after = (index == length() - 1) ? WellKnownConstants.INVALID_UNICODE_CHARACTER :
+ charAt(index + 1);
final char converted = FoTextCharacters4a.applyWhiteSpaceTreatment(before, c, after, whiteSpaceTreatment);
- if (converted != FoTextCharacters4a.DISCARD_CHAR) {
+ if (converted != WellKnownConstants.INVALID_UNICODE_CHARACTER) {
currentIndex ++;
}
if (currentIndex == whiteSpaceTreatmentIndex) {
@@ -133,7 +137,7 @@
for (int index = 0; index < whiteSpaceTreatmentLength(whiteSpaceTreatment); index ++) {
final char c = charAt(index);
final char converted = FoTextCharacters4a.applyLinefeedTreatment(c, linefeedTreatment);
- if (converted != FoTextCharacters4a.DISCARD_CHAR) {
+ if (converted != WellKnownConstants.INVALID_UNICODE_CHARACTER) {
length ++;
}
}
@@ -156,7 +160,7 @@
for (int index = 0; index < whiteSpaceTreatmentLength; index ++) {
final char c = charAt(index);
final char converted = FoTextCharacters4a.applyLinefeedTreatment(c, linefeedTreatment);
- if (converted != FoTextCharacters4a.DISCARD_CHAR) {
+ if (converted != WellKnownConstants.INVALID_UNICODE_CHARACTER) {
currentIndex ++;
}
if (currentIndex == linefeedTreatmentIndex) {
@@ -211,14 +215,14 @@
int length = 0;
final int textTransformLength = textTransformLength(whiteSpaceTreatment, linefeedTreatment, textTransform);
for (int index = 0; index < textTransformLength; index ++) {
- final char charBefore = (index == 0) ? AbstractCharacterSequence.DISCARD_CHAR :
+ final char charBefore = (index == 0) ? WellKnownConstants.INVALID_UNICODE_CHARACTER :
textTransformCharAt(whiteSpaceTreatment, linefeedTreatment, textTransform, index - 1);
final char c = textTransformCharAt(whiteSpaceTreatment, linefeedTreatment, textTransform, index);
final char charAfter = (index == textTransformLength - 1) ?
- AbstractCharacterSequence.DISCARD_CHAR :
+ WellKnownConstants.INVALID_UNICODE_CHARACTER :
textTransformCharAt(whiteSpaceTreatment, linefeedTreatment, textTransform, index + 1);
final char converted = AbstractCharacterSequence.applyWhiteSpaceCollapse(charBefore, c, charAfter);
- if (converted != FoTextCharacters4a.DISCARD_CHAR) {
+ if (converted != WellKnownConstants.INVALID_UNICODE_CHARACTER) {
length ++;
}
}
@@ -242,14 +246,14 @@
int currentIndex = -1;
final int textTransformLength = textTransformLength(whiteSpaceTreatment, linefeedTreatment, textTransform);
for (int index = 0; index < textTransformLength; index ++) {
- final char charBefore = (index == 0) ? AbstractCharacterSequence.DISCARD_CHAR :
+ final char charBefore = (index == 0) ? WellKnownConstants.INVALID_UNICODE_CHARACTER :
textTransformCharAt(whiteSpaceTreatment, linefeedTreatment, textTransform, index - 1);
final char c = textTransformCharAt(whiteSpaceTreatment, linefeedTreatment, textTransform, index);
final char charAfter = (index == textTransformLength - 1) ?
- AbstractCharacterSequence.DISCARD_CHAR :
+ WellKnownConstants.INVALID_UNICODE_CHARACTER :
textTransformCharAt(whiteSpaceTreatment, linefeedTreatment, textTransform, index + 1);
final char converted = AbstractCharacterSequence.applyWhiteSpaceCollapse(charBefore, c, charAfter);
- if (converted != FoTextCharacters4a.DISCARD_CHAR) {
+ if (converted != WellKnownConstants.INVALID_UNICODE_CHARACTER) {
currentIndex ++;
}
if (currentIndex == whiteSpaceCollapseIndex) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-27 17:37:22
|
Revision: 12281
http://sourceforge.net/p/foray/code/12281
Author: victormote
Date: 2021-12-27 17:37:20 +0000 (Mon, 27 Dec 2021)
Log Message:
-----------
Add more tests of refined FO tree text.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoRefinedText4a.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/obj/FoRefinedText4aTests.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoRefinedText4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoRefinedText4a.java 2021-12-27 16:22:48 UTC (rev 12280)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoRefinedText4a.java 2021-12-27 17:37:20 UTC (rev 12281)
@@ -85,22 +85,24 @@
/* Ignore text-transform for now. It can be efficiently applied as the chars are read. */
/* Apply white-space-collapse. */
- for (int index = 0; index < wrapped.length(); index ++) {
- if (deleted.indexOf(index) > -1) {
- /* Item at this index has already been deleted. Skip it. */
- continue;
- }
+ if (whiteSpaceCollapse) {
+ for (int index = 0; index < wrapped.length(); index ++) {
+ if (deleted.indexOf(index) > -1) {
+ /* Item at this index has already been deleted. Skip it. */
+ continue;
+ }
- final int deltaIndex = changed.indexOf(index);
- final char raw = deltaIndex > -1 ? deltas.charAt(deltaIndex) : wrapped.charAt(index);
- final int charBefore = index == 0 ? codepointBefore : wrapped.charAt(index - 1);
- final int charAfter = index == wrapped.length() - 1 ? codepointAfter : wrapped.charAt(index + 1);
- final char filtered = FoText4a.applyWhiteSpaceCollapse(charBefore, raw, charAfter);
- if (filtered == FoTextCharacters4a.DISCARD_CHAR) {
- deleted.insertSortedUnique(index);
- } else if (filtered != raw) {
- final int changeIndex = changed.insertSortedUnique(index);
- deltas.insert(changeIndex, filtered);
+ final int deltaIndex = changed.indexOf(index);
+ final char raw = deltaIndex > -1 ? deltas.charAt(deltaIndex) : wrapped.charAt(index);
+ final int charBefore = index == 0 ? codepointBefore : wrapped.charAt(index - 1);
+ final int charAfter = index == wrapped.length() - 1 ? codepointAfter : wrapped.charAt(index + 1);
+ final char filtered = FoText4a.applyWhiteSpaceCollapse(charBefore, raw, charAfter);
+ if (filtered == FoTextCharacters4a.DISCARD_CHAR) {
+ deleted.insertSortedUnique(index);
+ } else if (filtered != raw) {
+ final int changeIndex = changed.insertSortedUnique(index);
+ deltas.insert(changeIndex, filtered);
+ }
}
}
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/obj/FoRefinedText4aTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/obj/FoRefinedText4aTests.java 2021-12-27 16:22:48 UTC (rev 12280)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/obj/FoRefinedText4aTests.java 2021-12-27 17:37:20 UTC (rev 12281)
@@ -41,6 +41,9 @@
*/
public class FoRefinedText4aTests {
+ /**
+ * Tests of linefeed-treatment in isolation.
+ */
@Test
public void linefeedTreatment_Test_001() {
final StringBuilder builder = new StringBuilder();
@@ -82,4 +85,94 @@
Assert.assertEquals(expected, out.toString());
}
+ /**
+ * Tests of text-transform in isolation.
+ */
+ @Test
+ public void textTransform_Test_001() {
+ /* "The Merchant of Venice," Act iv. Scene 1. */
+ String input = "He is well paid that is well satisfied.";
+ Assert.assertEquals(39, input.length());
+
+ /* Make the other factors neutral. */
+ final LinefeedTreatment linefeedTreatment = LinefeedTreatment.PRESERVE;
+ final boolean whiteSpaceCollapse = false;
+
+ /* Test NONE. */
+ FoRefinedText4a out =
+ new FoRefinedText4a(input, linefeedTreatment, TextTransform.NONE, whiteSpaceCollapse, -1, -1);
+ Assert.assertEquals(39, out.length());
+ String expected = input;
+ Assert.assertEquals(expected, out.toString());
+
+ /* Test UPPERCASE. */
+ out = new FoRefinedText4a(input, linefeedTreatment, TextTransform.UPPERCASE, whiteSpaceCollapse, -1, -1);
+ Assert.assertEquals(39, out.length());
+ expected = "HE IS WELL PAID THAT IS WELL SATISFIED.";
+ Assert.assertEquals(expected, out.toString());
+
+ /* Test LOWERCASE. */
+ out = new FoRefinedText4a(input, linefeedTreatment, TextTransform.LOWERCASE, whiteSpaceCollapse, -1, -1);
+ Assert.assertEquals(39, out.length());
+ expected = "he is well paid that is well satisfied.";
+ Assert.assertEquals(expected, out.toString());
+
+ /* Test CAPITALIZE. */
+ out = new FoRefinedText4a(input, linefeedTreatment, TextTransform.CAPITALIZE, whiteSpaceCollapse, -1, -1);
+ Assert.assertEquals(39, out.length());
+ expected = "He Is Well Paid That Is Well Satisfied.";
+ Assert.assertEquals(expected, out.toString());
+
+ /* Test CAPITALIZE with non-white-space text before. */
+ input = "he is well paid that is well satisfied.";
+ out = new FoRefinedText4a(input, linefeedTreatment, TextTransform.CAPITALIZE, whiteSpaceCollapse, 'S', -1);
+ Assert.assertEquals(39, out.length());
+ expected = "he Is Well Paid That Is Well Satisfied.";
+ Assert.assertEquals(expected, out.toString());
+ }
+
+ /**
+ * Tests of white-space-collapse in isolation.
+ */
+ @Test
+ public void textWhiteSpaceCollapse_Test_001() {
+ /* "Julius Caesar," Act v. Scene 5. */
+ final String input = " This" + Basic_Latin_Block.CONTROL_LINE_FEED + "was " +
+ Basic_Latin_Block.CONTROL_LINE_FEED + " the noblest Roman of them all. ";
+ Assert.assertEquals(50, input.length());
+
+ /* Make the other factors neutral. */
+ final LinefeedTreatment linefeedTreatment = LinefeedTreatment.PRESERVE;
+ final TextTransform textTransform = TextTransform.NONE;
+
+ /* Test "false". */
+ FoRefinedText4a out = new FoRefinedText4a(input, linefeedTreatment, textTransform, false, -1, -1);
+ Assert.assertEquals(50, out.length());
+ String expected = input;
+ Assert.assertEquals(expected, out.toString());
+
+ /* Test "true". */
+ out = new FoRefinedText4a(input, linefeedTreatment, textTransform, true, -1, -1);
+ Assert.assertEquals(41, out.length());
+ expected = " This" + Basic_Latin_Block.CONTROL_LINE_FEED + "was" +
+ Basic_Latin_Block.CONTROL_LINE_FEED + "the noblest Roman of them all. ";
+ Assert.assertEquals(expected, out.toString());
+
+ /* Test "true" with space fore and aft. */
+ out = new FoRefinedText4a(input, linefeedTreatment, textTransform, true, ' ', ' ');
+ Assert.assertEquals(40, out.length());
+ expected = "This" + Basic_Latin_Block.CONTROL_LINE_FEED + "was" +
+ Basic_Latin_Block.CONTROL_LINE_FEED + "the noblest Roman of them all. ";
+ Assert.assertEquals(expected, out.toString());
+
+ /* Test "true" with linefeed fore and aft. */
+ out = new FoRefinedText4a(input, linefeedTreatment, textTransform, true, Basic_Latin_Block.CONTROL_LINE_FEED,
+ Basic_Latin_Block.CONTROL_LINE_FEED);
+ Assert.assertEquals(40, out.length());
+ expected = "This" + Basic_Latin_Block.CONTROL_LINE_FEED + "was" +
+ Basic_Latin_Block.CONTROL_LINE_FEED + "the noblest Roman of them all. ";
+ Assert.assertEquals(expected, out.toString());
+
}
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-27 16:22:51
|
Revision: 12280
http://sourceforge.net/p/foray/code/12280
Author: victormote
Date: 2021-12-27 16:22:48 +0000 (Mon, 27 Dec 2021)
Log Message:
-----------
Conform to aXSL change: Add method to get the refined value of the text.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoText4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextCharacters4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoRefinedText4a.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/obj/
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/obj/FoRefinedText4aTests.java
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoRefinedText4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoRefinedText4a.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoRefinedText4a.java 2021-12-27 16:22:48 UTC (rev 12280)
@@ -0,0 +1,164 @@
+/*
+ * Copyright 2021 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.fotree.fo.obj;
+
+import org.foray.common.primitive.XmlCharacterUtils;
+import org.foray.common.sequence.IntArrayBuilder;
+
+import org.axsl.common.sequence.IntSequencePlus;
+import org.axsl.common.value.LinefeedTreatment;
+import org.axsl.common.value.TextTransform;
+
+/**
+ * Wraps a sequence of characters and overlays it with the changes needed to convert it to the "refined" values for
+ * FO Tree.
+ */
+public class FoRefinedText4a implements CharSequence {
+
+ /** The wrapped raw text. */
+ private CharSequence wrapped;
+
+ /** The text-transform. */
+ private TextTransform textTransform;
+
+ /** The codepoint immediate before {@link #wrapped}. */
+ private int codepointBefore;
+
+ /** The sorted list of indexes that are deleted. */
+ private IntSequencePlus deleted;
+
+ /** The sorted list of indexes that are changed. This is parallel with {@link #deltas}. */
+ private IntSequencePlus changed;
+
+ /** The new values for indexes that are changed. This is parallel with {@link #changed}. */
+ private CharSequence deltas;
+
+ public FoRefinedText4a(final CharSequence wrapped, final LinefeedTreatment linefeedTreatment,
+ final TextTransform textTransform, final boolean whiteSpaceCollapse, final int codepointBefore,
+ final int codepointAfter) {
+ this.wrapped = wrapped;
+ this.textTransform = textTransform;
+ this.codepointBefore = codepointBefore;
+ final IntArrayBuilder deleted = new IntArrayBuilder();
+ final IntArrayBuilder changed = new IntArrayBuilder();
+ final StringBuilder deltas = new StringBuilder();
+
+ /* Apply linefeed-treatment. */
+ for (int index = 0; index < wrapped.length(); index ++) {
+ /* Check linefeed-treatment. */
+ final char raw = wrapped.charAt(index);
+ final char filtered = FoText4a.applyLinefeedTreatment(raw, linefeedTreatment);
+ if (filtered == FoTextCharacters4a.DISCARD_CHAR) {
+ deleted.append(index);
+ } else if (filtered != raw) {
+ changed.append(index);
+ deltas.append(filtered);
+ }
+ }
+
+ /* Ignore text-transform for now. It can be efficiently applied as the chars are read. */
+
+ /* Apply white-space-collapse. */
+ for (int index = 0; index < wrapped.length(); index ++) {
+ if (deleted.indexOf(index) > -1) {
+ /* Item at this index has already been deleted. Skip it. */
+ continue;
+ }
+
+ final int deltaIndex = changed.indexOf(index);
+ final char raw = deltaIndex > -1 ? deltas.charAt(deltaIndex) : wrapped.charAt(index);
+ final int charBefore = index == 0 ? codepointBefore : wrapped.charAt(index - 1);
+ final int charAfter = index == wrapped.length() - 1 ? codepointAfter : wrapped.charAt(index + 1);
+ final char filtered = FoText4a.applyWhiteSpaceCollapse(charBefore, raw, charAfter);
+ if (filtered == FoTextCharacters4a.DISCARD_CHAR) {
+ deleted.insertSortedUnique(index);
+ } else if (filtered != raw) {
+ final int changeIndex = changed.insertSortedUnique(index);
+ deltas.insert(changeIndex, filtered);
+ }
+ }
+
+ this.deleted = deleted.toIntArray().asPlus();
+ this.changed = changed.toIntArray().asPlus();
+ this.deltas = deltas.toString();
+ }
+
+ @Override
+ public int length() {
+ return this.wrapped.length() - this.deleted.length();
+ }
+
+ @Override
+ public char charAt(final int index) {
+ int realIndex = index;
+ if (this.deleted.length() > 0) {
+ int deletedIndex = 0;
+ while (this.deleted.intAt(deletedIndex) <= realIndex) {
+ realIndex ++;
+ deletedIndex ++;
+ }
+ }
+
+ if (this.deleted.binarySearch(realIndex) > -1) {
+ return FoTextCharacters4a.DISCARD_CHAR;
+ }
+ final int deltaIndex = this.changed.binarySearch(realIndex);
+ final char filteredChar = deltaIndex > -1 ? this.deltas.charAt(deltaIndex) : this.wrapped.charAt(realIndex);
+
+ /* Apply text-transform. */
+ if (this.textTransform == TextTransform.CAPITALIZE) {
+ final int codepointBefore = index == 0 ? this.codepointBefore : charAt(index - 1);
+ final boolean isFirstCharInWord = XmlCharacterUtils.isXMLWhitespace(codepointBefore);
+ return FoText4a.applyTextTransform(this.textTransform, isFirstCharInWord, filteredChar);
+
+ } else {
+ return FoText4a.applyTextTransformSimple(this.textTransform, filteredChar);
+ }
+ }
+
+ @Override
+ public CharSequence subSequence(final int start, final int end) {
+ final StringBuilder builder = new StringBuilder();
+ for (int index = start; index < end; index ++) {
+ final char c = charAt(index);
+ builder.append(c);
+ }
+ return builder;
+ }
+
+ public String toString() {
+ final StringBuilder builder = new StringBuilder();
+ for (int index = 0; index < length(); index ++) {
+ final char c = charAt(index);
+ builder.append(c);
+ }
+ return builder.toString();
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoRefinedText4a.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoText4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoText4a.java 2021-12-27 13:32:48 UTC (rev 12279)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoText4a.java 2021-12-27 16:22:48 UTC (rev 12280)
@@ -462,6 +462,25 @@
}
/**
+ * Applies text-transform to one character.
+ * Same as {@link #applyTextTransform(TextTransform, boolean, char)}, except doesn't handle the case of
+ * {@link TextTransform#CAPITALIZE}, which in many cases has more expensive preparation.
+ * @param textTransform The text-transform value to use.
+ * @param c The character to be converted.
+ * @return The converted character, or {@code c} if no conversion is performed.
+ */
+ public static char applyTextTransformSimple(final TextTransform textTransform, final char c) {
+ switch (textTransform) {
+ case UPPERCASE: return java.lang.Character.toUpperCase(c);
+ case LOWERCASE: return java.lang.Character.toLowerCase(c);
+ case CAPITALIZE: throw new UnsupportedOperationException("Use applyTextTransform for\"Capitalize.\"");
+ case NONE:
+ default:
+ return c;
+ }
+ }
+
+ /**
* <p>Applies white-space-collapse to one character of charArray.</p>
* <p>Per http://lists.w3.org/Archives/Public/xsl-editors/2002OctDec/0004, elements in previous or subsequent FOs
* should <em>not</em> be considered.</p>
@@ -480,13 +499,13 @@
/**
* Applies white-space-collapse to one char.
- * @param charBefore The character before c, or {@link AbstractCharacterSequence#DISCARD_CHAR} if there is none.
+ * @param codepointBefore The codepoint before c, or -1 if there is none.
* @param c The character being considered for conversion.
- * @param charAfter The character after c, or {@link AbstractCharacterSequence#DISCARD_CHAR} if there is none.
+ * @param codepointAfter The codepoint after c, or if there is none.
* @return {@link #DISCARD_CHAR} if the previous character is whitespace or if the next character is a line-feed.
* If neither of these is true, returns the original character.
*/
- public static char applyWhiteSpaceCollapse(final char charBefore, final char c, final char charAfter) {
+ public static char applyWhiteSpaceCollapse(final int codepointBefore, final char c, final int codepointAfter) {
if (! XmlCharacterUtils.isXMLWhitespace(c)) {
/* If it is not whitespace, nothing should change. */
return c;
@@ -495,11 +514,11 @@
/* If it is a linefeed, nothing should change. */
return c;
}
- if (charBefore != AbstractCharacterSequence.DISCARD_CHAR
- && XmlCharacterUtils.isXMLWhitespace(charBefore)) {
+ if (codepointBefore != AbstractCharacterSequence.DISCARD_CHAR
+ && XmlCharacterUtils.isXMLWhitespace(codepointBefore)) {
return FoTextCharacters4a.DISCARD_CHAR;
}
- if (charAfter == Basic_Latin_Block.CONTROL_LINE_FEED) {
+ if (codepointAfter == Basic_Latin_Block.CONTROL_LINE_FEED) {
return FoTextCharacters4a.DISCARD_CHAR;
}
return c;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextCharacters4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextCharacters4a.java 2021-12-27 13:32:48 UTC (rev 12279)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextCharacters4a.java 2021-12-27 16:22:48 UTC (rev 12280)
@@ -30,6 +30,7 @@
import org.foray.fotree.FoObj;
+import org.axsl.common.value.LinefeedTreatment;
import org.axsl.common.value.TextTransform;
import org.axsl.fotree.FoContext;
import org.axsl.fotree.FoVisitor;
@@ -476,4 +477,17 @@
return visitor.visit(this);
}
+ @Override
+ public CharSequence getRefinedText(final LinefeedTreatment linefeedTreatment, final TextTransform textTransform,
+ final boolean whiteSpaceCollapse, final int codepointBefore, final int codepointAfter) {
+ /* If none of the factors will result in any change, just return this. */
+ if (linefeedTreatment == LinefeedTreatment.PRESERVE
+ && textTransform == TextTransform.NONE
+ && whiteSpaceCollapse == false) {
+ return this;
+ }
+ return new FoRefinedText4a(this, linefeedTreatment, textTransform, whiteSpaceCollapse, codepointBefore,
+ codepointAfter);
+ }
+
}
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 2021-12-27 13:32:48 UTC (rev 12279)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2021-12-27 16:22:48 UTC (rev 12280)
@@ -240,4 +240,17 @@
return this;
}
+ @Override
+ public CharSequence getRefinedText(final LinefeedTreatment linefeedTreatment, final TextTransform textTransform,
+ final boolean whiteSpaceCollapse, final int codepointBefore, final int codepointAfter) {
+ /* If none of the factors will result in any change, just return this. */
+ if (linefeedTreatment == LinefeedTreatment.PRESERVE
+ && textTransform == TextTransform.NONE
+ && whiteSpaceCollapse == false) {
+ return this;
+ }
+ return new FoRefinedText4a(this, linefeedTreatment, textTransform, whiteSpaceCollapse, codepointBefore,
+ codepointAfter);
+ }
+
}
Added: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/obj/FoRefinedText4aTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/obj/FoRefinedText4aTests.java (rev 0)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/obj/FoRefinedText4aTests.java 2021-12-27 16:22:48 UTC (rev 12280)
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2021 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.fotree.fo.obj;
+
+import org.axsl.common.value.LinefeedTreatment;
+import org.axsl.common.value.TextTransform;
+import org.axsl.unicode.block.Basic_Latin_Block;
+import org.axsl.unicode.block.General_Punctuation_Block;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests of {@link FoRefinedText4a}.
+ */
+public class FoRefinedText4aTests {
+
+ @Test
+ public void linefeedTreatment_Test_001() {
+ final StringBuilder builder = new StringBuilder();
+ builder.append(Basic_Latin_Block.CONTROL_LINE_FEED);
+ builder.append("Word1");
+ builder.append(Basic_Latin_Block.CONTROL_LINE_FEED);
+ builder.append("Word2");
+ builder.append(Basic_Latin_Block.CONTROL_LINE_FEED);
+ builder.append("Word3");
+ builder.append(Basic_Latin_Block.CONTROL_LINE_FEED);
+ final String input = builder.toString();
+ Assert.assertEquals(19, input.length());
+
+ /* Make the other factors neutral. */
+ final TextTransform textTransform = TextTransform.NONE;
+ final boolean whiteSpaceCollapse = false;
+
+ /* Test IGNORE. */
+ FoRefinedText4a out =
+ new FoRefinedText4a(input, LinefeedTreatment.IGNORE, textTransform, whiteSpaceCollapse, -1, -1);
+ Assert.assertEquals(15, out.length());
+ String expected = "Word1Word2Word3";
+ Assert.assertEquals(expected, out.toString());
+
+ /* Test PRESERVE. */
+ out = new FoRefinedText4a(input, LinefeedTreatment.PRESERVE, textTransform, whiteSpaceCollapse, -1, -1);
+ expected = input;
+ Assert.assertEquals(expected, out.toString());
+
+ /* Test TREAT_AS_SPACE. */
+ out = new FoRefinedText4a(input, LinefeedTreatment.TREAT_AS_SPACE, textTransform, whiteSpaceCollapse, -1, -1);
+ expected = " Word1 Word2 Word3 ";
+ Assert.assertEquals(expected, out.toString());
+
+ /* Test TREAT_AS_ZERO_WIDTH_SPACE. */
+ out = new FoRefinedText4a(input, LinefeedTreatment.TREAT_AS_ZERO_WIDTH_SPACE, textTransform, whiteSpaceCollapse,
+ -1, -1);
+ expected = input.replace(Basic_Latin_Block.CONTROL_LINE_FEED, General_Punctuation_Block.ZERO_WIDTH_SPACE);
+ Assert.assertEquals(expected, out.toString());
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/obj/FoRefinedText4aTests.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-27 13:32:49
|
Revision: 12279
http://sourceforge.net/p/foray/code/12279
Author: victormote
Date: 2021-12-27 13:32:48 +0000 (Mon, 27 Dec 2021)
Log Message:
-----------
Conform to aXSL changes: Add methods for inserting elements into the sequence.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/IntArrayBuilder.java
Added Paths:
-----------
trunk/foray/foray-common/src/test/java/org/foray/common/sequence/
trunk/foray/foray-common/src/test/java/org/foray/common/sequence/IntArrayBuilderTests.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/IntArrayBuilder.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/IntArrayBuilder.java 2021-12-27 12:28:00 UTC (rev 12278)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/IntArrayBuilder.java 2021-12-27 13:32:48 UTC (rev 12279)
@@ -358,4 +358,29 @@
}
}
+ @Override
+ public void insert(final int index, final int newInt) {
+ if (index < 0
+ || index > length()) {
+ throw new IndexOutOfBoundsException();
+ }
+ ensureCapacity(length() + 1);
+ System.arraycopy(this.backingArray, index, this.backingArray, index + 1, this.length - index);
+ this.length ++;
+ this.backingArray[index] = newInt;
+ }
+
+ @Override
+ public int insertSortedUnique(final int newInt) {
+ int index = binarySearch(newInt);
+ if (index > -1) {
+ throw new IllegalArgumentException("Element already exists: " + newInt);
+ }
+ /* The value returned, when negative, is (-(insertion point) - 1). */
+ index ++;
+ index = Math.abs(index);
+ insert(index, newInt);
+ return index;
+ }
+
}
Added: trunk/foray/foray-common/src/test/java/org/foray/common/sequence/IntArrayBuilderTests.java
===================================================================
--- trunk/foray/foray-common/src/test/java/org/foray/common/sequence/IntArrayBuilderTests.java (rev 0)
+++ trunk/foray/foray-common/src/test/java/org/foray/common/sequence/IntArrayBuilderTests.java 2021-12-27 13:32:48 UTC (rev 12279)
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2021 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.common.sequence;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests of {@link IntArrayBuilder}.
+ */
+public class IntArrayBuilderTests {
+
+ /**
+ * Test of {@link IntArrayBuilder#insert(int, int)}.
+ */
+ @Test
+ public void insert_Test_001() {
+ final IntArrayBuilder out = new IntArrayBuilder();
+ final int[] starting = new int[] {0, 1, 2, 3, 4, 5};
+ out.append(starting);
+ Assert.assertEquals(6, out.length());
+
+ /* Insert in the middle. */
+ out.insert(2, 100);
+ Assert.assertEquals(7, out.length());
+ int[] expected = new int[] {0, 1, 100, 2, 3, 4, 5};
+ Assert.assertArrayEquals(expected, out.toArray());
+
+ /* Insert at the beginning. */
+ out.insert(0, 101);
+ Assert.assertEquals(8, out.length());
+ expected = new int[] {101, 0, 1, 100, 2, 3, 4, 5};
+ Assert.assertArrayEquals(expected, out.toArray());
+
+ /* Insert at the end. */
+ out.insert(out.length(), 102);
+ Assert.assertEquals(9, out.length());
+ expected = new int[] {101, 0, 1, 100, 2, 3, 4, 5, 102};
+ Assert.assertArrayEquals(expected, out.toArray());
+
+ /* Insert with negative index. */
+ try {
+ out.insert(-1, 103);
+ Assert.fail(IndexOutOfBoundsException.class.getName() + " expected");
+ } catch (final IndexOutOfBoundsException e) {
+ /* Nothing to do here. This is the expected case. */
+ }
+
+ /* Insert with index greater than length(). */
+ try {
+ out.insert(out.length() + 1, 104);
+ Assert.fail(IndexOutOfBoundsException.class.getName() + " expected");
+ } catch (final IndexOutOfBoundsException e) {
+ /* Nothing to do here. This is the expected case. */
+ }
+ }
+
+ /**
+ * Test of {@link IntArrayBuilder#insertSortedUnique(int)}.
+ */
+ @Test
+ public void insertSortedUnique_Test_001() {
+ final IntArrayBuilder out = new IntArrayBuilder();
+ final int[] starting = new int[] {-20, -10, 0, 10, 20};
+ out.append(starting);
+ Assert.assertEquals(5, out.length());
+
+ /* Insert in the middle. */
+ int actualIndex = out.insertSortedUnique(5);
+ Assert.assertEquals(3, actualIndex);
+ Assert.assertEquals(6, out.length());
+ int[] expected = new int[] {-20, -10, 0, 5, 10, 20};
+ Assert.assertArrayEquals(expected, out.toArray());
+
+ /* Insert at the beginning. */
+ actualIndex = out.insertSortedUnique(-30);
+ Assert.assertEquals(0, actualIndex);
+ Assert.assertEquals(7, out.length());
+ expected = new int[] {-30, -20, -10, 0, 5, 10, 20};
+ Assert.assertArrayEquals(expected, out.toArray());
+
+ /* Insert at the end. */
+ actualIndex = out.insertSortedUnique(30);
+ Assert.assertEquals(7, actualIndex);
+ Assert.assertEquals(8, out.length());
+ expected = new int[] {-30, -20, -10, 0, 5, 10, 20, 30};
+ Assert.assertArrayEquals(expected, out.toArray());
+
+ /* Insert one that already exists. */
+ try {
+ actualIndex = out.insertSortedUnique(10);
+ Assert.fail(IllegalArgumentException.class.getName() + " expected");
+ } catch (final IllegalArgumentException e) {
+ /* Nothing to do here. This is the expected case. */
+ }
+ }
+
+}
Property changes on: trunk/foray/foray-common/src/test/java/org/foray/common/sequence/IntArrayBuilderTests.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-27 12:28:02
|
Revision: 12278
http://sourceforge.net/p/foray/code/12278
Author: victormote
Date: 2021-12-27 12:28:00 +0000 (Mon, 27 Dec 2021)
Log Message:
-----------
Change parameter from char to int to handle 21-bit codepoints.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlCharacterUtils.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlCharacterUtils.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlCharacterUtils.java 2021-12-26 16:59:53 UTC (rev 12277)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlCharacterUtils.java 2021-12-27 12:28:00 UTC (rev 12278)
@@ -548,13 +548,12 @@
/**
* Tests a character for inclusion in XML whitespace.
- * The definition of XML whitespace is obtained from the XML 1.0
- * Recommendation, Section 2.3.
- * @param c The character to be tested.
- * @return True if and only if the character is XML whitespace.
+ * The definition of XML whitespace is obtained from the XML 1.0 Recommendation, Section 2.3.
+ * @param codepoint The Unicode codepoint to be tested.
+ * @return True if and only if {@code codepoint} is XML whitespace.
*/
- public static boolean isXMLWhitespace(final char c) {
- switch (c) {
+ public static boolean isXMLWhitespace(final int codepoint) {
+ switch (codepoint) {
case ' ':
case '\t':
case '\r':
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|