diff options
-rw-r--r-- | lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTree.java | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTree.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTree.java index fa2378b8a8..12f14ced82 100644 --- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTree.java +++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTree.java @@ -206,6 +206,7 @@ class HistoryTree { * file. * * @param requestedEndTime + * The greatest timestamp present in the history tree */ void closeTree(long requestedEndTime) { FileChannel fc; @@ -327,6 +328,7 @@ class HistoryTree { * Insert an interval in the tree * * @param interval + * The interval to be inserted */ void insertInterval(HTInterval interval) throws TimeRangeException { if (interval.getStartTime() < config.getTreeStart()) { @@ -376,7 +378,6 @@ class HistoryTree { if (interval.getEndTime() > this.treeEnd) { this.treeEnd = interval.getEndTime(); } - return; } /** @@ -418,7 +419,6 @@ class HistoryTree { latestBranch.set(i, newNode); } - return; } /** @@ -485,7 +485,9 @@ class HistoryTree { * 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 node intersecting t * @throws ClosedChannelException * If the file channel was closed while we were reading the tree @@ -501,6 +503,7 @@ class HistoryTree { break; } } + /* * Once we exit this loop, we should have found a children to follow. If * we didn't, there's a problem. @@ -621,41 +624,35 @@ class HistoryTree { + latestBranch.get(latestBranch.size() - 1).getSequenceNumber(); } - private int curDepth; - /** * Start at currentNode and print the contents of all its children, in * pre-order. Give the root node in parameter to visit the whole tree, and * have a nice overview. */ + /* Only used for debugging, shouldn't be externalized */ @SuppressWarnings("nls") private void preOrderPrint(PrintWriter writer, boolean printIntervals, - CoreNode currentNode) { - /* Only used for debugging, shouldn't be externalized */ - int i, j; - HTNode nextNode; + CoreNode currentNode, int curDepth) { writer.println(currentNode.toString()); if (printIntervals) { currentNode.debugPrintIntervals(writer); } - curDepth++; try { - for (i = 0; i < currentNode.getNbChildren(); i++) { - nextNode = treeIO.readNode(currentNode.getChild(i)); + for (int i = 0; i < currentNode.getNbChildren(); i++) { + HTNode nextNode = treeIO.readNode(currentNode.getChild(i)); assert (nextNode instanceof CoreNode); // TODO temporary - for (j = 0; j < curDepth - 1; j++) { + for (int j = 0; j < curDepth; j++) { writer.print(" "); } writer.print("+-"); - preOrderPrint(writer, printIntervals, (CoreNode) nextNode); + preOrderPrint(writer, printIntervals, (CoreNode) nextNode, + curDepth + 1); } } catch (ClosedChannelException e) { e.printStackTrace(); } - curDepth--; - return; } /** @@ -664,17 +661,16 @@ class HistoryTree { * @param writer * PrintWriter in which to write the output * @param printIntervals - * Says if you want to output the full interval information + * Flag to enable full output of the interval information */ void debugPrintFullTree(PrintWriter writer, boolean printIntervals) { /* Only used for debugging, shouldn't be externalized */ - curDepth = 0; - this.preOrderPrint(writer, false, latestBranch.get(0)); + + this.preOrderPrint(writer, false, latestBranch.get(0), 0); if (printIntervals) { writer.println("\nDetails of intervals:"); //$NON-NLS-1$ - curDepth = 0; - this.preOrderPrint(writer, true, latestBranch.get(0)); + this.preOrderPrint(writer, true, latestBranch.get(0), 0); } writer.println('\n'); } |