Source code: com/steadystate/css/parser/SelectorListImpl.java
1 /*
2 * SelectorListImpl.java
3 *
4 * Steady State CSS2 Parser
5 *
6 * Copyright (C) 1999, 2002 Steady State Software Ltd. All rights reserved.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 * To contact the authors of the library, write to Steady State Software Ltd.,
23 * 49 Littleworth, Wing, Buckinghamshire, LU7 0JX, England
24 *
25 * http://www.steadystate.com/css/
26 * mailto:css@steadystate.co.uk
27 *
28 * $Id: SelectorListImpl.java,v 1.1.1.1 2003/12/28 21:23:37 davidsch Exp $
29 */
30
31 package com.steadystate.css.parser;
32
33 import java.io.Serializable;
34 import java.util.*;
35 import org.w3c.css.sac.*;
36
37 public class SelectorListImpl implements SelectorList, Serializable {
38
39 private Vector _selectors = new Vector(10, 10);
40
41 public int getLength() {
42 return _selectors.size();
43 }
44
45 public Selector item(int index) {
46 return (Selector) _selectors.elementAt(index);
47 }
48
49 public void add(Selector sel) {
50 _selectors.addElement(sel);
51 }
52
53 public String toString() {
54 StringBuffer sb = new StringBuffer();
55 int len = getLength();
56 for (int i = 0; i < len; i++) {
57 sb.append(item(i).toString());
58 if (i < len - 1) {
59 sb.append(", ");
60 }
61 }
62 return sb.toString();
63 }
64 }