|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
NodeListImpl.java | - | 100% | 100% | 100% |
|
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
3 | * contributor license agreements. See the NOTICE file distributed with | |
4 | * this work for additional information regarding copyright ownership. | |
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
6 | * (the "License"); you may not use this file except in compliance with | |
7 | * the License. You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software | |
12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | * See the License for the specific language governing permissions and | |
15 | * limitations under the License. | |
16 | * | |
17 | * $Id: NodeListImpl.java 541508 2007-05-25 01:54:12Z vgritsenko $ | |
18 | */ | |
19 | ||
20 | package org.apache.xindice.xml.dom; | |
21 | ||
22 | import org.w3c.dom.Node; | |
23 | import org.w3c.dom.NodeList; | |
24 | ||
25 | import java.util.ArrayList; | |
26 | ||
27 | /** | |
28 | * NodeListImpl | |
29 | * | |
30 | * @version $Revision: 541508 $, $Date: 2007-05-24 18:54:12 -0700 (Thu, 24 May 2007) $ | |
31 | */ | |
32 | public class NodeListImpl extends ArrayList implements NodeList { | |
33 | ||
34 | protected NodeImpl owner; | |
35 | ||
36 | 1038748 | public NodeListImpl(NodeImpl owner) { |
37 | 1038749 | this.owner = owner; |
38 | } | |
39 | ||
40 | /** | |
41 | * Returns the <code>index</code>th item in the collection. If | |
42 | * <code>index</code> is greater than or equal to the number of nodes in | |
43 | * the list, this returns <code>null</code>. | |
44 | * @param index Index into the collection. | |
45 | * @return The node at the <code>index</code>th position in the | |
46 | * <code>NodeList</code>, or <code>null</code> if that is not a valid | |
47 | * index. | |
48 | */ | |
49 | 1271933 | public final Node item(int index) { |
50 | 1271932 | try { |
51 | 1271932 | return (Node) get(index); |
52 | } catch (IndexOutOfBoundsException e) { | |
53 | 4 | return null; |
54 | } | |
55 | } | |
56 | ||
57 | /** | |
58 | * The number of nodes in the list. The range of valid child node indices is | |
59 | * 0 to <code>length-1</code> inclusive. | |
60 | */ | |
61 | 1761660 | public final int getLength() { |
62 | 1761660 | return size(); |
63 | } | |
64 | } | |
65 |
|