1 29 30 package com.caucho.relaxng.program; 31 32 import com.caucho.xml.QName; 33 34 import java.util.HashSet ; 35 36 39 public class NameItem extends NameClassItem { 40 private final QName _name; 41 42 public NameItem(QName name) 43 { 44 _name = name; 45 } 46 47 public QName getQName() 48 { 49 return _name; 50 } 51 52 55 public void firstSet(HashSet <QName> set) 56 { 57 set.add(_name); 58 } 59 60 63 public boolean matches(QName name) 64 { 65 return name.equals(_name); 66 } 67 68 71 public String toSyntaxDescription(String prefix) 72 { 73 if (prefix.equals("")) 74 return "<" + _name.getName() + ">"; 75 else 76 return prefix + _name.getName(); 77 } 78 79 public int hashCode() 80 { 81 return _name.hashCode(); 82 } 83 84 public boolean equals(Object o) 85 { 86 if (this == o) 87 return true; 88 89 if (! (o instanceof NameItem)) 90 return false; 91 92 NameItem name = (NameItem) o; 93 94 return _name.equals(name._name); 95 } 96 97 public String toString() 98 { 99 return "NameItem[" + _name + "]"; 100 } 101 } 102 103 | Popular Tags |