[FOray-commit] SF.net SVN: foray: [9711] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-06-07 14:36:53
|
Revision: 9711
http://svn.sourceforge.net/foray/?rev=9711&view=rev
Author: victormote
Date: 2007-06-07 07:36:37 -0700 (Thu, 07 Jun 2007)
Log Message:
-----------
Add getOrderedParent method to the OrderedTreeNode interface to avoid casting conflicts with getParent.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java
trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java
trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2007-06-07 01:02:45 UTC (rev 9710)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2007-06-07 14:36:37 UTC (rev 9711)
@@ -29,6 +29,7 @@
package org.foray.area;
import org.foray.common.AbstractOrderedTreeNode;
+import org.foray.common.OrderedTreeNode;
import org.axsl.areaW.AreaWException;
import org.axsl.foR.FoNode;
@@ -71,6 +72,13 @@
public abstract AreaNode getParent();
/**
+ * {@inheritDoc}
+ */
+ public OrderedTreeNode getOrderedParent() {
+ return this.getParent();
+ }
+
+ /**
* Sets the parent node.
* @param node The new parent node.
* @throws AreaWException If the parent node is not compatible with the
Modified: trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java 2007-06-07 01:02:45 UTC (rev 9710)
+++ trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java 2007-06-07 14:36:37 UTC (rev 9711)
@@ -98,11 +98,6 @@
/**
* {@inheritDoc}
*/
- public abstract OrderedTreeNode getParent();
-
- /**
- * {@inheritDoc}
- */
public boolean isLeaf() {
if (getChildCount() < 1) {
return true;
@@ -207,7 +202,7 @@
return currentNode;
}
// Go up a level and see if the parent has any siblings
- currentNode = this.getParent();
+ currentNode = this.getOrderedParent();
}
// Current node is null; we are at the root of the tree.
return null;
@@ -228,7 +223,7 @@
/* If there are no siblings, then the parent's children are all
* processed, and the parent is the next node. If that happens to be
* null, then we are done, and null is what should be returned. */
- return this.getParent();
+ return this.getOrderedParent();
}
/**
@@ -260,7 +255,7 @@
* This implementation was liberated from {@link DefaultMutableTreeNode}).
*/
public OrderedTreeNode getNextLeaf() {
- final OrderedTreeNode myParent = getParent();
+ final OrderedTreeNode myParent = getOrderedParent();
if (myParent == null) {
return null;
}
@@ -278,7 +273,7 @@
* This implementation was liberated from {@link DefaultMutableTreeNode}).
*/
public OrderedTreeNode getPreviousLeaf() {
- final OrderedTreeNode myParent = getParent();
+ final OrderedTreeNode myParent = getOrderedParent();
if (myParent == null) {
return null;
}
@@ -303,7 +298,7 @@
if (ancestor == anotherNode) {
return true;
}
- } while((ancestor = ancestor.getParent()) != null);
+ } while((ancestor = ancestor.getOrderedParent()) != null);
return false;
}
@@ -369,7 +364,7 @@
// Go up the tree until the nodes are at the same level
while (diff > 0) {
- node1 = node1.getParent();
+ node1 = node1.getOrderedParent();
diff--;
}
@@ -382,8 +377,8 @@
if (node1 == node2) {
return node1;
}
- node1 = node1.getParent();
- node2 = node2.getParent();
+ node1 = node1.getOrderedParent();
+ node2 = node2.getOrderedParent();
} while (node1 != null);
/* Only need to check one -- they're at the same level so if one is
* null, so is the other one. */
@@ -401,7 +396,7 @@
public int getLevel() {
int levels = 0;
OrderedTreeNode ancestor = this;
- while ((ancestor = ancestor.getParent()) != null) {
+ while ((ancestor = ancestor.getOrderedParent()) != null) {
levels++;
}
return levels;
Modified: trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2007-06-07 01:02:45 UTC (rev 9710)
+++ trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2007-06-07 14:36:37 UTC (rev 9711)
@@ -39,9 +39,10 @@
public interface OrderedTreeNode extends TreeNode {
/**
- * {@inheritDoc}
+ * Returns the parent of this node, cast as an OrderedTreeNode.
+ * @return The parent of this node.
*/
- OrderedTreeNode getParent();
+ OrderedTreeNode getOrderedParent();
/**
* Returns this node's position within the siblings.
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2007-06-07 01:02:45 UTC (rev 9710)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2007-06-07 14:36:37 UTC (rev 9711)
@@ -29,6 +29,7 @@
package org.foray.fotree;
import org.foray.common.AbstractOrderedTreeNode;
+import org.foray.common.OrderedTreeNode;
import org.foray.fotree.fo.obj.Marker;
import org.foray.fotree.fo.obj.Root;
@@ -92,6 +93,13 @@
/**
* {@inheritDoc}
*/
+ public OrderedTreeNode getOrderedParent() {
+ return this.getParent();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public abstract List<? extends FONode> getChildren();
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|