1 package gnu.kawa.xslt; 2 import gnu.mapping.Procedure; 3 import gnu.mapping.Symbol; 4 5 6 7 public class TemplateTable 8 { 9 10 Symbol name; 11 12 static final TemplateTable nullModeTable = new TemplateTable(XSLT.nullMode); 13 14 public TemplateTable(Symbol mode) 15 { 16 this.name = mode; 17 } 18 19 static TemplateTable getTemplateTable(Symbol name) 20 { 21 if (name == XSLT.nullMode) 22 return nullModeTable; 23 return null; } 25 26 TemplateEntry entries; 28 public void enter(String pattern, double priority, Procedure procedure) 29 { 30 TemplateEntry entry = new TemplateEntry(); 31 entry.procedure = procedure; 32 entry.priority = priority; 33 entry.pattern = pattern; 34 entry.next = entries; 35 entries = entry; 36 } 37 38 public Procedure find (String name) 39 { 40 for (TemplateEntry entry = entries; entry != null; entry = entry.next) 41 { 42 if (entry.pattern.equals(name)) 43 return entry.procedure; 44 } 45 return null; 46 } 47 } 48 49 50 51 class TemplateEntry 52 { 53 Procedure procedure; 54 double priority; 55 String pattern; 56 TemplateEntry next; 57 } 58 | Popular Tags |