You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Selectors.java 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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: Selectors.java,v 1.1 2000/02/14 16:58:31 plehegar Exp $
  13. */
  14. package com.vaadin.sass.parser;
  15. import org.w3c.css.sac.SelectorList;
  16. import org.w3c.css.sac.Selector;
  17. /**
  18. * @version $Revision: 1.1 $
  19. * @author Philippe Le Hegaret
  20. */
  21. class Selectors implements SelectorList {
  22. Selector[] selectors = new Selector[5];
  23. int current;
  24. public Selector item(int index) {
  25. if ((index < 0) || (index >= current)) {
  26. return null;
  27. }
  28. return selectors[index];
  29. }
  30. public Selector itemSelector(int index) {
  31. if ((index < 0) || (index >= current)) {
  32. return null;
  33. }
  34. return selectors[index];
  35. }
  36. public int getLength() {
  37. return current;
  38. }
  39. void addSelector(Selector selector) {
  40. if (current == selectors.length) {
  41. Selector[] old = selectors;
  42. selectors = new Selector[old.length + old.length];
  43. System.arraycopy(old, 0, selectors, 0, old.length);
  44. }
  45. selectors[current++] = selector;
  46. }
  47. }