1 /*******************************************************************************
2 * Copyright (c) 2010, 2016 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
8 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.internal
.statesystem
.core
.backend
.historytree
;
12 import java
.util
.Collection
;
14 import org
.eclipse
.jdt
.annotation
.NonNull
;
15 import org
.eclipse
.tracecompass
.internal
.provisional
.datastore
.core
.condition
.IntegerRangeCondition
;
16 import org
.eclipse
.tracecompass
.internal
.provisional
.datastore
.core
.condition
.TimeRangeCondition
;
17 import org
.eclipse
.tracecompass
.statesystem
.core
.exceptions
.TimeRangeException
;
20 * A Core node is a first-level node of a History Tree which is not a leaf node.
22 * It extends HTNode by adding support for child nodes, and also extensions.
24 * @author Alexandre Montplaisir
25 * @author Florian Wininger
26 * @author Loïc Prieur-Drevon
28 public abstract class ParentNode
extends HTNode
{
31 * Initial constructor. Use this to initialize a new EMPTY node.
34 * Configuration of the History Tree
36 * The (unique) sequence number assigned to this particular node
37 * @param parentSeqNumber
38 * The sequence number of this node's parent node
40 * The earliest timestamp stored in this node
42 public ParentNode(HTConfig config
, int seqNumber
, int parentSeqNumber
,
44 super(config
, seqNumber
, parentSeqNumber
, start
);
48 * Return the number of child nodes this node has.
50 * @return The number of child nodes
52 public abstract int getNbChildren();
55 * Get the child node corresponding to the specified index
57 * @param index The index of the child to lookup
58 * @return The child node
60 public abstract int getChild(int index
);
63 * Get the latest (right-most) child node of this node.
65 * @return The latest child node
67 public abstract int getLatestChild();
70 * Get the start time of the specified child node.
73 * The index of the child node
74 * @return The start time of the that child node.
76 public abstract long getChildStart(int index
);
79 * Tell this node that it has a new child (Congrats!)
82 * The SHTNode object of the new child
84 public abstract void linkNewChild(HTNode childNode
);
87 * Inner method to select the sequence numbers for the children of the
88 * current node that intersect the given timestamp. Useful for moving down
92 * The timestamp to choose which child is the next one
93 * @return Collection of sequence numbers of the child nodes that intersect
94 * t, non-null empty collection if this is a Leaf Node
95 * @throws TimeRangeException
96 * If t is out of the node's range
98 public abstract @NonNull Collection
<@NonNull Integer
> selectNextChildren(long t
);
101 * Get a collection of sequence numbers for the children nodes that contain
102 * intervals with quarks from quarks, and times intersecting times from
106 * NumCondition on the quarks we are interested in.
108 * NumCondition on the time stamps we are interested in.
109 * @return a collection of the sequence numbers for the children that match
112 public abstract Collection
<Integer
> selectNextChildren2D(IntegerRangeCondition quarks
, TimeRangeCondition subTimes
);