KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > dom > DOMStringListImpl


1 /*
2  * Copyright 2001, 2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.xerces.dom;
18
19 import java.util.Vector JavaDoc;
20
21 import org.w3c.dom.DOMStringList JavaDoc;
22
23 /**
24  * DOM Level 3
25  *
26  * This class implements the DOM Level 3 Core interface DOMStringList.
27  *
28  * @xerces.internal
29  *
30  * @author Neil Delima, IBM
31  */

32 public class DOMStringListImpl implements DOMStringList JavaDoc {
33     
34     //A collection of DOMString values
35
private Vector JavaDoc fStrings;
36
37     /**
38      * Construct an empty list of DOMStringListImpl
39      */

40     public DOMStringListImpl() {
41         fStrings = new Vector JavaDoc();
42     }
43
44     /**
45      * Construct an empty list of DOMStringListImpl
46      */

47     public DOMStringListImpl(Vector JavaDoc params) {
48         fStrings = params;
49     }
50         
51     /**
52      * @see org.w3c.dom.DOMStringList#item(int)
53      */

54     public String JavaDoc item(int index) {
55         try {
56             return (String JavaDoc) fStrings.elementAt(index);
57         } catch (ArrayIndexOutOfBoundsException JavaDoc e) {
58             return null;
59         }
60     }
61
62     /**
63      * @see org.w3c.dom.DOMStringList#getLength()
64      */

65     public int getLength() {
66         return fStrings.size();
67     }
68
69     /**
70      * @see org.w3c.dom.DOMStringList#contains(String)
71      */

72     public boolean contains(String JavaDoc param) {
73         return fStrings.contains(param) ;
74     }
75
76     /**
77      * DOM Internal:
78      * Add a <code>DOMString</code> to the list.
79      *
80      * @param domString A string to add to the list
81      */

82     public void add(String JavaDoc param) {
83         fStrings.add(param);
84     }
85
86 }
87
Popular Tags