ss: Move selectNextChildren to CoreNode and return sequenceNumber
[deliverable/tracecompass.git] / statesystem / org.eclipse.tracecompass.statesystem.core / src / org / eclipse / tracecompass / internal / statesystem / core / backend / historytree / IHistoryTree.java
index f1d09a8e5e6aff4674eec70950e64cf39291233f..299db35370f27dad678d3104d97b80ebea43c898 100644 (file)
@@ -11,9 +11,8 @@ package org.eclipse.tracecompass.internal.statesystem.core.backend.historytree;
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.IOException;
 import java.nio.channels.ClosedChannelException;
-import java.util.Collection;
-
 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
 
 /**
@@ -21,9 +20,54 @@ import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
  * high-level data relevant to the tree.
  *
  * @author Alexandre Montplaisir
+ * @author Geneviève Bastien
  */
 public interface IHistoryTree {
 
+    /**
+     * Interface for history to create the various HTNodes
+     */
+    interface IHTNodeFactory {
+
+        /**
+         * Creates a new core node for the specific history tree
+         *
+         * @param config
+         *            Configuration of the History Tree
+         * @param seqNumber
+         *            The (unique) sequence number assigned to this particular
+         *            node
+         * @param parentSeqNumber
+         *            The sequence number of this node's parent node
+         * @param start
+         *            The earliest timestamp stored in this node
+         * @return The new core node
+         * @throws IOException
+         *             any exception occurring while trying to read/create the
+         *             node
+         */
+        HTNode createCoreNode(HTConfig config, int seqNumber, int parentSeqNumber, long start) throws IOException;
+
+        /**
+         * Creates a new core node for the specific history tree
+         *
+         * @param config
+         *            Configuration of the History Tree
+         * @param seqNumber
+         *            The (unique) sequence number assigned to this particular
+         *            node
+         * @param parentSeqNumber
+         *            The sequence number of this node's parent node
+         * @param start
+         *            The earliest timestamp stored in this node
+         * @return The new core node
+         * @throws IOException
+         *             any exception occurring while trying to read/create the
+         *             node
+         */
+        HTNode createLeafNode(HTConfig config, int seqNumber, int parentSeqNumber, long start) throws IOException;
+    }
+
     /**
      * Size of the "tree header" in the tree-file The nodes will use this offset
      * to know where they should be in the file. This should always be a
@@ -145,21 +189,6 @@ public interface IHistoryTree {
      */
     void insertInterval(HTInterval interval) throws TimeRangeException;
 
-    /**
-     * Inner method to select the next children of the current node intersecting
-     * the given timestamp. Useful for moving down the tree following one
-     * branch.
-     *
-     * @param currentNode
-     *            The node on which the request is made
-     * @param t
-     *            The timestamp to choose which child is the next one
-     * @return The child nodes intersecting t
-     * @throws ClosedChannelException
-     *             If the file channel was closed while we were reading the tree
-     */
-    Collection<HTNode> selectNextChildren(CoreNode currentNode, long t) throws ClosedChannelException;
-
     /**
      * Get the current size of the history file.
      *
This page took 0.026842 seconds and 5 git commands to generate.