Revision: 12405
http://sourceforge.net/p/foray/code/12405
Author: victormote
Date: 2022-01-15 17:44:53 +0000 (Sat, 15 Jan 2022)
Log Message:
-----------
Conform to aXSL change: Move interface no longer needed in API from aXSL to implementation code.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/data/OrderedTreePath4a.java
Added Paths:
-----------
trunk/foray/foray-common/src/main/java/org/foray/common/data/OrderedTreePath.java
Added: trunk/foray/foray-common/src/main/java/org/foray/common/data/OrderedTreePath.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/OrderedTreePath.java (rev 0)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/OrderedTreePath.java 2022-01-15 17:44:53 UTC (rev 12405)
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2019 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.common.data;
+
+/**
+ * <p>Describes a path to a node in a tree of ordered content.</p>
+ * <ul>
+ * <li>Suppose a tree of indexed content whose root is A.</li>
+ * <li>A has two children, B and C.</li>
+ * <li>B has three children, D, E, and F.</li>
+ * <li>C has two children, G and H.</li>
+ * <li>H has two children, I and J.</li>
+ * </ul>
+ *
+ * <p>Since the content in the tree is ordered, each of these nodes can be found by providing a series of indexes into
+ * the content.
+ * Traverse to the desired node as follows:
+ * <ol>
+ * <li>Set the current node to the root</li>
+ * <li>If there are no more indexes, the search is over, the current node is the one described by the path.
+ * <li>If there are more indexes, select the next one, and use it to select a child of the current node.</li>
+ * <li>Set the current node to the child selected above.
+ * <li>Repeat steps 2 through 4 as needed.</li>
+ * </ol>
+ *
+ * <p>The following index sequences can be used to describe the path to each of the elements described above:</p>
+ * <ul>
+ * <li>B: 0</li>
+ * <li>C: 1</li>
+ * <li>D: 0, 0</li>
+ * <li>E: 0, 1</li>
+ * <li>F: 0, 2</li>
+ * <li>G: 1, 0</li>
+ * <li>H: 1, 1</li>
+ * <li>I: 1, 1, 0</li>
+ * <li>J: 1, 1, 1</li>
+ * </ul>
+ * <p>The depth of the node is equal to the number of path segments required to describe it.
+ * In the example above, the depth of B is 1, and the depth of J is 3.</p>
+ */
+public interface OrderedTreePath {
+
+ /**
+ * Returns the depth of the path, that is, the number of elements in the path.
+ * @return The depth of the path.
+ * See the class documentation for a description of the node depth.
+ */
+ int depth();
+
+ /**
+ * Returns the index to the path element at a given depth.
+ * @param index The index to the depth of the path that should be returned.
+ * This is a zero-based index.
+ * If a path has a depth of three, index 0 should be queried first, then 1, then 2.
+ * @return The zero-based index to the path element for the depth described by {@code index}.
+ * If {@code index} is greater than or equal to {@link #depth()}, -1 is returned.
+ */
+ int getPathElement(int index);
+
+}
Property changes on: trunk/foray/foray-common/src/main/java/org/foray/common/data/OrderedTreePath.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/OrderedTreePath4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/OrderedTreePath4a.java 2022-01-15 14:39:44 UTC (rev 12404)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/OrderedTreePath4a.java 2022-01-15 17:44:53 UTC (rev 12405)
@@ -30,8 +30,6 @@
import org.foray.common.sequence.IntArray;
-import org.axsl.common.data.OrderedTreePath;
-
/**
* Implementation of {@link OrderedTreePath}.
* Instances of this class are immutable.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|