1 28 29 package com.caucho.relaxng.program; 30 31 import com.caucho.relaxng.RelaxException; 32 import com.caucho.util.L10N; 33 import com.caucho.xml.QName; 34 35 import java.util.HashSet ; 36 import java.util.Iterator ; 37 38 41 public class ZeroOrMoreItem extends Item { 42 protected final static L10N L = new L10N(ZeroOrMoreItem.class); 43 44 private Item _item; 45 46 public ZeroOrMoreItem(Item item) 47 { 48 _item = item; 49 } 50 51 54 public Item getItem() 55 { 56 return _item; 57 } 58 59 62 public void firstSet(HashSet <QName> set) 63 { 64 _item.firstSet(set); 65 } 66 67 70 public void requiredFirstSet(HashSet <QName> set) 71 { 72 } 73 74 77 public boolean allowEmpty() 78 { 79 return true; 80 } 81 82 85 public Iterator <Item> getItemsIterator() 86 { 87 return itemIterator( _item ); 88 } 89 90 96 public Item startElement(QName name) 97 throws RelaxException 98 { 99 Item next = _item.startElement(name); 100 101 if (next == null) 102 return null; 103 else 104 return next.groupContinuation(this); 105 } 106 107 110 public void attributeSet(HashSet <QName> set) 111 { 112 _item.attributeSet(set); 113 } 114 115 123 public boolean allowAttribute(QName name, String value) 124 throws RelaxException 125 { 126 return _item.allowAttribute(name, value); 127 } 128 129 138 public boolean allowsElement(QName name) 139 { 140 return _item.allowsElement(name); 141 } 142 143 146 public String toSyntaxDescription(int depth) 147 { 148 return _item.toSyntaxDescription(depth) + "*"; 149 } 150 151 154 protected boolean isSimpleSyntax() 155 { 156 return _item.isSimpleSyntax(); 157 } 158 159 162 public int hashCode() 163 { 164 return 17 + _item.hashCode(); 165 } 166 167 170 public boolean equals(Object o) 171 { 172 if (this == o) 173 return true; 174 175 if (! (o instanceof ZeroOrMoreItem)) 176 return false; 177 178 ZeroOrMoreItem item = (ZeroOrMoreItem) o; 179 180 return _item.equals(item._item); 181 } 182 183 public String toString() 184 { 185 return "ZeroOrMoreItem[" + _item + "]"; 186 } 187 } 188 189 | Popular Tags |