1
package com.thaiopensource.relaxng.output.xsd.basic;
3
import com.thaiopensource.xml.util.Name;
4
import com.thaiopensource.relaxng.edit.SourceLocation;
5
import com.thaiopensource.util.Equal;
7
public class Attribute extends SingleAttributeUse implements Structure {
8
private final Name name;
9
private final SimpleType type;
12
* type may be null, indicating any type
15
public Attribute(SourceLocation location, Annotation annotation, Name name, SimpleType type) {
16
super(location, annotation);
21
public Name getName() {
25
public SimpleType getType() {
29
public <T> T accept(AttributeUseVisitor<T> visitor) {
30
return visitor.visitAttribute(this);
33
public <T> T accept(StructureVisitor<T> visitor) {
34
return visitor.visitAttribute(this);
37
public boolean equals(Object obj) {
38
if (!super.equals(obj))
40
Attribute other = (Attribute)obj;
41
return Equal.equal(this.type, other.type) && this.name.equals(other.name);
44
public int hashCode() {
45
int hc = super.hashCode() ^ name.hashCode();
47
hc ^= type.hashCode();
51
public boolean isOptional() {