ss: add 2D iterator queries to the SS API
[deliverable/tracecompass.git] / statesystem / org.eclipse.tracecompass.statesystem.core / src / org / eclipse / tracecompass / internal / statesystem / core / backend / historytree / ParentNode.java
1 /*******************************************************************************
2 * Copyright (c) 2010, 2016 Ericsson, École Polytechnique de Montréal, and others
3 *
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 *******************************************************************************/
9
10 package org.eclipse.tracecompass.internal.statesystem.core.backend.historytree;
11
12 import java.util.Collection;
13
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;
18
19 /**
20 * A Core node is a first-level node of a History Tree which is not a leaf node.
21 *
22 * It extends HTNode by adding support for child nodes, and also extensions.
23 *
24 * @author Alexandre Montplaisir
25 * @author Florian Wininger
26 * @author Loïc Prieur-Drevon
27 */
28 public abstract class ParentNode extends HTNode {
29
30 /**
31 * Initial constructor. Use this to initialize a new EMPTY node.
32 *
33 * @param config
34 * Configuration of the History Tree
35 * @param seqNumber
36 * The (unique) sequence number assigned to this particular node
37 * @param parentSeqNumber
38 * The sequence number of this node's parent node
39 * @param start
40 * The earliest timestamp stored in this node
41 */
42 public ParentNode(HTConfig config, int seqNumber, int parentSeqNumber,
43 long start) {
44 super(config, seqNumber, parentSeqNumber, start);
45 }
46
47 /**
48 * Return the number of child nodes this node has.
49 *
50 * @return The number of child nodes
51 */
52 public abstract int getNbChildren();
53
54 /**
55 * Get the child node corresponding to the specified index
56 *
57 * @param index The index of the child to lookup
58 * @return The child node
59 */
60 public abstract int getChild(int index);
61
62 /**
63 * Get the latest (right-most) child node of this node.
64 *
65 * @return The latest child node
66 */
67 public abstract int getLatestChild();
68
69 /**
70 * Get the start time of the specified child node.
71 *
72 * @param index
73 * The index of the child node
74 * @return The start time of the that child node.
75 */
76 public abstract long getChildStart(int index);
77
78 /**
79 * Tell this node that it has a new child (Congrats!)
80 *
81 * @param childNode
82 * The SHTNode object of the new child
83 */
84 public abstract void linkNewChild(HTNode childNode);
85
86 /**
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
89 * the tree.
90 *
91 * @param t
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
97 */
98 public abstract @NonNull Collection<@NonNull Integer> selectNextChildren(long t);
99
100 /**
101 * Get a collection of sequence numbers for the children nodes that contain
102 * intervals with quarks from quarks, and times intersecting times from
103 * times.
104 *
105 * @param quarks
106 * NumCondition on the quarks we are interested in.
107 * @param subTimes
108 * NumCondition on the time stamps we are interested in.
109 * @return a collection of the sequence numbers for the children that match
110 * the conditions.
111 */
112 public abstract Collection<Integer> selectNextChildren2D(IntegerRangeCondition quarks, TimeRangeCondition subTimes);
113
114 }
This page took 0.033225 seconds and 5 git commands to generate.