1 /*******************************************************************************
2 * Copyright (c) 2010, 2014 Ericsson
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 * Francois Godin (copelnug@gmail.com) - Initial API
11 * Yuriy Vashchuk (yvashchuk@gmail.com) - Initial implementation
12 *******************************************************************************/
14 package org
.eclipse
.tracecompass
.tmf
.core
.filter
.model
;
16 import java
.util
.List
;
18 import org
.eclipse
.jdt
.annotation
.NonNull
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.filter
.ITmfFilter
;
23 * <h4>This is Node Interface in the Filter Tree</h4>
25 public interface ITmfFilterTreeNode
extends ITmfFilter
{
28 * <h4>Get the parent node of current node</h4>
30 * @return The parent node (null when the node has no parent).
32 public ITmfFilterTreeNode
getParent();
35 * <h4>Get the current node name</h4>
37 * @return The name of the current node.
39 public String
getNodeName();
42 * <h4>Tell if the node has children</h4>
44 * @return True if the node has children.
46 public boolean hasChildren();
49 * <h4>Return the number of children</h4>
51 * @return The number of children.
53 public int getChildrenCount();
56 * <h4>Get the array of children</h4>
58 * @return The array (possibly empty) of children nodes.
60 public @NonNull ITmfFilterTreeNode
[] getChildren();
63 * <h4>Get the node by index</h4>
65 * @param index The index of node to return.
66 * @return The desired node (null if the node is not exists).
68 public ITmfFilterTreeNode
getChild(int index
);
71 * <h4>Remove the node from its parent</h4>
73 * <p>Shifts all nodes after the removed one to prevent having an empty spot.
74 * See {@link #replaceChild(int, ITmfFilterTreeNode)} to replace a node.</p>
76 * @return The removed node.
78 public ITmfFilterTreeNode
remove();
81 * <h4>Remove the child from the current node</h4>
83 * <p>Shifts all nodes after the removed one to prevent having an empty spot.
84 * See {@link #replaceChild(int, ITmfFilterTreeNode)} to replace a node.</p>
86 * @param node the parent node
88 * @return The removed node.
90 public ITmfFilterTreeNode
removeChild(ITmfFilterTreeNode node
);
93 * <h4>Append a node to the current children</h4>
95 * @param node Node to append.
96 * @return Index of added node (-1 if the node cannot be added).
98 public int addChild(ITmfFilterTreeNode node
);
101 * <h4>Replace a child node</h4>
103 * @param index Index of the node to replace.
104 * @param node Node who will replace.
105 * @return Node replaced.
107 public ITmfFilterTreeNode
replaceChild(int index
, ITmfFilterTreeNode node
);
110 * <h4>Sets the parent of current node</h4>
112 * @param parent The parent of current node.
114 public void setParent(ITmfFilterTreeNode parent
);
117 * <h4>Gets the list of valid children node names that could be added to the node</h4>
119 * @return The list of valid children node names.
121 public List
<String
> getValidChildren();
124 * <h4>Returns a string representation of the filter tree node object.</h4>
127 * true if ambiguous fields should explicitly include additional
128 * information that can differentiate them from other fields with
131 * @return a string representation of the filter tree node object
133 public String
toString(boolean explicit
);
136 * @return a clone of the node
138 public ITmfFilterTreeNode
clone();