1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 import com.sun.star.lang.IndexOutOfBoundsException;
23 import java.util.Vector;
24 
25 /** The VectorNode class is a simple container whose list of children is
26     managed entirely by its owner.
27 */
28 class VectorNode
29     extends StringNode
30 {
31     private Vector maChildren;
32 
VectorNode(String sDisplayObject, AccessibleTreeNode aParent)33     public VectorNode (String sDisplayObject, AccessibleTreeNode aParent)
34     {
35         super (sDisplayObject, aParent);
36 
37         maChildren = new Vector ();
38     }
39 
addChild(AccessibleTreeNode aChild)40     public void addChild (AccessibleTreeNode aChild)
41     {
42         maChildren.add (aChild);
43     }
44 
getChildCount()45     public int getChildCount ()
46     {
47         return maChildren.size();
48     }
49 
getChild(int nIndex)50     public AccessibleTreeNode getChild (int nIndex)
51         throws IndexOutOfBoundsException
52     {
53         return (AccessibleTreeNode)maChildren.elementAt (nIndex);
54     }
55 
removeChild(int nIndex)56     public boolean removeChild (int nIndex)
57         throws IndexOutOfBoundsException
58     {
59         return maChildren.remove (nIndex) != null;
60     }
61 
indexOf(AccessibleTreeNode aNode)62     public int indexOf (AccessibleTreeNode aNode)
63     {
64         return maChildren.indexOf (aNode);
65     }
66 
isLeaf()67     public boolean isLeaf()
68     {
69         return maChildren.isEmpty();
70     }
71 }
72