1 /*******************************************************************************
2 * Copyright (c) 2010, 2015 Ericsson, École Polytechnique de Montréal, and others
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Alexandre Montplaisir - Initial API and implementation
11 * Florian Wininger - Add Extension and Leaf Node
12 * Patrick Tasse - Add message to exceptions
13 *******************************************************************************/
15 package org
.eclipse
.tracecompass
.internal
.statesystem
.core
.backend
.historytree
;
18 import java
.io
.FileInputStream
;
19 import java
.io
.IOException
;
20 import java
.io
.PrintWriter
;
21 import java
.nio
.ByteBuffer
;
22 import java
.nio
.ByteOrder
;
23 import java
.nio
.channels
.ClosedChannelException
;
24 import java
.nio
.channels
.FileChannel
;
25 import java
.util
.ArrayList
;
26 import java
.util
.Collections
;
27 import java
.util
.List
;
29 import org
.eclipse
.tracecompass
.internal
.statesystem
.core
.Activator
;
30 import org
.eclipse
.tracecompass
.statesystem
.core
.ITmfStateSystemBuilder
;
31 import org
.eclipse
.tracecompass
.statesystem
.core
.exceptions
.TimeRangeException
;
33 import com
.google
.common
.collect
.ImmutableList
;
36 * Meta-container for the History Tree. This structure contains all the
37 * high-level data relevant to the tree.
39 * @author Alexandre Montplaisir
41 public class HistoryTree
{
44 * Size of the "tree header" in the tree-file The nodes will use this offset
45 * to know where they should be in the file. This should always be a
48 public static final int TREE_HEADER_SIZE
= 4096;
50 private static final int HISTORY_FILE_MAGIC_NUMBER
= 0x05FFA900;
52 /** File format version. Increment when breaking compatibility. */
53 private static final int FILE_VERSION
= 5;
55 // ------------------------------------------------------------------------
56 // Tree-specific configuration
57 // ------------------------------------------------------------------------
59 /** Container for all the configuration constants */
60 private final HTConfig fConfig
;
62 /** Reader/writer object */
63 private final HT_IO fTreeIO
;
65 // ------------------------------------------------------------------------
66 // Variable Fields (will change throughout the existence of the SHT)
67 // ------------------------------------------------------------------------
69 /** Latest timestamp found in the tree (at any given moment) */
70 private long fTreeEnd
;
72 /** The total number of nodes that exists in this tree */
73 private int fNodeCount
;
75 /** "Cache" to keep the active nodes in memory */
76 private final List
<HTNode
> fLatestBranch
;
78 // ------------------------------------------------------------------------
79 // Constructors/"Destructors"
80 // ------------------------------------------------------------------------
83 * Create a new State History from scratch, using a {@link HTConfig} object
87 * The config to use for this History Tree.
89 * If an error happens trying to open/write to the file
90 * specified in the config
92 public HistoryTree(HTConfig conf
) throws IOException
{
94 * Simple check to make sure we have enough place in the 0th block for
95 * the tree configuration
97 if (conf
.getBlockSize() < TREE_HEADER_SIZE
) {
98 throw new IllegalArgumentException();
102 fTreeEnd
= conf
.getTreeStart();
104 fLatestBranch
= Collections
.synchronizedList(new ArrayList
<HTNode
>());
106 /* Prepare the IO object */
107 fTreeIO
= new HT_IO(fConfig
, true);
109 /* Add the first node to the tree */
110 LeafNode firstNode
= initNewLeafNode(-1, conf
.getTreeStart());
111 fLatestBranch
.add(firstNode
);
115 * "Reader" constructor : instantiate a SHTree from an existing tree file on
118 * @param existingStateFile
119 * Path/filename of the history-file we are to open
120 * @param expProviderVersion
121 * The expected version of the state provider
122 * @throws IOException
123 * If an error happens reading the file
125 public HistoryTree(File existingStateFile
, int expProviderVersion
) throws IOException
{
127 * Open the file ourselves, get the tree header information we need,
128 * then pass on the descriptor to the TreeIO object.
130 int rootNodeSeqNb
, res
;
134 /* Java I/O mumbo jumbo... */
135 if (!existingStateFile
.exists()) {
136 throw new IOException("Selected state file does not exist"); //$NON-NLS-1$
138 if (existingStateFile
.length() <= 0) {
139 throw new IOException("Empty target file"); //$NON-NLS-1$
142 try (FileInputStream fis
= new FileInputStream(existingStateFile
);
143 FileChannel fc
= fis
.getChannel();) {
145 ByteBuffer buffer
= ByteBuffer
.allocate(TREE_HEADER_SIZE
);
147 buffer
.order(ByteOrder
.LITTLE_ENDIAN
);
153 * Check the magic number to make sure we're opening the right type
156 res
= buffer
.getInt();
157 if (res
!= HISTORY_FILE_MAGIC_NUMBER
) {
158 throw new IOException("Wrong magic number"); //$NON-NLS-1$
161 res
= buffer
.getInt(); /* File format version number */
162 if (res
!= FILE_VERSION
) {
163 throw new IOException("Mismatching History Tree file format versions"); //$NON-NLS-1$
166 res
= buffer
.getInt(); /* Event handler's version number */
167 if (res
!= expProviderVersion
&&
168 expProviderVersion
!= ITmfStateSystemBuilder
.IGNORE_PROVIDER_VERSION
) {
170 * The existing history was built using an event handler that
171 * doesn't match the current one in the framework.
173 * Information could be all wrong. Instead of keeping an
174 * incorrect history file, a rebuild is done.
176 throw new IOException("Mismatching event handler versions"); //$NON-NLS-1$
179 bs
= buffer
.getInt(); /* Block Size */
180 maxc
= buffer
.getInt(); /* Max nb of children per node */
182 fNodeCount
= buffer
.getInt();
183 rootNodeSeqNb
= buffer
.getInt();
184 startTime
= buffer
.getLong();
186 fConfig
= new HTConfig(existingStateFile
, bs
, maxc
, expProviderVersion
, startTime
);
190 * FIXME We close fis here and the TreeIO will then reopen the same
191 * file, not extremely elegant. But how to pass the information here to
194 fTreeIO
= new HT_IO(fConfig
, false);
196 fLatestBranch
= buildLatestBranch(rootNodeSeqNb
);
197 fTreeEnd
= getRootNode().getNodeEnd();
200 * Make sure the history start time we read previously is consistent
201 * with was is actually in the root node.
203 if (startTime
!= getRootNode().getNodeStart()) {
204 throw new IOException("Inconsistent start times in the" + //$NON-NLS-1$
205 "history file, it might be corrupted."); //$NON-NLS-1$
210 * Rebuild the latestBranch "cache" object by reading the nodes from disk
211 * (When we are opening an existing file on disk and want to append to it,
214 * @param rootNodeSeqNb
215 * The sequence number of the root node, so we know where to
217 * @throws ClosedChannelException
219 private List
<HTNode
> buildLatestBranch(int rootNodeSeqNb
) throws ClosedChannelException
{
220 List
<HTNode
> list
= new ArrayList
<>();
222 HTNode nextChildNode
= fTreeIO
.readNode(rootNodeSeqNb
);
223 list
.add(nextChildNode
);
225 /* Follow the last branch up to the leaf */
226 while (nextChildNode
.getNodeType() == HTNode
.NodeType
.CORE
) {
227 nextChildNode
= fTreeIO
.readNode(((CoreNode
) nextChildNode
).getLatestChild());
228 list
.add(nextChildNode
);
230 return Collections
.synchronizedList(list
);
234 * "Save" the tree to disk. This method will cause the treeIO object to
235 * commit all nodes to disk and then return the RandomAccessFile descriptor
236 * so the Tree object can save its configuration into the header of the
239 * @param requestedEndTime
240 * The greatest timestamp present in the history tree
242 public void closeTree(long requestedEndTime
) {
243 /* This is an important operation, queries can wait */
244 synchronized (fLatestBranch
) {
246 * Work-around the "empty branches" that get created when the root
247 * node becomes full. Overwrite the tree's end time with the
248 * original wanted end-time, to ensure no queries are sent into
251 * This won't be needed once extended nodes are implemented.
253 fTreeEnd
= requestedEndTime
;
255 /* Close off the latest branch of the tree */
256 for (int i
= 0; i
< fLatestBranch
.size(); i
++) {
257 fLatestBranch
.get(i
).closeThisNode(fTreeEnd
);
258 fTreeIO
.writeNode(fLatestBranch
.get(i
));
261 try (FileChannel fc
= fTreeIO
.getFcOut();) {
262 ByteBuffer buffer
= ByteBuffer
.allocate(TREE_HEADER_SIZE
);
263 buffer
.order(ByteOrder
.LITTLE_ENDIAN
);
266 /* Save the config of the tree to the header of the file */
269 buffer
.putInt(HISTORY_FILE_MAGIC_NUMBER
);
271 buffer
.putInt(FILE_VERSION
);
272 buffer
.putInt(fConfig
.getProviderVersion());
274 buffer
.putInt(fConfig
.getBlockSize());
275 buffer
.putInt(fConfig
.getMaxChildren());
277 buffer
.putInt(fNodeCount
);
279 /* root node seq. nb */
280 buffer
.putInt(fLatestBranch
.get(0).getSequenceNumber());
282 /* start time of this history */
283 buffer
.putLong(fLatestBranch
.get(0).getNodeStart());
286 int res
= fc
.write(buffer
);
287 assert (res
<= TREE_HEADER_SIZE
);
288 /* done writing the file header */
290 } catch (IOException e
) {
292 * If we were able to write so far, there should not be any
293 * problem at this point...
295 throw new RuntimeException("State system write error"); //$NON-NLS-1$
300 // ------------------------------------------------------------------------
302 // ------------------------------------------------------------------------
305 * Get the start time of this tree.
307 * @return The start time
309 public long getTreeStart() {
310 return fConfig
.getTreeStart();
314 * Get the current end time of this tree.
316 * @return The end time
318 public long getTreeEnd() {
323 * Get the number of nodes in this tree.
325 * @return The number of nodes
327 public int getNodeCount() {
332 * Get the current root node of this tree
334 * @return The root node
336 public HTNode
getRootNode() {
337 return fLatestBranch
.get(0);
341 * Return the latest branch of the tree. That branch is immutable. Used for
342 * unit testing and debugging.
344 * @return The immutable latest branch
346 protected List
<HTNode
> getLatestBranch() {
347 return ImmutableList
.copyOf(fLatestBranch
);
350 // ------------------------------------------------------------------------
352 // ------------------------------------------------------------------------
355 * Return the FileInputStream reader with which we will read an attribute
356 * tree (it will be sought to the correct position).
358 * @return The FileInputStream indicating the file and position from which
359 * the attribute tree can be read.
361 public FileInputStream
supplyATReader() {
362 return fTreeIO
.supplyATReader(getNodeCount());
366 * Return the file to which we will write the attribute tree.
368 * @return The file to which we will write the attribute tree
370 public File
supplyATWriterFile() {
371 return fConfig
.getStateFile();
375 * Return the position in the file (given by {@link #supplyATWriterFile})
376 * where to start writing the attribute tree.
378 * @return The position in the file where to start writing
380 public long supplyATWriterFilePos() {
381 return HistoryTree
.TREE_HEADER_SIZE
382 + ((long) getNodeCount() * fConfig
.getBlockSize());
386 * Read a node from the tree.
389 * The sequence number of the node to read
391 * @throws ClosedChannelException
392 * If the tree IO is unavailable
394 public HTNode
readNode(int seqNumber
) throws ClosedChannelException
{
395 /* Try to read the node from memory */
396 synchronized (fLatestBranch
) {
397 for (HTNode node
: fLatestBranch
) {
398 if (node
.getSequenceNumber() == seqNumber
) {
404 /* Read the node from disk */
405 return fTreeIO
.readNode(seqNumber
);
409 * Write a node object to the history file.
412 * The node to write to disk
414 public void writeNode(HTNode node
) {
415 fTreeIO
.writeNode(node
);
419 * Close the history file.
421 public void closeFile() {
426 * Delete the history file.
428 public void deleteFile() {
429 fTreeIO
.deleteFile();
432 // ------------------------------------------------------------------------
434 // ------------------------------------------------------------------------
437 * Insert an interval in the tree.
440 * The interval to be inserted
441 * @throws TimeRangeException
442 * If the start of end time of the interval are invalid
444 public void insertInterval(HTInterval interval
) throws TimeRangeException
{
445 if (interval
.getStartTime() < fConfig
.getTreeStart()) {
446 throw new TimeRangeException("Interval Start:" + interval
.getStartTime() + ", Config Start:" + fConfig
.getTreeStart()); //$NON-NLS-1$ //$NON-NLS-2$
448 tryInsertAtNode(interval
, fLatestBranch
.size() - 1);
452 * Inner method to find in which node we should add the interval.
455 * The interval to add to the tree
457 * The index *in the latestBranch* where we are trying the
460 private void tryInsertAtNode(HTInterval interval
, int indexOfNode
) {
461 HTNode targetNode
= fLatestBranch
.get(indexOfNode
);
463 /* Verify if there is enough room in this node to store this interval */
464 if (interval
.getIntervalSize() > targetNode
.getNodeFreeSpace()) {
465 /* Nope, not enough room. Insert in a new sibling instead. */
466 addSiblingNode(indexOfNode
);
467 tryInsertAtNode(interval
, fLatestBranch
.size() - 1);
471 /* Make sure the interval time range fits this node */
472 if (interval
.getStartTime() < targetNode
.getNodeStart()) {
474 * No, this interval starts before the startTime of this node. We
475 * need to check recursively in parents if it can fit.
477 assert (indexOfNode
>= 1);
478 tryInsertAtNode(interval
, indexOfNode
- 1);
483 * Ok, there is room, and the interval fits in this time slot. Let's add
486 targetNode
.addInterval(interval
);
488 /* Update treeEnd if needed */
489 if (interval
.getEndTime() > fTreeEnd
) {
490 fTreeEnd
= interval
.getEndTime();
495 * Method to add a sibling to any node in the latest branch. This will add
496 * children back down to the leaf level, if needed.
499 * The index in latestBranch where we start adding
501 private void addSiblingNode(int indexOfNode
) {
502 synchronized (fLatestBranch
) {
503 final long splitTime
= fTreeEnd
;
505 if (indexOfNode
>= fLatestBranch
.size()) {
507 * We need to make sure (indexOfNode - 1) doesn't get the last
508 * node in the branch, because that one is a Leaf Node.
510 throw new IllegalStateException();
513 /* Check if we need to add a new root node */
514 if (indexOfNode
== 0) {
519 /* Check if we can indeed add a child to the target parent */
520 if (((CoreNode
) fLatestBranch
.get(indexOfNode
- 1)).getNbChildren() == fConfig
.getMaxChildren()) {
521 /* If not, add a branch starting one level higher instead */
522 addSiblingNode(indexOfNode
- 1);
526 /* Split off the new branch from the old one */
527 for (int i
= indexOfNode
; i
< fLatestBranch
.size(); i
++) {
528 fLatestBranch
.get(i
).closeThisNode(splitTime
);
529 fTreeIO
.writeNode(fLatestBranch
.get(i
));
531 CoreNode prevNode
= (CoreNode
) fLatestBranch
.get(i
- 1);
534 switch (fLatestBranch
.get(i
).getNodeType()) {
536 newNode
= initNewCoreNode(prevNode
.getSequenceNumber(), splitTime
+ 1);
539 newNode
= initNewLeafNode(prevNode
.getSequenceNumber(), splitTime
+ 1);
542 throw new IllegalStateException();
545 prevNode
.linkNewChild(newNode
);
546 fLatestBranch
.set(i
, newNode
);
552 * Similar to the previous method, except here we rebuild a completely new
555 private void addNewRootNode() {
556 final long splitTime
= fTreeEnd
;
558 HTNode oldRootNode
= fLatestBranch
.get(0);
559 CoreNode newRootNode
= initNewCoreNode(-1, fConfig
.getTreeStart());
561 /* Tell the old root node that it isn't root anymore */
562 oldRootNode
.setParentSequenceNumber(newRootNode
.getSequenceNumber());
564 /* Close off the whole current latestBranch */
566 for (int i
= 0; i
< fLatestBranch
.size(); i
++) {
567 fLatestBranch
.get(i
).closeThisNode(splitTime
);
568 fTreeIO
.writeNode(fLatestBranch
.get(i
));
571 /* Link the new root to its first child (the previous root node) */
572 newRootNode
.linkNewChild(oldRootNode
);
574 /* Rebuild a new latestBranch */
575 int depth
= fLatestBranch
.size();
576 fLatestBranch
.clear();
577 fLatestBranch
.add(newRootNode
);
579 // Create new coreNode
580 for (int i
= 1; i
< depth
+ 1; i
++) {
581 CoreNode prevNode
= (CoreNode
) fLatestBranch
.get(i
- 1);
582 CoreNode newNode
= initNewCoreNode(prevNode
.getParentSequenceNumber(),
584 prevNode
.linkNewChild(newNode
);
585 fLatestBranch
.add(newNode
);
588 // Create the new leafNode
589 CoreNode prevNode
= (CoreNode
) fLatestBranch
.get(depth
);
590 LeafNode newNode
= initNewLeafNode(prevNode
.getParentSequenceNumber(), splitTime
+ 1);
591 prevNode
.linkNewChild(newNode
);
592 fLatestBranch
.add(newNode
);
596 * Add a new empty core node to the tree.
598 * @param parentSeqNumber
599 * Sequence number of this node's parent
601 * Start time of the new node
602 * @return The newly created node
604 private CoreNode
initNewCoreNode(int parentSeqNumber
, long startTime
) {
605 CoreNode newNode
= new CoreNode(fConfig
, fNodeCount
, parentSeqNumber
,
609 /* Update the treeEnd if needed */
610 if (startTime
>= fTreeEnd
) {
611 fTreeEnd
= startTime
+ 1;
617 * Add a new empty leaf node to the tree.
619 * @param parentSeqNumber
620 * Sequence number of this node's parent
622 * Start time of the new node
623 * @return The newly created node
625 private LeafNode
initNewLeafNode(int parentSeqNumber
, long startTime
) {
626 LeafNode newNode
= new LeafNode(fConfig
, fNodeCount
, parentSeqNumber
,
630 /* Update the treeEnd if needed */
631 if (startTime
>= fTreeEnd
) {
632 fTreeEnd
= startTime
+ 1;
638 * Inner method to select the next child of the current node intersecting
639 * the given timestamp. Useful for moving down the tree following one
643 * The node on which the request is made
645 * The timestamp to choose which child is the next one
646 * @return The child node intersecting t
647 * @throws ClosedChannelException
648 * If the file channel was closed while we were reading the tree
650 public HTNode
selectNextChild(CoreNode currentNode
, long t
) throws ClosedChannelException
{
651 assert (currentNode
.getNbChildren() > 0);
652 int potentialNextSeqNb
= currentNode
.getSequenceNumber();
654 for (int i
= 0; i
< currentNode
.getNbChildren(); i
++) {
655 if (t
>= currentNode
.getChildStart(i
)) {
656 potentialNextSeqNb
= currentNode
.getChild(i
);
663 * Once we exit this loop, we should have found a children to follow. If
664 * we didn't, there's a problem.
666 assert (potentialNextSeqNb
!= currentNode
.getSequenceNumber());
669 * Since this code path is quite performance-critical, avoid iterating
670 * through the whole latestBranch array if we know for sure the next
671 * node has to be on disk
673 if (currentNode
.isOnDisk()) {
674 return fTreeIO
.readNode(potentialNextSeqNb
);
676 return readNode(potentialNextSeqNb
);
680 * Get the current size of the history file.
682 * @return The history file size
684 public long getFileSize() {
685 return fConfig
.getStateFile().length();
688 // ------------------------------------------------------------------------
689 // Test/debugging methods
690 // ------------------------------------------------------------------------
693 * Debugging method to make sure all intervals contained in the given node
694 * have valid start and end times.
698 * @return True if everything is fine, false if there is at least one
699 * invalid timestamp (end time < start time, time outside of the
700 * range of the node, etc.)
702 @SuppressWarnings("nls")
703 public boolean checkNodeIntegrity(HTNode zenode
) {
704 /* Only used for debugging, shouldn't be externalized */
707 StringBuffer buf
= new StringBuffer();
710 // FIXME /* Only testing Core Nodes for now */
711 if (!(zenode
instanceof CoreNode
)) {
715 node
= (CoreNode
) zenode
;
719 * Test that this node's start and end times match the start of the
720 * first child and the end of the last child, respectively
722 if (node
.getNbChildren() > 0) {
723 otherNode
= fTreeIO
.readNode(node
.getChild(0));
724 if (node
.getNodeStart() != otherNode
.getNodeStart()) {
725 buf
.append("Start time of node (" + node
.getNodeStart() + ") "
726 + "does not match start time of first child " + "("
727 + otherNode
.getNodeStart() + "), " + "node #"
728 + otherNode
.getSequenceNumber() + ")\n");
731 if (node
.isOnDisk()) {
732 otherNode
= fTreeIO
.readNode(node
.getLatestChild());
733 if (node
.getNodeEnd() != otherNode
.getNodeEnd()) {
734 buf
.append("End time of node (" + node
.getNodeEnd()
735 + ") does not match end time of last child ("
736 + otherNode
.getNodeEnd() + ", node #"
737 + otherNode
.getSequenceNumber() + ")\n");
744 * Test that the childStartTimes[] array matches the real nodes'
747 for (int i
= 0; i
< node
.getNbChildren(); i
++) {
748 otherNode
= fTreeIO
.readNode(node
.getChild(i
));
749 if (otherNode
.getNodeStart() != node
.getChildStart(i
)) {
750 buf
.append(" Expected start time of child node #"
751 + node
.getChild(i
) + ": " + node
.getChildStart(i
)
752 + "\n" + " Actual start time of node #"
753 + otherNode
.getSequenceNumber() + ": "
754 + otherNode
.getNodeStart() + "\n");
759 } catch (ClosedChannelException e
) {
760 Activator
.getDefault().logError(e
.getMessage(), e
);
764 Activator
.getDefault().logError("SHT: Integrity check failed for node #"
765 + node
.getSequenceNumber() + ":" + buf
.toString());
771 * Check the integrity of all the nodes in the tree. Calls
772 * {@link #checkNodeIntegrity} for every node in the tree.
774 public void checkIntegrity() {
776 for (int i
= 0; i
< fNodeCount
; i
++) {
777 checkNodeIntegrity(fTreeIO
.readNode(i
));
779 } catch (ClosedChannelException e
) {
783 /* Only used for debugging, shouldn't be externalized */
784 @SuppressWarnings("nls")
786 public String
toString() {
787 return "Information on the current tree:\n\n" + "Blocksize: "
788 + fConfig
.getBlockSize() + "\n" + "Max nb. of children per node: "
789 + fConfig
.getMaxChildren() + "\n" + "Number of nodes: " + fNodeCount
790 + "\n" + "Depth of the tree: " + fLatestBranch
.size() + "\n"
791 + "Size of the treefile: " + getFileSize() + "\n"
792 + "Root node has sequence number: "
793 + fLatestBranch
.get(0).getSequenceNumber() + "\n"
794 + "'Latest leaf' has sequence number: "
795 + fLatestBranch
.get(fLatestBranch
.size() - 1).getSequenceNumber();
799 * Start at currentNode and print the contents of all its children, in
800 * pre-order. Give the root node in parameter to visit the whole tree, and
801 * have a nice overview.
803 /* Only used for debugging, shouldn't be externalized */
804 @SuppressWarnings("nls")
805 private void preOrderPrint(PrintWriter writer
, boolean printIntervals
,
806 HTNode currentNode
, int curDepth
) {
808 writer
.println(currentNode
.toString());
809 if (printIntervals
) {
810 currentNode
.debugPrintIntervals(writer
);
813 switch (currentNode
.getNodeType()) {
815 /* Stop if it's the leaf node */
820 final CoreNode node
= (CoreNode
) currentNode
;
821 /* Print the extensions, if any */
822 int extension
= node
.getExtensionSequenceNumber();
823 while (extension
!= -1) {
824 HTNode nextNode
= fTreeIO
.readNode(extension
);
825 preOrderPrint(writer
, printIntervals
, nextNode
, curDepth
);
828 /* Print the child nodes */
829 for (int i
= 0; i
< node
.getNbChildren(); i
++) {
830 HTNode nextNode
= fTreeIO
.readNode(node
.getChild(i
));
831 for (int j
= 0; j
< curDepth
; j
++) {
835 preOrderPrint(writer
, printIntervals
, nextNode
, curDepth
+ 1);
837 } catch (ClosedChannelException e
) {
838 Activator
.getDefault().logError(e
.getMessage());
848 * Print out the full tree for debugging purposes
851 * PrintWriter in which to write the output
852 * @param printIntervals
853 * Flag to enable full output of the interval information
855 public void debugPrintFullTree(PrintWriter writer
, boolean printIntervals
) {
856 /* Only used for debugging, shouldn't be externalized */
858 preOrderPrint(writer
, false, fLatestBranch
.get(0), 0);
860 if (printIntervals
) {
861 writer
.println("\nDetails of intervals:"); //$NON-NLS-1$
862 preOrderPrint(writer
, true, fLatestBranch
.get(0), 0);
864 writer
.println('\n');