01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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:
18: package org.apache.xerces.dom;
19:
20: import java.util.Vector;
21: import org.w3c.dom.DOMImplementationList;
22: import org.w3c.dom.DOMImplementation;
23:
24: /**
25: * <p>This class implements the DOM Level 3 Core interface DOMImplementationList.</p>
26: *
27: * @xerces.internal
28: *
29: * @author Neil Delima, IBM
30: * @since DOM Level 3 Core
31: */
32: public class DOMImplementationListImpl implements DOMImplementationList {
33:
34: //A collection of DOMImplementations
35: private Vector fImplementations;
36:
37: /**
38: * Construct an empty list of DOMImplementations
39: */
40: public DOMImplementationListImpl() {
41: fImplementations = new Vector();
42: }
43:
44: /**
45: * Construct an empty list of DOMImplementations
46: */
47: public DOMImplementationListImpl(Vector params) {
48: fImplementations = params;
49: }
50:
51: /**
52: * Returns the indexth item in the collection.
53: *
54: * @param index The index of the DOMImplemetation from the list to return.
55: */
56: public DOMImplementation item(int index) {
57: try {
58: return (DOMImplementation) fImplementations
59: .elementAt(index);
60: } catch (ArrayIndexOutOfBoundsException e) {
61: return null;
62: }
63: }
64:
65: /**
66: * Returns the number of DOMImplementations in the list.
67: *
68: * @return An integer indicating the number of DOMImplementations.
69: */
70: public int getLength() {
71: return fImplementations.size();
72: }
73: }
|