From: Andreas L. Delmelle Date: Sat, 2 Jan 2016 20:53:51 +0000 (+0000) Subject: Slight improvement on previous commit: replace occurrence of ListIterator with FONode... X-Git-Tag: fop-2_1~12 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ed7cd271819f2b1e2e9ee7c601e552abd8acedd3;p=xmlgraphics-fop.git 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 --- 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 { + /** @return the next node */ + FONode next(); + + /** @return the previous node */ + FONode previous(); + + /** + * Replace the node at the current index with the given newNode. + * + * @param newNode the new node + */ + void set(FONode newNode); + + /** + * Add the given newNode at the current position. + * + * @param newNode the new node + */ + void add(FONode newNode); + + /** @return true if there is a next node, false otherwise */ + boolean hasNext(); + + /** @return true if there is a previous node, false 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) {