Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

Selectors.java 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright 2000-2013 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * 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, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. /*
  17. * Copyright (c) 1999 World Wide Web Consortium,
  18. * (Massachusetts Institute of Technology, Institut National de
  19. * Recherche en Informatique et en Automatique, Keio University). All
  20. * Rights Reserved. This program is distributed under the W3C's Software
  21. * Intellectual Property License. This program is distributed in the
  22. * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
  23. * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  24. * PURPOSE.
  25. * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
  26. *
  27. * $Id: Selectors.java,v 1.1 2000/02/14 16:58:31 plehegar Exp $
  28. */
  29. package com.vaadin.sass.internal.parser;
  30. import org.w3c.css.sac.SelectorList;
  31. import org.w3c.css.sac.Selector;
  32. /**
  33. * @version $Revision: 1.1 $
  34. * @author Philippe Le Hegaret
  35. */
  36. class Selectors implements SelectorList {
  37. Selector[] selectors = new Selector[5];
  38. int current;
  39. public Selector item(int index) {
  40. if ((index < 0) || (index >= current)) {
  41. return null;
  42. }
  43. return selectors[index];
  44. }
  45. public Selector itemSelector(int index) {
  46. if ((index < 0) || (index >= current)) {
  47. return null;
  48. }
  49. return selectors[index];
  50. }
  51. public int getLength() {
  52. return current;
  53. }
  54. void addSelector(Selector selector) {
  55. if (current == selectors.length) {
  56. Selector[] old = selectors;
  57. selectors = new Selector[old.length + old.length];
  58. System.arraycopy(old, 0, selectors, 0, old.length);
  59. }
  60. selectors[current++] = selector;
  61. }
  62. }