1 28 29 package com.caucho.relaxng.program; 30 31 import com.caucho.xml.QName; 32 33 import java.util.HashSet ; 34 35 38 public class AnyNameItem extends NameClassItem { 39 private NameClassItem _except; 40 41 public AnyNameItem() 42 { 43 } 44 45 48 public void setExcept(NameClassItem except) 49 { 50 _except = except; 51 } 52 53 56 public void firstSet(HashSet <QName> set) 57 { 58 } 59 60 63 public boolean matches(QName name) 64 { 65 if (_except == null) 66 return true; 67 else 68 return ! _except.matches(name); 69 } 70 71 74 public String toSyntaxDescription(String prefix) 75 { 76 if (_except != null) { 77 if (prefix.equals("")) 78 return "<* -" + _except.toSyntaxDescription(" ") + ">"; 79 else 80 return prefix + "(* -" + _except.toSyntaxDescription(" ") + ")"; 81 } 82 else if (prefix.equals("")) 83 return "<*>"; 84 else 85 return prefix + "*"; 86 } 87 88 public int hashCode() 89 { 90 return 321; 91 } 92 93 public boolean equals(Object o) 94 { 95 if (this == o) 96 return true; 97 98 if (! (o instanceof AnyNameItem)) 99 return false; 100 101 return true; 102 } 103 } 104 105 | Popular Tags |