1 /*******************************************************************************
2 * Copyright (c) 2016 École Polytechnique de Montréal
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
8 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.segmentstore
.core
.tests
.historytree
;
13 import java
.io
.IOException
;
15 import org
.eclipse
.tracecompass
.internal
.provisional
.datastore
.core
.historytree
.IHistoryTree
;
16 import org
.eclipse
.tracecompass
.internal
.provisional
.datastore
.core
.interval
.IHTIntervalReader
;
17 import org
.eclipse
.tracecompass
.internal
.provisional
.segmentstore
.core
.ISegment2
;
18 import org
.eclipse
.tracecompass
.internal
.segmentstore
.core
.segmentHistoryTree
.SegmentHistoryTree
;
19 import org
.eclipse
.tracecompass
.internal
.segmentstore
.core
.segmentHistoryTree
.SegmentTreeNode
;
22 * A stub segment history tree that extends the base segment history tree and
25 * @author Geneviève Bastien
27 * The type of segments that goes in this tree
29 public class SegmentHistoryTreeStub
<E
extends ISegment2
> extends SegmentHistoryTree
<E
> {
31 private int fLastInsertionIndex
;
34 * Minimum size a block of this tree should have
36 public static final int MINIMUM_BLOCK_SIZE
= IHistoryTree
.TREE_HEADER_SIZE
;
41 * @param stateHistoryFile
42 * The name of the history file
44 * The size of each "block" on disk in bytes. One node will
45 * always fit in one block. It should be at least 4096.
47 * The maximum number of children allowed per core (non-leaf)
49 * @param providerVersion
50 * The version of the state provider. If a file already exists,
51 * and their versions match, the history file will not be rebuilt
54 * The start time of the history
55 * @param intervalReader
56 * typed ISegment to allow access to the readSegment methods
58 * If an error happens trying to open/write to the file
59 * specified in the config
61 public SegmentHistoryTreeStub(File stateHistoryFile
,
66 IHTIntervalReader
<E
> intervalReader
) throws IOException
{
68 super(stateHistoryFile
,
77 * "Reader" constructor : instantiate a SHTree from an existing tree file on
80 * @param existingStateFile
81 * Path/filename of the history-file we are to open
82 * @param expProviderVersion
83 * The expected version of the state provider
85 * typed ISegment to allow access to the readSegment methods
87 * If an error happens reading the file
89 public SegmentHistoryTreeStub(File existingStateFile
, int expProviderVersion
, IHTIntervalReader
<E
> factory
) throws IOException
{
90 super(existingStateFile
, expProviderVersion
, factory
);
94 protected void informInsertingAtDepth(int depth
) {
95 fLastInsertionIndex
= depth
;
99 * Get the index in the current branch where the last element was inserted
101 * @return The index in the branch of the last insertion
103 public int getLastInsertionLocation() {
104 return fLastInsertionIndex
;
108 public SegmentTreeNode
<E
> getLatestLeaf() {
109 return super.getLatestLeaf();
This page took 0.052559 seconds and 6 git commands to generate.