Commit | Line | Data |
---|---|---|
be222f56 | 1 | /******************************************************************************* |
61759503 | 2 | * Copyright (c) 2010, 2012 Ericsson |
be222f56 PT |
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 | * Contributors: | |
10 | * Francois Godin (copelnug@gmail.com) - Initial API | |
11 | * Yuriy Vashchuk (yvashchuk@gmail.com) - Initial implementation | |
12 | *******************************************************************************/ | |
13 | ||
14 | package org.eclipse.linuxtools.tmf.core.filter.model; | |
15 | ||
16 | import java.util.List; | |
17 | ||
18 | import org.eclipse.linuxtools.tmf.core.filter.ITmfFilter; | |
19 | ||
20 | ||
21 | /** | |
22 | * <h4>This is Node Interface in the Filter Tree</h4> | |
23 | */ | |
24 | public interface ITmfFilterTreeNode extends ITmfFilter { | |
25 | ||
d5efe032 AF |
26 | /** |
27 | * <h4>Get the parent node of current node</h4> | |
28 | * | |
29 | * @return The parent node (null when the node has no parent). | |
30 | */ | |
31 | public ITmfFilterTreeNode getParent(); | |
32 | ||
33 | /** | |
34 | * <h4>Get the current node name</h4> | |
35 | * | |
36 | * @return The name of the current node. | |
37 | */ | |
38 | public String getNodeName(); | |
39 | ||
40 | /** | |
41 | * <h4>Tell if the node has children</h4> | |
42 | * | |
43 | * @return True if the node has children. | |
44 | */ | |
45 | public boolean hasChildren(); | |
46 | ||
47 | /** | |
48 | * <h4>Return the number of children</h4> | |
49 | * | |
50 | * @return The number of children. | |
51 | */ | |
52 | public int getChildrenCount(); | |
53 | ||
54 | /** | |
55 | * <h4>Get the array of children</h4> | |
56 | * | |
57 | * @return The array (possibly empty) of children nodes. | |
58 | */ | |
59 | public ITmfFilterTreeNode[] getChildren(); | |
60 | ||
61 | /** | |
62 | * <h4>Get the node by index</h4> | |
63 | * | |
64 | * @param index The index of node to return. | |
65 | * @return The desired node (null if the node is not exists). | |
66 | */ | |
67 | public ITmfFilterTreeNode getChild(int index); | |
68 | ||
69 | /** | |
70 | * <h4>Remove the node from its parent</h4> | |
71 | * | |
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> | |
74 | * | |
75 | * @return The removed node. | |
76 | */ | |
77 | public ITmfFilterTreeNode remove(); | |
78 | ||
79 | /** | |
80 | * <h4>Remove the child from the current node</h4> | |
81 | * | |
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> | |
84 | * | |
85 | * @param node the parent node | |
86 | * | |
87 | * @return The removed node. | |
88 | */ | |
89 | public ITmfFilterTreeNode removeChild(ITmfFilterTreeNode node); | |
90 | ||
91 | /** | |
92 | * <h4>Append a node to the current children</h4> | |
93 | * | |
94 | * @param node Node to append. | |
95 | * @return Index of added node (-1 if the node cannot be added). | |
96 | */ | |
97 | public int addChild(ITmfFilterTreeNode node); | |
98 | ||
99 | /** | |
100 | * <h4>Replace a child node</h4> | |
101 | * | |
102 | * @param index Index of the node to replace. | |
103 | * @param node Node who will replace. | |
104 | * @return Node replaced. | |
105 | */ | |
106 | public ITmfFilterTreeNode replaceChild(int index, ITmfFilterTreeNode node); | |
107 | ||
108 | /** | |
109 | * <h4>Sets the parent of current node</h4> | |
110 | * | |
111 | * @param parent The parent of current node. | |
112 | */ | |
113 | public void setParent(ITmfFilterTreeNode parent); | |
114 | ||
115 | /** | |
116 | * <h4>Gets the list of valid children node names that could be added to the node</h4> | |
117 | * | |
118 | * @return The list of valid children node names. | |
119 | */ | |
120 | public List<String> getValidChildren(); | |
121 | ||
122 | /** | |
123 | * @return a clone of the node | |
124 | */ | |
125 | public ITmfFilterTreeNode clone(); | |
be222f56 PT |
126 | |
127 | } |