/* Generated By:JJTree: Do not edit this line. ASTTryStatement.java */ package net.sourceforge.pmd.ast; import java.util.ArrayList; import java.util.List; public class ASTTryStatement extends SimpleNode { private boolean hasCatch; private boolean hasFinally; public ASTTryStatement(int id) { super(id); } public ASTTryStatement(JavaParser p, int id) { super(p, id); } public void setHasCatch() { hasCatch = true; } public void setHasFinally() { hasFinally = true; } public boolean hasCatch() { return hasCatch; } public boolean hasFinally() { return hasFinally; } /** * Call hasFinally() before you call this method */ public ASTBlock getFinallyBlock() { return (ASTBlock) jjtGetChild(jjtGetNumChildren() - 1); } /** * Call hasCatch() before you call this method */ public List getCatchBlocks() { int numChildren = jjtGetNumChildren(); if (hasFinally) numChildren--; List blocks = new ArrayList(); for (int i = 1; i < numChildren; i += 2) { blocks.add(new ASTCatch((ASTFormalParameter) jjtGetChild(i + 0), (ASTBlock) jjtGetChild(i + 1))); } return blocks; } /** Accept the visitor. **/ public Object jjtAccept(JavaParserVisitor visitor, Object data) { return visitor.visit(this, data); } }