[FOray-commit] SF.net SVN: foray:[12371] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
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.
|