1 18 package org.apache.batik.css.parser; 19 20 import org.w3c.css.sac.Selector; 21 import org.w3c.css.sac.SelectorList; 22 23 29 public class CSSSelectorList implements SelectorList { 30 31 34 protected Selector[] list = new Selector[3]; 35 36 39 protected int length; 40 41 44 public int getLength() { 45 return length; 46 } 47 48 52 public Selector item(int index) { 53 if (index < 0 || index >= length) { 54 return null; 55 } 56 return list[index]; 57 } 58 59 62 public void append(Selector item) { 63 if (length == list.length) { 64 Selector[] tmp = list; 65 list = new Selector[list.length * 3 / 2]; 66 for (int i = 0; i < tmp.length; i++) { 67 list[i] = tmp[i]; 68 } 69 } 70 list[length++] = item; 71 } 72 } 73 | Popular Tags |