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;
/**
* 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
*/
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.
*