|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.ksu.cis.projects.bogor.ast.Node
edu.ksu.cis.projects.bogor.ast.Statement
edu.ksu.cis.projects.bogor.ast.TryCatchStatement
public class TryCatchStatement
The try-catch statement AST.
| Field Summary | |
|---|---|
protected ArrayList<String> |
locals
Holds the catch local ids. |
protected ArrayList<String> |
records
Holds the catch record ids. |
protected Statement |
stmt
Holds the statement. |
protected ArrayList<Statement> |
stmts
Holds the choose statements. |
| Fields inherited from class edu.ksu.cis.projects.bogor.ast.Node |
|---|
ILLEGAL_LOCAL_ID_CHAR |
| Constructor Summary | |
|---|---|
TryCatchStatement(Statement stmt,
List<String> recordIds,
List<String> localIds,
List<? extends Statement> stmts)
Default constructor. |
|
| Method Summary | |
|---|---|
TryCatchStatement |
clone()
Clones this object (deep clone); including location info. |
void |
dispose()
Disposes exp and stmt. |
int |
getCatchCount()
Gets the number of catches. |
String |
getCatchLocalId(int index)
Gets a catch local id at a specified index. |
String |
getCatchRecordId(int index)
Gets a catch record id at a specified index. |
Statement |
getCatchStatement(int index)
Gets a catch statement at a specified index. |
Statement |
getTryStatement()
Gets the try statement. |
void |
setCatches(List<String> recordIds,
List<String> localIds,
List<? extends Statement> stmts)
Sets the catches. |
void |
setTryStatement(Statement stmt)
Sets the try statement. |
protected String |
toString(String indent)
Returns the string representation of this object. |
void |
visit(ASTVisitor visitor)
|
| Methods inherited from class edu.ksu.cis.projects.bogor.ast.Statement |
|---|
getParent, setParent, toString |
| Methods inherited from class edu.ksu.cis.projects.bogor.ast.Node |
|---|
getLocationInfo, getProperty, putProperty, setLocationInfo |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Statement stmt
protected ArrayList<String> records
protected ArrayList<String> locals
protected ArrayList<Statement> stmts
| Constructor Detail |
|---|
public TryCatchStatement(Statement stmt,
List<String> recordIds,
List<String> localIds,
List<? extends Statement> stmts)
stmt - The try statement. Must be non-null.recordIds - The catch record ids. Must be non-null. Each element must be
non-null. There must be at least one element.localIds - The catch local ids. Must agree with recordIdsstmts - The catch statements. Must agree with recordIds.| Method Detail |
|---|
public TryCatchStatement clone()
clone in class Statementpublic void dispose()
dispose in interface Disposabledispose in class Statementpublic Statement getTryStatement()
public void setTryStatement(Statement stmt)
stmt - The try statement. Must be non-null.
public void setCatches(List<String> recordIds,
List<String> localIds,
List<? extends Statement> stmts)
recordIds - localIds - stmts - The catch statements . Must be non-null. Each element must be
non-null. Should be the same size as recordIds.public String getCatchRecordId(int index)
index - The index of the the catch record id. Must be between 0 and
getCatchCount() - 1, inclusive.
public String getCatchLocalId(int index)
index - The index of the the catch local id. Must be between 0 and
getCatchCount() - 1, inclusive.
public Statement getCatchStatement(int index)
index - The index of the the catch statement. Must be between 0 and
getCatchCount() - 1, inclusive.
public int getCatchCount()
public void visit(ASTVisitor visitor)
visit in class Nodeprotected String toString(String indent)
toString in class Statementindent - The indentation for this statement.
"try\n" +
" stmt\n" +
"catch (record-id1 local-id1)\n" +
" stmt1\n" +
"catch (record-id2 local-id2)\n" +
" stmt2\n" +
"..." +
"catch (record-idN local-idN)\n" +
" stmtN\n" +
"end\n".
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||