1 28 29 package com.caucho.relaxng.pattern; 30 31 import com.caucho.relaxng.RelaxException; 32 import com.caucho.relaxng.program.DataItem; 33 import com.caucho.relaxng.program.Item; 34 35 38 public class DataPattern extends Pattern { 39 String _type; 40 43 public DataPattern(String type) 44 { 45 _type = type; 46 } 47 48 51 public Item createItem(GrammarPattern grammar) 52 throws RelaxException 53 { 54 return new DataItem(_type); 55 } 56 57 60 public String toProduction() 61 { 62 return "data"; 63 } 64 65 68 public boolean hasData() 69 { 70 return true; 71 } 72 73 public boolean equals(Object o) 74 { 75 if (this == o) 76 return true; 77 78 if (! (o instanceof DataPattern)) 79 return false; 80 81 DataPattern pattern = (DataPattern) o; 82 83 return _type.equals(pattern._type); 84 } 85 86 89 public String toString() 90 { 91 return "DataPattern[" + _type + "]"; 92 } 93 } 94 95 | Popular Tags |