// Autogenerated AST node
package org.python.pydev.parser.jython.ast;
import org.python.pydev.parser.jython.SimpleNode;
import java.util.Arrays;
public final class TryFinally extends stmtType {
public stmtType[] body;
public suiteType finalbody;
public TryFinally(stmtType[] body, suiteType finalbody) {
this.body = body;
this.finalbody = finalbody;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + Arrays.hashCode(body);
result = prime * result + ((finalbody == null) ? 0 : finalbody.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
TryFinally other = (TryFinally) obj;
if (!Arrays.equals(body, other.body)) return false;
if (finalbody == null) { if (other.finalbody != null) return false;}
else if (!finalbody.equals(other.finalbody)) return false;
return true;
}
@Override
public TryFinally createCopy() {
return createCopy(true);
}
@Override
public TryFinally createCopy(boolean copyComments) {
stmtType[] new0;
if(this.body != null){
new0 = new stmtType[this.body.length];
for(int i=0;i<this.body.length;i++){
new0[i] = (stmtType) (this.body[i] != null? this.body[i].createCopy(copyComments):null);
}
}else{
new0 = this.body;
}
TryFinally temp = new TryFinally(new0,
finalbody!=null?(suiteType)finalbody.createCopy(copyComments):null);
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;
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer("TryFinally[");
sb.append("body=");
sb.append(dumpThis(this.body));
sb.append(", ");
sb.append("finalbody=");
sb.append(dumpThis(this.finalbody));
sb.append("]");
return sb.toString();
}
@Override
public Object accept(VisitorIF visitor) throws Exception {
return visitor.visitTryFinally(this);
}
@Override
public void traverse(VisitorIF visitor) throws Exception {
if (body != null) {
for (int i = 0; i < body.length; i++) {
if (body[i] != null) {
body[i].accept(visitor);
}
}
}
if (finalbody != null) {
finalbody.accept(visitor);
}
}
}