1 28 29 package com.caucho.relaxng; 30 31 import com.caucho.config.BeanConfigException; 32 import com.caucho.relaxng.pattern.GrammarPattern; 33 import com.caucho.relaxng.program.Item; 34 import com.caucho.util.L10N; 35 import com.caucho.util.LruCache; 36 37 40 public class SchemaImpl implements Schema { 41 protected static final L10N L = new L10N(SchemaImpl.class); 42 43 private String _filename; 44 45 private LruCache<Object ,Item> _programCache 46 = new LruCache<Object ,Item>(1024); 47 48 private Item _startItem; 49 50 SchemaImpl(GrammarPattern grammar) 51 throws RelaxException 52 { 53 _startItem = grammar.getStart().createItem(grammar); 54 55 if (_startItem == null) 56 throw new RelaxException(L.l("Expected a start item.")); 57 } 58 59 62 public Item getStartItem() 63 throws BeanConfigException 64 { 65 return _startItem; 66 } 67 68 public LruCache<Object ,Item> getProgramCache() 69 { 70 return _programCache; 71 } 72 73 76 public void setFilename(String filename) 77 { 78 _filename = filename; 79 } 80 81 84 public Verifier newVerifier() 85 { 86 return new VerifierImpl(this); 87 } 88 89 public String toString() 90 { 91 if (_filename != null) 92 return "SchemaImpl[" + _filename + "]"; 93 else 94 return "SchemaImpl[]"; 95 } 96 } 97 | Popular Tags |