summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas L. Delmelle <adelmelle@apache.org>2016-01-02 20:53:51 +0000
committerAndreas L. Delmelle <adelmelle@apache.org>2016-01-02 20:53:51 +0000
commited7cd271819f2b1e2e9ee7c601e552abd8acedd3 (patch)
tree28c2bc908836b55f72ec793052ebbabb152248ed /src
parent3cd9a370a5d03293f5e1ba03c73b18b3d14b87cb (diff)
downloadxmlgraphics-fop-ed7cd271819f2b1e2e9ee7c601e552abd8acedd3.tar.gz
xmlgraphics-fop-ed7cd271819f2b1e2e9ee7c601e552abd8acedd3.zip
Slight improvement on previous commit: replace occurrence of ListIterator with FONodeIterator to avoid explicit cast + add base ListIterator methods to the FONodeIterator signature (to improve searching for usage in IDE)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1722664 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/fo/FONode.java37
-rw-r--r--src/java/org/apache/fop/fo/FObj.java4
2 files changed, 39 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java
index 7475cdccd..f5eb8854e 100644
--- a/src/java/org/apache/fop/fo/FONode.java
+++ b/src/java/org/apache/fop/fo/FONode.java
@@ -1017,6 +1017,43 @@ public abstract class FONode implements Cloneable {
*/
public interface FONodeIterator extends ListIterator<FONode> {
+ /** @return the next node */
+ FONode next();
+
+ /** @return the previous node */
+ FONode previous();
+
+ /**
+ * Replace the node at the current index with the given <code>newNode</code>.
+ *
+ * @param newNode the new node
+ */
+ void set(FONode newNode);
+
+ /**
+ * Add the given <code>newNode</code> at the current position.
+ *
+ * @param newNode the new node
+ */
+ void add(FONode newNode);
+
+ /** @return <code>true</code> if there is a next node, <code>false</code> otherwise */
+ boolean hasNext();
+
+ /** @return <code>true</code> if there is a previous node, <code>false</code> otherwise */
+ boolean hasPrevious();
+
+ /** @return the current index */
+ int nextIndex();
+
+ /** @return the previous index */
+ int previousIndex();
+
+ /**
+ * Removes the node at the current position.
+ */
+ void remove();
+
/**
* Returns the parent node for this iterator's list
* of child nodes
diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java
index 43add7b00..bf4bf45f6 100644
--- a/src/java/org/apache/fop/fo/FObj.java
+++ b/src/java/org/apache/fop/fo/FObj.java
@@ -444,13 +444,13 @@ public abstract class FObj extends FONode implements Constants {
if (getLocator() != null) {
return super.gatherContextInfo();
} else {
- ListIterator iter = getChildNodes();
+ FONodeIterator iter = getChildNodes();
if (iter == null) {
return null;
}
StringBuilder sb = new StringBuilder();
while (iter.hasNext()) {
- FONode node = (FONode) iter.next();
+ FONode node = iter.next();
String s = node.gatherContextInfo();
if (s != null) {
if (sb.length() > 0) {