Commit | Line | Data |
---|---|---|
46ab8ce3 FC |
1 | /*******************************************************************************\r |
2 | * Copyright (c) 2010 Ericsson\r | |
3 | * \r | |
4 | * All rights reserved. This program and the accompanying materials are\r | |
5 | * made available under the terms of the Eclipse Public License v1.0 which\r | |
6 | * accompanies this distribution, and is available at\r | |
7 | * http://www.eclipse.org/legal/epl-v10.html\r | |
8 | * \r | |
9 | * Contributors:\r | |
10 | * Francois Godin (copelnug@gmail.com) - Initial API\r | |
11 | * Yuriy Vashchuk (yvashchuk@gmail.com) - Initial implementation\r | |
12 | *******************************************************************************/\r | |
13 | \r | |
14 | package org.eclipse.linuxtools.tmf.filter.model;\r | |
15 | \r | |
16 | import java.util.List;\r | |
17 | \r | |
18 | import org.eclipse.linuxtools.tmf.filter.ITmfFilter;\r | |
19 | \r | |
20 | \r | |
21 | /**\r | |
22 | * <h4>This is Node Interface in the Filter Tree</h4>\r | |
23 | */\r | |
24 | public interface ITmfFilterTreeNode extends ITmfFilter {\r | |
25 | \r | |
26 | /**\r | |
27 | * <h4>Get the parent node of current node</h4>\r | |
28 | * \r | |
29 | * @return The parent node (null when the node has no parent).\r | |
30 | */\r | |
31 | public ITmfFilterTreeNode getParent();\r | |
32 | \r | |
33 | /**\r | |
34 | * <h4>Get the current node name</h4>\r | |
35 | * \r | |
36 | * @return The name of the current node.\r | |
37 | */\r | |
38 | public String getNodeName();\r | |
39 | \r | |
40 | /**\r | |
41 | * <h4>Tell if the node has children</h4> \r | |
42 | * \r | |
43 | * @return True if the node has children.\r | |
44 | */\r | |
45 | public boolean hasChildren();\r | |
46 | \r | |
47 | /**\r | |
48 | * <h4>Return the number of children</h4>\r | |
49 | * \r | |
50 | * @return The number of children.\r | |
51 | */\r | |
52 | public int getChildrenCount();\r | |
53 | \r | |
54 | /**\r | |
55 | * <h4>Get the array of children</h4>\r | |
56 | * \r | |
57 | * @return The array (possibly empty) of children nodes.\r | |
58 | */\r | |
59 | public ITmfFilterTreeNode[] getChildren();\r | |
60 | \r | |
61 | /**\r | |
62 | * <h4>Get the node by index</h4>\r | |
63 | * \r | |
64 | * @param index The index of node to return.\r | |
65 | * @return The desired node (null if the node is not exists).\r | |
66 | */\r | |
67 | public ITmfFilterTreeNode getChild(int index);\r | |
68 | \r | |
69 | /**\r | |
70 | * <h4>Remove the node from its parent</h4>\r | |
71 | * \r | |
72 | * <p>Shifts all nodes after the removed one to prevent having an empty spot. \r | |
73 | * See {@link #replaceChildren(int, ITmfFilterTreeNode)} to replace a node.</p>\r | |
74 | * \r | |
75 | * @return The removed node. \r | |
76 | */\r | |
77 | public ITmfFilterTreeNode remove();\r | |
78 | \r | |
79 | /**\r | |
80 | * <h4>Remove the child from the current node</h4>\r | |
81 | * \r | |
82 | * <p>Shifts all nodes after the removed one to prevent having an empty spot. \r | |
83 | * See {@link #replaceChildren(int, ITmfFilterTreeNode)} to replace a node.</p>\r | |
84 | * \r | |
85 | * @return The removed node. \r | |
86 | */\r | |
87 | public ITmfFilterTreeNode removeChild(ITmfFilterTreeNode node);\r | |
88 | \r | |
89 | /**\r | |
90 | * <h4>Append a node to the current children</h4>\r | |
91 | * \r | |
92 | * @param node Node to append.\r | |
93 | * @return Index of added node (-1 if the node cannot be added).\r | |
94 | */\r | |
95 | public int addChild(ITmfFilterTreeNode node);\r | |
96 | \r | |
97 | /**\r | |
98 | * <h4>Replace a child node</h4>\r | |
99 | * \r | |
100 | * @param index Index of the node to replace.\r | |
101 | * @param node Node who will replace.\r | |
102 | * @return Node replaced.\r | |
103 | */\r | |
104 | public ITmfFilterTreeNode replaceChild(int index, ITmfFilterTreeNode node);\r | |
105 | \r | |
106 | /**\r | |
107 | * <h4>Sets the parent of current node</h4>\r | |
108 | * \r | |
109 | * @param parent The parent of current node.\r | |
110 | */\r | |
111 | public void setParent(ITmfFilterTreeNode parent);\r | |
112 | \r | |
113 | /**\r | |
114 | * <h4>Gets the list of valid children node names that could be added to the node</h4>\r | |
115 | * \r | |
116 | * @return The list of valid children node names.\r | |
117 | */\r | |
118 | public List<String> getValidChildren();\r | |
119 | \r | |
120 | public ITmfFilterTreeNode clone();\r | |
121 | \r | |
122 | }\r |