foray-commit Mailing List for FOray (Page 61)
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...> - 2022-01-10 18:49:29
|
Revision: 12377
http://sourceforge.net/p/foray/code/12377
Author: victormote
Date: 2022-01-10 18:49:27 +0000 (Mon, 10 Jan 2022)
Log Message:
-----------
Conform to aXSL change: Add method to mark a location in a TokenFlow.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-10 18:20:28 UTC (rev 12376)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-10 18:49:27 UTC (rev 12377)
@@ -189,4 +189,9 @@
return null;
}
+ @Override
+ public Location markLocation(final int tokenIndex, final byte segmentIndex, final byte charIndex) {
+ return this.paraBranch.markLocation(tokenIndex, segmentIndex, charIndex);
+ }
+
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-01-10 18:20:28 UTC (rev 12376)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-01-10 18:49:27 UTC (rev 12377)
@@ -36,6 +36,7 @@
import org.axsl.common.para.ParaNode;
import org.axsl.fotree.text.FoToken;
import org.axsl.fotree.text.FoTokenFlow;
+import org.axsl.orthography.TokenFlow;
import java.util.ArrayList;
import java.util.List;
@@ -46,6 +47,48 @@
*/
public class TokenFlow4a implements FoTokenFlow {
+ /**
+ * FOray implementation of {@link FoTokenFlow.Location}.
+ */
+ public class Location implements FoTokenFlow.Location {
+ /* TODO: If 16 bits is not enough for the token index, consider cramming the three parameters into one int,
+ * using the 32 bits as 20 bits for the token, 6 for the segment, and 6 for the char, adding 4 bits to the size
+ * of the token index. */
+
+ /** The token index. See {@link TokenFlow.Location#getTokenIndex()}. */
+ private char tokenIndex;
+
+ /** The segment index. See {@link TokenFlow.Location#getSegmentIndex()}. */
+ private byte segmentIndex;
+
+ /** The char index. See {@link TokenFlow.Location#getCharIndex()}. */
+ private byte charIndex;
+
+ Location(final int tokenIndex, final byte segmentIndex, final byte charIndex) {
+ /* A char can index 65,536 tokens, which is probably 30,000 words, allowing half of the tokens to be
+ * whitespace, and some others to be punctuation. */
+ this.tokenIndex = (char) tokenIndex;
+ this.segmentIndex = segmentIndex;
+ this.charIndex = charIndex;
+ }
+
+ @Override
+ public int getTokenIndex() {
+ return this.tokenIndex;
+ }
+
+ @Override
+ public byte getSegmentIndex() {
+ return this.segmentIndex;
+ }
+
+ @Override
+ public byte getCharIndex() {
+ return this.charIndex;
+ }
+
+ }
+
/** The tokens (children) of this text flow. */
private List<FoToken> tokens = new ArrayList<FoToken>();
@@ -122,4 +165,10 @@
throw new UnsupportedOperationException();
}
+ @Override
+ public org.axsl.orthography.TokenFlow.Location markLocation(final int tokenIndex, final byte segmentIndex,
+ final byte charIndex) {
+ return new Location(tokenIndex, segmentIndex, charIndex);
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-10 18:20:30
|
Revision: 12376
http://sourceforge.net/p/foray/code/12376
Author: victormote
Date: 2022-01-10 18:20:28 +0000 (Mon, 10 Jan 2022)
Log Message:
-----------
Conform to aXSL change: Add and use interface to describe a location in a TokenFlow.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-10 15:49:17 UTC (rev 12375)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-10 18:20:28 UTC (rev 12376)
@@ -30,6 +30,7 @@
import org.foray.fotree.FoObj;
+import org.axsl.common.TextModifiers;
import org.axsl.common.para.ParaBranch;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
@@ -42,6 +43,7 @@
import org.axsl.fotree.text.FoToken;
import org.axsl.fotree.text.FoTokenFlow;
import org.axsl.orthography.OrthographyException;
+import org.axsl.orthography.TokenFlow;
import org.axsl.orthography.Whitespace;
import java.util.ListIterator;
@@ -181,8 +183,8 @@
}
@Override
- public CharSequence extract(final int startToken, final int startSegment, final int startChar, final int endToken,
- final int endSegment, final int endChar) {
+ public CharSequence extract(final TokenFlow.Location startLocation, final TokenFlow.Location endLocation,
+ final TextModifiers textModifiers) {
// TODO Auto-generated method stub
return null;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-10 15:49:19
|
Revision: 12375
http://sourceforge.net/p/foray/code/12375
Author: victormote
Date: 2022-01-10 15:49:17 +0000 (Mon, 10 Jan 2022)
Log Message:
-----------
Conform to aXSL change: Remove unused and unneeded method.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.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-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.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 2022-01-10 15:38:41 UTC (rev 12374)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.java 2022-01-10 15:49:17 UTC (rev 12375)
@@ -176,7 +176,10 @@
return builder.toString();
}
- @Override
+ /**
+ * Add a node.
+ * @param node The node to be added.
+ */
public void addNode(final ParaNode node) {
if (node == null) {
throw new IllegalArgumentException(this.getClass().getName() + " content cannot be null.");
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 2022-01-10 15:38:41 UTC (rev 12374)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete4a.java 2022-01-10 15:49:17 UTC (rev 12375)
@@ -218,11 +218,6 @@
}
@Override
- public void addNode(final ParaNode node) {
- throw new UnsupportedOperationException();
- }
-
- @Override
public int qtyParaLeaves() {
int count = 0;
for (int nodeIndex = 0; nodeIndex < qtyParaNodes(); nodeIndex ++) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-10 15:38:41 UTC (rev 12374)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-10 15:49:17 UTC (rev 12375)
@@ -87,11 +87,6 @@
}
@Override
- public void addNode(final ParaNode node) {
- throw new UnsupportedOperationException();
- }
-
- @Override
public int qtyParaLeaves() {
return this.paraBranch.qtyParaLeaves();
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-01-10 15:38:41 UTC (rev 12374)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-01-10 15:49:17 UTC (rev 12375)
@@ -73,11 +73,6 @@
}
@Override
- public void addNode(final ParaNode node) {
- throw new UnsupportedOperationException("Use addToken(FoToken) instead.");
- }
-
- @Override
public ParaLeaf paraLeafAt(final int leafIndex) {
return ParaBranch4a.paraLeafAt(this, leafIndex);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-01-10 15:38:41 UTC (rev 12374)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-01-10 15:49:17 UTC (rev 12375)
@@ -269,9 +269,4 @@
return null;
}
- @Override
- public void addNode(final ParaNode node) {
- throw new IllegalStateException("Word implementations are static and cannot add child nodes.");
- }
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-10 15:38:44
|
Revision: 12374
http://sourceforge.net/p/foray/code/12374
Author: victormote
Date: 2022-01-10 15:38:41 +0000 (Mon, 10 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: Remove no-longer-needed methods.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-10 14:18:28 UTC (rev 12373)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-10 15:38:41 UTC (rev 12374)
@@ -88,7 +88,7 @@
@Override
public void addNode(final ParaNode node) {
- this.paraBranch.addToken((FoToken) node);
+ throw new UnsupportedOperationException();
}
@Override
@@ -186,11 +186,6 @@
}
@Override
- public void addToken(final FoToken token) {
- this.paraBranch.addToken(token);
- }
-
- @Override
public CharSequence extract(final int startToken, final int startSegment, final int startChar, final int endToken,
final int endSegment, final int endChar) {
// TODO Auto-generated method stub
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-01-10 14:18:28 UTC (rev 12373)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-01-10 15:38:41 UTC (rev 12374)
@@ -36,10 +36,8 @@
import org.foray.orthography.wrapper.UppercaseWord;
import org.axsl.fotree.text.FoOrthography;
-import org.axsl.fotree.text.FoToken;
import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.OrthographyException;
-import org.axsl.orthography.TokenFlow;
import org.axsl.orthography.Word;
import org.axsl.orthography.optional.Dictionary;
import org.axsl.orthography.optional.Lexer;
@@ -438,7 +436,7 @@
return wordSequence;
}
- private void parseInterwordContent(final TokenFlow<FoToken> wordSequence, final CharSequence interword)
+ private void parseInterwordContent(final TokenFlow4a wordSequence, final CharSequence interword)
throws OrthographyException {
int index = 0;
while (index < interword.length()) {
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-01-10 14:18:28 UTC (rev 12373)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-01-10 15:38:41 UTC (rev 12374)
@@ -49,6 +49,14 @@
/** The tokens (children) of this text flow. */
private List<FoToken> tokens = new ArrayList<FoToken>();
+ /**
+ * Add a token.
+ * @param token The token to be added.
+ */
+ public void addToken(final FoToken token) {
+ this.tokens.add(token);
+ }
+
@Override
public int qtyTokens() {
return this.tokens.size();
@@ -60,11 +68,6 @@
}
@Override
- public void addToken(final FoToken segment) {
- this.tokens.add(segment);
- }
-
- @Override
public ParaNode paraNodeAt(final int nodeIndex) {
return this.tokens.get(nodeIndex);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-10 14:18:30
|
Revision: 12373
http://sourceforge.net/p/foray/code/12373
Author: victormote
Date: 2022-01-10 14:18:28 +0000 (Mon, 10 Jan 2022)
Log Message:
-----------
Switch FoTextWords4a from being effectively character-based to being word-based.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-10 14:09:03 UTC (rev 12372)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-10 14:18:28 UTC (rev 12373)
@@ -35,8 +35,6 @@
import org.axsl.common.para.ParaNode;
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.FoVisitor;
import org.axsl.fotree.fo.FoTextWords;
import org.axsl.fotree.text.FoOrthography;
@@ -46,22 +44,17 @@
import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.Whitespace;
-import java.util.ArrayList;
-import java.util.List;
import java.util.ListIterator;
/**
* Text in an FO document that is already broken into words.
*/
-public class FoTextWords4a extends AbstractCharacterSequence implements FoTextWords {
+public class FoTextWords4a extends FoText4a implements FoTextWords {
/** The parent of this node. */
private FoObj parent;
/** The parsed words. */
- private List<FoWordSequenceContent> content;
-
- /** The parsed words. */
private FoTokenFlow paraBranch;
/**
@@ -76,12 +69,6 @@
final FoOrthographyServer orthographyServer = getOrthographyServer();
final FoOrthography orthography = orthographyServer.getOrthography(getWritingSystem());
this.paraBranch = orthography.tokenize(content, 0, content.length());
- this.content = new ArrayList<FoWordSequenceContent>(this.paraBranch.qtyParaNodes());
- for (int index = 0; index < this.paraBranch.qtyParaNodes(); index ++) {
- final ParaNode wordSequenceContent = this.paraBranch.paraNodeAt(index);
- final FoWordSequenceContent contentElement = FoWordSequenceContent.create(wordSequenceContent);
- this.content.add(contentElement);
- }
}
@Override
@@ -145,27 +132,6 @@
}
@Override
- public CharSequence getAreaTreeText(final FoContext context) {
- final FoObj effectiveParent = this.effectiveParent(context);
- final WhiteSpaceTreatment whiteSpaceTreatment = effectiveParent.traitWhiteSpaceTreatment(context);
- final LinefeedTreatment linefeedTreatment = effectiveParent.traitLinefeedTreatment(context);
- final TextTransform textTransform = effectiveParent.traitTextTransform(context);
- final boolean isWhiteSpaceCollapse = effectiveParent.traitWhiteSpaceCollapse(context);
- final StringBuilder builder = new StringBuilder();
- for (int index = 0; index < this.content.size(); index ++) {
- final FoWordSequenceContent content = this.content.get(index);
- final int length = content.whiteSpaceCollapseLength(whiteSpaceTreatment, linefeedTreatment, textTransform,
- isWhiteSpaceCollapse);
- for (int contentIndex = 0; contentIndex < length; contentIndex ++) {
- final char c = content.whiteSpaceCollapseCharAt(whiteSpaceTreatment, linefeedTreatment, textTransform,
- isWhiteSpaceCollapse, contentIndex);
- builder.append(c);
- }
- }
- return builder;
- }
-
- @Override
public boolean isAllWhiteSpace() {
for (int index = 0; index < this.paraBranch.qtyTokens(); index ++) {
final FoToken token = this.paraBranch.tokenAt(index);
@@ -176,47 +142,9 @@
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 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);
+ return visitor.visit(this);
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-10 14:09:05
|
Revision: 12372
http://sourceforge.net/p/foray/code/12372
Author: victormote
Date: 2022-01-10 14:09:03 +0000 (Mon, 10 Jan 2022)
Log Message:
-----------
Allow any text items as previous siblings.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Marker4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Marker4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Marker4a.java 2022-01-10 13:34:32 UTC (rev 12371)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Marker4a.java 2022-01-10 14:09:03 UTC (rev 12372)
@@ -82,8 +82,8 @@
final FoObj sibling = siblings.get(i).asNativeType();
if (sibling instanceof Marker4a) {
/* This is valid. */
- } else if (sibling instanceof AbstractCharacterSequence) {
- final AbstractCharacterSequence text = (AbstractCharacterSequence) sibling;
+ } else if (sibling instanceof FoText4a) {
+ final FoText4a text = (FoText4a) sibling;
if (text.isAllWhiteSpace()) {
/* This is valid. */
} else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-10 13:34:34
|
Revision: 12371
http://sourceforge.net/p/foray/code/12371
Author: victormote
Date: 2022-01-10 13:34:32 +0000 (Mon, 10 Jan 2022)
Log Message:
-----------
Rename the orthography FoTokenFlow implementation for clarity. Remove the fotree implementation that was not being used.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
Added Paths:
-----------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java
Removed Paths:
-------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTokenFlow4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTokenFlow4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTokenFlow4a.java 2022-01-10 13:27:53 UTC (rev 12370)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTokenFlow4a.java 2022-01-10 13:34:32 UTC (rev 12371)
@@ -1,127 +0,0 @@
-/*
- * 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.para.ParaBranch4a;
-import org.foray.common.para.ParaBranch4aIterator;
-
-import org.axsl.common.para.ParaBranch;
-import org.axsl.common.para.ParaLeaf;
-import org.axsl.common.para.ParaNode;
-import org.axsl.fotree.text.FoToken;
-import org.axsl.fotree.text.FoTokenFlow;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-
-/**
- * FOray implementation of {@link FoTokenFlow}.
- */
-public class FoTokenFlow4a implements FoTokenFlow {
-
- /** The tokens (children) of this token flow. */
- private List<FoToken> tokens = new ArrayList<FoToken>();
-
- @Override
- public int qtyTokens() {
- return this.tokens.size();
- }
-
- @Override
- public FoToken tokenAt(final int index) {
- return this.tokens.get(index);
- }
-
- @Override
- public void addToken(final FoToken segment) {
- this.tokens.add(segment);
- }
-
- @Override
- public Type getParaNodeType() {
- return Type.BRANCH;
- }
-
- @Override
- public ParaLeaf asParaLeaf() {
- return null;
- }
-
- @Override
- public ParaBranch asParaBranch() {
- return this;
- }
-
- @Override
- public int qtyKpLeaves() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public CharSequence getText() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int qtyParaNodes() {
- return this.tokens.size();
- }
-
- @Override
- public ParaNode paraNodeAt(final int nodeIndex) {
- return (ParaNode) this.tokens.get(nodeIndex);
- }
-
- @Override
- public void addNode(final ParaNode node) {
- this.tokens.add((FoToken) node);
- }
-
- @Override
- public int qtyParaLeaves() {
- int count = 0;
- for (int index = 0; index < this.tokens.size(); index ++) {
- final ParaNode paraNode = (ParaNode) this.tokens.get(index);
- count += paraNode.qtyParaLeaves();
- }
- return count;
- }
-
- @Override
- public ParaLeaf paraLeafAt(final int leafIndex) {
- return ParaBranch4a.paraLeafAt(this, leafIndex);
- }
-
- @Override
- public ListIterator<ParaLeaf> leafIterator() {
- return new ParaBranch4aIterator(this);
- }
-
-}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-01-10 13:27:53 UTC (rev 12370)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-01-10 13:34:32 UTC (rev 12371)
@@ -408,9 +408,9 @@
}
@Override
- public TextFlow4a tokenize(final CharSequence characters, final int startIndex, final int length)
+ public TokenFlow4a tokenize(final CharSequence characters, final int startIndex, final int length)
throws OrthographyException {
- final TextFlow4a wordSequence = new TextFlow4a();
+ final TokenFlow4a wordSequence = new TokenFlow4a();
final CharSequence sequence = characters.subSequence(startIndex, startIndex + length);
final List<CharSequence> chunks = this.lexer.tokenize(sequence);
Deleted: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java 2022-01-10 13:27:53 UTC (rev 12370)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java 2022-01-10 13:34:32 UTC (rev 12371)
@@ -1,127 +0,0 @@
-/*
- * 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.orthography;
-
-import org.foray.common.para.ParaBranch4a;
-import org.foray.common.para.ParaBranch4aIterator;
-
-import org.axsl.common.para.ParaBranch;
-import org.axsl.common.para.ParaLeaf;
-import org.axsl.common.para.ParaNode;
-import org.axsl.fotree.text.FoToken;
-import org.axsl.fotree.text.FoTokenFlow;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-
-/**
- * FOray implementation of {@link FoTokenFlow}.
- */
-public class TextFlow4a implements FoTokenFlow {
-
- /** The tokens (children) of this text flow. */
- private List<FoToken> tokens = new ArrayList<FoToken>();
-
- @Override
- public int qtyTokens() {
- return this.tokens.size();
- }
-
- @Override
- public FoToken tokenAt(final int index) {
- return this.tokens.get(index);
- }
-
- @Override
- public void addToken(final FoToken segment) {
- this.tokens.add(segment);
- }
-
- @Override
- public ParaNode paraNodeAt(final int nodeIndex) {
- return this.tokens.get(nodeIndex);
- }
-
- @Override
- public void addNode(final ParaNode node) {
- throw new UnsupportedOperationException("Use addToken(FoToken) instead.");
- }
-
- @Override
- public ParaLeaf paraLeafAt(final int leafIndex) {
- return ParaBranch4a.paraLeafAt(this, leafIndex);
- }
-
- @Override
- public ListIterator<ParaLeaf> leafIterator() {
- return new ParaBranch4aIterator(this);
- }
-
- @Override
- public Type getParaNodeType() {
- return Type.BRANCH;
- }
-
- @Override
- public ParaLeaf asParaLeaf() {
- return null;
- }
-
- @Override
- public ParaBranch asParaBranch() {
- return this;
- }
-
- @Override
- public int qtyParaNodes() {
- return this.tokens.size();
- }
-
- @Override
- public int qtyParaLeaves() {
- int count = 0;
- for (int index = 0; index < this.tokens.size(); index ++) {
- final ParaNode paraNode = (ParaNode) this.tokens.get(index);
- count += paraNode.qtyParaLeaves();
- }
- return count;
- }
-
- @Override
- public int qtyKpLeaves() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public CharSequence getText() {
- throw new UnsupportedOperationException();
- }
-
-}
Copied: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java (from rev 12370, trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java)
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TokenFlow4a.java 2022-01-10 13:34:32 UTC (rev 12371)
@@ -0,0 +1,127 @@
+/*
+ * 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.orthography;
+
+import org.foray.common.para.ParaBranch4a;
+import org.foray.common.para.ParaBranch4aIterator;
+
+import org.axsl.common.para.ParaBranch;
+import org.axsl.common.para.ParaLeaf;
+import org.axsl.common.para.ParaNode;
+import org.axsl.fotree.text.FoToken;
+import org.axsl.fotree.text.FoTokenFlow;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+
+/**
+ * FOray implementation of {@link FoTokenFlow}.
+ */
+public class TokenFlow4a implements FoTokenFlow {
+
+ /** The tokens (children) of this text flow. */
+ private List<FoToken> tokens = new ArrayList<FoToken>();
+
+ @Override
+ public int qtyTokens() {
+ return this.tokens.size();
+ }
+
+ @Override
+ public FoToken tokenAt(final int index) {
+ return this.tokens.get(index);
+ }
+
+ @Override
+ public void addToken(final FoToken segment) {
+ this.tokens.add(segment);
+ }
+
+ @Override
+ public ParaNode paraNodeAt(final int nodeIndex) {
+ return this.tokens.get(nodeIndex);
+ }
+
+ @Override
+ public void addNode(final ParaNode node) {
+ throw new UnsupportedOperationException("Use addToken(FoToken) instead.");
+ }
+
+ @Override
+ public ParaLeaf paraLeafAt(final int leafIndex) {
+ return ParaBranch4a.paraLeafAt(this, leafIndex);
+ }
+
+ @Override
+ public ListIterator<ParaLeaf> leafIterator() {
+ return new ParaBranch4aIterator(this);
+ }
+
+ @Override
+ public Type getParaNodeType() {
+ return Type.BRANCH;
+ }
+
+ @Override
+ public ParaLeaf asParaLeaf() {
+ return null;
+ }
+
+ @Override
+ public ParaBranch asParaBranch() {
+ return this;
+ }
+
+ @Override
+ public int qtyParaNodes() {
+ return this.tokens.size();
+ }
+
+ @Override
+ public int qtyParaLeaves() {
+ int count = 0;
+ for (int index = 0; index < this.tokens.size(); index ++) {
+ final ParaNode paraNode = (ParaNode) this.tokens.get(index);
+ count += paraNode.qtyParaLeaves();
+ }
+ return count;
+ }
+
+ @Override
+ public int qtyKpLeaves() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public CharSequence getText() {
+ throw new UnsupportedOperationException();
+ }
+
+}
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2022-01-10 13:27:53 UTC (rev 12370)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2022-01-10 13:34:32 UTC (rev 12371)
@@ -81,7 +81,7 @@
public void parseWordSequenceTest() throws OrthographyException {
/* Spoken by Henry, Henry V, Act III Scene 1. */
final String testString = "Once more unto the breach, dear friends, once more;";
- final TextFlow4a wordSequence =
+ final TokenFlow4a wordSequence =
this.consumer.tokenize(testString, 0, testString.length());
Assert.assertEquals(20, wordSequence.qtyTokens());
Assert.assertEquals("Once", wordSequence.tokenAt(0).toString());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-10 13:27:56
|
Revision: 12370
http://sourceforge.net/p/foray/code/12370
Author: victormote
Date: 2022-01-10 13:27:53 +0000 (Mon, 10 Jan 2022)
Log Message:
-----------
Beef up class actually used with code from FoTokenFlow4a.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java 2022-01-10 13:09:30 UTC (rev 12369)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java 2022-01-10 13:27:53 UTC (rev 12370)
@@ -28,6 +28,9 @@
package org.foray.orthography;
+import org.foray.common.para.ParaBranch4a;
+import org.foray.common.para.ParaBranch4aIterator;
+
import org.axsl.common.para.ParaBranch;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
@@ -73,20 +76,17 @@
@Override
public ParaLeaf paraLeafAt(final int leafIndex) {
- // TODO Auto-generated method stub
- return null;
+ return ParaBranch4a.paraLeafAt(this, leafIndex);
}
@Override
public ListIterator<ParaLeaf> leafIterator() {
- // TODO Auto-generated method stub
- return null;
+ return new ParaBranch4aIterator(this);
}
@Override
public Type getParaNodeType() {
- // TODO Auto-generated method stub
- return null;
+ return Type.BRANCH;
}
@Override
@@ -106,20 +106,22 @@
@Override
public int qtyParaLeaves() {
- // TODO Auto-generated method stub
- return 0;
+ int count = 0;
+ for (int index = 0; index < this.tokens.size(); index ++) {
+ final ParaNode paraNode = (ParaNode) this.tokens.get(index);
+ count += paraNode.qtyParaLeaves();
+ }
+ return count;
}
@Override
public int qtyKpLeaves() {
- // TODO Auto-generated method stub
- return 0;
+ throw new UnsupportedOperationException();
}
@Override
public CharSequence getText() {
- // TODO Auto-generated method stub
- return null;
+ throw new UnsupportedOperationException();
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-10 13:09:32
|
Revision: 12369
http://sourceforge.net/p/foray/code/12369
Author: victormote
Date: 2022-01-10 13:09:30 +0000 (Mon, 10 Jan 2022)
Log Message:
-----------
Complete some missing pieces related to FoTextWords4a.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.java
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/FoTokenFlow4a.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 2022-01-10 02:44:52 UTC (rev 12368)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.java 2022-01-10 13:09:30 UTC (rev 12369)
@@ -90,12 +90,18 @@
return returnValue;
}
- @Override
- public ParaLeaf paraLeafAt(final int leafIndex) {
+ /**
+ * Returns the leaf node at a given index in a given branch.
+ * @param branch The branch whose leaf nodes are being searched.
+ * @param leafIndex The index to the leaf of {@code branch} to be returned.
+ * @return The leaf of {@code branch} at index {@code leafIndex}.
+ * @see ParaBranch#paraLeafAt(int)
+ */
+ public static ParaLeaf paraLeafAt(final ParaBranch branch, final int leafIndex) {
int runningLeafIndex = 0;
- for (int nodeIndex = 0; nodeIndex < this.nodes.size(); nodeIndex ++) {
- final ParaNode node = this.nodes.get(nodeIndex);
- final ParaBranch branch = node.asParaBranch();
+ for (int nodeIndex = 0; nodeIndex < branch.qtyParaNodes(); nodeIndex ++) {
+ final ParaNode node = branch.paraNodeAt(nodeIndex);
+ final ParaBranch childBranch = node.asParaBranch();
final ParaLeaf leaf = node.asParaLeaf();
if (runningLeafIndex == leafIndex) {
@@ -102,17 +108,17 @@
if (leaf != null) {
return leaf;
} else {
- return branch.paraLeafAt(0);
+ return childBranch.paraLeafAt(0);
}
}
- final int additionalLeaves = branch == null ? 1 : branch.qtyParaLeaves();
+ final int additionalLeaves = childBranch == null ? 1 : childBranch.qtyParaLeaves();
final int newRunningLeafIndex = runningLeafIndex + additionalLeaves;
if (newRunningLeafIndex > leafIndex) {
/* The leafIndex is a descendant of this node. */
final int relativeLeafIndex = leafIndex - runningLeafIndex;
- return branch.paraLeafAt(relativeLeafIndex);
+ return childBranch.paraLeafAt(relativeLeafIndex);
}
runningLeafIndex = newRunningLeafIndex;
@@ -121,6 +127,11 @@
}
@Override
+ public ParaLeaf paraLeafAt(final int leafIndex) {
+ return paraLeafAt(this, leafIndex);
+ }
+
+ @Override
public int qtyKpLeaves() {
int returnValue = 0;
for (int nodeIndex = 0; nodeIndex < qtyParaNodes(); nodeIndex ++) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-10 02:44:52 UTC (rev 12368)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-10 13:09:30 UTC (rev 12369)
@@ -96,8 +96,7 @@
@Override
public ParaNode paraNodeAt(final int nodeIndex) {
- /* TODO: Fix this ugly cast. */
- return (ParaNode) this.paraBranch.tokenAt(nodeIndex);
+ return this.paraBranch.paraNodeAt(nodeIndex);
}
@Override
@@ -107,13 +106,12 @@
@Override
public int qtyParaLeaves() {
- return this.content.size();
+ return this.paraBranch.qtyParaLeaves();
}
@Override
public ParaLeaf paraLeafAt(final int leafIndex) {
- /* TODO: Fix this ugly cast. */
- return (ParaLeaf) this.paraBranch.paraLeafAt(leafIndex);
+ return this.paraBranch.paraLeafAt(leafIndex);
}
@Override
@@ -251,20 +249,17 @@
@Override
public int qtyTokens() {
- // TODO Auto-generated method stub
- return 0;
+ return this.paraBranch.qtyTokens();
}
@Override
public FoToken tokenAt(final int index) {
- // TODO Auto-generated method stub
- return null;
+ return this.paraBranch.tokenAt(index);
}
@Override
public void addToken(final FoToken token) {
- // TODO Auto-generated method stub
-
+ this.paraBranch.addToken(token);
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTokenFlow4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTokenFlow4a.java 2022-01-10 02:44:52 UTC (rev 12368)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTokenFlow4a.java 2022-01-10 13:09:30 UTC (rev 12369)
@@ -28,6 +28,7 @@
package org.foray.fotree.fo.obj;
+import org.foray.common.para.ParaBranch4a;
import org.foray.common.para.ParaBranch4aIterator;
import org.axsl.common.para.ParaBranch;
@@ -105,14 +106,17 @@
@Override
public int qtyParaLeaves() {
- // TODO Auto-generated method stub
- return 0;
+ int count = 0;
+ for (int index = 0; index < this.tokens.size(); index ++) {
+ final ParaNode paraNode = (ParaNode) this.tokens.get(index);
+ count += paraNode.qtyParaLeaves();
+ }
+ return count;
}
@Override
public ParaLeaf paraLeafAt(final int leafIndex) {
- // TODO Auto-generated method stub
- return null;
+ return ParaBranch4a.paraLeafAt(this, leafIndex);
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-10 02:44:54
|
Revision: 12368
http://sourceforge.net/p/foray/code/12368
Author: victormote
Date: 2022-01-10 02:44:52 +0000 (Mon, 10 Jan 2022)
Log Message:
-----------
Remove a dependency on "content".
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-10 02:29:56 UTC (rev 12367)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-10 02:44:52 UTC (rev 12368)
@@ -44,6 +44,7 @@
import org.axsl.fotree.text.FoToken;
import org.axsl.fotree.text.FoTokenFlow;
import org.axsl.orthography.OrthographyException;
+import org.axsl.orthography.Whitespace;
import java.util.ArrayList;
import java.util.List;
@@ -168,13 +169,10 @@
@Override
public boolean isAllWhiteSpace() {
- for (int index = 0; index < this.content.size(); index ++) {
- final FoWordSequenceContent content = this.content.get(index);
- for (int contentIndex = 0; contentIndex < content.length(); contentIndex ++) {
- final char c = content.charAt(contentIndex);
- if (! isWhitespace(c)) {
- return false;
- }
+ for (int index = 0; index < this.paraBranch.qtyTokens(); index ++) {
+ final FoToken token = this.paraBranch.tokenAt(index);
+ if (! (token instanceof Whitespace)) {
+ return false;
}
}
return true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-10 02:29:59
|
Revision: 12367
http://sourceforge.net/p/foray/code/12367
Author: victormote
Date: 2022-01-10 02:29:56 +0000 (Mon, 10 Jan 2022)
Log Message:
-----------
Rename class for consistency and clarity.
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTokenFlow4a.java
Removed Paths:
-------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java 2022-01-10 01:54:04 UTC (rev 12366)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java 2022-01-10 02:29:56 UTC (rev 12367)
@@ -1,123 +0,0 @@
-/*
- * 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.para.ParaBranch4aIterator;
-
-import org.axsl.common.para.ParaBranch;
-import org.axsl.common.para.ParaLeaf;
-import org.axsl.common.para.ParaNode;
-import org.axsl.fotree.text.FoToken;
-import org.axsl.fotree.text.FoTokenFlow;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-
-/**
- * FOray implementation of {@link FoTokenFlow}.
- */
-public class FoTextFlow4a implements FoTokenFlow, ParaBranch {
-
- /** The tokens (children) of this token flow. */
- private List<FoToken> tokens = new ArrayList<FoToken>();
-
- @Override
- public int qtyTokens() {
- return this.tokens.size();
- }
-
- @Override
- public FoToken tokenAt(final int index) {
- return this.tokens.get(index);
- }
-
- @Override
- public void addToken(final FoToken segment) {
- this.tokens.add(segment);
- }
-
- @Override
- public Type getParaNodeType() {
- return Type.BRANCH;
- }
-
- @Override
- public ParaLeaf asParaLeaf() {
- return null;
- }
-
- @Override
- public ParaBranch asParaBranch() {
- return this;
- }
-
- @Override
- public int qtyKpLeaves() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public CharSequence getText() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int qtyParaNodes() {
- return this.tokens.size();
- }
-
- @Override
- public ParaNode paraNodeAt(final int nodeIndex) {
- return (ParaNode) this.tokens.get(nodeIndex);
- }
-
- @Override
- public void addNode(final ParaNode node) {
- this.tokens.add((FoToken) node);
- }
-
- @Override
- public int qtyParaLeaves() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public ParaLeaf paraLeafAt(final int leafIndex) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public ListIterator<ParaLeaf> leafIterator() {
- return new ParaBranch4aIterator(this);
- }
-
-}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTokenFlow4a.java (from rev 12365, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTokenFlow4a.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTokenFlow4a.java 2022-01-10 02:29:56 UTC (rev 12367)
@@ -0,0 +1,123 @@
+/*
+ * 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.para.ParaBranch4aIterator;
+
+import org.axsl.common.para.ParaBranch;
+import org.axsl.common.para.ParaLeaf;
+import org.axsl.common.para.ParaNode;
+import org.axsl.fotree.text.FoToken;
+import org.axsl.fotree.text.FoTokenFlow;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+
+/**
+ * FOray implementation of {@link FoTokenFlow}.
+ */
+public class FoTokenFlow4a implements FoTokenFlow {
+
+ /** The tokens (children) of this token flow. */
+ private List<FoToken> tokens = new ArrayList<FoToken>();
+
+ @Override
+ public int qtyTokens() {
+ return this.tokens.size();
+ }
+
+ @Override
+ public FoToken tokenAt(final int index) {
+ return this.tokens.get(index);
+ }
+
+ @Override
+ public void addToken(final FoToken segment) {
+ this.tokens.add(segment);
+ }
+
+ @Override
+ public Type getParaNodeType() {
+ return Type.BRANCH;
+ }
+
+ @Override
+ public ParaLeaf asParaLeaf() {
+ return null;
+ }
+
+ @Override
+ public ParaBranch asParaBranch() {
+ return this;
+ }
+
+ @Override
+ public int qtyKpLeaves() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public CharSequence getText() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int qtyParaNodes() {
+ return this.tokens.size();
+ }
+
+ @Override
+ public ParaNode paraNodeAt(final int nodeIndex) {
+ return (ParaNode) this.tokens.get(nodeIndex);
+ }
+
+ @Override
+ public void addNode(final ParaNode node) {
+ this.tokens.add((FoToken) node);
+ }
+
+ @Override
+ public int qtyParaLeaves() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public ParaLeaf paraLeafAt(final int leafIndex) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ListIterator<ParaLeaf> leafIterator() {
+ return new ParaBranch4aIterator(this);
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-10 01:54:07
|
Revision: 12366
http://sourceforge.net/p/foray/code/12366
Author: victormote
Date: 2022-01-10 01:54:04 +0000 (Mon, 10 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: Move remaining code related to line-breaking from axsl-orthography to axsl-fotree.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphen4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutatingWord4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegment.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordSegment4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapper.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/CapitalizedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/ExactWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/FinalSegmentModifiedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/SuffixedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/UppercaseWord.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
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphen4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphen4a.java 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphen4a.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -36,8 +36,10 @@
import org.axsl.common.para.ParaGlue;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaPenalty;
+import org.axsl.fotree.text.FoDiscretionaryHyphen;
import org.axsl.orthography.DiscretionaryHyphen;
+import java.util.Collections;
import java.util.EnumMap;
import java.util.Map;
@@ -45,32 +47,44 @@
* FOray implementation of {@link DiscretionaryHyphen}.
* Instances of this class are immutable.
*/
-public final class DiscretionaryHyphen4a extends ParaLeaf4a implements DiscretionaryHyphen {
+public final class DiscretionaryHyphen4a extends ParaLeaf4a implements FoDiscretionaryHyphen {
- /** Pre-built "heinous" hyphenation point. */
- public static final DiscretionaryHyphen4a HEINOUS = new DiscretionaryHyphen4a(ParaPenalty.Quality.INFINITE_PENALTY);
-
/** Pre-built "acceptable" hyphenation point. */
- public static final DiscretionaryHyphen4a ACCEPTABLE = new DiscretionaryHyphen4a(ParaPenalty.Quality.ACCEPTABLE);
+ public static final DiscretionaryHyphen4a ACCEPTABLE =
+ new DiscretionaryHyphen4a(DiscretionaryHyphen.Quality.ACCEPTABLE);
/** Pre-built "good" hyphenation point. */
- public static final DiscretionaryHyphen4a GOOD = new DiscretionaryHyphen4a(ParaPenalty.Quality.GOOD);
+ public static final DiscretionaryHyphen4a GOOD = new DiscretionaryHyphen4a(DiscretionaryHyphen.Quality.GOOD);
/** Pre-built "best" hyphenation point. */
- public static final DiscretionaryHyphen4a BEST = new DiscretionaryHyphen4a(ParaPenalty.Quality.BEST);
+ public static final DiscretionaryHyphen4a BEST = new DiscretionaryHyphen4a(DiscretionaryHyphen.Quality.BEST);
- /** The array of pre-constructed instances. */
+ /** The map of pre-constructed instances. */
private static final Map<ParaPenalty.Quality, DiscretionaryHyphen4a> PRE_CONSTRUCTED_POINTS =
new EnumMap<ParaPenalty.Quality, DiscretionaryHyphen4a>(ParaPenalty.Quality.class);
static {
- PRE_CONSTRUCTED_POINTS.put(ParaPenalty.Quality.INFINITE_PENALTY, HEINOUS);
PRE_CONSTRUCTED_POINTS.put(ParaPenalty.Quality.ACCEPTABLE, ACCEPTABLE);
PRE_CONSTRUCTED_POINTS.put(ParaPenalty.Quality.GOOD, GOOD);
PRE_CONSTRUCTED_POINTS.put(ParaPenalty.Quality.BEST, BEST);
}
+ /** Map whose key is an instance of {@link DiscretionaryHyphen.Quality} and whose value is the instance of
+ * {@link ParaPenalty.Quality} to which it maps. */
+ private static final Map<DiscretionaryHyphen.Quality, ParaPenalty.Quality> PENALTY_MAP_INTERNAL =
+ new EnumMap<DiscretionaryHyphen.Quality, ParaPenalty.Quality>(DiscretionaryHyphen.Quality.class);
+ static {
+ PENALTY_MAP_INTERNAL.put(DiscretionaryHyphen.Quality.ACCEPTABLE, ParaPenalty.Quality.ACCEPTABLE);
+ PENALTY_MAP_INTERNAL.put(DiscretionaryHyphen.Quality.GOOD, ParaPenalty.Quality.GOOD);
+ PENALTY_MAP_INTERNAL.put(DiscretionaryHyphen.Quality.BEST, ParaPenalty.Quality.BEST);
+ }
+
+ /** Unmodifiable view of the map whose key is an instance of {@link DiscretionaryHyphen.Quality} and whose value is
+ * the instance of {@link ParaPenalty.Quality} to which it maps. */
+ public static final Map<DiscretionaryHyphen.Quality, ParaPenalty.Quality> PENALTY_MAP =
+ Collections.unmodifiableMap(PENALTY_MAP_INTERNAL);
+
/** The quality for this instance. */
- private ParaPenalty.Quality quality;
+ private DiscretionaryHyphen.Quality quality;
/**
* Protected constructor. There are only 3 possible normal values, so these are pre-constructed.
@@ -77,7 +91,7 @@
* Use {@link #fromQuality(org.axsl.common.para.ParaPenalty.Quality)} to obtain an instance of this class.
* @param quality The quality for this instance.
*/
- protected DiscretionaryHyphen4a(final ParaPenalty.Quality quality) {
+ protected DiscretionaryHyphen4a(final DiscretionaryHyphen.Quality quality) {
this.quality = quality;
}
@@ -91,7 +105,7 @@
}
@Override
- public ParaPenalty.Quality getQuality() {
+ public DiscretionaryHyphen.Quality getQuality() {
return this.quality;
}
@@ -106,8 +120,13 @@
}
@Override
+ public org.axsl.common.para.ParaPenalty.Quality getPenaltyQuality() {
+ return PENALTY_MAP.get(this.quality);
+ }
+
+ @Override
public int getCost(final ParaContext paraContext) {
- return paraContext.getCost(this.quality);
+ return paraContext.getCost(getPenaltyQuality());
}
@Override
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -44,13 +44,14 @@
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
import org.axsl.common.para.ParaPenalty;
+import org.axsl.fotree.text.FoDiscretionaryHyphen;
+import org.axsl.orthography.DiscretionaryHyphen;
import org.axsl.orthography.DiscretionaryHyphenMutating;
import java.io.Serializable;
/**
- * <p>Specialized information about a specific hyphenation break opportunity in
- * a word.
+ * <p>Specialized information about a specific hyphenation break opportunity in a word.
* This handles "hard" hyphenation cases, such as those where the word changes
* spelling when it is hyphenated.
* See {@link org.axsl.orthography.DiscretionaryHyphenMutating} for more information about the
@@ -62,13 +63,13 @@
* pre-break and post-break are used. Typically, pre-break is equal to
* the hyphen character and the others are empty.</p>
*/
-public class DiscretionaryHyphenMutating4a implements Serializable, DiscretionaryHyphenMutating {
+public class DiscretionaryHyphenMutating4a implements Serializable, FoDiscretionaryHyphen, DiscretionaryHyphenMutating {
/** Constant needed for serialization. */
private static final long serialVersionUID = 990405609314441965L;
/** The quality for this instance. */
- private ParaPenalty.Quality quality;
+ private DiscretionaryHyphen.Quality quality;
/** The pre-break text. */
private String preBreak;
@@ -86,7 +87,7 @@
* @param no The no-break text (can be null).
* @param post The post-break text (can be null).
*/
- DiscretionaryHyphenMutating4a(final ParaPenalty.Quality quality, final String pre, final String no,
+ DiscretionaryHyphenMutating4a(final DiscretionaryHyphen.Quality quality, final String pre, final String no,
final String post) {
this.quality = quality;
this.preBreak = pre;
@@ -145,7 +146,7 @@
}
@Override
- public Quality getQuality() {
+ public DiscretionaryHyphen.Quality getQuality() {
return this.quality;
}
@@ -156,10 +157,16 @@
}
@Override
+ public org.axsl.common.para.ParaPenalty.Quality getPenaltyQuality() {
+ return DiscretionaryHyphen4a.PENALTY_MAP.get(this.quality);
+ }
+
+ @Override
public int getCost(final ParaContext paraContext) {
- return paraContext.getCost(this.quality);
+ return paraContext.getCost(getPenaltyQuality());
}
+
@Override
public boolean isFlagged() {
return true;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutatingWord4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutatingWord4a.java 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutatingWord4a.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -28,7 +28,7 @@
package org.foray.orthography;
-import org.axsl.orthography.DiscretionaryHyphen;
+import org.axsl.fotree.text.FoDiscretionaryHyphen;
import java.io.Serializable;
@@ -75,7 +75,7 @@
}
@Override
- public DiscretionaryHyphen hyphenationPointAt(final int pointIndex) {
+ public FoDiscretionaryHyphen hyphenationPointAt(final int pointIndex) {
if (this.breaks[pointIndex] == null) {
return super.hyphenationPointAt(pointIndex);
} else {
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -28,8 +28,9 @@
package org.foray.orthography;
+import org.axsl.fotree.text.FoWordComponent;
+import org.axsl.fotree.text.FoWordSegment;
import org.axsl.orthography.Word;
-import org.axsl.orthography.WordComponent;
import org.axsl.orthography.WordSegment;
/**
@@ -93,7 +94,7 @@
}
@Override
- public WordSegment wordSegmentAt(final int segmentIndex) {
+ public FoWordSegment wordSegmentAt(final int segmentIndex) {
final int dictionaryIndex = this.segments[segmentIndex];
return this.dictionary.getWordSegment(dictionaryIndex);
}
@@ -114,7 +115,7 @@
}
@Override
- public WordComponent paraLeafAt(final int index) {
+ public FoWordComponent paraLeafAt(final int index) {
return wordComponentAt(index);
}
@@ -134,7 +135,7 @@
public CharSequence getText() {
final StringBuilder builder = new StringBuilder();
for (int index = 0; index < this.segments.length; index ++) {
- final WordSegment segment = wordSegmentAt(index);
+ final FoWordSegment segment = wordSegmentAt(index);
builder.append(segment.getText());
}
return builder.toString();
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegment.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegment.java 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegment.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -28,8 +28,7 @@
package org.foray.orthography;
-import org.axsl.common.para.ParaLeaf;
-import org.axsl.orthography.WordSegment;
+import org.axsl.fotree.text.FoWordSegment;
/**
* Word segments made up of string or string-like entities.
@@ -36,6 +35,6 @@
* This interface is needed for classes that extend classes that are raw in nature and that would not be expected to
* conform to this kind of interface.
*/
-public interface StringWordSegment extends WordSegment, ParaLeaf {
+public interface StringWordSegment extends FoWordSegment {
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -36,10 +36,11 @@
import org.axsl.common.para.ParaNode;
import org.axsl.common.para.ParaPenalty;
import org.axsl.common.sequence.ByteSequence;
+import org.axsl.fotree.text.FoDiscretionaryHyphen;
import org.axsl.fotree.text.FoWord;
-import org.axsl.orthography.DiscretionaryHyphen;
+import org.axsl.fotree.text.FoWordComponent;
+import org.axsl.fotree.text.FoWordSegment;
import org.axsl.orthography.Word;
-import org.axsl.orthography.WordComponent;
import org.axsl.orthography.WordSegment;
import java.io.Serializable;
@@ -63,7 +64,7 @@
public String toString() {
final StringBuilder builder = new StringBuilder();
for (int index = 0; index < qtyWordComponents(); index ++) {
- final ParaLeaf component = wordComponentAt(index);
+ final FoWordComponent component = wordComponentAt(index);
builder.append(component.toString());
}
return builder.toString();
@@ -73,7 +74,7 @@
public CharSequence getActualContent() {
final StringBuilder builder = new StringBuilder();
for (int index = 0; index < qtyWordSegments(); index ++) {
- final WordSegment segment = wordSegmentAt(index);
+ final FoWordSegment segment = wordSegmentAt(index);
builder.append(segment.getText());
}
return builder.toString();
@@ -83,7 +84,7 @@
public CharSequence getNormalizedContent() {
final StringBuilder builder = new StringBuilder();
for (int index = 0; index < qtyWordSegments(); index ++) {
- final WordSegment segment = wordSegmentAt(index);
+ final FoWordSegment segment = wordSegmentAt(index);
builder.append(segment.getText());
}
return builder.toString();
@@ -164,7 +165,7 @@
}
@Override
- public DiscretionaryHyphen hyphenationPointAt(final int pointIndex) {
+ public FoDiscretionaryHyphen hyphenationPointAt(final int pointIndex) {
return DiscretionaryHyphen4a.fromQuality(ParaPenalty.Quality.ACCEPTABLE);
}
@@ -181,7 +182,7 @@
}
@Override
- public WordComponent wordComponentAt(final int componentIndex) {
+ public FoWordComponent wordComponentAt(final int componentIndex) {
if (componentIndex < 0
|| componentIndex >= qtyWordComponents()) {
throw new IndexOutOfBoundsException(Integer.toString(componentIndex));
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordSegment4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordSegment4a.java 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordSegment4a.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -35,6 +35,7 @@
import org.axsl.common.para.ParaGlue;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaPenalty;
+import org.axsl.fotree.text.FoWordSegment;
import org.axsl.orthography.WordSegment;
import java.io.Serializable;
@@ -42,7 +43,7 @@
/**
* Abstract superclass for FOray {@link WordSegment} implementations.
*/
-public abstract class WordSegment4a extends ParaLeaf4a implements WordSegment, Serializable {
+public abstract class WordSegment4a extends ParaLeaf4a implements FoWordSegment, Serializable {
/** Constant needed for serialization. */
private static final long serialVersionUID = -9006099460669286001L;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapper.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapper.java 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapper.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -29,7 +29,7 @@
package org.foray.orthography;
import org.axsl.fotree.text.FoWord;
-import org.axsl.orthography.WordSegment;
+import org.axsl.fotree.text.FoWordSegment;
/**
* Decorates a normalized word with some additional data.
@@ -70,7 +70,7 @@
}
@Override
- public WordSegment wordSegmentAt(final int segmentIndex) {
+ public FoWordSegment wordSegmentAt(final int segmentIndex) {
return this.wrappedWord.wordSegmentAt(segmentIndex);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/CapitalizedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/CapitalizedWord.java 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/CapitalizedWord.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -32,6 +32,7 @@
import org.axsl.common.para.ParaLeaf;
import org.axsl.fotree.text.FoWord;
+import org.axsl.fotree.text.FoWordSegment;
import org.axsl.orthography.WordSegment;
/**
@@ -91,8 +92,8 @@
}
@Override
- public WordSegment wordSegmentAt(final int segmentIndex) {
- final WordSegment segment = getWrappedWord().wordSegmentAt(segmentIndex);
+ public FoWordSegment wordSegmentAt(final int segmentIndex) {
+ final FoWordSegment segment = getWrappedWord().wordSegmentAt(segmentIndex);
if (segmentIndex == 0) {
return new Segment(segment);
} else {
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -35,7 +35,7 @@
import org.axsl.common.para.ParaNode;
import org.axsl.common.para.ParaPenalty;
import org.axsl.fotree.text.FoWord;
-import org.axsl.orthography.WordComponent;
+import org.axsl.fotree.text.FoWordComponent;
/**
* Decorates a normalized word with some additional data.
@@ -89,7 +89,7 @@
}
@Override
- public WordComponent wordComponentAt(final int componentIndex) {
+ public FoWordComponent wordComponentAt(final int componentIndex) {
if (componentIndex < 0
|| componentIndex >= qtyWordComponents()) {
throw new IndexOutOfBoundsException(Integer.toString(componentIndex));
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/ExactWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/ExactWord.java 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/ExactWord.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -34,7 +34,7 @@
import org.axsl.common.para.ParaLeaf;
import org.axsl.fotree.text.FoWord;
-import org.axsl.orthography.WordSegment;
+import org.axsl.fotree.text.FoWordSegment;
/**
* Decorates a normalized word with an exact representation of the actual capitalization.
@@ -69,8 +69,8 @@
}
@Override
- public WordSegment wordSegmentAt(final int segmentIndex) {
- final WordSegment segment = getWrappedWord().wordSegmentAt(segmentIndex);
+ public FoWordSegment wordSegmentAt(final int segmentIndex) {
+ final FoWordSegment segment = getWrappedWord().wordSegmentAt(segmentIndex);
final int start = StringWord.getSegmentStart(getWrappedWord(), segmentIndex);
if (CharSequenceUtils.areEquivalent(segment, 0, segment.length(), this.exact, 0, this.exact.length())) {
return segment;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/FinalSegmentModifiedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/FinalSegmentModifiedWord.java 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/FinalSegmentModifiedWord.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -31,6 +31,7 @@
import org.foray.orthography.WordWrapper;
import org.axsl.fotree.text.FoWord;
+import org.axsl.fotree.text.FoWordSegment;
import org.axsl.orthography.WordSegment;
/**
@@ -42,7 +43,7 @@
private static final long serialVersionUID = 8075477767144178967L;
/** The word segment that replaces the last word segment in the wrapped word. */
- private WordSegment lastSegment;
+ private FoWordSegment lastSegment;
/**
* Package-visible constructor. Use {@link LatinPlural1WordFactory} to create an instance.
@@ -56,7 +57,7 @@
}
@Override
- public WordSegment wordSegmentAt(final int segmentIndex) {
+ public FoWordSegment wordSegmentAt(final int segmentIndex) {
if (segmentIndex == qtyWordSegments() - 1) {
return this.lastSegment;
}
@@ -68,6 +69,6 @@
* @param unmodifiedSegment The segment that should be wrapped to create the substitute.
* @return The segment that replaces the final segment.
*/
- protected abstract WordSegment createModifiedSegment(WordSegment unmodifiedSegment);
+ protected abstract FoWordSegment createModifiedSegment(WordSegment unmodifiedSegment);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1Word.java 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1Word.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -30,6 +30,7 @@
import org.axsl.common.para.ParaLeaf;
import org.axsl.fotree.text.FoWord;
+import org.axsl.fotree.text.FoWordSegment;
import org.axsl.orthography.WordSegment;
/**
@@ -86,7 +87,7 @@
}
@Override
- protected WordSegment createModifiedSegment(final WordSegment unmodifiedSegment) {
+ protected FoWordSegment createModifiedSegment(final WordSegment unmodifiedSegment) {
return new Segment(unmodifiedSegment);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2Word.java 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2Word.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -30,6 +30,7 @@
import org.axsl.common.para.ParaLeaf;
import org.axsl.fotree.text.FoWord;
+import org.axsl.fotree.text.FoWordSegment;
import org.axsl.orthography.WordSegment;
/**
@@ -89,7 +90,7 @@
}
@Override
- protected WordSegment createModifiedSegment(final WordSegment unmodifiedSegment) {
+ protected FoWordSegment createModifiedSegment(final WordSegment unmodifiedSegment) {
return new Segment(unmodifiedSegment);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1Word.java 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1Word.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -30,6 +30,7 @@
import org.axsl.common.para.ParaLeaf;
import org.axsl.fotree.text.FoWord;
+import org.axsl.fotree.text.FoWordSegment;
import org.axsl.orthography.WordSegment;
/**
@@ -87,7 +88,7 @@
}
@Override
- protected WordSegment createModifiedSegment(final WordSegment unmodifiedSegment) {
+ protected FoWordSegment createModifiedSegment(final WordSegment unmodifiedSegment) {
return new Segment(unmodifiedSegment);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2Word.java 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2Word.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -30,6 +30,7 @@
import org.axsl.common.para.ParaLeaf;
import org.axsl.fotree.text.FoWord;
+import org.axsl.fotree.text.FoWordSegment;
import org.axsl.orthography.WordSegment;
/**
@@ -87,7 +88,7 @@
}
@Override
- protected WordSegment createModifiedSegment(final WordSegment unmodifiedSegment) {
+ protected FoWordSegment createModifiedSegment(final WordSegment unmodifiedSegment) {
return new Segment(unmodifiedSegment);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/SuffixedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/SuffixedWord.java 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/SuffixedWord.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -32,7 +32,7 @@
import org.foray.orthography.WordWrapper;
import org.axsl.fotree.text.FoWord;
-import org.axsl.orthography.WordSegment;
+import org.axsl.fotree.text.FoWordSegment;
/**
* Wraps a word that has a suffix attached.
@@ -57,7 +57,7 @@
}
@Override
- public WordSegment wordSegmentAt(final int segmentIndex) {
+ public FoWordSegment wordSegmentAt(final int segmentIndex) {
if (segmentIndex < getWrappedWord().qtyWordSegments()) {
return getWrappedWord().wordSegmentAt(segmentIndex);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/UppercaseWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/UppercaseWord.java 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/UppercaseWord.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -32,6 +32,7 @@
import org.axsl.common.para.ParaLeaf;
import org.axsl.fotree.text.FoWord;
+import org.axsl.fotree.text.FoWordSegment;
import org.axsl.orthography.WordSegment;
/**
@@ -86,7 +87,7 @@
}
@Override
- public WordSegment wordSegmentAt(final int segmentIndex) {
+ public FoWordSegment wordSegmentAt(final int segmentIndex) {
final WordSegment segment = getWrappedWord().wordSegmentAt(segmentIndex);
return new Segment(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 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/SegmentDictionaryWordTests.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -29,7 +29,7 @@
package org.foray.orthography;
import org.axsl.common.para.ParaNode;
-import org.axsl.common.para.ParaPenalty.Quality;
+import org.axsl.orthography.DiscretionaryHyphen.Quality;
import org.junit.Assert;
import org.junit.BeforeClass;
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 2022-01-10 00:20:06 UTC (rev 12365)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordWrapperTests.java 2022-01-10 01:54:04 UTC (rev 12366)
@@ -29,7 +29,7 @@
package org.foray.orthography;
import org.axsl.common.para.ParaNode;
-import org.axsl.common.para.ParaPenalty.Quality;
+import org.axsl.orthography.DiscretionaryHyphen.Quality;
import org.axsl.orthography.Word;
import org.junit.Assert;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-10 00:20:09
|
Revision: 12365
http://sourceforge.net/p/foray/code/12365
Author: victormote
Date: 2022-01-10 00:20:06 +0000 (Mon, 10 Jan 2022)
Log Message:
-----------
Conform to aXSL change: Remove no-longer-needed interface.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java 2022-01-09 22:32:56 UTC (rev 12364)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java 2022-01-10 00:20:06 UTC (rev 12365)
@@ -35,7 +35,6 @@
import org.axsl.common.para.ParaNode;
import org.axsl.fotree.text.FoToken;
import org.axsl.fotree.text.FoTokenFlow;
-import org.axsl.orthography.TokenFlowFactory;
import java.util.ArrayList;
import java.util.List;
@@ -46,14 +45,6 @@
*/
public class FoTextFlow4a implements FoTokenFlow, ParaBranch {
- /** Singleton factory. */
- private static final TokenFlowFactory<FoTextFlow4a> FACTORY = new TokenFlowFactory<FoTextFlow4a>() {
- @Override
- public FoTextFlow4a makeTextFlow() {
- return new FoTextFlow4a();
- }
- };
-
/** The tokens (children) of this token flow. */
private List<FoToken> tokens = new ArrayList<FoToken>();
@@ -72,14 +63,6 @@
this.tokens.add(segment);
}
- /**
- * Returns the singleton factory that creates instances of this class.
- * @return The singleton factory that creates instances of this class.
- */
- public static TokenFlowFactory<FoTextFlow4a> getFactory() {
- return FACTORY;
- }
-
@Override
public Type getParaNodeType() {
return Type.BRANCH;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java 2022-01-09 22:32:56 UTC (rev 12364)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java 2022-01-10 00:20:06 UTC (rev 12365)
@@ -33,7 +33,6 @@
import org.axsl.common.para.ParaNode;
import org.axsl.fotree.text.FoToken;
import org.axsl.fotree.text.FoTokenFlow;
-import org.axsl.orthography.TokenFlowFactory;
import java.util.ArrayList;
import java.util.List;
@@ -44,14 +43,6 @@
*/
public class TextFlow4a implements FoTokenFlow {
- /** Singleton factory. */
- private static final TokenFlowFactory<TextFlow4a> FACTORY = new TokenFlowFactory<TextFlow4a>() {
- @Override
- public TextFlow4a makeTextFlow() {
- return new TextFlow4a();
- }
- };
-
/** The tokens (children) of this text flow. */
private List<FoToken> tokens = new ArrayList<FoToken>();
@@ -70,14 +61,6 @@
this.tokens.add(segment);
}
- /**
- * Returns the singleton factory that creates instances of this class.
- * @return The singleton factory that creates instances of this class.
- */
- public static TokenFlowFactory<TextFlow4a> getFactory() {
- return FACTORY;
- }
-
@Override
public ParaNode paraNodeAt(final int nodeIndex) {
return this.tokens.get(nodeIndex);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-09 22:32:59
|
Revision: 12364
http://sourceforge.net/p/foray/code/12364
Author: victormote
Date: 2022-01-09 22:32:56 +0000 (Sun, 09 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: Move more fotree-related text content features from axsl-orthography to axsl-fotree.
Modified Paths:
--------------
trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java
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/Root4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2022-01-09 21:08:43 UTC (rev 12363)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2022-01-09 22:32:56 UTC (rev 12364)
@@ -46,6 +46,7 @@
import org.axsl.font.FontException;
import org.axsl.font.FontServer;
import org.axsl.fotree.FoTreeFactory;
+import org.axsl.fotree.text.FoOrthographyServer;
import org.axsl.graphic.GraphicServer;
import org.axsl.layout.LayoutFactory;
import org.axsl.linebreak.LineBreakerFactory;
@@ -96,7 +97,7 @@
public static ForaySession makeFOraySession(final SessionConfig sessionConfig) throws ForayException {
final Logger logger = LoggerFactory.getLogger(ForaySpecific.class);
final FontServer fontServer = ForaySpecific.makeFontServer(sessionConfig);
- final OrthographyServer hyphenServer = ForaySpecific.makeHyphenationServer(sessionConfig);
+ final FoOrthographyServer hyphenServer = ForaySpecific.makeHyphenationServer(sessionConfig);
final TextServer textServer = ForaySpecific.makeTextServer(logger, hyphenServer);
final GraphicServer graphicServer = ForaySpecific.makeGraphicServer(logger);
final FoTreeFactory foTreeServer = ForaySpecific.makeFOTreeFactory(
@@ -167,7 +168,7 @@
* @return The newly-created HyphenationServer instance.
* @throws ForayException For errors creating the hyphenation server.
*/
- public static OrthographyServer makeHyphenationServer(final SessionConfig configuration) throws ForayException {
+ public static FoOrthographyServer makeHyphenationServer(final SessionConfig configuration) throws ForayException {
final OrthographyServerConfig config = new OrthographyServerConfig();
config.setOrthographyConfigurationLocation(configuration.optionOrthographyConfiguration());
config.setWordListsBaseDirectory(configuration.optionDictionariesBaseDirectory());
@@ -212,7 +213,7 @@
final FontServer fontServer,
final GraphicServer graphicServer,
final TextServer textServer,
- final OrthographyServer hyphenationServer)
+ final FoOrthographyServer hyphenationServer)
throws ForayException {
final URL[] graphicSearchPath = buildGraphicSearchPath(configuration);
return new FoTreeServer4a(logger, fontServer, textServer, hyphenationServer,
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java 2022-01-09 21:08:43 UTC (rev 12363)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java 2022-01-09 22:32:56 UTC (rev 12364)
@@ -40,8 +40,8 @@
import org.axsl.font.FontConsumer;
import org.axsl.font.FontServer;
import org.axsl.fotree.FoTreeException;
+import org.axsl.fotree.text.FoOrthographyServer;
import org.axsl.graphic.GraphicServer;
-import org.axsl.orthography.OrthographyServer;
import org.axsl.text.TextServer;
import org.slf4j.Logger;
@@ -90,7 +90,7 @@
final FontServer fontServer = ForaySpecific.makeFontServer(sessionConfig);
final GraphicServer graphicServer = ForaySpecific.makeGraphicServer(logger);
- final OrthographyServer hyphenServer = ForaySpecific.makeHyphenationServer(sessionConfig);
+ final FoOrthographyServer hyphenServer = ForaySpecific.makeHyphenationServer(sessionConfig);
final TextServer textServer = ForaySpecific.makeTextServer(logger, hyphenServer);
final URL[] graphicSearchPath = new URL[1];
final URL testDirUrl = this.testDirectory.toURI().toURL();
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2022-01-09 21:08:43 UTC (rev 12363)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2022-01-09 22:32:56 UTC (rev 12364)
@@ -140,6 +140,7 @@
import org.axsl.fotree.fo.FoTextCharacters;
import org.axsl.fotree.fo.Marker;
import org.axsl.fotree.fo.prop.WritingModePa;
+import org.axsl.fotree.text.FoOrthographyServer;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicServer;
import org.axsl.orthography.Orthography;
@@ -3640,7 +3641,7 @@
* Returns the orthography server.
* @return The orthography server.
*/
- public OrthographyServer getOrthographyServer() {
+ public FoOrthographyServer getOrthographyServer() {
return getParent().getOrthographyServer();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java 2022-01-09 21:08:43 UTC (rev 12363)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java 2022-01-09 22:32:56 UTC (rev 12364)
@@ -38,8 +38,8 @@
import org.axsl.font.FontConsumer;
import org.axsl.fotree.FoTree;
+import org.axsl.fotree.text.FoOrthographyServer;
import org.axsl.graphic.GraphicServer;
-import org.axsl.orthography.OrthographyServer;
import org.axsl.speech.SpeechServer;
import org.slf4j.Logger;
@@ -70,7 +70,7 @@
private SpeechServer speechServer;
/** The orthography server. */
- private OrthographyServer orthographyServer;
+ private FoOrthographyServer orthographyServer;
/** The URLs to be searched when looking for graphics files. */
private URL[] graphicSearchPath;
@@ -138,12 +138,12 @@
}
@Override
- public void setOrthographyServer(final OrthographyServer orthographyServer) {
+ public void setOrthographyServer(final FoOrthographyServer orthographyServer) {
this.orthographyServer = orthographyServer;
}
@Override
- public OrthographyServer getOrthographyServer() {
+ public FoOrthographyServer getOrthographyServer() {
return this.orthographyServer;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java 2022-01-09 21:08:43 UTC (rev 12363)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java 2022-01-09 22:32:56 UTC (rev 12364)
@@ -38,8 +38,8 @@
import org.axsl.font.FontServer;
import org.axsl.fotree.FoTreeFactory;
+import org.axsl.fotree.text.FoOrthographyServer;
import org.axsl.graphic.GraphicServer;
-import org.axsl.orthography.OrthographyServer;
import org.axsl.text.TextServer;
import org.slf4j.Logger;
@@ -70,7 +70,7 @@
private TextServer textServer;
/** The hyphenation server. */
- private OrthographyServer orthographyServer;
+ private FoOrthographyServer orthographyServer;
/** The array of URLs in which graphics should be searched. */
private URL[] graphicSearchPath;
@@ -116,7 +116,7 @@
public FoTreeServer4a(final Logger logger,
final FontServer fontServer,
final TextServer textServer,
- final OrthographyServer orthographyServer,
+ final FoOrthographyServer orthographyServer,
final GraphicServer graphicServer,
final URL[] graphicSearchPath,
final boolean cachingGraphics) {
@@ -312,7 +312,7 @@
return this.graphicServer;
}
- public OrthographyServer getOrthographyServer() {
+ public FoOrthographyServer getOrthographyServer() {
return this.orthographyServer;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java 2022-01-09 21:08:43 UTC (rev 12363)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java 2022-01-09 22:32:56 UTC (rev 12364)
@@ -33,8 +33,8 @@
import org.axsl.common.para.ParaBranch;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
-import org.axsl.orthography.Token;
-import org.axsl.orthography.TokenFlow;
+import org.axsl.fotree.text.FoToken;
+import org.axsl.fotree.text.FoTokenFlow;
import org.axsl.orthography.TokenFlowFactory;
import java.util.ArrayList;
@@ -42,9 +42,9 @@
import java.util.ListIterator;
/**
- * FOray implementation of {@link TokenFlow}.
+ * FOray implementation of {@link FoTokenFlow}.
*/
-public class FoTextFlow4a implements TokenFlow, ParaBranch {
+public class FoTextFlow4a implements FoTokenFlow, ParaBranch {
/** Singleton factory. */
private static final TokenFlowFactory<FoTextFlow4a> FACTORY = new TokenFlowFactory<FoTextFlow4a>() {
@@ -55,7 +55,7 @@
};
/** The tokens (children) of this token flow. */
- private List<Token> tokens = new ArrayList<Token>();
+ private List<FoToken> tokens = new ArrayList<FoToken>();
@Override
public int qtyTokens() {
@@ -63,12 +63,12 @@
}
@Override
- public Token tokenAt(final int index) {
+ public FoToken tokenAt(final int index) {
return this.tokens.get(index);
}
@Override
- public void addToken(final Token segment) {
+ public void addToken(final FoToken segment) {
this.tokens.add(segment);
}
@@ -117,7 +117,7 @@
@Override
public void addNode(final ParaNode node) {
- this.tokens.add((Token) node);
+ this.tokens.add((FoToken) node);
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-09 21:08:43 UTC (rev 12363)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-09 22:32:56 UTC (rev 12364)
@@ -39,10 +39,11 @@
import org.axsl.fotree.FoContext;
import org.axsl.fotree.FoVisitor;
import org.axsl.fotree.fo.FoTextWords;
-import org.axsl.orthography.Orthography;
+import org.axsl.fotree.text.FoOrthography;
+import org.axsl.fotree.text.FoOrthographyServer;
+import org.axsl.fotree.text.FoToken;
+import org.axsl.fotree.text.FoTokenFlow;
import org.axsl.orthography.OrthographyException;
-import org.axsl.orthography.OrthographyServer;
-import org.axsl.orthography.Token;
import java.util.ArrayList;
import java.util.List;
@@ -60,7 +61,7 @@
private List<FoWordSequenceContent> content;
/** The parsed words. */
- private FoTextFlow4a paraBranch;
+ private FoTokenFlow paraBranch;
/**
* Constructor.
@@ -71,9 +72,9 @@
public FoTextWords4a(final FoObj parent, final CharSequence content) throws OrthographyException {
super(parent);
this.parent = parent;
- final OrthographyServer orthographyServer = getOrthographyServer();
- final Orthography orthography = orthographyServer.getOrthography(getWritingSystem());
- this.paraBranch = orthography.tokenize(FoTextFlow4a.getFactory(), content, 0, content.length());
+ final FoOrthographyServer orthographyServer = getOrthographyServer();
+ final FoOrthography orthography = orthographyServer.getOrthography(getWritingSystem());
+ this.paraBranch = orthography.tokenize(content, 0, content.length());
this.content = new ArrayList<FoWordSequenceContent>(this.paraBranch.qtyParaNodes());
for (int index = 0; index < this.paraBranch.qtyParaNodes(); index ++) {
final ParaNode wordSequenceContent = this.paraBranch.paraNodeAt(index);
@@ -100,7 +101,7 @@
@Override
public void addNode(final ParaNode node) {
- this.paraBranch.addToken((Token) node);
+ this.paraBranch.addToken((FoToken) node);
}
@Override
@@ -257,13 +258,13 @@
}
@Override
- public Token tokenAt(final int index) {
+ public FoToken tokenAt(final int index) {
// TODO Auto-generated method stub
return null;
}
@Override
- public void addToken(final Token token) {
+ public void addToken(final FoToken token) {
// TODO Auto-generated method stub
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root4a.java 2022-01-09 21:08:43 UTC (rev 12363)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root4a.java 2022-01-09 22:32:56 UTC (rev 12364)
@@ -40,7 +40,7 @@
import org.axsl.fotree.FoTreeException;
import org.axsl.fotree.FoVisitor;
import org.axsl.fotree.fo.Root;
-import org.axsl.orthography.OrthographyServer;
+import org.axsl.fotree.text.FoOrthographyServer;
import org.slf4j.Logger;
@@ -504,7 +504,7 @@
}
@Override
- public OrthographyServer getOrthographyServer() {
+ public FoOrthographyServer getOrthographyServer() {
return this.treeBuilder.getOrthographyServer();
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-01-09 21:08:43 UTC (rev 12363)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-01-09 22:32:56 UTC (rev 12364)
@@ -35,11 +35,11 @@
import org.foray.orthography.wrapper.ExactWord;
import org.foray.orthography.wrapper.UppercaseWord;
+import org.axsl.fotree.text.FoOrthography;
+import org.axsl.fotree.text.FoToken;
import org.axsl.fotree.text.FoWord;
-import org.axsl.orthography.Orthography;
import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.TokenFlow;
-import org.axsl.orthography.TokenFlowFactory;
import org.axsl.orthography.Word;
import org.axsl.orthography.optional.Dictionary;
import org.axsl.orthography.optional.Lexer;
@@ -52,7 +52,7 @@
/**
* The resources (dictionaries, word wrappers, hyphenation patterns, etc.) that should be used by a given orthography.
*/
-public class Orthography4a implements Orthography {
+public class Orthography4a implements FoOrthography {
/** The list of ids to lists of regex patterns, which, for this orthography, signal a valid word if matched. */
private List<String> matchRuleListIds = new ArrayList<String>();
@@ -262,7 +262,7 @@
}
@Override
- public Word recognizeWord(final CharSequence wordChars, final int offset, final int length,
+ public FoWord recognizeWord(final CharSequence wordChars, final int offset, final int length,
final Word.PartOfSpeech pos, final List<Dictionary> adhocDictionaries) {
// TODO Auto-generated method stub
return null;
@@ -362,7 +362,7 @@
}
@Override
- public Word hyphenateUnrecognizedWord(final CharSequence word, final int offset, final int length) {
+ public FoWord hyphenateUnrecognizedWord(final CharSequence word, final int offset, final int length) {
/* The character sequence containing the characters in the word that we are looking for. */
final CharSequence chars = word.subSequence(offset, offset + length);
FoWord hyphenatedWord = null;
@@ -408,9 +408,9 @@
}
@Override
- public <T extends TokenFlow> T tokenize(final TokenFlowFactory<T> factory,
- final CharSequence characters, final int startIndex, final int length) throws OrthographyException {
- final T wordSequence = factory.makeTextFlow();
+ public TextFlow4a tokenize(final CharSequence characters, final int startIndex, final int length)
+ throws OrthographyException {
+ final TextFlow4a wordSequence = new TextFlow4a();
final CharSequence sequence = characters.subSequence(startIndex, startIndex + length);
final List<CharSequence> chunks = this.lexer.tokenize(sequence);
@@ -425,7 +425,7 @@
parseInterwordContent(wordSequence, chunk);
} else {
/* Chunk is a word. */
- Word word = recognizeWord(chunk, 0, chunk.length(), null, null);
+ FoWord word = recognizeWord(chunk, 0, chunk.length(), null, null);
if (word == null) {
word = hyphenateUnrecognizedWord(chunk, 0, chunk.length());
}
@@ -438,7 +438,7 @@
return wordSequence;
}
- private void parseInterwordContent(final TokenFlow wordSequence, final CharSequence interword)
+ private void parseInterwordContent(final TokenFlow<FoToken> wordSequence, final CharSequence interword)
throws OrthographyException {
int index = 0;
while (index < interword.length()) {
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java 2022-01-09 21:08:43 UTC (rev 12363)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java 2022-01-09 22:32:56 UTC (rev 12364)
@@ -41,8 +41,8 @@
import org.foray.orthography.util.OrthographyParser;
import org.axsl.common.i18n.Language;
+import org.axsl.fotree.text.FoOrthographyServer;
import org.axsl.orthography.OrthographyException;
-import org.axsl.orthography.OrthographyServer;
import org.axsl.orthography.WritingSystem;
import org.slf4j.Logger;
@@ -66,7 +66,7 @@
/**
* This class is the main entry point to the hyphenation package.
*/
-public class OrthographyServer4a implements OrthographyServer {
+public class OrthographyServer4a implements FoOrthographyServer {
/** The logger. */
private Logger logger = LoggerFactory.getLogger(OrthographyServer4a.class);
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java 2022-01-09 21:08:43 UTC (rev 12363)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java 2022-01-09 22:32:56 UTC (rev 12364)
@@ -28,17 +28,21 @@
package org.foray.orthography;
-import org.axsl.orthography.Token;
-import org.axsl.orthography.TokenFlow;
+import org.axsl.common.para.ParaBranch;
+import org.axsl.common.para.ParaLeaf;
+import org.axsl.common.para.ParaNode;
+import org.axsl.fotree.text.FoToken;
+import org.axsl.fotree.text.FoTokenFlow;
import org.axsl.orthography.TokenFlowFactory;
import java.util.ArrayList;
import java.util.List;
+import java.util.ListIterator;
/**
- * FOray implementation of {@link TokenFlow}.
+ * FOray implementation of {@link FoTokenFlow}.
*/
-public class TextFlow4a implements TokenFlow {
+public class TextFlow4a implements FoTokenFlow {
/** Singleton factory. */
private static final TokenFlowFactory<TextFlow4a> FACTORY = new TokenFlowFactory<TextFlow4a>() {
@@ -49,7 +53,7 @@
};
/** The tokens (children) of this text flow. */
- private List<Token> tokens = new ArrayList<Token>();
+ private List<FoToken> tokens = new ArrayList<FoToken>();
@Override
public int qtyTokens() {
@@ -57,12 +61,12 @@
}
@Override
- public Token tokenAt(final int index) {
+ public FoToken tokenAt(final int index) {
return this.tokens.get(index);
}
@Override
- public void addToken(final Token segment) {
+ public void addToken(final FoToken segment) {
this.tokens.add(segment);
}
@@ -74,4 +78,65 @@
return FACTORY;
}
+ @Override
+ public ParaNode paraNodeAt(final int nodeIndex) {
+ return this.tokens.get(nodeIndex);
+ }
+
+ @Override
+ public void addNode(final ParaNode node) {
+ throw new UnsupportedOperationException("Use addToken(FoToken) instead.");
+ }
+
+ @Override
+ public ParaLeaf paraLeafAt(final int leafIndex) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ListIterator<ParaLeaf> leafIterator() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Type getParaNodeType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ParaLeaf asParaLeaf() {
+ return null;
+ }
+
+ @Override
+ public ParaBranch asParaBranch() {
+ return this;
+ }
+
+ @Override
+ public int qtyParaNodes() {
+ return this.tokens.size();
+ }
+
+ @Override
+ public int qtyParaLeaves() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int qtyKpLeaves() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public CharSequence getText() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2022-01-09 21:08:43 UTC (rev 12363)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2022-01-09 22:32:56 UTC (rev 12364)
@@ -82,7 +82,7 @@
/* Spoken by Henry, Henry V, Act III Scene 1. */
final String testString = "Once more unto the breach, dear friends, once more;";
final TextFlow4a wordSequence =
- this.consumer.tokenize(TextFlow4a.getFactory(), testString, 0, testString.length());
+ this.consumer.tokenize(testString, 0, testString.length());
Assert.assertEquals(20, wordSequence.qtyTokens());
Assert.assertEquals("Once", wordSequence.tokenAt(0).toString());
Assert.assertEquals(" ", wordSequence.tokenAt(1).toString());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-09 21:08:45
|
Revision: 12363
http://sourceforge.net/p/foray/code/12363
Author: victormote
Date: 2022-01-09 21:08:43 +0000 (Sun, 09 Jan 2022)
Log Message:
-----------
Conform to aXSL chanes: Move fotree-related text content features from axsl-orthography to axsl-fotree.
Modified Paths:
--------------
trunk/foray/foray-orthography/build.gradle
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapper.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/CapitalizedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/ExactWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/FinalSegmentModifiedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/SuffixedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/UppercaseWord.java
Modified: trunk/foray/foray-orthography/build.gradle
===================================================================
--- trunk/foray/foray-orthography/build.gradle 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/build.gradle 2022-01-09 21:08:43 UTC (rev 12363)
@@ -1,18 +1,19 @@
description = 'foray-orthography'
dependencies {
- api group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
- api group: 'xml-resolver', name: 'xml-resolver', version: xmlResolverVersion
- api group: 'org.apache.ant', name: 'ant-launcher', version: antVersion
- api group: 'commons-cli', name: 'commons-cli', version: commonsCliVersion
- api group: 'com.ibm.icu', name: 'icu4j', version: icu4jVersion
- api group: 'org.axsl', name: 'axsl-orthography', version: axslVersion
+ api group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
+ api group: 'xml-resolver', name: 'xml-resolver', version: xmlResolverVersion
+ api group: 'org.apache.ant', name: 'ant-launcher', version: antVersion
+ api group: 'commons-cli', name: 'commons-cli', version: commonsCliVersion
+ api group: 'com.ibm.icu', name: 'icu4j', version: icu4jVersion
+ api group: 'org.axsl', name: 'axsl-orthography', version: axslVersion
+ api group: 'org.axsl', name: 'axsl-fotree', version: axslVersion
api project(':foray-common')
- implementation group: 'ch.qos.logback', name: 'logback-classic', version: logbackClassicVersion
+ implementation group: 'ch.qos.logback', name: 'logback-classic', version: logbackClassicVersion
- testImplementation group: 'junit', name: 'junit', version: junitVersion
- testImplementation group: 'org.mockito', name: 'mockito-core', version: mockitoVersion
+ testImplementation group: 'junit', name: 'junit', version: junitVersion
+ testImplementation group: 'org.mockito', name: 'mockito-core', version: mockitoVersion
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -35,6 +35,7 @@
import org.foray.orthography.wrapper.ExactWord;
import org.foray.orthography.wrapper.UppercaseWord;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.Orthography;
import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.TokenFlow;
@@ -364,7 +365,7 @@
public Word hyphenateUnrecognizedWord(final CharSequence word, final int offset, final int length) {
/* The character sequence containing the characters in the word that we are looking for. */
final CharSequence chars = word.subSequence(offset, offset + length);
- Word hyphenatedWord = null;
+ FoWord hyphenatedWord = null;
/* Look in the dictionary first, as it should be more accurate. */
final SegmentDictionary dictionary = getDictionary();
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -37,7 +37,7 @@
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
import org.axsl.common.para.ParaPenalty;
-import org.axsl.orthography.Punctuation;
+import org.axsl.fotree.text.FoPunctuation;
import java.util.ArrayList;
import java.util.List;
@@ -46,7 +46,7 @@
* Handles punctuation between words.
* Instances of this class are immutable.
*/
-public final class Punctuation4a implements Punctuation, ParaLeaf, ParaBox {
+public final class Punctuation4a implements FoPunctuation {
/** Common punctuation item, a comma. */
public static final Punctuation4a COMMA = new Punctuation4a(",");
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -36,7 +36,7 @@
import org.axsl.common.para.ParaGlue;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaPenalty;
-import org.axsl.orthography.Whitespace;
+import org.axsl.fotree.text.FoWhitespace;
import org.slf4j.LoggerFactory;
@@ -47,7 +47,7 @@
* Handles whitespace between words.
* Instances of this class are immutable.
*/
-public final class Whitespace4a implements Whitespace, ParaLeaf, ParaGlue {
+public final class Whitespace4a implements FoWhitespace {
/** Common whitespace item. */
public static final Whitespace4a SPACE = new Whitespace4a(" ");
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -36,6 +36,7 @@
import org.axsl.common.para.ParaNode;
import org.axsl.common.para.ParaPenalty;
import org.axsl.common.sequence.ByteSequence;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.DiscretionaryHyphen;
import org.axsl.orthography.Word;
import org.axsl.orthography.WordComponent;
@@ -53,7 +54,7 @@
* Therefore this abstract superclass is able to do a lot of the grunt work needed to conform to the other three API
* subsets.</p>
*/
-public abstract class Word4a implements Word, Serializable, Comparable<CharSequence> {
+public abstract class Word4a implements FoWord, Serializable, Comparable<CharSequence> {
/** Constant needed for serialization. */
private static final long serialVersionUID = -5425415601308185409L;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapper.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapper.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapper.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -28,7 +28,7 @@
package org.foray.orthography;
-import org.axsl.orthography.Word;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.WordSegment;
/**
@@ -41,13 +41,13 @@
private static final long serialVersionUID = -4655467895699192446L;
/** The wrapped word. */
- private Word wrappedWord;
+ private FoWord wrappedWord;
/**
* Constructor.
* @param wrappedWord The word being wrapped.
*/
- public WordWrapper(final Word wrappedWord) {
+ public WordWrapper(final FoWord wrappedWord) {
this.wrappedWord = wrappedWord;
}
@@ -55,7 +55,7 @@
* Returns the wrapped word.
* @return The wrapped word.
*/
- public Word getWrappedWord() {
+ public FoWord getWrappedWord() {
return this.wrappedWord;
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/CapitalizedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/CapitalizedWord.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/CapitalizedWord.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -31,7 +31,7 @@
import org.foray.orthography.WordSegmentWrapper;
import org.axsl.common.para.ParaLeaf;
-import org.axsl.orthography.Word;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.WordSegment;
/**
@@ -78,7 +78,7 @@
* Constructor.
* @param wrappedWord The word being wrapped.
*/
- public CapitalizedWord(final Word wrappedWord) {
+ public CapitalizedWord(final FoWord wrappedWord) {
super(wrappedWord);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -34,7 +34,7 @@
import org.axsl.common.para.ParaNode;
import org.axsl.common.para.ParaPenalty;
-import org.axsl.orthography.Word;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.WordComponent;
/**
@@ -50,7 +50,7 @@
* Constructor.
* @param wrappedWord The word being wrapped.
*/
- public DecoratedWord(final Word wrappedWord) {
+ public DecoratedWord(final FoWord wrappedWord) {
super(wrappedWord);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/ExactWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/ExactWord.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/ExactWord.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -33,7 +33,7 @@
import org.foray.orthography.StringWordSegmentUtf16;
import org.axsl.common.para.ParaLeaf;
-import org.axsl.orthography.Word;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.WordSegment;
/**
@@ -54,7 +54,7 @@
* @param wrappedWord The word being wrapped.
* @param exact The exact capitalization of the word.
*/
- public ExactWord(final Word wrappedWord, final String exact) {
+ public ExactWord(final FoWord wrappedWord, final String exact) {
super(wrappedWord);
if (wrappedWord.length() != exact.length()) {
throw new IllegalArgumentException("Length of normalized word: " + wrappedWord.length() +
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/FinalSegmentModifiedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/FinalSegmentModifiedWord.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/FinalSegmentModifiedWord.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -30,7 +30,7 @@
import org.foray.orthography.WordWrapper;
-import org.axsl.orthography.Word;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.WordSegment;
/**
@@ -48,7 +48,7 @@
* Package-visible constructor. Use {@link LatinPlural1WordFactory} to create an instance.
* @param wrappedWord The wrapped word.
*/
- protected FinalSegmentModifiedWord(final Word wrappedWord) {
+ protected FinalSegmentModifiedWord(final FoWord wrappedWord) {
super(wrappedWord);
final int lastSegmentIndex = wrappedWord.qtyWordSegments() - 1;
final WordSegment unmodifiedSegment = wrappedWord.wordSegmentAt(lastSegmentIndex);
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1Word.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1Word.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -31,7 +31,7 @@
import org.foray.orthography.StringWordSegmentUtf16;
import org.axsl.common.para.ParaLeaf;
-import org.axsl.orthography.Word;
+import org.axsl.fotree.text.FoWord;
/**
* Wraps a word, usually a verb, and adds a syllable "ed" to the end.
@@ -49,7 +49,7 @@
* Constructor.
* @param wrappedWord The wrapped word.
*/
- public LatinPast1Word(final Word wrappedWord) {
+ public LatinPast1Word(final FoWord wrappedWord) {
super(wrappedWord);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1WordFactory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1WordFactory.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1WordFactory.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -31,7 +31,7 @@
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.orthography.WordWrapperFactory;
-import org.axsl.orthography.Word;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.optional.Dictionary;
/**
@@ -53,7 +53,7 @@
final int qtyToRemove = LatinPast1Word.SUFFIX.length();
final String baseWordChars = CharSequenceUtils.removeTrailing(chars, qtyToRemove).toString();
- final Word baseWord = dictionary.getWord(baseWordChars, 0);
+ final FoWord baseWord = (FoWord) dictionary.getWord(baseWordChars, 0);
if (baseWord != null) {
return new LatinPast1Word(baseWord);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1Word.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1Word.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -29,7 +29,7 @@
package org.foray.orthography.wrapper;
import org.axsl.common.para.ParaLeaf;
-import org.axsl.orthography.Word;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.WordSegment;
/**
@@ -81,7 +81,7 @@
* Package-visible constructor. Use {@link LatinPlural1WordFactory} to create an instance.
* @param wrappedWord The wrapped word.
*/
- LatinPlural1Word(final Word wrappedWord) {
+ LatinPlural1Word(final FoWord wrappedWord) {
super(wrappedWord);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1WordFactory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1WordFactory.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1WordFactory.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -31,7 +31,7 @@
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.orthography.WordWrapperFactory;
-import org.axsl.orthography.Word;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.optional.Dictionary;
/**
@@ -53,7 +53,8 @@
final int qtyToRemove = LatinPlural1Word.Segment.WRAPPED_FORM.length();
final String baseWordChars = CharSequenceUtils.removeTrailing(chars, qtyToRemove).toString();
- final Word baseWord = dictionary.getWord(baseWordChars, 0);
+ /* TODO: Remove this cast. */
+ final FoWord baseWord = (FoWord) dictionary.getWord(baseWordChars, 0);
if (baseWord != null) {
return new LatinPlural1Word(baseWord);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2Word.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2Word.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -29,7 +29,7 @@
package org.foray.orthography.wrapper;
import org.axsl.common.para.ParaLeaf;
-import org.axsl.orthography.Word;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.WordSegment;
/**
@@ -84,7 +84,7 @@
* Package-visible constructor. Use {@link LatinPlural2WordFactory} to create an instance.
* @param wrappedWord The wrapped word.
*/
- LatinPlural2Word(final Word wrappedWord) {
+ LatinPlural2Word(final FoWord wrappedWord) {
super(wrappedWord);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2WordFactory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2WordFactory.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2WordFactory.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -31,7 +31,7 @@
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.orthography.WordWrapperFactory;
-import org.axsl.orthography.Word;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.optional.Dictionary;
/**
@@ -72,7 +72,8 @@
builder.append('y');
final String baseWordChars = builder.toString();
- final Word baseWord = dictionary.getWord(baseWordChars, 0);
+ /* TODO: Remove this cast. */
+ final FoWord baseWord = (FoWord) dictionary.getWord(baseWordChars, 0);
if (baseWord != null) {
return new LatinPlural2Word(baseWord);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1Word.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1Word.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -29,7 +29,7 @@
package org.foray.orthography.wrapper;
import org.axsl.common.para.ParaLeaf;
-import org.axsl.orthography.Word;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.WordSegment;
/**
@@ -82,7 +82,7 @@
* Package-visible constructor. Use {@link LatinPossessive1WordFactory} to create an instance.
* @param wrappedWord The wrapped word.
*/
- LatinPossessive1Word(final Word wrappedWord) {
+ LatinPossessive1Word(final FoWord wrappedWord) {
super(wrappedWord);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1WordFactory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1WordFactory.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1WordFactory.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -31,7 +31,7 @@
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.orthography.WordWrapperFactory;
-import org.axsl.orthography.Word;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.optional.Dictionary;
/**
@@ -53,7 +53,8 @@
final int qtyToRemove = LatinPossessive1Word.Segment.WRAPPED_FORM.length();
final String baseWordChars = CharSequenceUtils.removeTrailing(chars, qtyToRemove).toString();
- final Word baseWord = dictionary.getWord(baseWordChars, 0);
+ /* TODO: Remove this cast. */
+ final FoWord baseWord = (FoWord) dictionary.getWord(baseWordChars, 0);
if (baseWord != null) {
return new LatinPossessive1Word(baseWord);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2Word.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2Word.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -29,7 +29,7 @@
package org.foray.orthography.wrapper;
import org.axsl.common.para.ParaLeaf;
-import org.axsl.orthography.Word;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.WordSegment;
/**
@@ -82,7 +82,7 @@
* Package-visible constructor. Use {@link LatinPossessive2WordFactory} to create an instance.
* @param wrappedWord The wrapped word.
*/
- public LatinPossessive2Word(final Word wrappedWord) {
+ public LatinPossessive2Word(final FoWord wrappedWord) {
super(wrappedWord);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2WordFactory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2WordFactory.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2WordFactory.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -31,7 +31,7 @@
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.orthography.WordWrapperFactory;
-import org.axsl.orthography.Word;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.optional.Dictionary;
/**
@@ -53,7 +53,8 @@
final int qtyToRemove = LatinPossessive2Word.Segment.WRAPPED_FORM.length();
final String baseWordChars = CharSequenceUtils.removeTrailing(chars, qtyToRemove).toString();
- final Word baseWord = dictionary.getWord(baseWordChars, 0);
+ /* TODO: Remove this cast. */
+ final FoWord baseWord = (FoWord) dictionary.getWord(baseWordChars, 0);
if (baseWord != null) {
return new LatinPossessive2Word(baseWord);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/SuffixedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/SuffixedWord.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/SuffixedWord.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -31,7 +31,7 @@
import org.foray.orthography.StringWordSegmentUtf16;
import org.foray.orthography.WordWrapper;
-import org.axsl.orthography.Word;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.WordSegment;
/**
@@ -47,7 +47,7 @@
* Constructor.
* @param wrappedWord The wrapped word.
*/
- public SuffixedWord(final Word wrappedWord) {
+ public SuffixedWord(final FoWord wrappedWord) {
super(wrappedWord);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/UppercaseWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/UppercaseWord.java 2022-01-08 22:31:08 UTC (rev 12362)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/UppercaseWord.java 2022-01-09 21:08:43 UTC (rev 12363)
@@ -31,7 +31,7 @@
import org.foray.orthography.WordSegmentWrapper;
import org.axsl.common.para.ParaLeaf;
-import org.axsl.orthography.Word;
+import org.axsl.fotree.text.FoWord;
import org.axsl.orthography.WordSegment;
/**
@@ -75,7 +75,7 @@
* Constructor.
* @param wrappedWord The word being wrapped.
*/
- public UppercaseWord(final Word wrappedWord) {
+ public UppercaseWord(final FoWord wrappedWord) {
super(wrappedWord);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-08 22:31:11
|
Revision: 12362
http://sourceforge.net/p/foray/code/12362
Author: victormote
Date: 2022-01-08 22:31:08 +0000 (Sat, 08 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: Allow all ParaNodes (not just branches) to report the number of node and leaf children that they have.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaLeaf4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentLatin1.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentUtf16.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaLeaf4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaLeaf4a.java 2022-01-08 22:14:56 UTC (rev 12361)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaLeaf4a.java 2022-01-08 22:31:08 UTC (rev 12362)
@@ -52,4 +52,14 @@
return null;
}
+ @Override
+ public int qtyParaNodes() {
+ return 0;
+ }
+
+ @Override
+ public int qtyParaLeaves() {
+ return 1;
+ }
+
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java 2022-01-08 22:14:56 UTC (rev 12361)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java 2022-01-08 22:31:08 UTC (rev 12362)
@@ -206,6 +206,16 @@
}
@Override
+ public int qtyParaNodes() {
+ return 0;
+ }
+
+ @Override
+ public int qtyParaLeaves() {
+ return 1;
+ }
+
+ @Override
public int qtyKpLeaves() {
return 1;
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java 2022-01-08 22:14:56 UTC (rev 12361)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java 2022-01-08 22:31:08 UTC (rev 12362)
@@ -241,6 +241,16 @@
}
@Override
+ public int qtyParaNodes() {
+ return 0;
+ }
+
+ @Override
+ public int qtyParaLeaves() {
+ return 1;
+ }
+
+ @Override
public int qtyKpLeaves() {
return this.content.length();
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentLatin1.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentLatin1.java 2022-01-08 22:14:56 UTC (rev 12361)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentLatin1.java 2022-01-08 22:31:08 UTC (rev 12362)
@@ -110,6 +110,16 @@
}
@Override
+ public int qtyParaNodes() {
+ return 0;
+ }
+
+ @Override
+ public int qtyParaLeaves() {
+ return 1;
+ }
+
+ @Override
public int qtyKpLeaves() {
return length();
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentUtf16.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentUtf16.java 2022-01-08 22:14:56 UTC (rev 12361)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentUtf16.java 2022-01-08 22:31:08 UTC (rev 12362)
@@ -110,6 +110,16 @@
}
@Override
+ public int qtyParaNodes() {
+ return 0;
+ }
+
+ @Override
+ public int qtyParaLeaves() {
+ return 1;
+ }
+
+ @Override
public int qtyKpLeaves() {
return length();
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java 2022-01-08 22:14:56 UTC (rev 12361)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java 2022-01-08 22:31:08 UTC (rev 12362)
@@ -179,6 +179,16 @@
}
@Override
+ public int qtyParaNodes() {
+ return 0;
+ }
+
+ @Override
+ public int qtyParaLeaves() {
+ return 1;
+ }
+
+ @Override
public int qtyKpLeaves() {
return this.content.length();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-08 22:14:59
|
Revision: 12361
http://sourceforge.net/p/foray/code/12361
Author: victormote
Date: 2022-01-08 22:14:56 +0000 (Sat, 08 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: Rename methods for consistency.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBox4a.java
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBoxChars.java
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.java
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4aIterator.java
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaGlue4a.java
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaGlueChars.java
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaPenalty4a.java
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaPenaltyChars.java
trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aIteratorTests.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/FoTextFlow4a.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/FirstFitLb.java
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/ParaContentIterator.java
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/TotalFitLb.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/util/DumpLayout.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/util/DumpParaBranch.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphen4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentLatin1.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentUtf16.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordSegment4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/CapitalizedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/ExactWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/UppercaseWord.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/SegmentDictionaryWordTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/StringWordTests.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
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBox4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBox4a.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBox4a.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -85,7 +85,7 @@
}
@Override
- public int paraKpLeafSize() {
+ public int qtyKpLeaves() {
return 1;
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBoxChars.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBoxChars.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBoxChars.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -87,7 +87,7 @@
}
@Override
- public int paraKpLeafSize() {
+ public int qtyKpLeaves() {
return this.chars.length();
}
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 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -65,7 +65,7 @@
}
@Override
- public int paraNodeSize() {
+ public int qtyParaNodes() {
return this.nodes.size();
}
@@ -75,9 +75,9 @@
}
@Override
- public int paraLeafSize() {
+ public int qtyParaLeaves() {
int returnValue = 0;
- for (int nodeIndex = 0; nodeIndex < paraNodeSize(); nodeIndex ++) {
+ for (int nodeIndex = 0; nodeIndex < qtyParaNodes(); nodeIndex ++) {
final ParaBranch childBranch = paraNodeAt(nodeIndex).asParaBranch();
if (childBranch == null) {
/* Child node is a leaf. */
@@ -84,7 +84,7 @@
returnValue ++;
} else {
/* Child node is a branch. */
- returnValue += childBranch.paraLeafSize();
+ returnValue += childBranch.qtyParaLeaves();
}
}
return returnValue;
@@ -106,7 +106,7 @@
}
}
- final int additionalLeaves = branch == null ? 1 : branch.paraLeafSize();
+ final int additionalLeaves = branch == null ? 1 : branch.qtyParaLeaves();
final int newRunningLeafIndex = runningLeafIndex + additionalLeaves;
if (newRunningLeafIndex > leafIndex) {
@@ -120,29 +120,19 @@
throw new IndexOutOfBoundsException("Leaf index out of bounds: " + leafIndex);
}
- /**
- * Returns the quantity of leaf nodes as computed by the Knuth-Plass model.
- * In the FOray data model, syllables of words (aka word segments) are atoms, but the Knuth-Plass model treats
- * each character as an atom.
- * As a theoretical matter, the K-P count is correct, but the FOray model works as well as a practical matter.
- * This method computes the count using the K-P method, which, within FOay at least, is probably useful only for
- * testing.
- * @return The number of descendant leaf nodes as compute by the Knuth-Plass model, i.e. each character in a word
- * is treated as a box.
- * @see ParaBranch#paraLeafSize()
- */
- public int paraKpLeafSize() {
+ @Override
+ public int qtyKpLeaves() {
int returnValue = 0;
- for (int nodeIndex = 0; nodeIndex < paraNodeSize(); nodeIndex ++) {
+ for (int nodeIndex = 0; nodeIndex < qtyParaNodes(); nodeIndex ++) {
final ParaNode node = paraNodeAt(nodeIndex);
final ParaBranch childBranch = node.asParaBranch();
if (childBranch == null) {
/* Child node is a leaf. */
final ParaLeaf leaf = node.asParaLeaf();
- returnValue += leaf.paraKpLeafSize();
+ returnValue += leaf.qtyKpLeaves();
} else {
/* Child node is a branch. */
- returnValue += childBranch.paraKpLeafSize();
+ returnValue += childBranch.qtyKpLeaves();
}
}
return returnValue;
@@ -168,7 +158,7 @@
@Override
public CharSequence getText() {
final StringBuilder builder = new StringBuilder();
- for (int leafIndex = 0; leafIndex < paraLeafSize(); leafIndex ++) {
+ for (int leafIndex = 0; leafIndex < qtyParaLeaves(); leafIndex ++) {
final ParaLeaf leaf = paraLeafAt(leafIndex);
builder.append(leaf.getText());
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4aIterator.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4aIterator.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4aIterator.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -67,7 +67,7 @@
public ParaBranch4aIterator(final ParaBranch branch) {
this.branchStack.push(branch);
- this.paraLeafSize = branch.paraLeafSize();
+ this.paraLeafSize = branch.qtyParaLeaves();
branchIndexes.push(0);
}
@@ -89,7 +89,7 @@
}
final ParaBranch currentBranch = this.branchStack.peek();
final int nextIndex = this.branchIndexes.peek();
- if (nextIndex >= currentBranch.paraNodeSize()) {
+ if (nextIndex >= currentBranch.qtyParaNodes()) {
this.branchStack.pop();
this.branchIndexes.pop();
incrementBranchIndex();
@@ -136,7 +136,7 @@
}
final ParaBranch branch = node.asParaBranch();
this.branchStack.push(branch);
- this.branchIndexes.push(branch.paraNodeSize());
+ this.branchIndexes.push(branch.qtyParaNodes());
return internalPrevious();
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaGlue4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaGlue4a.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaGlue4a.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -110,7 +110,7 @@
}
@Override
- public int paraKpLeafSize() {
+ public int qtyKpLeaves() {
return 1;
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaGlueChars.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaGlueChars.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaGlueChars.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -104,7 +104,7 @@
}
@Override
- public int paraKpLeafSize() {
+ public int qtyKpLeaves() {
return this.chars.length();
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaPenalty4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaPenalty4a.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaPenalty4a.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -120,7 +120,7 @@
}
@Override
- public int paraKpLeafSize() {
+ public int qtyKpLeaves() {
return 1;
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaPenaltyChars.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaPenaltyChars.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaPenaltyChars.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -103,7 +103,7 @@
}
@Override
- public int paraKpLeafSize() {
+ public int qtyKpLeaves() {
return this.chars.length();
}
Modified: trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aIteratorTests.java
===================================================================
--- trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aIteratorTests.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aIteratorTests.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -170,7 +170,7 @@
iteratorAssertions(out, true, false, 0, -1);
/* Iterate to the end of the branch. */
- for (int leafIndex = 0; leafIndex < para.paraLeafSize(); leafIndex ++) {
+ for (int leafIndex = 0; leafIndex < para.qtyParaLeaves(); leafIndex ++) {
out.next();
}
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 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aTests.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -120,7 +120,7 @@
final ParaBranch4a out = createTestPara();
/* Test the /node/ count. */
- Assert.assertEquals(39, out.paraNodeSize());
+ Assert.assertEquals(39, out.qtyParaNodes());
/* Test the /nodes/ at each end, and one in the middle. */
Assert.assertEquals("Be", out.paraNodeAt(0).getText());
@@ -128,7 +128,7 @@
Assert.assertEquals("born", out.paraNodeAt(15).getText());
/* Most nodes are exactly one leaf. 3 lines each add an additional 2 leaves each, adding 6 leaves. */
- Assert.assertEquals(50, out.paraLeafSize());
+ Assert.assertEquals(50, out.qtyParaLeaves());
/* Test the /leaves/ at each end. */
Assert.assertEquals("B", out.paraLeafAt(0).getText());
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 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete4a.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -191,7 +191,7 @@
}
@Override
- public int paraNodeSize() {
+ public int qtyParaNodes() {
int count = 0;
for (int index = 0; index < this.children.size(); index ++) {
final FoObj child = this.children.get(index);
@@ -223,15 +223,15 @@
}
@Override
- public int paraLeafSize() {
+ public int qtyParaLeaves() {
int count = 0;
- for (int nodeIndex = 0; nodeIndex < paraNodeSize(); nodeIndex ++) {
+ for (int nodeIndex = 0; nodeIndex < qtyParaNodes(); nodeIndex ++) {
final ParaNode node = paraNodeAt(nodeIndex);
final ParaBranch branch = node.asParaBranch();
if (branch == null) {
count ++;
} else {
- count += branch.paraLeafSize();
+ count += branch.qtyParaLeaves();
}
}
return count;
@@ -243,7 +243,7 @@
throw new IndexOutOfBoundsException();
}
int totalLength = 0;
- for (int nodeIndex = 0; nodeIndex < paraNodeSize(); nodeIndex ++) {
+ for (int nodeIndex = 0; nodeIndex < qtyParaNodes(); nodeIndex ++) {
final ParaNode node = paraNodeAt(nodeIndex);
final ParaBranch branch = node.asParaBranch();
if (branch == null) {
@@ -255,7 +255,7 @@
}
} else {
/* Node is a branch. */
- final int currentLength = branch.paraLeafSize();
+ final int currentLength = branch.qtyParaLeaves();
totalLength += currentLength;
if (totalLength > leafIndex) {
final int currentIndex = leafIndex - (totalLength - currentLength);
@@ -287,7 +287,7 @@
}
@Override
- public int paraKpLeafSize() {
+ public int qtyKpLeaves() {
/* TODO: Support this. */
throw new UnsupportedOperationException();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -96,7 +96,7 @@
}
@Override
- public int paraKpLeafSize() {
+ public int qtyKpLeaves() {
throw new UnsupportedOperationException();
}
@@ -106,7 +106,7 @@
}
@Override
- public int paraNodeSize() {
+ public int qtyParaNodes() {
return this.tokens.size();
}
@@ -121,7 +121,7 @@
}
@Override
- public int paraLeafSize() {
+ public int qtyParaLeaves() {
// TODO Auto-generated method stub
return 0;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -74,8 +74,8 @@
final OrthographyServer orthographyServer = getOrthographyServer();
final Orthography orthography = orthographyServer.getOrthography(getWritingSystem());
this.paraBranch = orthography.tokenize(FoTextFlow4a.getFactory(), content, 0, content.length());
- this.content = new ArrayList<FoWordSequenceContent>(this.paraBranch.paraNodeSize());
- for (int index = 0; index < this.paraBranch.paraNodeSize(); index ++) {
+ this.content = new ArrayList<FoWordSequenceContent>(this.paraBranch.qtyParaNodes());
+ for (int index = 0; index < this.paraBranch.qtyParaNodes(); index ++) {
final ParaNode wordSequenceContent = this.paraBranch.paraNodeAt(index);
final FoWordSequenceContent contentElement = FoWordSequenceContent.create(wordSequenceContent);
this.content.add(contentElement);
@@ -88,7 +88,7 @@
}
@Override
- public int paraNodeSize() {
+ public int qtyParaNodes() {
return this.paraBranch.qtyTokens();
}
@@ -104,7 +104,7 @@
}
@Override
- public int paraLeafSize() {
+ public int qtyParaLeaves() {
return this.content.size();
}
@@ -135,8 +135,8 @@
}
@Override
- public int paraKpLeafSize() {
- return this.paraBranch.paraKpLeafSize();
+ public int qtyKpLeaves() {
+ return this.paraBranch.qtyKpLeaves();
}
@Override
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -312,13 +312,13 @@
/* Make sure there is at least one line if there is any content. */
if (state.breakpoints.length() < 1
- && paragraph.paraLeafSize() > 0) {
- state.breakpoints.append(paragraph.paraLeafSize());
+ && paragraph.qtyParaLeaves() > 0) {
+ state.breakpoints.append(paragraph.qtyParaLeaves());
}
/* Make sure the last line catches all of the content. */
- if (paragraph.paraLeafSize() > state.breakpoints.lastElement()) {
- state.breakpoints.setIntAt(state.breakpoints.length() - 1, paragraph.paraLeafSize());
+ if (paragraph.qtyParaLeaves() > state.breakpoints.lastElement()) {
+ state.breakpoints.setIntAt(state.breakpoints.length() - 1, paragraph.qtyParaLeaves());
}
while (state.lineLengths.length() > state.breakpoints.length()) {
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/ParaContentIterator.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/ParaContentIterator.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/ParaContentIterator.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -68,7 +68,7 @@
this.nodeStack.push(paraContent);
/* Push the first child of the root node, if any, on the stack. This is the first item to be returned.
* Push its index onto the currentPath. */
- if (paraContent.paraNodeSize() > 0) {
+ if (paraContent.qtyParaNodes() > 0) {
currentPath.push(0);
this.nodeStack.push(paraContent.paraNodeAt(0));
}
@@ -91,7 +91,7 @@
/* Set up the next item (if any) here. */
if (returnParaBranch != null
- && returnParaBranch.paraNodeSize() > 0) {
+ && returnParaBranch.qtyParaNodes() > 0) {
/* The return value has children. Put the first one on the stack. */
this.nodeStack.push(returnParaBranch.paraNodeAt(0));
this.currentPath.push(0);
@@ -112,7 +112,7 @@
final int nextIndex = this.currentPath.peek() + 1;
this.currentPath.pop();
if (topParaBranch != null
- && nextIndex < topParaBranch.paraNodeSize()) {
+ && nextIndex < topParaBranch.qtyParaNodes()) {
nextNode = topParaBranch.paraNodeAt(nextIndex);
this.nodeStack.push(nextNode);
this.currentPath.push(nextIndex);
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/TotalFitLb.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/TotalFitLb.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/TotalFitLb.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -111,7 +111,7 @@
/* Flatten the tree structure. */
final IntArrayBuilder currentPath = new IntArrayBuilder();
- for (int index = 0; index < this.paragraph.paraNodeSize(); index ++) {
+ for (int index = 0; index < this.paragraph.qtyParaNodes(); index ++) {
final ParaNode node = this.paragraph.paraNodeAt(index);
currentPath.push(index);
flatten(node, currentPath, paraConfig);
@@ -155,7 +155,7 @@
case BRANCH: {
final ParaBranch branch = node.asParaBranch();
this.branchStack.push(branch);
- for (int index = 0; index < branch.paraNodeSize(); index ++) {
+ for (int index = 0; index < branch.qtyParaNodes(); index ++) {
final ParaNode childNode = branch.paraNodeAt(index);
currentPath.push(index);
flatten(childNode, currentPath, paraConfig);
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -339,7 +339,7 @@
/* There are 242 lines of code creating the paragraph.
* Each of them adds exactly one node. */
- Assert.assertEquals(242, para.paraNodeSize());
+ Assert.assertEquals(242, para.qtyParaNodes());
/* Of the words added, 13 are two-syllable, and 2 are three-syllable.
* If "n" is the number of syllables in a word, the total number of nodes in each word is ((2 * n) - 1).
@@ -353,11 +353,11 @@
* 34
* ====
*/
- Assert.assertEquals(276, para.paraLeafSize());
+ Assert.assertEquals(276, para.qtyParaLeaves());
/* Check the count of leaves using a strict Knuth-Plass notion of leaves, i.e. where each character in the word
* is a box. See Table 1 where the leaves are listed from 1 through 601. */
- Assert.assertEquals(601, para.paraKpLeafSize());
+ Assert.assertEquals(601, para.qtyKpLeaves());
return para;
}
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/util/DumpLayout.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/util/DumpLayout.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/util/DumpLayout.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -56,7 +56,7 @@
this.output = System.out;
final StringBuilder builder = new StringBuilder();
final int nextBreakIndex = 0;
- for (int leafIndex = 0; leafIndex < branch.paraLeafSize(); leafIndex ++) {
+ for (int leafIndex = 0; leafIndex < branch.qtyParaLeaves(); leafIndex ++) {
if (nextBreakIndex < layout.length) {
final int nextBreakLeaf = layout[nextBreakIndex];
if (leafIndex == nextBreakLeaf) {
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/util/DumpParaBranch.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/util/DumpParaBranch.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/util/DumpParaBranch.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -56,10 +56,10 @@
this.output.println("------ ------ ------ ------ ------ --------------------------------------");
int startLeafIndex = 0;
int startKpLeafIndex = 0;
- for (int nodeIndex = 0; nodeIndex < branch.paraNodeSize(); nodeIndex ++) {
+ for (int nodeIndex = 0; nodeIndex < branch.qtyParaNodes(); nodeIndex ++) {
final ParaNode node = branch.paraNodeAt(nodeIndex);
- final int qtyLeaves = node.asParaBranch() == null ? 1 : ((ParaBranch) node).paraLeafSize();
- final int qtyKpLeaves = node.paraKpLeafSize();
+ final int qtyLeaves = node.asParaBranch() == null ? 1 : ((ParaBranch) node).qtyParaLeaves();
+ final int qtyKpLeaves = node.qtyKpLeaves();
final String line = String.format(FORMAT, nodeIndex, startLeafIndex, qtyLeaves, startKpLeafIndex,
qtyKpLeaves, node);
this.output.println(line);
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphen4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphen4a.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphen4a.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -141,7 +141,7 @@
}
@Override
- public int paraKpLeafSize() {
+ public int qtyKpLeaves() {
return 1;
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -206,7 +206,7 @@
}
@Override
- public int paraKpLeafSize() {
+ public int qtyKpLeaves() {
return 1;
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -241,7 +241,7 @@
}
@Override
- public int paraKpLeafSize() {
+ public int qtyKpLeaves() {
return this.content.length();
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -109,7 +109,7 @@
}
@Override
- public int paraLeafSize() {
+ public int qtyParaLeaves() {
return qtyWordComponents();
}
@@ -119,7 +119,7 @@
}
@Override
- public int paraKpLeafSize() {
+ public int qtyKpLeaves() {
/* First, count the discretionary hyphens. */
int leafCount = this.segments.length - 1;
/* Add the number of chars in each segment. */
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -124,7 +124,7 @@
}
@Override
- public int paraLeafSize() {
+ public int qtyParaLeaves() {
/* Each segment is 2 nodes, one for the segment, one for the discretionary hyphen that follows it, except that
* the last segment is not followed by a discretionary hyphen. */
return (2 * this.segments.length) - 1;
@@ -133,7 +133,7 @@
@Override
public ParaLeaf paraLeafAt(final int leafIndex) {
if (leafIndex < 0
- || leafIndex >= paraLeafSize()) {
+ || leafIndex >= qtyParaLeaves()) {
throw new IndexOutOfBoundsException("Index out of bounds: " + leafIndex);
}
@@ -147,7 +147,7 @@
}
@Override
- public int paraKpLeafSize() {
+ public int qtyKpLeaves() {
/* First, count the discretionary hyphens. */
int leafCount = this.segments.length - 1;
/* Add the number of chars in each segment. */
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentLatin1.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentLatin1.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentLatin1.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -110,7 +110,7 @@
}
@Override
- public int paraKpLeafSize() {
+ public int qtyKpLeaves() {
return length();
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentUtf16.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentUtf16.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentUtf16.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -110,7 +110,7 @@
}
@Override
- public int paraKpLeafSize() {
+ public int qtyKpLeaves() {
return length();
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -179,7 +179,7 @@
}
@Override
- public int paraKpLeafSize() {
+ public int qtyKpLeaves() {
return this.content.length();
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -210,7 +210,7 @@
}
@Override
- public int paraNodeSize() {
+ public int qtyParaNodes() {
return this.qtyWordComponents();
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordSegment4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordSegment4a.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordSegment4a.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -96,7 +96,7 @@
}
@Override
- public int paraKpLeafSize() {
+ public int qtyKpLeaves() {
return this.length();
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/CapitalizedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/CapitalizedWord.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/CapitalizedWord.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -101,9 +101,9 @@
}
@Override
- public int paraLeafSize() {
+ public int qtyParaLeaves() {
/* Capitalizing the word does not change the number of leaf descendants. */
- return this.getWrappedWord().paraLeafSize();
+ return this.getWrappedWord().qtyParaLeaves();
}
@Override
@@ -112,8 +112,8 @@
}
@Override
- public int paraKpLeafSize() {
- return getWrappedWord().paraKpLeafSize();
+ public int qtyKpLeaves() {
+ return getWrappedWord().qtyKpLeaves();
}
@Override
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -79,8 +79,8 @@
}
@Override
- public int paraLeafSize() {
- return getWrappedWord().paraLeafSize();
+ public int qtyParaLeaves() {
+ return getWrappedWord().qtyParaLeaves();
}
@Override
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/ExactWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/ExactWord.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/ExactWord.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -84,9 +84,9 @@
}
@Override
- public int paraLeafSize() {
+ public int qtyParaLeaves() {
/* Changing the case of chars in the word does not change the number of leaf descendants. */
- return this.getWrappedWord().paraLeafSize();
+ return this.getWrappedWord().qtyParaLeaves();
}
@Override
@@ -95,8 +95,8 @@
}
@Override
- public int paraKpLeafSize() {
- return getWrappedWord().paraKpLeafSize();
+ public int qtyKpLeaves() {
+ return getWrappedWord().qtyKpLeaves();
}
@Override
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1Word.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1Word.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -59,17 +59,17 @@
}
@Override
- public int paraLeafSize() {
+ public int qtyParaLeaves() {
/* This wrapper should add one leaf descendant to the size of the wrapped word. */
- return this.getWrappedWord().paraLeafSize() + 1;
+ return this.getWrappedWord().qtyParaLeaves() + 1;
}
@Override
public ParaLeaf paraLeafAt(final int index) {
- if (index < getWrappedWord().paraLeafSize()) {
+ if (index < getWrappedWord().qtyParaLeaves()) {
return getWrappedWord().paraLeafAt(index);
}
- if (index == getWrappedWord().paraLeafSize()) {
+ if (index == getWrappedWord().qtyParaLeaves()) {
return SUFFIX;
}
throw new IndexOutOfBoundsException("Index out of bounds: " + index);
@@ -76,8 +76,8 @@
}
@Override
- public int paraKpLeafSize() {
- return getWrappedWord().paraKpLeafSize() + LatinPast1Word.SUFFIX.length();
+ public int qtyKpLeaves() {
+ return getWrappedWord().qtyKpLeaves() + LatinPast1Word.SUFFIX.length();
}
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1Word.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1Word.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -91,9 +91,9 @@
}
@Override
- public int paraLeafSize() {
+ public int qtyParaLeaves() {
/* We think this wrapper should not change the number of leaf descendants. */
- return getWrappedWord().paraLeafSize();
+ return getWrappedWord().qtyParaLeaves();
}
@Override
@@ -102,8 +102,8 @@
}
@Override
- public int paraKpLeafSize() {
- return getWrappedWord().paraKpLeafSize() + LatinPlural1Word.Segment.SIZE_DIFFERENCE;
+ public int qtyKpLeaves() {
+ return getWrappedWord().qtyKpLeaves() + LatinPlural1Word.Segment.SIZE_DIFFERENCE;
}
@Override
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2Word.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2Word.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -94,9 +94,9 @@
}
@Override
- public int paraLeafSize() {
+ public int qtyParaLeaves() {
/* We think this wrapper should not change the number of leaf descendants. */
- return getWrappedWord().paraLeafSize();
+ return getWrappedWord().qtyParaLeaves();
}
@Override
@@ -105,8 +105,8 @@
}
@Override
- public int paraKpLeafSize() {
- return getWrappedWord().paraLeafSize() + LatinPlural2Word.Segment.SIZE_DIFFERENCE;
+ public int qtyKpLeaves() {
+ return getWrappedWord().qtyParaLeaves() + LatinPlural2Word.Segment.SIZE_DIFFERENCE;
}
@Override
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1Word.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1Word.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -92,9 +92,9 @@
}
@Override
- public int paraLeafSize() {
+ public int qtyParaLeaves() {
/* We think this wrapper should not change the number of leaf descendants. */
- return getWrappedWord().paraLeafSize();
+ return getWrappedWord().qtyParaLeaves();
}
@Override
@@ -103,8 +103,8 @@
}
@Override
- public int paraKpLeafSize() {
- return getWrappedWord().paraKpLeafSize() + LatinPossessive1Word.Segment.SIZE_DIFFERENCE;
+ public int qtyKpLeaves() {
+ return getWrappedWord().qtyKpLeaves() + LatinPossessive1Word.Segment.SIZE_DIFFERENCE;
}
@Override
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2Word.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2Word.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -92,9 +92,9 @@
}
@Override
- public int paraLeafSize() {
+ public int qtyParaLeaves() {
/* We think this wrapper should not change the number of leaf descendants. */
- return this.getWrappedWord().paraLeafSize();
+ return this.getWrappedWord().qtyParaLeaves();
}
@Override
@@ -103,8 +103,8 @@
}
@Override
- public int paraKpLeafSize() {
- return getWrappedWord().paraKpLeafSize() + LatinPossessive2Word.Segment.SIZE_DIFFERENCE;
+ public int qtyKpLeaves() {
+ return getWrappedWord().qtyKpLeaves() + LatinPossessive2Word.Segment.SIZE_DIFFERENCE;
}
@Override
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/UppercaseWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/UppercaseWord.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/UppercaseWord.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -92,9 +92,9 @@
}
@Override
- public int paraLeafSize() {
+ public int qtyParaLeaves() {
/* Converting the word to uppercase does not change the number of leaf descendants. */
- return getWrappedWord().paraLeafSize();
+ return getWrappedWord().qtyParaLeaves();
}
@Override
@@ -103,8 +103,8 @@
}
@Override
- public int paraKpLeafSize() {
- return getWrappedWord().paraKpLeafSize();
+ public int qtyKpLeaves() {
+ return getWrappedWord().qtyKpLeaves();
}
@Override
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 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/SegmentDictionaryWordTests.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -82,7 +82,7 @@
*/
@Test
public void getQtyParaNodeChildrenTests() {
- Assert.assertEquals(5, dictionary.getWord("ambition", 0).paraNodeSize());
+ Assert.assertEquals(5, dictionary.getWord("ambition", 0).qtyParaNodes());
}
/**
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/StringWordTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/StringWordTests.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/StringWordTests.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -113,7 +113,7 @@
@Test
public void paraBranchTest() {
- Assert.assertEquals(7, WORD_PHILOSOPHY.paraNodeSize());
+ Assert.assertEquals(7, WORD_PHILOSOPHY.qtyParaNodes());
Assert.assertEquals(StringWordSegmentUtf16.class, WORD_PHILOSOPHY.paraNodeAt(0).getClass());
Assert.assertEquals(DiscretionaryHyphen4a.class, WORD_PHILOSOPHY.paraNodeAt(1).getClass());
Assert.assertEquals(StringWordSegmentUtf16.class, WORD_PHILOSOPHY.paraNodeAt(2).getClass());
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 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordWrapperTests.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -287,7 +287,7 @@
*/
@Test
public void testGetQtyParaNodeChildren() {
- Assert.assertEquals(7, this.out.paraNodeSize());
+ Assert.assertEquals(7, this.out.qtyParaNodes());
}
/**
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java 2022-01-08 21:35:26 UTC (rev 12360)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockDiscretePnr.java 2022-01-08 22:14:56 UTC (rev 12361)
@@ -103,7 +103,7 @@
currentBranch = branch;
branchNodesConsumed = 0;
}
- final int branchNodesRemaining = branch.paraNodeSize() - branchNodesConsumed;
+ final int branchNodesRemaining = branch.qtyParaNodes() - branchNodesConsumed;
final int lineNodesRemaining = qtyLineNodes - lineNodesConsumed;
final int length = Math.min(lineNodesRemaining, branchNodesRemaining);
lineArea.addParaBranch(paraNode.asParaBranch(), branchNodesConsumed, length);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-08 21:35:28
|
Revision: 12360
http://sourceforge.net/p/foray/code/12360
Author: victormote
Date: 2022-01-08 21:35:26 +0000 (Sat, 08 Jan 2022)
Log Message:
-----------
Minor improvements to text processing.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java 2022-01-08 18:36:14 UTC (rev 12359)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java 2022-01-08 21:35:26 UTC (rev 12360)
@@ -28,6 +28,8 @@
package org.foray.fotree.fo.obj;
+import org.foray.common.para.ParaBranch4aIterator;
+
import org.axsl.common.para.ParaBranch;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
@@ -52,22 +54,22 @@
}
};
- /** The segments (children) of this text flow. */
- private List<Token> segments = new ArrayList<Token>();
+ /** The tokens (children) of this token flow. */
+ private List<Token> tokens = new ArrayList<Token>();
@Override
public int qtyTokens() {
- return this.segments.size();
+ return this.tokens.size();
}
@Override
public Token tokenAt(final int index) {
- return this.segments.get(index);
+ return this.tokens.get(index);
}
@Override
public void addToken(final Token segment) {
- this.segments.add(segment);
+ this.tokens.add(segment);
}
/**
@@ -105,18 +107,17 @@
@Override
public int paraNodeSize() {
- return this.segments.size();
+ return this.tokens.size();
}
@Override
public ParaNode paraNodeAt(final int nodeIndex) {
- return (ParaNode) this.segments.get(nodeIndex);
+ return (ParaNode) this.tokens.get(nodeIndex);
}
@Override
public void addNode(final ParaNode node) {
- // TODO Auto-generated method stub
-
+ this.tokens.add((Token) node);
}
@Override
@@ -133,8 +134,7 @@
@Override
public ListIterator<ParaLeaf> leafIterator() {
- // TODO Auto-generated method stub
- return null;
+ return new ParaBranch4aIterator(this);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-08 18:36:17
|
Revision: 12359
http://sourceforge.net/p/foray/code/12359
Author: victormote
Date: 2022-01-08 18:36:14 +0000 (Sat, 08 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: Rename methods for consistency.
Modified Paths:
--------------
trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutatingWord4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionary.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapper.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/CapitalizedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/ExactWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/FinalSegmentModifiedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/SuffixedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/UppercaseWord.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PatternTreeTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/SegmentDictionaryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/SegmentDictionaryWordTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/StringWordTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordWrapperTests.java
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 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -418,7 +418,7 @@
return this.wordStart;
}
// Compute the number of characters that should be included.
- final int charsToInclude = hyph.getHyphenationPointOffset(index);
+ final int charsToInclude = hyph.hyphenationPointOffsetAt(index);
// Add it and the non-word characters to the count to be returned.
return this.wordStart + nonWordChars + charsToInclude;
}
@@ -441,9 +441,9 @@
int index = -1;
- for (int i = 0; i < hyph.getQtyHyphenationPoints(); i++) {
+ for (int i = 0; i < hyph.qtyHyphenationPoints(); i++) {
final int provisionalWordWidth =
- getWordWidth(lineText, hyph, 0, hyph.getHyphenationPointOffset(i));
+ getWordWidth(lineText, hyph, 0, hyph.hyphenationPointOffsetAt(i));
if (provisionalWordWidth > remainingWidth) {
break;
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutatingWord4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutatingWord4a.java 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutatingWord4a.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -75,9 +75,9 @@
}
@Override
- public DiscretionaryHyphen getHyphenationPoint(final int pointIndex) {
+ public DiscretionaryHyphen hyphenationPointAt(final int pointIndex) {
if (this.breaks[pointIndex] == null) {
- return super.getHyphenationPoint(pointIndex);
+ return super.hyphenationPointAt(pointIndex);
} else {
return this.breaks[pointIndex];
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionary.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionary.java 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionary.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -129,8 +129,8 @@
final Set<StringWordSegmentUtf16> segments = new HashSet<StringWordSegmentUtf16>(stringWords.size() * 3);
for (int index = 0; index < stringWords.size(); index ++) {
final StringWord stringWord = stringWords.get(index);
- for (int segmentIndex = 0; segmentIndex < stringWord.getQtyWordSegments(); segmentIndex ++) {
- final StringWordSegmentUtf16 wordSegment = stringWord.getWordSegment(segmentIndex);
+ for (int segmentIndex = 0; segmentIndex < stringWord.qtyWordSegments(); segmentIndex ++) {
+ final StringWordSegmentUtf16 wordSegment = stringWord.wordSegmentAt(segmentIndex);
segments.add(wordSegment);
}
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -72,9 +72,9 @@
public SegmentDictionaryWord(final int partsOfSpeech, final SegmentDictionary dictionary, final Word word) {
this.partsOfSpeech = (char) partsOfSpeech;
this.dictionary = dictionary;
- final char[] segmentIndexes = new char[word.getQtyWordSegments()];
- for (int segmentIndex = 0; segmentIndex < word.getQtyWordSegments(); segmentIndex ++) {
- final WordSegment wordSegment = word.getWordSegment(segmentIndex);
+ final char[] segmentIndexes = new char[word.qtyWordSegments()];
+ for (int segmentIndex = 0; segmentIndex < word.qtyWordSegments(); segmentIndex ++) {
+ final WordSegment wordSegment = word.wordSegmentAt(segmentIndex);
final int dictionarySegmentIndex = dictionary.getWordSegmentIndex(wordSegment);
if (dictionarySegmentIndex < 0) {
throw new IllegalArgumentException(
@@ -88,12 +88,12 @@
}
@Override
- public int getQtyWordSegments() {
+ public int qtyWordSegments() {
return this.segments.length;
}
@Override
- public WordSegment getWordSegment(final int segmentIndex) {
+ public WordSegment wordSegmentAt(final int segmentIndex) {
final int dictionaryIndex = this.segments[segmentIndex];
return this.dictionary.getWordSegment(dictionaryIndex);
}
@@ -110,12 +110,12 @@
@Override
public int paraLeafSize() {
- return getQtyWordComponents();
+ return qtyWordComponents();
}
@Override
public WordComponent paraLeafAt(final int index) {
- return getWordComponent(index);
+ return wordComponentAt(index);
}
@Override
@@ -134,7 +134,7 @@
public CharSequence getText() {
final StringBuilder builder = new StringBuilder();
for (int index = 0; index < this.segments.length; index ++) {
- final WordSegment segment = getWordSegment(index);
+ final WordSegment segment = wordSegmentAt(index);
builder.append(segment.getText());
}
return builder.toString();
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -96,12 +96,12 @@
}
@Override
- public int getQtyWordSegments() {
+ public int qtyWordSegments() {
return this.segments.length;
}
@Override
- public StringWordSegmentUtf16 getWordSegment(final int segmentIndex) {
+ public StringWordSegmentUtf16 wordSegmentAt(final int segmentIndex) {
return this.segments[segmentIndex];
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -61,8 +61,8 @@
@Override
public String toString() {
final StringBuilder builder = new StringBuilder();
- for (int index = 0; index < getQtyWordComponents(); index ++) {
- final ParaLeaf component = getWordComponent(index);
+ for (int index = 0; index < qtyWordComponents(); index ++) {
+ final ParaLeaf component = wordComponentAt(index);
builder.append(component.toString());
}
return builder.toString();
@@ -71,8 +71,8 @@
@Override
public CharSequence getActualContent() {
final StringBuilder builder = new StringBuilder();
- for (int index = 0; index < getQtyWordSegments(); index ++) {
- final WordSegment segment = getWordSegment(index);
+ for (int index = 0; index < qtyWordSegments(); index ++) {
+ final WordSegment segment = wordSegmentAt(index);
builder.append(segment.getText());
}
return builder.toString();
@@ -81,8 +81,8 @@
@Override
public CharSequence getNormalizedContent() {
final StringBuilder builder = new StringBuilder();
- for (int index = 0; index < getQtyWordSegments(); index ++) {
- final WordSegment segment = getWordSegment(index);
+ for (int index = 0; index < qtyWordSegments(); index ++) {
+ final WordSegment segment = wordSegmentAt(index);
builder.append(segment.getText());
}
return builder.toString();
@@ -91,8 +91,8 @@
@Override
public int length() {
int length = 0;
- for (int index = 0; index < getQtyWordSegments(); index ++) {
- length += getWordSegment(index).length();
+ for (int index = 0; index < qtyWordSegments(); index ++) {
+ length += wordSegmentAt(index).length();
}
return length;
}
@@ -116,8 +116,8 @@
}
/* Index to the start of this segment, if the segments were concatenated. */
int startOfSegment = 0;
- for (int segmentIndex = 0; segmentIndex < word.getQtyWordSegments(); segmentIndex ++) {
- final WordSegment currentSegment = word.getWordSegment(segmentIndex);
+ for (int segmentIndex = 0; segmentIndex < word.qtyWordSegments(); segmentIndex ++) {
+ final WordSegment currentSegment = word.wordSegmentAt(segmentIndex);
final int endOfSegment = startOfSegment + currentSegment.length();
if (index < endOfSegment) {
final int indexOfCurrentSegment = index - startOfSegment;
@@ -138,32 +138,32 @@
throw new IndexOutOfBoundsException(Integer.toString(end));
}
final StringBuilder builder = new StringBuilder();
- for (int index = 0; index < getQtyWordSegments(); index ++) {
- builder.append(getWordSegment(index));
+ for (int index = 0; index < qtyWordSegments(); index ++) {
+ builder.append(wordSegmentAt(index));
}
return builder.subSequence(start, end);
}
@Override
- public int getQtyHyphenationPoints() {
- return this.getQtyWordSegments() - 1;
+ public int qtyHyphenationPoints() {
+ return this.qtyWordSegments() - 1;
}
@Override
- public int getHyphenationPointOffset(final int pointIndex) {
+ public int hyphenationPointOffsetAt(final int pointIndex) {
if (pointIndex < 0
- || pointIndex >= getQtyWordSegments() - 1) {
+ || pointIndex >= qtyWordSegments() - 1) {
throw new IndexOutOfBoundsException(Integer.toString(pointIndex));
}
int offset = 0;
for (int index = 0; index <= pointIndex; index ++) {
- offset += getWordSegment(index).length();
+ offset += wordSegmentAt(index).length();
}
return offset;
}
@Override
- public DiscretionaryHyphen getHyphenationPoint(final int pointIndex) {
+ public DiscretionaryHyphen hyphenationPointAt(final int pointIndex) {
return DiscretionaryHyphen4a.fromQuality(ParaPenalty.Quality.ACCEPTABLE);
}
@@ -173,16 +173,16 @@
}
@Override
- public int getQtyWordComponents() {
+ public int qtyWordComponents() {
/* Each syllable has a leaf for itself and one for the discretionary hyphen that follows it, except the last
* syllable, which is not followed by a hyphen. */
- return (this.getQtyWordSegments() * 2) - 1;
+ return (qtyWordSegments() * 2) - 1;
}
@Override
- public WordComponent getWordComponent(final int componentIndex) {
+ public WordComponent wordComponentAt(final int componentIndex) {
if (componentIndex < 0
- || componentIndex >= getQtyWordComponents()) {
+ || componentIndex >= qtyWordComponents()) {
throw new IndexOutOfBoundsException(Integer.toString(componentIndex));
}
/* Even-indexed components will always be segments, odd-indexed components will always be hyphenation points. */
@@ -190,7 +190,7 @@
return DiscretionaryHyphen4a.fromQuality(ParaPenalty.Quality.ACCEPTABLE);
} else {
final int segmentIndex = componentIndex / 2;
- return getWordSegment(segmentIndex);
+ return wordSegmentAt(segmentIndex);
}
}
@@ -211,12 +211,12 @@
@Override
public int paraNodeSize() {
- return this.getQtyWordComponents();
+ return this.qtyWordComponents();
}
@Override
public ParaNode paraNodeAt(final int index) {
- return this.getWordComponent(index);
+ return this.wordComponentAt(index);
}
/**
@@ -230,7 +230,7 @@
public static int getSegmentStart(final Word word, final int segmentIndex) {
int startOfSegment = 0;
for (int currentSegmentIndex = 0; currentSegmentIndex < segmentIndex; currentSegmentIndex ++) {
- final WordSegment currentSegment = word.getWordSegment(currentSegmentIndex);
+ final WordSegment currentSegment = word.wordSegmentAt(currentSegmentIndex);
startOfSegment += currentSegment.length();
}
return startOfSegment;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapper.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapper.java 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapper.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -65,13 +65,13 @@
}
@Override
- public int getQtyWordSegments() {
- return this.wrappedWord.getQtyWordSegments();
+ public int qtyWordSegments() {
+ return this.wrappedWord.qtyWordSegments();
}
@Override
- public WordSegment getWordSegment(final int segmentIndex) {
- return this.wrappedWord.getWordSegment(segmentIndex);
+ public WordSegment wordSegmentAt(final int segmentIndex) {
+ return this.wrappedWord.wordSegmentAt(segmentIndex);
}
@Override
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/CapitalizedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/CapitalizedWord.java 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/CapitalizedWord.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -91,8 +91,8 @@
}
@Override
- public WordSegment getWordSegment(final int segmentIndex) {
- final WordSegment segment = getWrappedWord().getWordSegment(segmentIndex);
+ public WordSegment wordSegmentAt(final int segmentIndex) {
+ final WordSegment segment = getWrappedWord().wordSegmentAt(segmentIndex);
if (segmentIndex == 0) {
return new Segment(segment);
} else {
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -69,13 +69,13 @@
}
@Override
- public int getQtyWordSegments() {
- return getWrappedWord().getQtyWordSegments();
+ public int qtyWordSegments() {
+ return getWrappedWord().qtyWordSegments();
}
@Override
- public int getQtyWordComponents() {
- return getWrappedWord().getQtyWordComponents();
+ public int qtyWordComponents() {
+ return getWrappedWord().qtyWordComponents();
}
@Override
@@ -89,9 +89,9 @@
}
@Override
- public WordComponent getWordComponent(final int componentIndex) {
+ public WordComponent wordComponentAt(final int componentIndex) {
if (componentIndex < 0
- || componentIndex >= getQtyWordComponents()) {
+ || componentIndex >= qtyWordComponents()) {
throw new IndexOutOfBoundsException(Integer.toString(componentIndex));
}
/* Even-indexed components will always be segments, odd-indexed components will always be hyphenation points. */
@@ -99,7 +99,7 @@
return DiscretionaryHyphen4a.fromQuality(ParaPenalty.Quality.ACCEPTABLE);
} else {
final int index = componentIndex / 2;
- return getWordSegment(index);
+ return wordSegmentAt(index);
}
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/ExactWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/ExactWord.java 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/ExactWord.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -69,8 +69,8 @@
}
@Override
- public WordSegment getWordSegment(final int segmentIndex) {
- final WordSegment segment = getWrappedWord().getWordSegment(segmentIndex);
+ public WordSegment wordSegmentAt(final int segmentIndex) {
+ final WordSegment segment = getWrappedWord().wordSegmentAt(segmentIndex);
final int start = StringWord.getSegmentStart(getWrappedWord(), segmentIndex);
if (CharSequenceUtils.areEquivalent(segment, 0, segment.length(), this.exact, 0, this.exact.length())) {
return segment;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/FinalSegmentModifiedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/FinalSegmentModifiedWord.java 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/FinalSegmentModifiedWord.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -50,17 +50,17 @@
*/
protected FinalSegmentModifiedWord(final Word wrappedWord) {
super(wrappedWord);
- final int lastSegmentIndex = wrappedWord.getQtyWordSegments() - 1;
- final WordSegment unmodifiedSegment = wrappedWord.getWordSegment(lastSegmentIndex);
+ final int lastSegmentIndex = wrappedWord.qtyWordSegments() - 1;
+ final WordSegment unmodifiedSegment = wrappedWord.wordSegmentAt(lastSegmentIndex);
this.lastSegment = createModifiedSegment(unmodifiedSegment);
}
@Override
- public WordSegment getWordSegment(final int segmentIndex) {
- if (segmentIndex == getQtyWordSegments() - 1) {
+ public WordSegment wordSegmentAt(final int segmentIndex) {
+ if (segmentIndex == qtyWordSegments() - 1) {
return this.lastSegment;
}
- return getWrappedWord().getWordSegment(segmentIndex);
+ return getWrappedWord().wordSegmentAt(segmentIndex);
}
/**
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/SuffixedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/SuffixedWord.java 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/SuffixedWord.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -52,16 +52,16 @@
}
@Override
- public int getQtyWordSegments() {
- return getWrappedWord().getQtyWordSegments() + 1;
+ public int qtyWordSegments() {
+ return getWrappedWord().qtyWordSegments() + 1;
}
@Override
- public WordSegment getWordSegment(final int segmentIndex) {
- if (segmentIndex < getWrappedWord().getQtyWordSegments()) {
- return getWrappedWord().getWordSegment(segmentIndex);
+ public WordSegment wordSegmentAt(final int segmentIndex) {
+ if (segmentIndex < getWrappedWord().qtyWordSegments()) {
+ return getWrappedWord().wordSegmentAt(segmentIndex);
}
- if (segmentIndex < getQtyWordSegments()) {
+ if (segmentIndex < qtyWordSegments()) {
return getSuffix();
}
throw new IndexOutOfBoundsException(Integer.toString(segmentIndex));
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/UppercaseWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/UppercaseWord.java 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/UppercaseWord.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -86,8 +86,8 @@
}
@Override
- public WordSegment getWordSegment(final int segmentIndex) {
- final WordSegment segment = getWrappedWord().getWordSegment(segmentIndex);
+ public WordSegment wordSegmentAt(final int segmentIndex) {
+ final WordSegment segment = getWrappedWord().wordSegmentAt(segmentIndex);
return new Segment(segment);
}
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -141,10 +141,10 @@
final Orthography4a orthography = server.getOrthography(WritingSystem4a.USA);
final Word hyphenation = orthography.hyphenateUnrecognizedWord(testWord, 0, testWord.length());
Assert.assertNotNull(hyphenation);
- Assert.assertEquals(3, hyphenation.getQtyHyphenationPoints());
- Assert.assertEquals(2, hyphenation.getHyphenationPointOffset(0));
- Assert.assertEquals(6, hyphenation.getHyphenationPointOffset(1));
- Assert.assertEquals(7, hyphenation.getHyphenationPointOffset(2));
+ Assert.assertEquals(3, hyphenation.qtyHyphenationPoints());
+ Assert.assertEquals(2, hyphenation.hyphenationPointOffsetAt(0));
+ Assert.assertEquals(6, hyphenation.hyphenationPointOffsetAt(1));
+ Assert.assertEquals(7, hyphenation.hyphenationPointOffsetAt(2));
}
/**
@@ -182,11 +182,11 @@
final Orthography4a orthography = server.getOrthography(WritingSystem4a.USA);
final Word hyphenation = orthography.hyphenateUnrecognizedWord(testWord, 0, testWord.length());
Assert.assertNotNull(hyphenation);
- Assert.assertEquals(4, hyphenation.getQtyHyphenationPoints());
- Assert.assertEquals(2, hyphenation.getHyphenationPointOffset(0));
- Assert.assertEquals(5, hyphenation.getHyphenationPointOffset(1));
- Assert.assertEquals(6, hyphenation.getHyphenationPointOffset(2));
- Assert.assertEquals(8, hyphenation.getHyphenationPointOffset(3));
+ Assert.assertEquals(4, hyphenation.qtyHyphenationPoints());
+ Assert.assertEquals(2, hyphenation.hyphenationPointOffsetAt(0));
+ Assert.assertEquals(5, hyphenation.hyphenationPointOffsetAt(1));
+ Assert.assertEquals(6, hyphenation.hyphenationPointOffsetAt(2));
+ Assert.assertEquals(8, hyphenation.hyphenationPointOffsetAt(3));
}
/**
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PatternTreeTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PatternTreeTests.java 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PatternTreeTests.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -102,7 +102,7 @@
public void hyphenateTest02() throws IOException, OrthographyException {
final String testString = "hyphenation";
final StringWord actual = PatternTreeTests.patternTree.hyphenate(testString, 0, testString.length());
- Assert.assertEquals(7, actual.getQtyWordComponents());
+ Assert.assertEquals(7, actual.qtyWordComponents());
}
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/SegmentDictionaryTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/SegmentDictionaryTests.java 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/SegmentDictionaryTests.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -65,8 +65,8 @@
* @param word The word.
*/
private void addWordSegments(final Set<StringWordSegmentUtf16> wordSegmentSet, final StringWord word) {
- for (int index = 0; index < word.getQtyWordSegments(); index ++) {
- wordSegmentSet.add(word.getWordSegment(index));
+ for (int index = 0; index < word.qtyWordSegments(); index ++) {
+ wordSegmentSet.add(word.wordSegmentAt(index));
}
}
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 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/SegmentDictionaryWordTests.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -226,7 +226,7 @@
@Test
public void getQtyHyphenationPointsTests() {
final SegmentDictionaryWord word = dictionary.getWord("ambition", 0);
- Assert.assertEquals(2, word.getQtyHyphenationPoints());
+ Assert.assertEquals(2, word.qtyHyphenationPoints());
}
/**
@@ -235,10 +235,10 @@
@Test
public void getHyphenationPointOffsetTests() {
final SegmentDictionaryWord word = dictionary.getWord("ambition", 0);
- Assert.assertEquals(2, word.getHyphenationPointOffset(0));
- Assert.assertEquals(4, word.getHyphenationPointOffset(1));
+ Assert.assertEquals(2, word.hyphenationPointOffsetAt(0));
+ Assert.assertEquals(4, word.hyphenationPointOffsetAt(1));
try {
- word.getHyphenationPointOffset(-1);
+ word.hyphenationPointOffsetAt(-1);
Assert.fail("Expected: " + IndexOutOfBoundsException.class.getName());
} catch (final IndexOutOfBoundsException e) {
/* This is the expected path. */
@@ -245,7 +245,7 @@
Assert.assertEquals("-1", e.getMessage());
}
try {
- word.getHyphenationPointOffset(2);
+ word.hyphenationPointOffsetAt(2);
Assert.fail("Expected: " + IndexOutOfBoundsException.class.getName());
} catch (final IndexOutOfBoundsException e) {
/* This is the expected path. */
@@ -259,10 +259,10 @@
@Test
public void getHyphenationPointTests() {
final SegmentDictionaryWord word = dictionary.getWord("ambition", 0);
- Assert.assertEquals(Quality.ACCEPTABLE, word.getHyphenationPoint(0).getQuality());
- Assert.assertEquals(Quality.ACCEPTABLE, word.getHyphenationPoint(1).getQuality());
+ Assert.assertEquals(Quality.ACCEPTABLE, word.hyphenationPointAt(0).getQuality());
+ Assert.assertEquals(Quality.ACCEPTABLE, word.hyphenationPointAt(1).getQuality());
try {
- word.getHyphenationPointOffset(-1);
+ word.hyphenationPointOffsetAt(-1);
Assert.fail("Expected: " + IndexOutOfBoundsException.class.getName());
} catch (final IndexOutOfBoundsException e) {
/* This is the expected path. */
@@ -269,7 +269,7 @@
Assert.assertEquals("-1", e.getMessage());
}
try {
- word.getHyphenationPointOffset(2);
+ word.hyphenationPointOffsetAt(2);
Assert.fail("Expected: " + IndexOutOfBoundsException.class.getName());
} catch (final IndexOutOfBoundsException e) {
/* This is the expected path. */
@@ -292,7 +292,7 @@
@Test
public void getQtyWordSegmentsTests() {
final SegmentDictionaryWord word = dictionary.getWord("ambition", 0);
- Assert.assertEquals(3, word.getQtyWordSegments());
+ Assert.assertEquals(3, word.qtyWordSegments());
}
/**
@@ -303,11 +303,11 @@
/* @TODO: Fails in some Java 8 implementations. */
public void getWordSegmentTests() {
final SegmentDictionaryWord word = dictionary.getWord("ambition", 0);
- Assert.assertEquals("am", word.getWordSegment(0).toString());
- Assert.assertEquals("bi", word.getWordSegment(1).toString());
- Assert.assertEquals("tion", word.getWordSegment(2).toString());
+ Assert.assertEquals("am", word.wordSegmentAt(0).toString());
+ Assert.assertEquals("bi", word.wordSegmentAt(1).toString());
+ Assert.assertEquals("tion", word.wordSegmentAt(2).toString());
try {
- word.getWordSegment(-1);
+ word.wordSegmentAt(-1);
Assert.fail("Expected: " + IndexOutOfBoundsException.class.getName());
} catch (final IndexOutOfBoundsException e) {
/* This is the expected path. */
@@ -314,7 +314,7 @@
Assert.assertEquals("-1", e.getMessage());
}
try {
- word.getWordSegment(3);
+ word.wordSegmentAt(3);
Assert.fail("Expected: " + IndexOutOfBoundsException.class.getName());
} catch (final IndexOutOfBoundsException e) {
/* This is the expected path. */
@@ -328,7 +328,7 @@
@Test
public void getQtyWordComponentsTests() {
final SegmentDictionaryWord word = dictionary.getWord("ambition", 0);
- Assert.assertEquals(5, word.getQtyWordComponents());
+ Assert.assertEquals(5, word.qtyWordComponents());
}
/**
@@ -339,13 +339,13 @@
/* @TODO: Fails in some Java 8 implementations. */
public void getgetWordComponentTests() {
final SegmentDictionaryWord word = dictionary.getWord("ambition", 0);
- Assert.assertEquals("am", word.getWordComponent(0).toString());
- Assert.assertEquals("-", word.getWordComponent(1).toString());
- Assert.assertEquals("bi", word.getWordComponent(2).toString());
- Assert.assertEquals("-", word.getWordComponent(3).toString());
- Assert.assertEquals("tion", word.getWordComponent(4).toString());
+ Assert.assertEquals("am", word.wordComponentAt(0).toString());
+ Assert.assertEquals("-", word.wordComponentAt(1).toString());
+ Assert.assertEquals("bi", word.wordComponentAt(2).toString());
+ Assert.assertEquals("-", word.wordComponentAt(3).toString());
+ Assert.assertEquals("tion", word.wordComponentAt(4).toString());
try {
- word.getWordSegment(-1);
+ word.wordSegmentAt(-1);
Assert.fail("Expected: " + IndexOutOfBoundsException.class.getName());
} catch (final IndexOutOfBoundsException e) {
/* This is the expected path. */
@@ -352,7 +352,7 @@
Assert.assertEquals("-1", e.getMessage());
}
try {
- word.getWordSegment(5);
+ word.wordSegmentAt(5);
Assert.fail("Expected: " + IndexOutOfBoundsException.class.getName());
} catch (final IndexOutOfBoundsException e) {
/* This is the expected path. */
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/StringWordTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/StringWordTests.java 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/StringWordTests.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -59,13 +59,13 @@
*/
@Test
public void testIsHyphenationPoint() {
- Assert.assertTrue(WORD_PHILOSOPHY.getWordComponent(0) instanceof StringWordSegmentUtf16);
- Assert.assertTrue(WORD_PHILOSOPHY.getWordComponent(1) instanceof DiscretionaryHyphen);
- Assert.assertTrue(WORD_PHILOSOPHY.getWordComponent(2) instanceof StringWordSegmentUtf16);
- Assert.assertTrue(WORD_PHILOSOPHY.getWordComponent(3) instanceof DiscretionaryHyphen);
- Assert.assertTrue(WORD_PHILOSOPHY.getWordComponent(4) instanceof StringWordSegmentUtf16);
- Assert.assertTrue(WORD_PHILOSOPHY.getWordComponent(5) instanceof DiscretionaryHyphen);
- Assert.assertTrue(WORD_PHILOSOPHY.getWordComponent(6) instanceof StringWordSegmentUtf16);
+ Assert.assertTrue(WORD_PHILOSOPHY.wordComponentAt(0) instanceof StringWordSegmentUtf16);
+ Assert.assertTrue(WORD_PHILOSOPHY.wordComponentAt(1) instanceof DiscretionaryHyphen);
+ Assert.assertTrue(WORD_PHILOSOPHY.wordComponentAt(2) instanceof StringWordSegmentUtf16);
+ Assert.assertTrue(WORD_PHILOSOPHY.wordComponentAt(3) instanceof DiscretionaryHyphen);
+ Assert.assertTrue(WORD_PHILOSOPHY.wordComponentAt(4) instanceof StringWordSegmentUtf16);
+ Assert.assertTrue(WORD_PHILOSOPHY.wordComponentAt(5) instanceof DiscretionaryHyphen);
+ Assert.assertTrue(WORD_PHILOSOPHY.wordComponentAt(6) instanceof StringWordSegmentUtf16);
}
/**
@@ -159,7 +159,7 @@
*/
@Test
public void getSegmentStartTest01() {
- Assert.assertEquals(4, WORD_PHILOSOPHY.getQtyWordSegments());
+ Assert.assertEquals(4, WORD_PHILOSOPHY.qtyWordSegments());
Assert.assertEquals(0, StringWord.getSegmentStart(WORD_PHILOSOPHY, 0));
Assert.assertEquals(3, StringWord.getSegmentStart(WORD_PHILOSOPHY, 1));
Assert.assertEquals(6, StringWord.getSegmentStart(WORD_PHILOSOPHY, 2));
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 2022-01-08 17:52:10 UTC (rev 12358)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordWrapperTests.java 2022-01-08 18:36:14 UTC (rev 12359)
@@ -160,7 +160,7 @@
*/
@Test
public void testGetQtyHyphenationPoints() {
- Assert.assertEquals(3, this.out.getQtyHyphenationPoints());
+ Assert.assertEquals(3, this.out.qtyHyphenationPoints());
}
/**
@@ -168,11 +168,11 @@
*/
@Test
public void testGetHyphenationPointOffset() {
- Assert.assertEquals(3, this.out.getHyphenationPointOffset(0));
- Assert.assertEquals(5, this.out.getHyphenationPointOffset(1));
- Assert.assertEquals(7, this.out.getHyphenationPointOffset(2));
+ Assert.assertEquals(3, this.out.hyphenationPointOffsetAt(0));
+ Assert.assertEquals(5, this.out.hyphenationPointOffsetAt(1));
+ Assert.assertEquals(7, this.out.hyphenationPointOffsetAt(2));
try {
- this.out.getHyphenationPointOffset(-1);
+ this.out.hyphenationPointOffsetAt(-1);
Assert.fail("Expected: " + IndexOutOfBoundsException.class.getName());
} catch (final IndexOutOfBoundsException e) {
/* This is the expected path. */
@@ -179,7 +179,7 @@
Assert.assertEquals("-1", e.getMessage());
}
try {
- this.out.getHyphenationPointOffset(7);
+ this.out.hyphenationPointOffsetAt(7);
Assert.fail("Expected: " + IndexOutOfBoundsException.class.getName());
} catch (final IndexOutOfBoundsException e) {
/* This is the expected path. */
@@ -192,11 +192,11 @@
*/
@Test
public void testGetHyphenationPoint() {
- Assert.assertEquals(Quality.ACCEPTABLE, this.out.getHyphenationPoint(0).getQuality());
- Assert.assertEquals(Quality.ACCEPTABLE, this.out.getHyphenationPoint(1).getQuality());
- Assert.assertEquals(Quality.ACCEPTABLE, this.out.getHyphenationPoint(2).getQuality());
+ Assert.assertEquals(Quality.ACCEPTABLE, this.out.hyphenationPointAt(0).getQuality());
+ Assert.assertEquals(Quality.ACCEPTABLE, this.out.hyphenationPointAt(1).getQuality());
+ Assert.assertEquals(Quality.ACCEPTABLE, this.out.hyphenationPointAt(2).getQuality());
try {
- this.out.getHyphenationPointOffset(-1);
+ this.out.hyphenationPointOffsetAt(-1);
Assert.fail("Expected: " + IndexOutOfBoundsException.class.getName());
} catch (final IndexOutOfBoundsException e) {
/* This is the expected path. */
@@ -203,7 +203,7 @@
Assert.assertEquals("-1", e.getMessage());
}
try {
- this.out.getHyphenationPointOffset(3);
+ this.out.hyphenationPointOffsetAt(3);
Assert.fail("Expected: " + IndexOutOfBoundsException.class.getName());
} catch (final IndexOutOfBoundsException e) {
/* This is the expected path. */
@@ -224,7 +224,7 @@
*/
@Test
public void testGetQtyWordComponents() {
- Assert.assertEquals(7, this.out.getQtyWordComponents());
+ Assert.assertEquals(7, this.out.qtyWordComponents());
}
/**
@@ -234,15 +234,15 @@
@Ignore
/* @TODO: Fails in some Java 8 implementations. */
public void testGetWordComponent() {
- Assert.assertEquals("har", this.out.getWordComponent(0).toString());
- Assert.assertEquals("-", this.out.getWordComponent(1).toString());
- Assert.assertEquals("mo", this.out.getWordComponent(2).toString());
- Assert.assertEquals("-", this.out.getWordComponent(3).toString());
- Assert.assertEquals("ni", this.out.getWordComponent(4).toString());
- Assert.assertEquals("-", this.out.getWordComponent(5).toString());
- Assert.assertEquals("ous", this.out.getWordComponent(6).toString());
+ Assert.assertEquals("har", this.out.wordComponentAt(0).toString());
+ Assert.assertEquals("-", this.out.wordComponentAt(1).toString());
+ Assert.assertEquals("mo", this.out.wordComponentAt(2).toString());
+ Assert.assertEquals("-", this.out.wordComponentAt(3).toString());
+ Assert.assertEquals("ni", this.out.wordComponentAt(4).toString());
+ Assert.assertEquals("-", this.out.wordComponentAt(5).toString());
+ Assert.assertEquals("ous", this.out.wordComponentAt(6).toString());
try {
- this.out.getWordSegment(-1);
+ this.out.wordSegmentAt(-1);
Assert.fail("Expected: " + IndexOutOfBoundsException.class.getName());
} catch (final IndexOutOfBoundsException e) {
/* This is the expected path. */
@@ -249,7 +249,7 @@
Assert.assertEquals("-1", e.getMessage());
}
try {
- this.out.getWordSegment(5);
+ this.out.wordSegmentAt(5);
Assert.fail("Expected: " + IndexOutOfBoundsException.class.getName());
} catch (final IndexOutOfBoundsException e) {
/* This is the expected path. */
@@ -332,7 +332,7 @@
*/
@Test
public void testGetQtyWordSegments() {
- Assert.assertEquals(4, this.out.getQtyWordSegments());
+ Assert.assertEquals(4, this.out.qtyWordSegments());
}
/**
@@ -342,12 +342,12 @@
@Ignore
/* @TODO: Fails in some Java 8 implementations. */
public void testGetWordSegment() {
- Assert.assertEquals("har", this.out.getWordSegment(0).toString());
- Assert.assertEquals("mo", this.out.getWordSegment(1).toString());
- Assert.assertEquals("ni", this.out.getWordSegment(2).toString());
- Assert.assertEquals("ous", this.out.getWordSegment(3).toString());
+ Assert.assertEquals("har", this.out.wordSegmentAt(0).toString());
+ Assert.assertEquals("mo", this.out.wordSegmentAt(1).toString());
+ Assert.assertEquals("ni", this.out.wordSegmentAt(2).toString());
+ Assert.assertEquals("ous", this.out.wordSegmentAt(3).toString());
try {
- this.out.getWordSegment(-1);
+ this.out.wordSegmentAt(-1);
Assert.fail("Expected: " + IndexOutOfBoundsException.class.getName());
} catch (final IndexOutOfBoundsException e) {
/* This is the expected path. */
@@ -354,7 +354,7 @@
Assert.assertEquals("-1", e.getMessage());
}
try {
- this.out.getWordSegment(4);
+ this.out.wordSegmentAt(4);
Assert.fail("Expected: " + IndexOutOfBoundsException.class.getName());
} catch (final IndexOutOfBoundsException e) {
/* This is the expected path. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-08 17:52:12
|
Revision: 12358
http://sourceforge.net/p/foray/code/12358
Author: victormote
Date: 2022-01-08 17:52:10 +0000 (Sat, 08 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: 1. Simplify TokenFlow. 2. Add method to FoTextWords to extract a subset of its content as chars.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java 2022-01-08 15:27:37 UTC (rev 12357)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java 2022-01-08 17:52:10 UTC (rev 12358)
@@ -33,9 +33,7 @@
import org.axsl.common.para.ParaNode;
import org.axsl.orthography.Token;
import org.axsl.orthography.TokenFlow;
-import org.axsl.orthography.TokenFlowComponent;
import org.axsl.orthography.TokenFlowFactory;
-import org.axsl.orthography.Word;
import java.util.ArrayList;
import java.util.List;
@@ -72,27 +70,6 @@
this.segments.add(segment);
}
- @Override
- public int qtyTokenFlowComponents() {
- int count = 0;
- for (int index = 0; index < this.segments.size(); index ++) {
- final Token segment = this.segments.get(index);
- if (segment instanceof Word) {
- final Word word = (Word) segment;
- count += word.getQtyWordComponents();
- } else {
- count ++;
- }
- }
- return count;
- }
-
- @Override
- public TokenFlowComponent tokenFlowComponentAt(final int index) {
- // TODO Auto-generated method stub
- return null;
- }
-
/**
* Returns the singleton factory that creates instances of this class.
* @return The singleton factory that creates instances of this class.
@@ -118,7 +95,7 @@
@Override
public int paraKpLeafSize() {
- return qtyTokenFlowComponents();
+ throw new UnsupportedOperationException();
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-08 15:27:37 UTC (rev 12357)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-08 17:52:10 UTC (rev 12358)
@@ -105,13 +105,13 @@
@Override
public int paraLeafSize() {
- return this.paraBranch.qtyTokenFlowComponents();
+ return this.content.size();
}
@Override
public ParaLeaf paraLeafAt(final int leafIndex) {
/* TODO: Fix this ugly cast. */
- return (ParaLeaf) this.paraBranch.tokenFlowComponentAt(leafIndex);
+ return (ParaLeaf) this.paraBranch.paraLeafAt(leafIndex);
}
@Override
@@ -250,4 +250,29 @@
return getRawText().toString();
}
+ @Override
+ public int qtyTokens() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public Token tokenAt(final int index) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addToken(final Token token) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public CharSequence extract(final int startToken, final int startSegment, final int startChar, final int endToken,
+ final int endSegment, final int endChar) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java 2022-01-08 15:27:37 UTC (rev 12357)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java 2022-01-08 17:52:10 UTC (rev 12358)
@@ -30,7 +30,6 @@
import org.axsl.orthography.Token;
import org.axsl.orthography.TokenFlow;
-import org.axsl.orthography.TokenFlowComponent;
import org.axsl.orthography.TokenFlowFactory;
import java.util.ArrayList;
@@ -67,16 +66,6 @@
this.tokens.add(segment);
}
- @Override
- public int qtyTokenFlowComponents() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public TokenFlowComponent tokenFlowComponentAt(final int index) {
- throw new UnsupportedOperationException();
- }
-
/**
* Returns the singleton factory that creates instances of this class.
* @return The singleton factory that creates instances of this class.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-08 15:27:40
|
Revision: 12357
http://sourceforge.net/p/foray/code/12357
Author: victormote
Date: 2022-01-08 15:27:37 +0000 (Sat, 08 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: Rename methods for clarity.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java 2022-01-08 15:05:16 UTC (rev 12356)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java 2022-01-08 15:27:37 UTC (rev 12357)
@@ -58,22 +58,22 @@
private List<Token> segments = new ArrayList<Token>();
@Override
- public int qtyTextFlowSegments() {
+ public int qtyTokens() {
return this.segments.size();
}
@Override
- public Token textFlowSegmentAt(final int index) {
+ public Token tokenAt(final int index) {
return this.segments.get(index);
}
@Override
- public void addSegment(final Token segment) {
+ public void addToken(final Token segment) {
this.segments.add(segment);
}
@Override
- public int qtyTextFlowComponents() {
+ public int qtyTokenFlowComponents() {
int count = 0;
for (int index = 0; index < this.segments.size(); index ++) {
final Token segment = this.segments.get(index);
@@ -88,7 +88,7 @@
}
@Override
- public TokenFlowComponent textFlowComponentAt(final int index) {
+ public TokenFlowComponent tokenFlowComponentAt(final int index) {
// TODO Auto-generated method stub
return null;
}
@@ -118,7 +118,7 @@
@Override
public int paraKpLeafSize() {
- return qtyTextFlowComponents();
+ return qtyTokenFlowComponents();
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-08 15:05:16 UTC (rev 12356)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-08 15:27:37 UTC (rev 12357)
@@ -73,7 +73,7 @@
this.parent = parent;
final OrthographyServer orthographyServer = getOrthographyServer();
final Orthography orthography = orthographyServer.getOrthography(getWritingSystem());
- this.paraBranch = orthography.tokenizeWordSequence(FoTextFlow4a.getFactory(), content, 0, content.length());
+ this.paraBranch = orthography.tokenize(FoTextFlow4a.getFactory(), content, 0, content.length());
this.content = new ArrayList<FoWordSequenceContent>(this.paraBranch.paraNodeSize());
for (int index = 0; index < this.paraBranch.paraNodeSize(); index ++) {
final ParaNode wordSequenceContent = this.paraBranch.paraNodeAt(index);
@@ -89,29 +89,29 @@
@Override
public int paraNodeSize() {
- return this.paraBranch.qtyTextFlowSegments();
+ return this.paraBranch.qtyTokens();
}
@Override
public ParaNode paraNodeAt(final int nodeIndex) {
/* TODO: Fix this ugly cast. */
- return (ParaNode) this.paraBranch.textFlowSegmentAt(nodeIndex);
+ return (ParaNode) this.paraBranch.tokenAt(nodeIndex);
}
@Override
public void addNode(final ParaNode node) {
- this.paraBranch.addSegment((Token) node);
+ this.paraBranch.addToken((Token) node);
}
@Override
public int paraLeafSize() {
- return this.paraBranch.qtyTextFlowComponents();
+ return this.paraBranch.qtyTokenFlowComponents();
}
@Override
public ParaLeaf paraLeafAt(final int leafIndex) {
/* TODO: Fix this ugly cast. */
- return (ParaLeaf) this.paraBranch.textFlowComponentAt(leafIndex);
+ return (ParaLeaf) this.paraBranch.tokenFlowComponentAt(leafIndex);
}
@Override
@@ -225,7 +225,7 @@
@Override
public CharSequence getRawText() {
final StringBuilder builder = new StringBuilder();
- for (int nodeIndex = 0; nodeIndex < this.paraBranch.qtyTextFlowSegments(); nodeIndex ++) {
+ for (int nodeIndex = 0; nodeIndex < this.paraBranch.qtyTokens(); nodeIndex ++) {
final ParaNode node = this.paraBranch.paraNodeAt(nodeIndex);
builder.append(node.getText());
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-01-08 15:05:16 UTC (rev 12356)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-01-08 15:27:37 UTC (rev 12357)
@@ -407,7 +407,7 @@
}
@Override
- public <T extends TokenFlow> T tokenizeWordSequence(final TokenFlowFactory<T> factory,
+ public <T extends TokenFlow> T tokenize(final TokenFlowFactory<T> factory,
final CharSequence characters, final int startIndex, final int length) throws OrthographyException {
final T wordSequence = factory.makeTextFlow();
final CharSequence sequence = characters.subSequence(startIndex, startIndex + length);
@@ -431,7 +431,7 @@
if (word == null) {
word = new StringWord(0, chunk);
}
- wordSequence.addSegment(word);
+ wordSequence.addToken(word);
}
}
return wordSequence;
@@ -444,11 +444,11 @@
final char contentChar = interword.charAt(index);
final Punctuation4a punctuation = Punctuation4a.findInstance(interword.subSequence(index, index + 1));
if (punctuation != null) {
- wordSequence.addSegment(punctuation);
+ wordSequence.addToken(punctuation);
index ++;
} else if (Character.isWhitespace(contentChar)) {
final Whitespace4a whitespace = Whitespace4a.findInstance(interword.subSequence(index, index + 1));
- wordSequence.addSegment(whitespace);
+ wordSequence.addToken(whitespace);
index ++;
} else {
throw new OrthographyException("Don't know how to handle interword content: " + contentChar);
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java 2022-01-08 15:05:16 UTC (rev 12356)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java 2022-01-08 15:27:37 UTC (rev 12357)
@@ -49,31 +49,31 @@
}
};
- /** The segments (children) of this text flow. */
- private List<Token> segments = new ArrayList<Token>();
+ /** The tokens (children) of this text flow. */
+ private List<Token> tokens = new ArrayList<Token>();
@Override
- public int qtyTextFlowSegments() {
- return this.segments.size();
+ public int qtyTokens() {
+ return this.tokens.size();
}
@Override
- public Token textFlowSegmentAt(final int index) {
- return this.segments.get(index);
+ public Token tokenAt(final int index) {
+ return this.tokens.get(index);
}
@Override
- public void addSegment(final Token segment) {
- this.segments.add(segment);
+ public void addToken(final Token segment) {
+ this.tokens.add(segment);
}
@Override
- public int qtyTextFlowComponents() {
+ public int qtyTokenFlowComponents() {
throw new UnsupportedOperationException();
}
@Override
- public TokenFlowComponent textFlowComponentAt(final int index) {
+ public TokenFlowComponent tokenFlowComponentAt(final int index) {
throw new UnsupportedOperationException();
}
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2022-01-08 15:05:16 UTC (rev 12356)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2022-01-08 15:27:37 UTC (rev 12357)
@@ -82,28 +82,28 @@
/* Spoken by Henry, Henry V, Act III Scene 1. */
final String testString = "Once more unto the breach, dear friends, once more;";
final TextFlow4a wordSequence =
- this.consumer.tokenizeWordSequence(TextFlow4a.getFactory(), testString, 0, testString.length());
- Assert.assertEquals(20, wordSequence.qtyTextFlowSegments());
- Assert.assertEquals("Once", wordSequence.textFlowSegmentAt(0).toString());
- Assert.assertEquals(" ", wordSequence.textFlowSegmentAt(1).toString());
- Assert.assertEquals("more", wordSequence.textFlowSegmentAt(2).toString());
- Assert.assertEquals(" ", wordSequence.textFlowSegmentAt(3).toString());
- Assert.assertEquals("un-to", wordSequence.textFlowSegmentAt(4).toString());
- Assert.assertEquals(" ", wordSequence.textFlowSegmentAt(5).toString());
- Assert.assertEquals("the", wordSequence.textFlowSegmentAt(6).toString());
- Assert.assertEquals(" ", wordSequence.textFlowSegmentAt(7).toString());
- Assert.assertEquals("breach", wordSequence.textFlowSegmentAt(8).toString());
- Assert.assertEquals(",", wordSequence.textFlowSegmentAt(9).toString());
- Assert.assertEquals(" ", wordSequence.textFlowSegmentAt(10).toString());
- Assert.assertEquals("dear", wordSequence.textFlowSegmentAt(11).toString());
- Assert.assertEquals(" ", wordSequence.textFlowSegmentAt(12).toString());
- Assert.assertEquals("friends", wordSequence.textFlowSegmentAt(13).toString());
- Assert.assertEquals(",", wordSequence.textFlowSegmentAt(14).toString());
- Assert.assertEquals(" ", wordSequence.textFlowSegmentAt(15).toString());
- Assert.assertEquals("once", wordSequence.textFlowSegmentAt(16).toString());
- Assert.assertEquals(" ", wordSequence.textFlowSegmentAt(17).toString());
- Assert.assertEquals("more", wordSequence.textFlowSegmentAt(18).toString());
- Assert.assertEquals(";", wordSequence.textFlowSegmentAt(19).toString());
+ this.consumer.tokenize(TextFlow4a.getFactory(), testString, 0, testString.length());
+ Assert.assertEquals(20, wordSequence.qtyTokens());
+ Assert.assertEquals("Once", wordSequence.tokenAt(0).toString());
+ Assert.assertEquals(" ", wordSequence.tokenAt(1).toString());
+ Assert.assertEquals("more", wordSequence.tokenAt(2).toString());
+ Assert.assertEquals(" ", wordSequence.tokenAt(3).toString());
+ Assert.assertEquals("un-to", wordSequence.tokenAt(4).toString());
+ Assert.assertEquals(" ", wordSequence.tokenAt(5).toString());
+ Assert.assertEquals("the", wordSequence.tokenAt(6).toString());
+ Assert.assertEquals(" ", wordSequence.tokenAt(7).toString());
+ Assert.assertEquals("breach", wordSequence.tokenAt(8).toString());
+ Assert.assertEquals(",", wordSequence.tokenAt(9).toString());
+ Assert.assertEquals(" ", wordSequence.tokenAt(10).toString());
+ Assert.assertEquals("dear", wordSequence.tokenAt(11).toString());
+ Assert.assertEquals(" ", wordSequence.tokenAt(12).toString());
+ Assert.assertEquals("friends", wordSequence.tokenAt(13).toString());
+ Assert.assertEquals(",", wordSequence.tokenAt(14).toString());
+ Assert.assertEquals(" ", wordSequence.tokenAt(15).toString());
+ Assert.assertEquals("once", wordSequence.tokenAt(16).toString());
+ Assert.assertEquals(" ", wordSequence.tokenAt(17).toString());
+ Assert.assertEquals("more", wordSequence.tokenAt(18).toString());
+ Assert.assertEquals(";", wordSequence.tokenAt(19).toString());
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-08 15:05:18
|
Revision: 12356
http://sourceforge.net/p/foray/code/12356
Author: victormote
Date: 2022-01-08 15:05:16 +0000 (Sat, 08 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: Rename types for clarity.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java 2022-01-07 21:38:16 UTC (rev 12355)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java 2022-01-08 15:05:16 UTC (rev 12356)
@@ -31,10 +31,10 @@
import org.axsl.common.para.ParaBranch;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
-import org.axsl.orthography.TextFlow;
-import org.axsl.orthography.TextFlowComponent;
-import org.axsl.orthography.TextFlowFactory;
-import org.axsl.orthography.TextFlowSegment;
+import org.axsl.orthography.Token;
+import org.axsl.orthography.TokenFlow;
+import org.axsl.orthography.TokenFlowComponent;
+import org.axsl.orthography.TokenFlowFactory;
import org.axsl.orthography.Word;
import java.util.ArrayList;
@@ -42,12 +42,12 @@
import java.util.ListIterator;
/**
- * FOray implementation of {@link TextFlow}.
+ * FOray implementation of {@link TokenFlow}.
*/
-public class FoTextFlow4a implements TextFlow, ParaBranch {
+public class FoTextFlow4a implements TokenFlow, ParaBranch {
/** Singleton factory. */
- private static final TextFlowFactory<FoTextFlow4a> FACTORY = new TextFlowFactory<FoTextFlow4a>() {
+ private static final TokenFlowFactory<FoTextFlow4a> FACTORY = new TokenFlowFactory<FoTextFlow4a>() {
@Override
public FoTextFlow4a makeTextFlow() {
return new FoTextFlow4a();
@@ -55,7 +55,7 @@
};
/** The segments (children) of this text flow. */
- private List<TextFlowSegment> segments = new ArrayList<TextFlowSegment>();
+ private List<Token> segments = new ArrayList<Token>();
@Override
public int qtyTextFlowSegments() {
@@ -63,12 +63,12 @@
}
@Override
- public TextFlowSegment textFlowSegmentAt(final int index) {
+ public Token textFlowSegmentAt(final int index) {
return this.segments.get(index);
}
@Override
- public void addSegment(final TextFlowSegment segment) {
+ public void addSegment(final Token segment) {
this.segments.add(segment);
}
@@ -76,7 +76,7 @@
public int qtyTextFlowComponents() {
int count = 0;
for (int index = 0; index < this.segments.size(); index ++) {
- final TextFlowSegment segment = this.segments.get(index);
+ final Token segment = this.segments.get(index);
if (segment instanceof Word) {
final Word word = (Word) segment;
count += word.getQtyWordComponents();
@@ -88,7 +88,7 @@
}
@Override
- public TextFlowComponent textFlowComponentAt(final int index) {
+ public TokenFlowComponent textFlowComponentAt(final int index) {
// TODO Auto-generated method stub
return null;
}
@@ -97,7 +97,7 @@
* Returns the singleton factory that creates instances of this class.
* @return The singleton factory that creates instances of this class.
*/
- public static TextFlowFactory<FoTextFlow4a> getFactory() {
+ public static TokenFlowFactory<FoTextFlow4a> getFactory() {
return FACTORY;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-07 21:38:16 UTC (rev 12355)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-08 15:05:16 UTC (rev 12356)
@@ -42,7 +42,7 @@
import org.axsl.orthography.Orthography;
import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.OrthographyServer;
-import org.axsl.orthography.TextFlowSegment;
+import org.axsl.orthography.Token;
import java.util.ArrayList;
import java.util.List;
@@ -100,7 +100,7 @@
@Override
public void addNode(final ParaNode node) {
- this.paraBranch.addSegment((TextFlowSegment) node);
+ this.paraBranch.addSegment((Token) node);
}
@Override
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-01-07 21:38:16 UTC (rev 12355)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-01-08 15:05:16 UTC (rev 12356)
@@ -37,8 +37,8 @@
import org.axsl.orthography.Orthography;
import org.axsl.orthography.OrthographyException;
-import org.axsl.orthography.TextFlow;
-import org.axsl.orthography.TextFlowFactory;
+import org.axsl.orthography.TokenFlow;
+import org.axsl.orthography.TokenFlowFactory;
import org.axsl.orthography.Word;
import org.axsl.orthography.optional.Dictionary;
import org.axsl.orthography.optional.Lexer;
@@ -407,7 +407,7 @@
}
@Override
- public <T extends TextFlow> T tokenizeWordSequence(final TextFlowFactory<T> factory,
+ public <T extends TokenFlow> T tokenizeWordSequence(final TokenFlowFactory<T> factory,
final CharSequence characters, final int startIndex, final int length) throws OrthographyException {
final T wordSequence = factory.makeTextFlow();
final CharSequence sequence = characters.subSequence(startIndex, startIndex + length);
@@ -437,7 +437,7 @@
return wordSequence;
}
- private void parseInterwordContent(final TextFlow wordSequence, final CharSequence interword)
+ private void parseInterwordContent(final TokenFlow wordSequence, final CharSequence interword)
throws OrthographyException {
int index = 0;
while (index < interword.length()) {
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java 2022-01-07 21:38:16 UTC (rev 12355)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java 2022-01-08 15:05:16 UTC (rev 12356)
@@ -28,21 +28,21 @@
package org.foray.orthography;
-import org.axsl.orthography.TextFlow;
-import org.axsl.orthography.TextFlowComponent;
-import org.axsl.orthography.TextFlowFactory;
-import org.axsl.orthography.TextFlowSegment;
+import org.axsl.orthography.Token;
+import org.axsl.orthography.TokenFlow;
+import org.axsl.orthography.TokenFlowComponent;
+import org.axsl.orthography.TokenFlowFactory;
import java.util.ArrayList;
import java.util.List;
/**
- * FOray implementation of {@link TextFlow}.
+ * FOray implementation of {@link TokenFlow}.
*/
-public class TextFlow4a implements TextFlow {
+public class TextFlow4a implements TokenFlow {
/** Singleton factory. */
- private static final TextFlowFactory<TextFlow4a> FACTORY = new TextFlowFactory<TextFlow4a>() {
+ private static final TokenFlowFactory<TextFlow4a> FACTORY = new TokenFlowFactory<TextFlow4a>() {
@Override
public TextFlow4a makeTextFlow() {
return new TextFlow4a();
@@ -50,7 +50,7 @@
};
/** The segments (children) of this text flow. */
- private List<TextFlowSegment> segments = new ArrayList<TextFlowSegment>();
+ private List<Token> segments = new ArrayList<Token>();
@Override
public int qtyTextFlowSegments() {
@@ -58,12 +58,12 @@
}
@Override
- public TextFlowSegment textFlowSegmentAt(final int index) {
+ public Token textFlowSegmentAt(final int index) {
return this.segments.get(index);
}
@Override
- public void addSegment(final TextFlowSegment segment) {
+ public void addSegment(final Token segment) {
this.segments.add(segment);
}
@@ -73,7 +73,7 @@
}
@Override
- public TextFlowComponent textFlowComponentAt(final int index) {
+ public TokenFlowComponent textFlowComponentAt(final int index) {
throw new UnsupportedOperationException();
}
@@ -81,7 +81,7 @@
* Returns the singleton factory that creates instances of this class.
* @return The singleton factory that creates instances of this class.
*/
- public static TextFlowFactory<TextFlow4a> getFactory() {
+ public static TokenFlowFactory<TextFlow4a> getFactory() {
return FACTORY;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-07 21:38:19
|
Revision: 12355
http://sourceforge.net/p/foray/code/12355
Author: victormote
Date: 2022-01-07 21:38:16 +0000 (Fri, 07 Jan 2022)
Log Message:
-----------
Rename class in preparation for some FO refactoring.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequenceContent.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWord4a.java
Removed Paths:
-------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWord.java
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWord.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWord.java 2022-01-07 21:15:38 UTC (rev 12354)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWord.java 2022-01-07 21:38:16 UTC (rev 12355)
@@ -1,133 +0,0 @@
-/*
- * Copyright 2017 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.common.value.WhiteSpaceTreatment;
-import org.axsl.orthography.Word;
-
-/**
- * Fo wrapper around a word.
- */
-public class FoWord extends FoWordSequenceContent {
-
- /** The wrapped word. */
- private Word word;
-
- /**
- * Constructor.
- * @param word The wrapped word.
- */
- public FoWord(final Word word) {
- this.word = word;
- }
-
- /**
- * Returns the wrapped word.
- * @return The wrapped word.
- */
- public Word getWord() {
- return this.word;
- }
-
- @Override
- public int length() {
- return this.word.length();
- }
-
- @Override
- public char charAt(final int index) {
- return this.word.charAt(index);
- }
-
- @Override
- public CharSequence subSequence(final int start, final int end) {
- return this.word.subSequence(start, end);
- }
-
- @Override
- public int whiteSpaceTreatmentLength(final WhiteSpaceTreatment whiteSpaceTreatment) {
- /* For now we assume that words do not have white-space and therefore have no white-space treatment. */
- return this.word.length();
- }
-
- @Override
- public char whiteSpaceTreatmentCharAt(final WhiteSpaceTreatment whiteSpaceTreatment,
- final int whiteSpaceTreatmentIndex) {
- /* For now we assume that words do not have white-space and therefore have no white-space treatment. */
- return this.word.charAt(whiteSpaceTreatmentIndex);
- }
-
- @Override
- public int linefeedTreatmentLength(final WhiteSpaceTreatment whiteSpaceTreatment,
- final LinefeedTreatment linefeedTreatment) {
- /* For now we assume that words do not contain linefeeds and therefore have no linefeed treatment. */
- return whiteSpaceTreatmentLength(whiteSpaceTreatment);
- }
-
- @Override
- public char linefeedTreatmentCharAt(final WhiteSpaceTreatment whiteSpaceTreatment,
- final LinefeedTreatment linefeedTreatment, final int linefeedTreatmentIndex) {
- /* For now we assume that words do not contain linefeeds and therefore have no linefeed treatment. */
- return whiteSpaceTreatmentCharAt(whiteSpaceTreatment, linefeedTreatmentIndex);
- }
-
- @Override
- public char textTransformCharAt(final WhiteSpaceTreatment whiteSpaceTreatment,
- final LinefeedTreatment linefeedTreatment, final TextTransform textTransform,
- final int textTransformIndex) {
- final boolean isFirstCharInWord = (textTransformIndex == 0) ? true : false;
- final char c = linefeedTreatmentCharAt(whiteSpaceTreatment, linefeedTreatment, textTransformIndex);
- return AbstractCharacterSequence.applyTextTransform(textTransform, isFirstCharInWord, c);
- }
-
- @Override
- public int whiteSpaceCollapseLength(final WhiteSpaceTreatment whiteSpaceTreatment,
- final LinefeedTreatment linefeedTreatment, final TextTransform textTransform,
- final boolean isWhiteSpaceCollapse) {
- /* For now we assume that words do not contain white-space and therefore we have no white-space-collapse. */
- return textTransformLength(whiteSpaceTreatment, linefeedTreatment, textTransform);
- }
-
- @Override
- public char whiteSpaceCollapseCharAt(final WhiteSpaceTreatment whiteSpaceTreatment,
- final LinefeedTreatment linefeedTreatment, final TextTransform textTransform,
- final boolean isWhiteSpaceCollapse, final int whiteSpaceCollapseIndex) {
- /* For now we assume that words do not contain white-space and therefore we have no white-space-collapse. */
- return textTransformCharAt(whiteSpaceTreatment, linefeedTreatment, textTransform, whiteSpaceCollapseIndex);
-
- }
-
- @Override
- public String toString() {
- return this.word.toString();
- }
-
-}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWord4a.java (from rev 12181, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWord.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWord4a.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWord4a.java 2022-01-07 21:38:16 UTC (rev 12355)
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2017 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.common.value.WhiteSpaceTreatment;
+import org.axsl.orthography.Word;
+
+/**
+ * Fo wrapper around a word.
+ */
+public class FoWord4a extends FoWordSequenceContent {
+
+ /** The wrapped word. */
+ private Word word;
+
+ /**
+ * Constructor.
+ * @param word The wrapped word.
+ */
+ public FoWord4a(final Word word) {
+ this.word = word;
+ }
+
+ /**
+ * Returns the wrapped word.
+ * @return The wrapped word.
+ */
+ public Word getWord() {
+ return this.word;
+ }
+
+ @Override
+ public int length() {
+ return this.word.length();
+ }
+
+ @Override
+ public char charAt(final int index) {
+ return this.word.charAt(index);
+ }
+
+ @Override
+ public CharSequence subSequence(final int start, final int end) {
+ return this.word.subSequence(start, end);
+ }
+
+ @Override
+ public int whiteSpaceTreatmentLength(final WhiteSpaceTreatment whiteSpaceTreatment) {
+ /* For now we assume that words do not have white-space and therefore have no white-space treatment. */
+ return this.word.length();
+ }
+
+ @Override
+ public char whiteSpaceTreatmentCharAt(final WhiteSpaceTreatment whiteSpaceTreatment,
+ final int whiteSpaceTreatmentIndex) {
+ /* For now we assume that words do not have white-space and therefore have no white-space treatment. */
+ return this.word.charAt(whiteSpaceTreatmentIndex);
+ }
+
+ @Override
+ public int linefeedTreatmentLength(final WhiteSpaceTreatment whiteSpaceTreatment,
+ final LinefeedTreatment linefeedTreatment) {
+ /* For now we assume that words do not contain linefeeds and therefore have no linefeed treatment. */
+ return whiteSpaceTreatmentLength(whiteSpaceTreatment);
+ }
+
+ @Override
+ public char linefeedTreatmentCharAt(final WhiteSpaceTreatment whiteSpaceTreatment,
+ final LinefeedTreatment linefeedTreatment, final int linefeedTreatmentIndex) {
+ /* For now we assume that words do not contain linefeeds and therefore have no linefeed treatment. */
+ return whiteSpaceTreatmentCharAt(whiteSpaceTreatment, linefeedTreatmentIndex);
+ }
+
+ @Override
+ public char textTransformCharAt(final WhiteSpaceTreatment whiteSpaceTreatment,
+ final LinefeedTreatment linefeedTreatment, final TextTransform textTransform,
+ final int textTransformIndex) {
+ final boolean isFirstCharInWord = (textTransformIndex == 0) ? true : false;
+ final char c = linefeedTreatmentCharAt(whiteSpaceTreatment, linefeedTreatment, textTransformIndex);
+ return AbstractCharacterSequence.applyTextTransform(textTransform, isFirstCharInWord, c);
+ }
+
+ @Override
+ public int whiteSpaceCollapseLength(final WhiteSpaceTreatment whiteSpaceTreatment,
+ final LinefeedTreatment linefeedTreatment, final TextTransform textTransform,
+ final boolean isWhiteSpaceCollapse) {
+ /* For now we assume that words do not contain white-space and therefore we have no white-space-collapse. */
+ return textTransformLength(whiteSpaceTreatment, linefeedTreatment, textTransform);
+ }
+
+ @Override
+ public char whiteSpaceCollapseCharAt(final WhiteSpaceTreatment whiteSpaceTreatment,
+ final LinefeedTreatment linefeedTreatment, final TextTransform textTransform,
+ final boolean isWhiteSpaceCollapse, final int whiteSpaceCollapseIndex) {
+ /* For now we assume that words do not contain white-space and therefore we have no white-space-collapse. */
+ return textTransformCharAt(whiteSpaceTreatment, linefeedTreatment, textTransform, whiteSpaceCollapseIndex);
+
+ }
+
+ @Override
+ public String toString() {
+ return this.word.toString();
+ }
+
+}
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 2022-01-07 21:15:38 UTC (rev 12354)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequenceContent.java 2022-01-07 21:38:16 UTC (rev 12355)
@@ -55,7 +55,7 @@
static FoWordSequenceContent create(final ParaNode wordSequenceContent) {
if (wordSequenceContent instanceof Word) {
final Word word = (Word) wordSequenceContent;
- return new FoWord(word);
+ return new FoWord4a(word);
}
if (wordSequenceContent instanceof Punctuation) {
final Punctuation interword = (Punctuation) wordSequenceContent;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-07 21:15:41
|
Revision: 12354
http://sourceforge.net/p/foray/code/12354
Author: victormote
Date: 2022-01-07 21:15:38 +0000 (Fri, 07 Jan 2022)
Log Message:
-----------
Conform to aXSL change: Replace ParaBranchFactory with an orthography-specific class.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.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 2022-01-07 12:46:13 UTC (rev 12353)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.java 2022-01-07 21:15:38 UTC (rev 12354)
@@ -29,7 +29,6 @@
package org.foray.common.para;
import org.axsl.common.para.ParaBranch;
-import org.axsl.common.para.ParaBranchFactory;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
@@ -42,14 +41,6 @@
*/
public class ParaBranch4a implements ParaBranch {
- /** Singleton factory. */
- private static final ParaBranchFactory<ParaBranch4a> FACTORY = new ParaBranchFactory<ParaBranch4a>() {
- @Override
- public ParaBranch4a makeParaBranch() {
- return new ParaBranch4a();
- }
- };
-
/** The list of child nodes. */
private List<ParaNode> nodes = new ArrayList<ParaNode>();
@@ -192,12 +183,4 @@
this.nodes.add(node);
}
- /**
- * Returns the singleton factory that creates instances of this class.
- * @return The singleton factory that creates instances of this class.
- */
- public static ParaBranchFactory<ParaBranch4a> getFactory() {
- return FACTORY;
- }
-
}
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.java 2022-01-07 21:15:38 UTC (rev 12354)
@@ -0,0 +1,163 @@
+/*
+ * 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.para.ParaBranch;
+import org.axsl.common.para.ParaLeaf;
+import org.axsl.common.para.ParaNode;
+import org.axsl.orthography.TextFlow;
+import org.axsl.orthography.TextFlowComponent;
+import org.axsl.orthography.TextFlowFactory;
+import org.axsl.orthography.TextFlowSegment;
+import org.axsl.orthography.Word;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+
+/**
+ * FOray implementation of {@link TextFlow}.
+ */
+public class FoTextFlow4a implements TextFlow, ParaBranch {
+
+ /** Singleton factory. */
+ private static final TextFlowFactory<FoTextFlow4a> FACTORY = new TextFlowFactory<FoTextFlow4a>() {
+ @Override
+ public FoTextFlow4a makeTextFlow() {
+ return new FoTextFlow4a();
+ }
+ };
+
+ /** The segments (children) of this text flow. */
+ private List<TextFlowSegment> segments = new ArrayList<TextFlowSegment>();
+
+ @Override
+ public int qtyTextFlowSegments() {
+ return this.segments.size();
+ }
+
+ @Override
+ public TextFlowSegment textFlowSegmentAt(final int index) {
+ return this.segments.get(index);
+ }
+
+ @Override
+ public void addSegment(final TextFlowSegment segment) {
+ this.segments.add(segment);
+ }
+
+ @Override
+ public int qtyTextFlowComponents() {
+ int count = 0;
+ for (int index = 0; index < this.segments.size(); index ++) {
+ final TextFlowSegment segment = this.segments.get(index);
+ if (segment instanceof Word) {
+ final Word word = (Word) segment;
+ count += word.getQtyWordComponents();
+ } else {
+ count ++;
+ }
+ }
+ return count;
+ }
+
+ @Override
+ public TextFlowComponent textFlowComponentAt(final int index) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * Returns the singleton factory that creates instances of this class.
+ * @return The singleton factory that creates instances of this class.
+ */
+ public static TextFlowFactory<FoTextFlow4a> getFactory() {
+ return FACTORY;
+ }
+
+ @Override
+ public Type getParaNodeType() {
+ return Type.BRANCH;
+ }
+
+ @Override
+ public ParaLeaf asParaLeaf() {
+ return null;
+ }
+
+ @Override
+ public ParaBranch asParaBranch() {
+ return this;
+ }
+
+ @Override
+ public int paraKpLeafSize() {
+ return qtyTextFlowComponents();
+ }
+
+ @Override
+ public CharSequence getText() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int paraNodeSize() {
+ return this.segments.size();
+ }
+
+ @Override
+ public ParaNode paraNodeAt(final int nodeIndex) {
+ return (ParaNode) this.segments.get(nodeIndex);
+ }
+
+ @Override
+ public void addNode(final ParaNode node) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int paraLeafSize() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public ParaLeaf paraLeafAt(final int leafIndex) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ListIterator<ParaLeaf> leafIterator() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextFlow4a.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/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-07 12:46:13 UTC (rev 12353)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-07 21:15:38 UTC (rev 12354)
@@ -28,7 +28,6 @@
package org.foray.fotree.fo.obj;
-import org.foray.common.para.ParaBranch4a;
import org.foray.fotree.FoObj;
import org.axsl.common.para.ParaBranch;
@@ -43,6 +42,7 @@
import org.axsl.orthography.Orthography;
import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.OrthographyServer;
+import org.axsl.orthography.TextFlowSegment;
import java.util.ArrayList;
import java.util.List;
@@ -60,7 +60,7 @@
private List<FoWordSequenceContent> content;
/** The parsed words. */
- private ParaBranch paraBranch;
+ private FoTextFlow4a paraBranch;
/**
* Constructor.
@@ -73,7 +73,7 @@
this.parent = parent;
final OrthographyServer orthographyServer = getOrthographyServer();
final Orthography orthography = orthographyServer.getOrthography(getWritingSystem());
- this.paraBranch = orthography.tokenizeWordSequence(ParaBranch4a.getFactory(), content, 0, content.length());
+ this.paraBranch = orthography.tokenizeWordSequence(FoTextFlow4a.getFactory(), content, 0, content.length());
this.content = new ArrayList<FoWordSequenceContent>(this.paraBranch.paraNodeSize());
for (int index = 0; index < this.paraBranch.paraNodeSize(); index ++) {
final ParaNode wordSequenceContent = this.paraBranch.paraNodeAt(index);
@@ -89,27 +89,29 @@
@Override
public int paraNodeSize() {
- return this.paraBranch.paraNodeSize();
+ return this.paraBranch.qtyTextFlowSegments();
}
@Override
public ParaNode paraNodeAt(final int nodeIndex) {
- return this.paraBranch.paraNodeAt(nodeIndex);
+ /* TODO: Fix this ugly cast. */
+ return (ParaNode) this.paraBranch.textFlowSegmentAt(nodeIndex);
}
@Override
public void addNode(final ParaNode node) {
- this.paraBranch.addNode(node);
+ this.paraBranch.addSegment((TextFlowSegment) node);
}
@Override
public int paraLeafSize() {
- return this.paraBranch.paraLeafSize();
+ return this.paraBranch.qtyTextFlowComponents();
}
@Override
public ParaLeaf paraLeafAt(final int leafIndex) {
- return this.paraBranch.paraLeafAt(leafIndex);
+ /* TODO: Fix this ugly cast. */
+ return (ParaLeaf) this.paraBranch.textFlowComponentAt(leafIndex);
}
@Override
@@ -223,7 +225,7 @@
@Override
public CharSequence getRawText() {
final StringBuilder builder = new StringBuilder();
- for (int nodeIndex = 0; nodeIndex < this.paraBranch.paraNodeSize(); nodeIndex ++) {
+ for (int nodeIndex = 0; nodeIndex < this.paraBranch.qtyTextFlowSegments(); nodeIndex ++) {
final ParaNode node = this.paraBranch.paraNodeAt(nodeIndex);
builder.append(node.getText());
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-01-07 12:46:13 UTC (rev 12353)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2022-01-07 21:15:38 UTC (rev 12354)
@@ -35,10 +35,10 @@
import org.foray.orthography.wrapper.ExactWord;
import org.foray.orthography.wrapper.UppercaseWord;
-import org.axsl.common.para.ParaBranch;
-import org.axsl.common.para.ParaBranchFactory;
import org.axsl.orthography.Orthography;
import org.axsl.orthography.OrthographyException;
+import org.axsl.orthography.TextFlow;
+import org.axsl.orthography.TextFlowFactory;
import org.axsl.orthography.Word;
import org.axsl.orthography.optional.Dictionary;
import org.axsl.orthography.optional.Lexer;
@@ -407,9 +407,9 @@
}
@Override
- public <B extends ParaBranch> B tokenizeWordSequence(final ParaBranchFactory<B> factory,
+ public <T extends TextFlow> T tokenizeWordSequence(final TextFlowFactory<T> factory,
final CharSequence characters, final int startIndex, final int length) throws OrthographyException {
- final B wordSequence = factory.makeParaBranch();
+ final T wordSequence = factory.makeTextFlow();
final CharSequence sequence = characters.subSequence(startIndex, startIndex + length);
final List<CharSequence> chunks = this.lexer.tokenize(sequence);
@@ -431,13 +431,13 @@
if (word == null) {
word = new StringWord(0, chunk);
}
- wordSequence.addNode(word);
+ wordSequence.addSegment(word);
}
}
return wordSequence;
}
- private void parseInterwordContent(final ParaBranch wordSequence, final CharSequence interword)
+ private void parseInterwordContent(final TextFlow wordSequence, final CharSequence interword)
throws OrthographyException {
int index = 0;
while (index < interword.length()) {
@@ -444,11 +444,11 @@
final char contentChar = interword.charAt(index);
final Punctuation4a punctuation = Punctuation4a.findInstance(interword.subSequence(index, index + 1));
if (punctuation != null) {
- wordSequence.addNode(punctuation);
+ wordSequence.addSegment(punctuation);
index ++;
} else if (Character.isWhitespace(contentChar)) {
final Whitespace4a whitespace = Whitespace4a.findInstance(interword.subSequence(index, index + 1));
- wordSequence.addNode(whitespace);
+ wordSequence.addSegment(whitespace);
index ++;
} else {
throw new OrthographyException("Don't know how to handle interword content: " + contentChar);
Added: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java 2022-01-07 21:15:38 UTC (rev 12354)
@@ -0,0 +1,88 @@
+/*
+ * 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.orthography;
+
+import org.axsl.orthography.TextFlow;
+import org.axsl.orthography.TextFlowComponent;
+import org.axsl.orthography.TextFlowFactory;
+import org.axsl.orthography.TextFlowSegment;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * FOray implementation of {@link TextFlow}.
+ */
+public class TextFlow4a implements TextFlow {
+
+ /** Singleton factory. */
+ private static final TextFlowFactory<TextFlow4a> FACTORY = new TextFlowFactory<TextFlow4a>() {
+ @Override
+ public TextFlow4a makeTextFlow() {
+ return new TextFlow4a();
+ }
+ };
+
+ /** The segments (children) of this text flow. */
+ private List<TextFlowSegment> segments = new ArrayList<TextFlowSegment>();
+
+ @Override
+ public int qtyTextFlowSegments() {
+ return this.segments.size();
+ }
+
+ @Override
+ public TextFlowSegment textFlowSegmentAt(final int index) {
+ return this.segments.get(index);
+ }
+
+ @Override
+ public void addSegment(final TextFlowSegment segment) {
+ this.segments.add(segment);
+ }
+
+ @Override
+ public int qtyTextFlowComponents() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public TextFlowComponent textFlowComponentAt(final int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the singleton factory that creates instances of this class.
+ * @return The singleton factory that creates instances of this class.
+ */
+ public static TextFlowFactory<TextFlow4a> getFactory() {
+ return FACTORY;
+ }
+
+}
Property changes on: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/TextFlow4a.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2022-01-07 12:46:13 UTC (rev 12353)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2022-01-07 21:15:38 UTC (rev 12354)
@@ -29,7 +29,6 @@
package org.foray.orthography;
import org.foray.common.i18n.WritingSystem4a;
-import org.foray.common.para.ParaBranch4a;
import org.axsl.common.para.ParaConfig;
import org.axsl.orthography.OrthographyException;
@@ -82,29 +81,29 @@
public void parseWordSequenceTest() throws OrthographyException {
/* Spoken by Henry, Henry V, Act III Scene 1. */
final String testString = "Once more unto the breach, dear friends, once more;";
- final ParaBranch4a wordSequence =
- this.consumer.tokenizeWordSequence(ParaBranch4a.getFactory(), testString, 0, testString.length());
- Assert.assertEquals(20, wordSequence.paraNodeSize());
- Assert.assertEquals("Once", wordSequence.paraNodeAt(0).toString());
- Assert.assertEquals(" ", wordSequence.paraNodeAt(1).toString());
- Assert.assertEquals("more", wordSequence.paraNodeAt(2).toString());
- Assert.assertEquals(" ", wordSequence.paraNodeAt(3).toString());
- Assert.assertEquals("un-to", wordSequence.paraNodeAt(4).toString());
- Assert.assertEquals(" ", wordSequence.paraNodeAt(5).toString());
- Assert.assertEquals("the", wordSequence.paraNodeAt(6).toString());
- Assert.assertEquals(" ", wordSequence.paraNodeAt(7).toString());
- Assert.assertEquals("breach", wordSequence.paraNodeAt(8).toString());
- Assert.assertEquals(",", wordSequence.paraNodeAt(9).toString());
- Assert.assertEquals(" ", wordSequence.paraNodeAt(10).toString());
- Assert.assertEquals("dear", wordSequence.paraNodeAt(11).toString());
- Assert.assertEquals(" ", wordSequence.paraNodeAt(12).toString());
- Assert.assertEquals("friends", wordSequence.paraNodeAt(13).toString());
- Assert.assertEquals(",", wordSequence.paraNodeAt(14).toString());
- Assert.assertEquals(" ", wordSequence.paraNodeAt(15).toString());
- Assert.assertEquals("once", wordSequence.paraNodeAt(16).toString());
- Assert.assertEquals(" ", wordSequence.paraNodeAt(17).toString());
- Assert.assertEquals("more", wordSequence.paraNodeAt(18).toString());
- Assert.assertEquals(";", wordSequence.paraNodeAt(19).toString());
+ final TextFlow4a wordSequence =
+ this.consumer.tokenizeWordSequence(TextFlow4a.getFactory(), testString, 0, testString.length());
+ Assert.assertEquals(20, wordSequence.qtyTextFlowSegments());
+ Assert.assertEquals("Once", wordSequence.textFlowSegmentAt(0).toString());
+ Assert.assertEquals(" ", wordSequence.textFlowSegmentAt(1).toString());
+ Assert.assertEquals("more", wordSequence.textFlowSegmentAt(2).toString());
+ Assert.assertEquals(" ", wordSequence.textFlowSegmentAt(3).toString());
+ Assert.assertEquals("un-to", wordSequence.textFlowSegmentAt(4).toString());
+ Assert.assertEquals(" ", wordSequence.textFlowSegmentAt(5).toString());
+ Assert.assertEquals("the", wordSequence.textFlowSegmentAt(6).toString());
+ Assert.assertEquals(" ", wordSequence.textFlowSegmentAt(7).toString());
+ Assert.assertEquals("breach", wordSequence.textFlowSegmentAt(8).toString());
+ Assert.assertEquals(",", wordSequence.textFlowSegmentAt(9).toString());
+ Assert.assertEquals(" ", wordSequence.textFlowSegmentAt(10).toString());
+ Assert.assertEquals("dear", wordSequence.textFlowSegmentAt(11).toString());
+ Assert.assertEquals(" ", wordSequence.textFlowSegmentAt(12).toString());
+ Assert.assertEquals("friends", wordSequence.textFlowSegmentAt(13).toString());
+ Assert.assertEquals(",", wordSequence.textFlowSegmentAt(14).toString());
+ Assert.assertEquals(" ", wordSequence.textFlowSegmentAt(15).toString());
+ Assert.assertEquals("once", wordSequence.textFlowSegmentAt(16).toString());
+ Assert.assertEquals(" ", wordSequence.textFlowSegmentAt(17).toString());
+ Assert.assertEquals("more", wordSequence.textFlowSegmentAt(18).toString());
+ Assert.assertEquals(";", wordSequence.textFlowSegmentAt(19).toString());
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-07 12:46:15
|
Revision: 12353
http://sourceforge.net/p/foray/code/12353
Author: victormote
Date: 2022-01-07 12:46:13 +0000 (Fri, 07 Jan 2022)
Log Message:
-----------
Improvements to areatree/pioneer.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa4a.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa4a.java 2022-01-07 11:40:15 UTC (rev 12352)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa4a.java 2022-01-07 12:46:13 UTC (rev 12353)
@@ -204,9 +204,19 @@
@Override
public SpanRa4a getOverflowArea(final Area4a childRequesting) throws AreaTreeException {
+ if (! (childRequesting instanceof NormalFlowRa4a)) {
+ throw new IllegalArgumentException();
+ }
+ final NormalFlowRa4a nfra = (NormalFlowRa4a) childRequesting;
+
/* Spans stack in the block-progression-direction, and the last span on the page extends to the end (after-edge)
* of the parent main-reference-area. Therefore, if the child has overflowed, we need a new page. */
final MainRa4a newMainRa = getParent().getOverflowArea(this);
+
+ /* Since this is overflow, the new span area should have the same number of columns as the one from the
+ * previous page. */
+ final int qtyColumns = nfra.getParent().areaNodeCount();
+ newMainRa.addSpanArea(qtyColumns);
return newMainRa.areaNodeAt(0);
}
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java 2022-01-07 11:40:15 UTC (rev 12352)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoTextWordsPnr.java 2022-01-07 12:46:13 UTC (rev 12353)
@@ -62,16 +62,14 @@
setProgress(0);
}
- if (! (areaNode instanceof ParaContext)) {
- throw new IllegalArgumentException("AreaNode must be an instance of ParaControl");
+ final NormalBlockArea normalBlockArea = areaNode instanceof NormalBlockArea ? (NormalBlockArea) areaNode :
+ areaNode.ancestorNormalBlockArea();
+ if (normalBlockArea == null) {
+ throw new IllegalArgumentException(AreaNode.class.getName() + " must be or have an ancestor " +
+ NormalBlockArea.class.getName());
}
- final ParaContext paraContext = (ParaContext) areaNode;
+ final ParaContext paraContext = normalBlockArea.getParaContext();
- if (! (areaNode instanceof NormalBlockArea)) {
- throw new IllegalArgumentException("AreaNode must be an instance of NormalBlockArea");
- }
- final NormalBlockArea normalBlockArea = (NormalBlockArea) areaNode;
-
final LineBreaker lb = areaNode.getAreaTree().getLineBreaker();
final LineBreakResult result = lb.breakIntoLines(this.node, (ParaConfig) this.node, paraContext);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|