001package gudusoft.gsqlparser.nodes;
002
003import gudusoft.gsqlparser.ESqlClause;
004import gudusoft.gsqlparser.TStatementList;
005import gudusoft.gsqlparser.TCustomSqlStatement;
006/*
007 * Date: 2010-12-28
008 * Time: 10:24:40
009 */
010
011public class TElseIfSqlNode extends TParseTreeNode {
012    private TExpression condition = null;
013    private TStatementListSqlNode stmtNodes = null;
014
015    public TExpression getCondition() {
016        return condition;
017    }
018
019    private TStatementList stmts = null;
020
021    public TStatementList getStmts() {
022        if (this.stmts == null){
023            this.stmts = new TStatementList(); 
024        }
025        return stmts;
026    }
027
028    public void init(Object arg1){
029        this.condition = (TExpression)arg1;
030    }
031
032    public void init(Object arg1,Object arg2){
033        this.condition = (TExpression)arg1;
034        this.stmtNodes = (TStatementListSqlNode)arg2;
035    }
036
037    public void doParse(TCustomSqlStatement psql, ESqlClause plocation){
038        this.condition.doParse(psql,plocation);
039        if (this.stmtNodes != null){
040            this.stmtNodes.doParse(psql,plocation);
041            for(int i=0; i<this.stmtNodes.size();i++){
042                this.getStmts().add(this.stmtNodes.getStatementSqlNode(i).getStmt());
043            }
044        }
045    }
046
047    public void setCondition(TExpression condition) {
048        this.condition = condition;
049    }
050
051    public void setStmtNodes(TStatementListSqlNode stmtNodes) {
052        this.stmtNodes = stmtNodes;
053    }
054
055    public void setStmts(TStatementList stmts) {
056        this.stmts = stmts;
057    }
058}