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:
22: import org.w3c.dom.DOMStringList;
23:
24: /**
25: * DOM Level 3
26: *
27: * This class implements the DOM Level 3 Core interface DOMStringList.
28: *
29: * @xerces.internal
30: *
31: * @author Neil Delima, IBM
32: */
33: public class DOMStringListImpl implements DOMStringList {
34:
35: //A collection of DOMString values
36: private Vector fStrings;
37:
38: /**
39: * Construct an empty list of DOMStringListImpl
40: */
41: public DOMStringListImpl() {
42: fStrings = new Vector();
43: }
44:
45: /**
46: * Construct an empty list of DOMStringListImpl
47: */
48: public DOMStringListImpl(Vector params) {
49: fStrings = params;
50: }
51:
52: /**
53: * @see org.w3c.dom.DOMStringList#item(int)
54: */
55: public String item(int index) {
56: try {
57: return (String) fStrings.elementAt(index);
58: } catch (ArrayIndexOutOfBoundsException e) {
59: return null;
60: }
61: }
62:
63: /**
64: * @see org.w3c.dom.DOMStringList#getLength()
65: */
66: public int getLength() {
67: return fStrings.size();
68: }
69:
70: /**
71: * @see org.w3c.dom.DOMStringList#contains(String)
72: */
73: public boolean contains(String param) {
74: return fStrings.contains(param);
75: }
76:
77: /**
78: * DOM Internal:
79: * Add a <code>DOMString</code> to the list.
80: *
81: * @param param A string to add to the list
82: */
83: public void add(String param) {
84: fStrings.add(param);
85: }
86:
87: }
|