1 /*******************************************************************************
2 * Copyright (c) 2010 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
.linuxtools
.tmf
.core
.filter
.model
;
16 import java
.util
.List
;
18 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.ITmfFilter
;
22 * <h4>This is Node Interface in the Filter Tree</h4>
24 public interface ITmfFilterTreeNode
extends ITmfFilter
{
27 * <h4>Get the parent node of current node</h4>
29 * @return The parent node (null when the node has no parent).
31 public ITmfFilterTreeNode
getParent();
34 * <h4>Get the current node name</h4>
36 * @return The name of the current node.
38 public String
getNodeName();
41 * <h4>Tell if the node has children</h4>
43 * @return True if the node has children.
45 public boolean hasChildren();
48 * <h4>Return the number of children</h4>
50 * @return The number of children.
52 public int getChildrenCount();
55 * <h4>Get the array of children</h4>
57 * @return The array (possibly empty) of children nodes.
59 public ITmfFilterTreeNode
[] getChildren();
62 * <h4>Get the node by index</h4>
64 * @param index The index of node to return.
65 * @return The desired node (null if the node is not exists).
67 public ITmfFilterTreeNode
getChild(int index
);
70 * <h4>Remove the node from its parent</h4>
72 * <p>Shifts all nodes after the removed one to prevent having an empty spot.
73 * See {@link #replaceChild(int, ITmfFilterTreeNode)} to replace a node.</p>
75 * @return The removed node.
77 public ITmfFilterTreeNode
remove();
80 * <h4>Remove the child from the current node</h4>
82 * <p>Shifts all nodes after the removed one to prevent having an empty spot.
83 * See {@link #replaceChild(int, ITmfFilterTreeNode)} to replace a node.</p>
85 * @param node the parent node
87 * @return The removed node.
89 public ITmfFilterTreeNode
removeChild(ITmfFilterTreeNode node
);
92 * <h4>Append a node to the current children</h4>
94 * @param node Node to append.
95 * @return Index of added node (-1 if the node cannot be added).
97 public int addChild(ITmfFilterTreeNode node
);
100 * <h4>Replace a child node</h4>
102 * @param index Index of the node to replace.
103 * @param node Node who will replace.
104 * @return Node replaced.
106 public ITmfFilterTreeNode
replaceChild(int index
, ITmfFilterTreeNode node
);
109 * <h4>Sets the parent of current node</h4>
111 * @param parent The parent of current node.
113 public void setParent(ITmfFilterTreeNode parent
);
116 * <h4>Gets the list of valid children node names that could be added to the node</h4>
118 * @return The list of valid children node names.
120 public List
<String
> getValidChildren();
123 * @return a clone of the node
125 public ITmfFilterTreeNode
clone();