// Autogenerated AST node
package org.python.pydev.parser.jython.ast;
import org.python.pydev.parser.jython.SimpleNode;
import java.util.Arrays;
public final class Attribute extends exprType implements expr_contextType {
public exprType value;
public NameTokType attr;
public int ctx;
public Attribute(exprType value, NameTokType attr, int ctx) {
this.value = value;
this.attr = attr;
this.ctx = ctx;
}
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((value == null) ? 0 : value.hashCode());
result = prime * result + ((attr == null) ? 0 : attr.hashCode());
result = prime * result + ctx;
return result;
}
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Attribute other = (Attribute) obj;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
if (attr == null) {
if (other.attr != null)
return false;
} else if (!attr.equals(other.attr))
return false;
if (this.ctx != other.ctx)
return false;
return true;
}
public Attribute createCopy() {
return createCopy(true);
}
public Attribute createCopy(boolean copyComments) {
Attribute temp = new Attribute(value != null ? (exprType) value.createCopy(copyComments) : null,
attr != null ? (NameTokType) attr.createCopy(copyComments) : null, ctx);
temp.beginLine = this.beginLine;
temp.beginColumn = this.beginColumn;
if (this.specialsBefore != null && copyComments) {
for (Object o : this.specialsBefore) {
if (o instanceof commentType) {
commentType commentType = (commentType) o;
temp.getSpecialsBefore().add(commentType.createCopy(copyComments));
}
}
}
if (this.specialsAfter != null && copyComments) {
for (Object o : this.specialsAfter) {
if (o instanceof commentType) {
commentType commentType = (commentType) o;
temp.getSpecialsAfter().add(commentType.createCopy(copyComments));
}
}
}
return temp;
}
public String toString() {
StringBuffer sb = new StringBuffer("Attribute[");
sb.append("value=");
sb.append(dumpThis(this.value));
sb.append(", ");
sb.append("attr=");
sb.append(dumpThis(this.attr));
sb.append(", ");
sb.append("ctx=");
sb.append(dumpThis(this.ctx, expr_contextType.expr_contextTypeNames));
sb.append("]");
return sb.toString();
}
public Object accept(VisitorIF visitor) throws Exception {
return visitor.visitAttribute(this);
}
public void traverse(VisitorIF visitor) throws Exception {
if (value != null) {
value.accept(visitor);
}
if (attr != null) {
attr.accept(visitor);
}
}
}