KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > w3c > flute > parser > SelectorListImpl


1 /*
2  * Copyright (c) 1999 World Wide Web Consortium,
3  * (Massachusetts Institute of Technology, Institut National de
4  * Recherche en Informatique et en Automatique, Keio University). All
5  * Rights Reserved. This program is distributed under the W3C's Software
6  * Intellectual Property License. This program is distributed in the
7  * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
8  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  * PURPOSE.
10  * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
11  *
12  * $Id: SelectorListImpl.java,v 1.1.1.1 2006/04/23 14:51:51 taqua Exp $
13  */

14 package org.w3c.flute.parser;
15
16 import org.w3c.css.sac.SelectorList;
17 import org.w3c.css.sac.Selector;
18
19 /**
20  * @version $Revision: 1.1.1.1 $
21  * @author Philippe Le Hegaret
22  */

23 class SelectorListImpl implements SelectorList {
24
25     Selector[] selectors = new Selector[5];
26     int current;
27
28     public Selector item(int index) {
29     if ((index < 0) || (index >= current)) {
30         return null;
31     }
32     return selectors[index];
33     }
34
35     public Selector itemSelector(int index) {
36     if ((index < 0) || (index >= current)) {
37         return null;
38     }
39     return selectors[index];
40     }
41
42     public int getLength() {
43     return current;
44     }
45
46     void addSelector(Selector selector) {
47     if (current == selectors.length) {
48         Selector[] old = selectors;
49         selectors = new Selector[old.length + old.length];
50         System.arraycopy(old, 0, selectors, 0, old.length);
51     }
52     selectors[current++] = selector;
53     }
54 }
55
Popular Tags