| 1 |
package com.thaiopensource.relaxng.output.xsd.basic; |
| 2 |
|
| 3 |
import com.thaiopensource.xml.util.Name; |
| 4 |
import com.thaiopensource.relaxng.edit.SourceLocation; |
| 5 |
|
| 6 |
public class Element extends Particle implements Structure { |
| 7 |
private final Name name; |
| 8 |
private final ComplexType complexType; |
| 9 |
|
| 10 |
public Element(SourceLocation location, Annotation annotation, Name name, ComplexType complexType) { |
| 11 |
super(location, annotation); |
| 12 |
this.name = name; |
| 13 |
this.complexType = complexType; |
| 14 |
} |
| 15 |
|
| 16 |
public Name getName() { |
| 17 |
return name; |
| 18 |
} |
| 19 |
|
| 20 |
public ComplexType getComplexType() { |
| 21 |
return complexType; |
| 22 |
} |
| 23 |
|
| 24 |
public <T> T accept(ParticleVisitor<T> visitor) { |
| 25 |
return visitor.visitElement(this); |
| 26 |
} |
| 27 |
|
| 28 |
public <T> T accept(StructureVisitor<T> visitor) { |
| 29 |
return visitor.visitElement(this); |
| 30 |
} |
| 31 |
|
| 32 |
public boolean equals(Object obj) { |
| 33 |
if (!super.equals(obj)) |
| 34 |
return false; |
| 35 |
Element other = (Element)obj; |
| 36 |
return this.name.equals(other.name) && this.complexType.equals(other.complexType); |
| 37 |
} |
| 38 |
|
| 39 |
public int hashCode() { |
| 40 |
return super.hashCode() ^ name.hashCode() ^ complexType.hashCode(); |
| 41 |
} |
| 42 |
} |